| The Gaudi Framework v32r1 (f65d50dc)

Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
PerfMonAuditor Class Reference

Performance Monitoring Auditor that uses Perfmon2 library to monitor algorithms. More...

Inheritance diagram for PerfMonAuditor:
[legend]
Collaboration diagram for PerfMonAuditor:
[legend]

## Public Member Functions
void | before (StandardEventType evt, INamedInterface *alg) override
void | after (StandardEventType evt, INamedInterface *alg, const StatusCode &sc) override
StatusCode | initialize () override
StatusCode | finalize () override
int | is_nehalem ()
| PerfMonAuditor (const std::string &name, ISvcLocator *pSvc)
virtual | ~PerfMonAuditor ()
void | after (StandardEventType, INamedInterface *, const StatusCode &) override
void | after (StandardEventType, const std::string &, const StatusCode &) override
void | after (CustomEventTypeRef, INamedInterface *, const StatusCode &) override
void | after (CustomEventTypeRef, const std::string &, const StatusCode &) override
void | before (StandardEventType, INamedInterface *) override
| The following methods are meant to be implemented by the child class... More...
void | before (StandardEventType, const std::string &) override
void | before (CustomEventTypeRef, INamedInterface *) override
void | before (CustomEventTypeRef, const std::string &) override
Public Member Functions inherited from Auditor
| Auditor (const std::string &name, ISvcLocator *svcloc)
| Constructor. More...
| Auditor (const Auditor &a)=delete
Auditor & | operator= (const Auditor &rhs)=delete
StatusCode | sysInitialize () override
| Initialization method invoked by the framework. More...
StatusCode | sysFinalize () override
| Finalization method invoked by the framework. More...
void | before (StandardEventType, INamedInterface *) override
| The following methods are meant to be implemented by the child class... More...
void | before (StandardEventType, const std::string &) override
void | before (CustomEventTypeRef, INamedInterface *) override
void | before (CustomEventTypeRef, const std::string &) override
void | after (StandardEventType, INamedInterface *, const StatusCode &) override
void | after (StandardEventType, const std::string &, const StatusCode &) override
void | after (CustomEventTypeRef, INamedInterface *, const StatusCode &) override
void | after (CustomEventTypeRef, const std::string &, const StatusCode &) override
void | beforeInitialize (INamedInterface *) override
void | afterInitialize (INamedInterface *) override
void | beforeReinitialize (INamedInterface *) override
void | afterReinitialize (INamedInterface *) override
void | beforeExecute (INamedInterface *) override
void | afterExecute (INamedInterface *, const StatusCode &) override
void | beforeFinalize (INamedInterface *) override
void | afterFinalize (INamedInterface *) override
void | beforeBeginRun (INamedInterface *) override
void | afterBeginRun (INamedInterface *) override
void | beforeEndRun (INamedInterface *) override
void | afterEndRun (INamedInterface *) override
const std::string & | name () const override
bool | isEnabled () const override
SmartIF< ISvcLocator > & | serviceLocator () const override
| The standard service locator. More...
template<class T >
StatusCode | service (const std::string &name, T *&svc, bool createIf=false) const
| Access a service by name, creating it if it doesn't already exist. More...
template<class T = IService>
SmartIF< T > | service (const std::string &name, bool createIf=false) const
StatusCode | setProperties ()
| Set the auditor's properties. More...
Public Member Functions inherited from PropertyHolder< CommonMessaging< implements< IAuditor, IProperty > > >
| PropertyHolder ()=default
Gaudi::Details::PropertyBase & | declareProperty (Gaudi::Details::PropertyBase &prop)
| Declare a property. More...
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, TYPE &value, const std::string &doc="none")
| Helper to wrap a regular data member and use it as a regular property. More...
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, Gaudi::Property< TYPE, VERIFIER, HANDLERS > &prop, const std::string &doc="none")
| Declare a PropertyBase instance setting name and documentation. More...
Gaudi::Details::PropertyBase * | declareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="")
| Declare a remote property. More...
StatusCode | setProperty (const Gaudi::Details::PropertyBase &p) override
| set the property form another property More...
StatusCode | setProperty (const std::string &s) override
| set the property from the formatted string More...
StatusCode | setProperty (const std::string &n, const std::string &v) override
| set the property from name and the value More...
StatusCode | setProperty (const std::string &name, const TYPE &value)
| set the property form the value More...
StatusCode | getProperty (Gaudi::Details::PropertyBase *p) const override
| get the property More...
const Gaudi::Details::PropertyBase & | getProperty (const std::string &name) const override
| get the property by name More...
StatusCode | getProperty (const std::string &n, std::string &v) const override
| convert the property to the string More...
const std::vector< Gaudi::Details::PropertyBase * > & | getProperties () const override
| get all properties More...
bool | hasProperty (const std::string &name) const override
| Return true if we have a property with the given name. More...
| PropertyHolder (const PropertyHolder &)=delete
PropertyHolder & | operator= (const PropertyHolder &)=delete
Public Member Functions inherited from CommonMessaging< implements< IAuditor, IProperty > >
MSG::Level | msgLevel () const
| get the cached level (originally extracted from the embedded MsgStream) More...
bool | msgLevel (MSG::Level lvl) const
| get the output level from the embedded MsgStream More...
MSG::Level | outputLevel () const
| Backward compatibility function for getting the output level. More...
Public Member Functions inherited from CommonMessagingBase
virtual | ~CommonMessagingBase ()=default
| Virtual destructor. More...
const SmartIF< IMessageSvc > & | msgSvc () const
| The standard message service. More...
MsgStream & | msgStream () const
| Return an uninitialized MsgStream. More...
MsgStream & | msgStream (const MSG::Level level) const
| Predefined configurable message stream for the efficient printouts. More...
MsgStream & | always () const
| shortcut for the method msgStream(MSG::ALWAYS) More...
MsgStream & | fatal () const
| shortcut for the method msgStream(MSG::FATAL) More...
MsgStream & | err () const
| shortcut for the method msgStream(MSG::ERROR) More...
MsgStream & | error () const
| shortcut for the method msgStream(MSG::ERROR) More...
MsgStream & | warning () const
| shortcut for the method msgStream(MSG::WARNING) More...
MsgStream & | info () const
| shortcut for the method msgStream(MSG::INFO) More...
MsgStream & | debug () const
| shortcut for the method msgStream(MSG::DEBUG) More...
MsgStream & | verbose () const
| shortcut for the method msgStream(MSG::VERBOSE) More...
MsgStream & | msg () const
| shortcut for the method msgStream(MSG::INFO) More...

## Private Types
typedef GaudiUtils::VectorMap< const INamedInterface *, int > | Map

## Private Member Functions
void | i_beforeInitialize (INamedInterface *alg)
void | i_afterInitialize (INamedInterface *alg)
void | i_beforeExecute (INamedInterface *alg)
void | i_afterExecute (INamedInterface *alg)
| PerfMonAuditor ()
| PerfMonAuditor (const PerfMonAuditor &)
PerfMonAuditor & | operator= (const PerfMonAuditor &)
void | startpm ()
void | pausepm ()
void | stoppm ()
void | finalizepm ()
int | detect_unavail_pmu_regs (int fd, pfmlib_regmask_t *r_pmcs, pfmlib_regmask_t *r_pmds)
int | detect_unavail_pmcs (int fd, pfmlib_regmask_t *r_pmcs)
void | pfm_bv_set (uint64_t *bv, uint16_t rnum)
int | pfm_bv_isset (uint64_t *bv, uint16_t rnum)
void | pfm_bv_copy (uint64_t *d, uint64_t *j, uint16_t n)
void | start_smpl ()
void | stop_smpl ()
void | finalize_smpl ()

## Static Private Member Functions
static void | process_smpl_buf (pfm_dfl_smpl_hdr_t *hdr, size_t entry_size)
static void | sigio_handler (int, siginfo_t *, void *)

## Private Attributes
PFMon & | m_pfm
Map | m_map
int | m_indent
bool | m_inEvent
int | is_nehalem_ret
pfmlib_input_param_t | inp
pfmlib_output_param_t | outp
pfarg_ctx_t | ctx
pfarg_pmd_t | pd [NUM_PMDS]
pfarg_pmc_t | pc [NUM_PMCS]
pfarg_load_t | load_arg
int | fd
unsigned int | i
int | ret
std::string | event_str [MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS]
std::string | prefix
std::string | family
char | event_cstr [MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS][MAX_EVENT_NAME_LENGTH]
char | prefix_cstr [MAX_PREFIX_NAME_LENGTH]
unsigned int | ph_ev_count
bool | inv [MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS]
unsigned int | cmask [MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS]
unsigned int | start_at_event
pfmlib_core_input_param_t | params
pfmlib_nhm_input_param_t | nhm_params
int | used_counters_number
bool | nehalem
bool | westmere
bool | core
bool | sampling
pfm_dfl_smpl_arg_t | buf_arg
pfarg_load_t | load_args
void * | buf_addr
unsigned | num_counters
unsigned int | max_pmd
pfmlib_options_t | pfmlib_options
int | level
bool | first_alg
std::string | first_alg_name
bool | event_count_reached

## Additional Inherited Members
Public Types inherited from Auditor
using | Factory = Gaudi::PluginService::Factory< IAuditor *(const std::string &, ISvcLocator *)>
Public Types inherited from PropertyHolder< CommonMessaging< implements< IAuditor, IProperty > > >
using | PropertyHolderImpl = PropertyHolder< CommonMessaging< implements< IAuditor, IProperty > > >
| Typedef used to refer to this class from derived classes, as in. More...
Public Types inherited from CommonMessaging< implements< IAuditor, IProperty > >
using | base_class = CommonMessaging
Protected Member Functions inherited from PropertyHolder< CommonMessaging< implements< IAuditor, IProperty > > >
Gaudi::Details::PropertyBase * | property (const std::string &name) const
Protected Member Functions inherited from CommonMessaging< implements< IAuditor, IProperty > >
MSG::Level | setUpMessaging () const
| Set up local caches. More...
MSG::Level | resetMessaging ()
| Reinitialize internal states. More...
void | updateMsgStreamOutputLevel (int level)
| Update the output level of the cached MsgStream. More...

## Detailed Description

Performance Monitoring Auditor that uses Perfmon2 library to monitor algorithms.

Author
  Daniele Francesco KRUSE danie.nosp@m.le.f.nosp@m.rance.nosp@m.sco..nosp@m.kruse.nosp@m.@cer.nosp@m.n.ch

Date
  2009-10-28

Definition at line 198 of file PerfMonAuditor.cpp.

## Member Typedef Documentation

## ◆ Map

typedef GaudiUtils::VectorMap<const INamedInterface*, int> PerfMonAuditor::Map
| private

Definition at line 350 of file PerfMonAuditor.cpp.

## Constructor & Destructor Documentation

## ◆ PerfMonAuditor() [1/3]

PerfMonAuditor::PerfMonAuditor | ( | const std::string & | name,
|  | ISvcLocator * | pSvc
| ) |  |
| inline

Definition at line 271 of file PerfMonAuditor.cpp.

272 : // standard constructor
273 Auditor( name, pSvc )
274 , m_pfm( PFMon::instance() )
275 , m_map()
276 , m_indent( 0 )
277 , m_inEvent( false ) {
278 is_nehalem_ret = is_nehalem();
279 declareProperty( "EVENT0", event_str[0] );
280 declareProperty( "EVENT1", event_str[1] );
281 declareProperty( "EVENT2", event_str[2] );
282 declareProperty( "EVENT3", event_str[3] );
283 declareProperty( "FAMILY", family );
284 declareProperty( "PREFIX", prefix );
285 declareProperty( "INV0", inv[0] );
286 declareProperty( "INV1", inv[1] );
287 declareProperty( "INV2", inv[2] );
288 declareProperty( "INV3", inv[3] );
289 declareProperty( "CMASK0", cmask[0] );
290 declareProperty( "CMASK1", cmask[1] );
291 declareProperty( "CMASK2", cmask[2] );
292 declareProperty( "CMASK3", cmask[3] );
293 declareProperty( "SP0", sp[0] );
294 declareProperty( "SP1", sp[1] );
295 declareProperty( "SP2", sp[2] );
296 declareProperty( "SP3", sp[3] );
297 declareProperty( "SAMPLE", sampling );
298 declareProperty( "START_AT_EVENT", start_at_event );
299 declareProperty( "IS_NEHALEM", is_nehalem_ret );
300
302 /*
303 // loading functions from PFM library
304 void* handle = dlopen("libpfm.so", RTLD_NOW);
305 if (!handle) {
306 // error() << "Cannot open library: " << dlerror() << endmsg;
307 }
308 typedef void (*hello_t)();
309 hello_t hello = (hello_t) dlsym(handle, "hello");
310 if (!hello) {
311 // error() << "Cannot load symbol 'hello': " << dlerror() << endmsg;
312 dlclose(handle);
313 }
314
315 pfm_start = (pfm_start_t) dlsym(handle, "pfm_start");
316 pfm_stop = (pfm_stop_t) dlsym(handle, "pfm_stop");
317 pfm_self_stop = (pfm_self_stop_t) dlsym(handle, "pfm_stop"); //it's the same
318 pfm_restart = (pfm_restart_t) dlsym(handle, "pfm_restart");
319 //pfm_read_pmds = (pfm_read_pmds_t) dlsym(handle, "pfm_read_pmds");
320 pfm_initialize = (pfm_initialize_t) dlsym(handle, "pfm_initialize");
321 pfm_find_full_event = (pfm_find_full_event_t) dlsym(handle, "pfm_find_full_event");
322 pfm_dispatch_events = (pfm_dispatch_events_t) dlsym(handle, "pfm_dispatch_events");
323 pfm_create_context = (pfm_create_context_t) dlsym(handle, "pfm_create_context");
324 pfm_write_pmcs = (pfm_write_pmcs_t) dlsym(handle, "pfm_write_pmcs");
325 pfm_write_pmds = (pfm_write_pmds_t) dlsym(handle, "pfm_write_pmds");
326 pfm_load_context = (pfm_load_context_t) dlsym(handle, "pfm_load_context");
327 pfm_strerror = (pfm_strerror_t) dlsym(handle, "pfm_strerror");
328 pfm_set_options = (pfm_set_options_t) dlsym(handle, "pfm_set_options");
329 pfm_get_num_counters = (pfm_get_num_counters_t) dlsym(handle, "pfm_get_num_counters");
330 // use it to do the calculation
331 // info() << "Calling hello..." << endmsg;
332 // hello();
333
334 // close the library
335 // info() << "Closing library..." << endmsg;
336 dlclose(handle);
337 */
338
340 }
PerfMonAuditor::is_nehalem
int is_nehalem()
Definition: PerfMonAuditor.cpp:214
PerfMonAuditor::family
std::string family
Definition: PerfMonAuditor.cpp:373
PerfMonAuditor::inv
bool inv[MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS]
Definition: PerfMonAuditor.cpp:377
PropertyHolder< CommonMessaging< implements< IAuditor, IProperty > > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Details::PropertyBase &prop)
Declare a property.
Definition: PropertyHolder.h:95
boost::spirit
Definition: iter_pos.hpp:14
PerfMonAuditor::is_nehalem_ret
int is_nehalem_ret
Definition: PerfMonAuditor.cpp:356
PerfMonAuditor::event_str
std::string event_str[MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS]
Definition: PerfMonAuditor.cpp:371
Auditor::Auditor
Auditor(const std::string &name, ISvcLocator *svcloc)
Constructor.
Definition: Auditor.cpp:12
PerfMonAuditor::prefix
std::string prefix
Definition: PerfMonAuditor.cpp:372
PerfMonAuditor::m_map
Map m_map
Definition: PerfMonAuditor.cpp:351
PerfMonAuditor::m_indent
int m_indent
Definition: PerfMonAuditor.cpp:352
PerfMonAuditor::start_at_event
unsigned int start_at_event
Definition: PerfMonAuditor.cpp:379
PerfMonAuditor::sampling
bool sampling
Definition: PerfMonAuditor.cpp:387
Auditor::name
const std::string & name() const override
Definition: Auditor.cpp:193
PerfMonAuditor::m_inEvent
bool m_inEvent
Definition: PerfMonAuditor.cpp:353
PerfMonAuditor::cmask
unsigned int cmask[MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS]
Definition: PerfMonAuditor.cpp:378
PerfMonAuditor::m_pfm
PFMon & m_pfm
Definition: PerfMonAuditor.cpp:233

## ◆ ~PerfMonAuditor()

virtual PerfMonAuditor::~PerfMonAuditor | ( |  | ) |
| inline virtual

Definition at line 342 of file PerfMonAuditor.cpp.

342 {} // virtual destructor

## ◆ PerfMonAuditor() [2/3]

PerfMonAuditor::PerfMonAuditor | ( |  | ) |
| private

## ◆ PerfMonAuditor() [3/3]

PerfMonAuditor::PerfMonAuditor | ( | const PerfMonAuditor & |  | ) |
| private

## Member Function Documentation

## ◆ after() [1/5]

void PerfMonAuditor::after | ( | StandardEventType | evt,
|  | INamedInterface * | alg,
|  | const StatusCode & | sc
| ) |  |
| override

Definition at line 893 of file PerfMonAuditor.cpp.

893 {
894 switch ( evt ) {
895 case IAuditor::Initialize:
896 i_afterInitialize( alg );
897 break;
898 case IAuditor::Execute:
899 i_afterExecute( alg );
900 break;
901 default:
902 break;
903 }
904 return;
905 }
ManySmallAlgs.alg
alg
Definition: ManySmallAlgs.py:69
PerfMonAuditor::i_afterExecute
void i_afterExecute(INamedInterface *alg)
Definition: PerfMonAuditor.cpp:954
IAuditor::Initialize
Definition: IAuditor.h:24
IAuditor::Execute
Definition: IAuditor.h:24
PerfMonAuditor::i_afterInitialize
void i_afterInitialize(INamedInterface *alg)
Definition: PerfMonAuditor.cpp:912
IOTest.evt
evt
Definition: IOTest.py:94

## ◆ after() [2/5]

void Auditor::after
| override

Definition at line 103 of file Auditor.cpp.

103 {
104 switch ( evt ) {
105 case Initialize:
106 afterInitialize( obj );
107 break;
108 case ReInitialize:
109 afterReinitialize( obj );
110 break;
111 case Execute:
112 afterExecute( obj, sc );
113 break;
114 case BeginRun:
115 afterBeginRun( obj );
116 break;
117 case EndRun:
118 afterEndRun( obj );
119 break;
120 case Finalize:
121 afterFinalize( obj );
122 break;
123 case Start:
124 break;
125 case Stop:
126 break;
127 case ReStart:
128 break;
129 default:
130 break; // do nothing
131 }
132 }
Auditor::afterEndRun
void afterEndRun(INamedInterface *) override
Definition: Auditor.cpp:147
Auditor::afterBeginRun
void afterBeginRun(INamedInterface *) override
Definition: Auditor.cpp:145
Auditor::afterExecute
void afterExecute(INamedInterface *, const StatusCode &) override
Definition: Auditor.cpp:143
Auditor::afterInitialize
void afterInitialize(INamedInterface *) override
Definition: Auditor.cpp:139
Auditor::afterFinalize
void afterFinalize(INamedInterface *) override
Definition: Auditor.cpp:149
IOTest.evt
evt
Definition: IOTest.py:94
Auditor::afterReinitialize
void afterReinitialize(INamedInterface *) override
Definition: Auditor.cpp:141

## ◆ after() [3/5]

void Auditor::after
| override

Definition at line 133 of file Auditor.cpp.

133 {}

## ◆ after() [4/5]

void Auditor::after
| override

Definition at line 135 of file Auditor.cpp.

135 {}

## ◆ after() [5/5]

void Auditor::after
| override

Definition at line 136 of file Auditor.cpp.

136 {}

## ◆ before() [1/5]

void PerfMonAuditor::before | ( | StandardEventType | evt,
|  | INamedInterface * | alg
| ) |  |
| override

Definition at line 879 of file PerfMonAuditor.cpp.

879 {
880 switch ( evt ) {
881 case IAuditor::Initialize:
882 i_beforeInitialize( alg );
883 break;
884 case IAuditor::Execute:
885 i_beforeExecute( alg );
886 break;
887 default:
888 break;
889 }
890 return;
891 }
ManySmallAlgs.alg
alg
Definition: ManySmallAlgs.py:69
IAuditor::Initialize
Definition: IAuditor.h:24
IAuditor::Execute
Definition: IAuditor.h:24
PerfMonAuditor::i_beforeExecute
void i_beforeExecute(INamedInterface *alg)
Definition: PerfMonAuditor.cpp:917
PerfMonAuditor::i_beforeInitialize
void i_beforeInitialize(INamedInterface *alg)
Definition: PerfMonAuditor.cpp:907
IOTest.evt
evt
Definition: IOTest.py:94

## ◆ before() [2/5]

void Auditor::before
| override

Definition at line 100 of file Auditor.cpp.

100 {}

## ◆ before() [3/5]

void Auditor::before
| override

Definition at line 99 of file Auditor.cpp.

99 {}

## ◆ before() [4/5]

void Auditor::before
| override

The following methods are meant to be implemented by the child class...

Definition at line 67 of file Auditor.cpp.

67 {
68 switch ( evt ) {
69 case Initialize:
70 beforeInitialize( obj );
71 break;
72 case ReInitialize:
73 beforeReinitialize( obj );
74 break;
75 case Execute:
76 beforeExecute( obj );
77 break;
78 case BeginRun:
79 beforeBeginRun( obj );
80 break;
81 case EndRun:
82 beforeEndRun( obj );
83 break;
84 case Finalize:
85 beforeFinalize( obj );
86 break;
87 case Start:
88 break;
89 case Stop:
90 break;
91 case ReStart:
92 break;
93 default:
94 break; // do nothing
95 }
96 }
Auditor::beforeInitialize
void beforeInitialize(INamedInterface *) override
Definition: Auditor.cpp:138
Auditor::beforeBeginRun
void beforeBeginRun(INamedInterface *) override
Definition: Auditor.cpp:144
Auditor::beforeExecute
void beforeExecute(INamedInterface *) override
Definition: Auditor.cpp:142
Auditor::beforeReinitialize
void beforeReinitialize(INamedInterface *) override
Definition: Auditor.cpp:140
Auditor::beforeFinalize
void beforeFinalize(INamedInterface *) override
Definition: Auditor.cpp:148
Auditor::beforeEndRun
void beforeEndRun(INamedInterface *) override
Definition: Auditor.cpp:146
IOTest.evt
evt
Definition: IOTest.py:94

## ◆ before() [5/5]

void Auditor::before
| override

Definition at line 97 of file Auditor.cpp.

97 {}

## ◆ detect_unavail_pmcs()

int PerfMonAuditor::detect_unavail_pmcs | ( | int | fd,
|  | pfmlib_regmask_t * | r_pmcs
| ) |  |
| inline private

Definition at line 389 of file PerfMonAuditor.cpp.

389 { return detect_unavail_pmu_regs( fd, r_pmcs, NULL ); }
PerfMonAuditor::detect_unavail_pmu_regs
int detect_unavail_pmu_regs(int fd, pfmlib_regmask_t *r_pmcs, pfmlib_regmask_t *r_pmds)
PerfMonAuditor::fd
int fd
Definition: PerfMonAuditor.cpp:364

## ◆ detect_unavail_pmu_regs()

int PerfMonAuditor::detect_unavail_pmu_regs | ( | int | fd,
|  | pfmlib_regmask_t * | r_pmcs,
|  | pfmlib_regmask_t * | r_pmds
| ) |  |
| private

## ◆ finalize()

StatusCode PerfMonAuditor::finalize | ( |  | ) |
| override virtual

Reimplemented from Auditor.

Definition at line 871 of file PerfMonAuditor.cpp.

871 {
872 if ( sampling == 0 )
873 finalizepm();
874 else
875 finalize_smpl();
876 return Auditor::finalize();
877 }
Auditor::finalize
virtual StatusCode finalize()
Definition: Auditor.cpp:191
PerfMonAuditor::finalize_smpl
void finalize_smpl()
Definition: PerfMonAuditor.cpp:790
PerfMonAuditor::finalizepm
void finalizepm()
Definition: PerfMonAuditor.cpp:508
PerfMonAuditor::sampling
bool sampling
Definition: PerfMonAuditor.cpp:387

## ◆ finalize_smpl()

void PerfMonAuditor::finalize_smpl | ( |  | ) |
| private

Definition at line 790 of file PerfMonAuditor.cpp.

790 {
791 int err;
792 for ( int i = 0; i < used_counters_number; i++ ) {
793 std::string filename = prefix_cstr;
794 filename += '_';
795 filename += event_cstr[i];
796
797 for ( auto& c : filename )
798 if ( c == ':' ) c = '-';
799
800 if ( inv[i] ) filename += "_INV_1";
801 if ( cmask[i] > 0 ) filename += "_CMASK_" + std::to_string( cmask[i] );
802 filename += ".txt.gz";
803
804 gzFile outfile = gzopen( filename.c_str(), "wb" );
805 if ( outfile != NULL ) {
806 if ( nehalem ) {
807 gzprintf( outfile, "NHM " );
808 } else if ( westmere ) {
809 gzprintf( outfile, "WSM " );
810 } else if ( core ) {
811 gzprintf( outfile, "CORE " );
812 }
813 if ( gzprintf( outfile, "%s %d %d %d\n", event_cstr[i], cmask[i], inv[i], sp[i] ) <
814 (int)strlen( event_cstr[i] ) ) {
815 error() << "ERROR: gzputs err: " << gzerror( outfile, &err ) << ". Aborting..." << endmsg;
816 }
817 for ( std::map<std::string, std::map<unsigned long, unsigned int>>::iterator it = samples[i].begin();
818 it != samples[i].end(); it++ ) {
819 unsigned long long sum = 0;
820 for ( std::map<unsigned long, unsigned int>::iterator jt = ( it->second ).begin(); jt != ( it->second ).end();
821 jt++ ) {
822 sum += jt->second;
823 }
824 if ( gzprintf( outfile, "%s%%%llu\n", ( it->first ).c_str(), sum ) < (int)( ( it->first ).length() ) ) {
825 error() << "ERROR: gzputs err: " << gzerror( outfile, &err ) << ". Aborting..." << endmsg;
826 }
827 for ( std::map<unsigned long, unsigned int>::iterator jt = ( it->second ).begin(); jt != ( it->second ).end();
828 jt++ ) {
829 char sym_name[SYM_NAME_MAX_LENGTH];
830 bzero( sym_name, SYM_NAME_MAX_LENGTH );
831 const char* libName;
832 const char* symbolName;
833 int libOffset = 0;
834 int offset = 0;
835 void* sym_addr = IgHookTrace::tosymbol( (void*)( jt->first ) );
836 if ( sym_addr != NULL ) {
837 bool success = IgHookTrace::symbol( sym_addr, symbolName, libName, offset, libOffset );
838 if ( success ) {
839 if ( symbolName != NULL && strlen( symbolName ) > 0 ) {
840 strcpy( sym_name, symbolName );
841 strcat( sym_name, " " );
842 } else {
843 strcpy( sym_name, "??? " );
844 }
845 if ( libName != NULL && strlen( libName ) > 0 ) {
846 strcat( sym_name, libName );
847 strcat( sym_name, " " );
848 } else {
849 strcat( sym_name, "??? " );
850 }
851 sprintf( sym_name + strlen( sym_name ), "%d ", libOffset );
852 if ( strlen( sym_name ) <= 0 ) { error() << "ERROR: Symbol name length is zero. Aborting..." << endmsg; }
853 } else {
854 strcpy( sym_name, "??? ??? 0 " );
855 }
856 } else {
857 strcpy( sym_name, "??? ??? 0 " );
858 }
859 if ( gzprintf( outfile, "%s %d\n", sym_name, jt->second ) < (int)strlen( sym_name ) ) {
860 error() << "ERROR: gzputs err: " << gzerror( outfile, &err ) << endmsg;
861 }
862 }
863 }
864 } else {
865 error() << "ERROR: Could not open file: " << filename << ". Aborting..." << endmsg;
866 }
867 gzclose( outfile );
868 }
869 }
gaudirun.c
c
Definition: gaudirun.py:487
std::strcat
T strcat(T... args)
IgHookTrace::tosymbol
static void * tosymbol(void *address)
Definition: IgHook_IgHookTrace.cpp:237
PerfMonAuditor::inv
bool inv[MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS]
Definition: PerfMonAuditor.cpp:377
std::to_string
T to_string(T... args)
SYM_NAME_MAX_LENGTH
#define SYM_NAME_MAX_LENGTH
Definition: PerfMonAuditor.cpp:65
graphanalysis.filename
string filename
Definition: graphanalysis.py:119
boost::spirit
Definition: iter_pos.hpp:14
std::map
STL class.
std::string
STL class.
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:98
std::strlen
T strlen(T... args)
PerfMonAuditor::used_counters_number
int used_counters_number
Definition: PerfMonAuditor.cpp:382
IgHookTrace::symbol
static bool symbol(void *address, const char *&sym, const char *&lib, int &offset, int &liboffset)
Definition: IgHook_IgHookTrace.cpp:212
PerfMonAuditor::event_cstr
char event_cstr[MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS][MAX_EVENT_NAME_LENGTH]
Definition: PerfMonAuditor.cpp:374
IOTest.end
def end
Definition: IOTest.py:112
PerfMonAuditor::prefix_cstr
char prefix_cstr[MAX_PREFIX_NAME_LENGTH]
Definition: PerfMonAuditor.cpp:375
std::strcpy
T strcpy(T... args)
PerfMonAuditor::i
unsigned int i
Definition: PerfMonAuditor.cpp:365
std::map::begin
T begin(T... args)
PerfMonAuditor::westmere
bool westmere
Definition: PerfMonAuditor.cpp:384
CommonMessagingBase::err
MsgStream & err() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:95
Gaudi::Utils::begin
AttribStringParser::Iterator begin(const AttribStringParser &parser)
Definition: AttribStringParser.h:120
PerfMonAuditor::cmask
unsigned int cmask[MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS]
Definition: PerfMonAuditor.cpp:378
std::sprintf
T sprintf(T... args)
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192
PerfMonAuditor::nehalem
bool nehalem
Definition: PerfMonAuditor.cpp:383
PerfMonAuditor::core
bool core
Definition: PerfMonAuditor.cpp:385

## ◆ finalizepm()

void PerfMonAuditor::finalizepm | ( |  | ) |
| private

Definition at line 508 of file PerfMonAuditor.cpp.

508 {
509 info() << "start of finalizepm ucn:" << used_counters_number << endmsg;
510 for ( int i = 0; i < used_counters_number; i++ ) {
511 std::string filename = prefix_cstr;
512 filename += '_';
513 filename += event_cstr[i];
514
515 for ( auto& c : filename )
516 if ( c == ':' ) c = '-';
517
518 if ( inv[i] ) filename += "_INV_1";
519 if ( cmask[i] > 0 ) filename += "_CMASK_" + std::to_string( cmask[i] );
520 filename += ".txt";
521
522 info() << "Filename:" << filename << endmsg;
523 FILE* outfile = fopen( filename.c_str(), "w" );
524 if ( nehalem ) {
525 fprintf( outfile, "NHM " );
526 } else if ( westmere ) {
527 fprintf( outfile, "WSM " );
528 } else if ( core ) {
529 fprintf( outfile, "CORE " );
530 }
531 fprintf( outfile, "%s %d %d %d\n", event_cstr[i], cmask[i], inv[i], sp[i] );
532 for ( std::map<std::string, std::vector<unsigned long int>>::iterator it = ( results[i] ).begin();
533 it != ( results[i] ).end(); it++ ) {
534 fprintf( outfile, "%s\n", ( it->first ).c_str() );
535 for ( std::vector<unsigned long int>::iterator j = ( it->second ).begin(); j != ( it->second ).end(); j++ ) {
536 fprintf( outfile, "%lu\n", *j );
537 }
538 }
539 fclose( outfile );
540 }
541 }
gaudirun.c
c
Definition: gaudirun.py:487
PerfMonAuditor::inv
bool inv[MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS]
Definition: PerfMonAuditor.cpp:377
std::to_string
T to_string(T... args)
graphanalysis.filename
string filename
Definition: graphanalysis.py:119
CommonMessagingBase::info
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
Definition: CommonMessaging.h:104
boost::spirit
Definition: iter_pos.hpp:14
std::map
STL class.
std::fclose
T fclose(T... args)
std::string
STL class.
std::fopen
T fopen(T... args)
PerfMonAuditor::used_counters_number
int used_counters_number
Definition: PerfMonAuditor.cpp:382
PerfMonAuditor::event_cstr
char event_cstr[MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS][MAX_EVENT_NAME_LENGTH]
Definition: PerfMonAuditor.cpp:374
IOTest.end
def end
Definition: IOTest.py:112
PerfMonAuditor::prefix_cstr
char prefix_cstr[MAX_PREFIX_NAME_LENGTH]
Definition: PerfMonAuditor.cpp:375
PerfMonAuditor::i
unsigned int i
Definition: PerfMonAuditor.cpp:365
std::vector
STL class.
std::vector::begin
T begin(T... args)
PerfMonAuditor::westmere
bool westmere
Definition: PerfMonAuditor.cpp:384
Gaudi::Utils::begin
AttribStringParser::Iterator begin(const AttribStringParser &parser)
Definition: AttribStringParser.h:120
PerfMonAuditor::cmask
unsigned int cmask[MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS]
Definition: PerfMonAuditor.cpp:378
std::fprintf
T fprintf(T... args)
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192
PerfMonAuditor::nehalem
bool nehalem
Definition: PerfMonAuditor.cpp:383
PerfMonAuditor::core
bool core
Definition: PerfMonAuditor.cpp:385

## ◆ i_afterExecute()

void PerfMonAuditor::i_afterExecute | ( | INamedInterface * | alg | ) |
| private

Definition at line 954 of file PerfMonAuditor.cpp.

954 {
955 if ( !alg ) { return; } // info() << "after:inside! " << alg->name() << endmsg;
956
957 if ( event_count_reached ) {
958 // info() << "after:inside! " << alg->name() << endmsg;
959
960 if ( sampling == 0 )
961 stoppm();
962 else
963 stop_smpl();
964 alg_stack.pop();
965 --m_indent;
966 if ( !alg_stack.empty() ) {
967 if ( sampling == 0 )
968 startpm();
969 else
970 start_smpl(); // resuming father algorithm counting
971 }
972 }
973 }
ManySmallAlgs.alg
alg
Definition: ManySmallAlgs.py:69
PerfMonAuditor::stop_smpl
void stop_smpl()
Definition: PerfMonAuditor.cpp:777
PerfMonAuditor::startpm
void startpm()
Definition: PerfMonAuditor.cpp:421
PerfMonAuditor::stoppm
void stoppm()
Definition: PerfMonAuditor.cpp:486
PerfMonAuditor::m_indent
int m_indent
Definition: PerfMonAuditor.cpp:352
PerfMonAuditor::event_count_reached
bool event_count_reached
Definition: PerfMonAuditor.cpp:418
PerfMonAuditor::start_smpl
void start_smpl()
Definition: PerfMonAuditor.cpp:661
PerfMonAuditor::sampling
bool sampling
Definition: PerfMonAuditor.cpp:387

## ◆ i_afterInitialize()

void PerfMonAuditor::i_afterInitialize | ( | INamedInterface * | alg | ) |
| private

Definition at line 912 of file PerfMonAuditor.cpp.

912 {
913 if ( !alg ) return;
914 return;
915 }
ManySmallAlgs.alg
alg
Definition: ManySmallAlgs.py:69

## ◆ i_beforeExecute()

void PerfMonAuditor::i_beforeExecute | ( | INamedInterface * | alg | ) |
| private

Definition at line 917 of file PerfMonAuditor.cpp.

917 {
918 if ( !alg ) return;
919 // info() << "before:inside! " << alg->name() << endmsg;
920 if ( first_alg ) {
921 first_alg = false;
922 first_alg_name = alg->name();
923 // info() << "first_alg_name= " << alg->name() << endmsg;
924 }
925 if ( !event_count_reached ) {
926 if ( !first_alg_name.compare( alg->name() ) ) {
927 ph_ev_count++;
928 // info() << "EVENT COUNT: " << ph_ev_count << endmsg;
929 if ( ph_ev_count == start_at_event ) {
930 event_count_reached = true;
931 // info() << "!!! EVENT COUNT REACHED: " << ph_ev_count << endmsg;
932 }
933 }
934 }
935 if ( event_count_reached ) {
936 // info() << "before:inside! " << alg->name() << endmsg;
937
938 if ( !alg_stack.empty() ) {
939 if ( sampling == 0 )
940 pausepm(); // pausing father algorithm counting
941 else
942 stop_smpl();
943 }
944 ++m_indent;
945 std::vector<unsigned long int> zeroes( 4, 0 );
946 alg_stack.push( std::make_pair( alg, zeroes ) );
947 if ( sampling == 0 )
948 startpm();
949 else
950 start_smpl();
951 }
952 }
ManySmallAlgs.alg
alg
Definition: ManySmallAlgs.py:69
PerfMonAuditor::stop_smpl
void stop_smpl()
Definition: PerfMonAuditor.cpp:777
PerfMonAuditor::startpm
void startpm()
Definition: PerfMonAuditor.cpp:421
PerfMonAuditor::pausepm
void pausepm()
Definition: PerfMonAuditor.cpp:496
PerfMonAuditor::first_alg_name
std::string first_alg_name
Definition: PerfMonAuditor.cpp:417
std::make_pair
T make_pair(T... args)
PerfMonAuditor::m_indent
int m_indent
Definition: PerfMonAuditor.cpp:352
PerfMonAuditor::ph_ev_count
unsigned int ph_ev_count
Definition: PerfMonAuditor.cpp:376
std::vector
STL class.
PerfMonAuditor::event_count_reached
bool event_count_reached
Definition: PerfMonAuditor.cpp:418
PerfMonAuditor::start_smpl
void start_smpl()
Definition: PerfMonAuditor.cpp:661
PerfMonAuditor::start_at_event
unsigned int start_at_event
Definition: PerfMonAuditor.cpp:379
PerfMonAuditor::sampling
bool sampling
Definition: PerfMonAuditor.cpp:387
PerfMonAuditor::first_alg
bool first_alg
Definition: PerfMonAuditor.cpp:416
std::string::compare
T compare(T... args)

## ◆ i_beforeInitialize()

void PerfMonAuditor::i_beforeInitialize | ( | INamedInterface * | alg | ) |
| private

Definition at line 907 of file PerfMonAuditor.cpp.

907 {
908 if ( !alg ) return;
909 return;
910 }
ManySmallAlgs.alg
alg
Definition: ManySmallAlgs.py:69

## ◆ initialize()

StatusCode PerfMonAuditor::initialize | ( |  | ) |
| override virtual

Reimplemented from Auditor.

Definition at line 543 of file PerfMonAuditor.cpp.

543 {
544 if ( !m_pfm.loaded ) {
545 error() << "pfm library could not be loaded" << endmsg;
546 return StatusCode::FAILURE;
547 }
548
549 info() << "Initializing..." << endmsg;
550 StatusCode sc = Auditor::initialize();
551 if ( sc.isFailure() ) { return sc; }
552 used_counters_number = 0;
553 for ( int i = 0; i < MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS; i++ ) {
554 if ( event_str[i].length() > 0 ) used_counters_number++;
555 }
556 for ( int i = 0; i < MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS; i++ ) { strcpy( event_cstr[i], event_str[i].c_str() ); }
557 strcpy( prefix_cstr, prefix.c_str() );
558
559 if ( m_pfm.pfm_initialize() != PFMLIB_SUCCESS ) { error() << "Cannot initialize perfmon!!" << endmsg; }
560 ph_ev_count = 0;
561 first_alg = true;
562 event_count_reached = false;
563 nehalem = false;
564 core = false;
565 westmere = false;
566 if ( family.compare( "CORE" ) == 0 )
567 core = true;
568 else if ( family.compare( "NEHALEM" ) == 0 )
569 nehalem = true;
570 else if ( family.compare( "WESTMERE" ) == 0 )
571 westmere = true;
572 else {
573 error() << "ERROR: Unsupported processor family " << family << ". aborting..." << endmsg;
574 }
575
576 info() << "Initialized!" << endmsg;
577 return StatusCode::SUCCESS;
578 }
PerfMonAuditor::family
std::string family
Definition: PerfMonAuditor.cpp:373
PFMLIB_SUCCESS
#define PFMLIB_SUCCESS
Definition: pfmlib.h:267
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
CommonMessagingBase::info
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
Definition: CommonMessaging.h:104
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:98
PerfMonAuditor::event_str
std::string event_str[MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS]
Definition: PerfMonAuditor.cpp:371
PerfMonAuditor::prefix
std::string prefix
Definition: PerfMonAuditor.cpp:372
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
PerfMonAuditor::used_counters_number
int used_counters_number
Definition: PerfMonAuditor.cpp:382
PerfMonAuditor::event_cstr
char event_cstr[MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS][MAX_EVENT_NAME_LENGTH]
Definition: PerfMonAuditor.cpp:374
PerfMonAuditor::prefix_cstr
char prefix_cstr[MAX_PREFIX_NAME_LENGTH]
Definition: PerfMonAuditor.cpp:375
std::strcpy
T strcpy(T... args)
PerfMonAuditor::i
unsigned int i
Definition: PerfMonAuditor.cpp:365
PerfMonAuditor::ph_ev_count
unsigned int ph_ev_count
Definition: PerfMonAuditor.cpp:376
PerfMonAuditor::event_count_reached
bool event_count_reached
Definition: PerfMonAuditor.cpp:418
std::string::c_str
T c_str(T... args)
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:86
PerfMonAuditor::westmere
bool westmere
Definition: PerfMonAuditor.cpp:384
Auditor::initialize
virtual StatusCode initialize()
Definition: Auditor.cpp:64
PerfMonAuditor::first_alg
bool first_alg
Definition: PerfMonAuditor.cpp:416
StatusCode::isFailure
bool isFailure() const
Definition: StatusCode.h:130
MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS
#define MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS
Definition: PerfMonAuditor.cpp:71
PerfMonAuditor::m_pfm
PFMon & m_pfm
Definition: PerfMonAuditor.cpp:233
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192
std::string::compare
T compare(T... args)
PerfMonAuditor::nehalem
bool nehalem
Definition: PerfMonAuditor.cpp:383
PerfMonAuditor::core
bool core
Definition: PerfMonAuditor.cpp:385

## ◆ is_nehalem()

int PerfMonAuditor::is_nehalem | ( |  | ) |
| inline

Definition at line 214 of file PerfMonAuditor.cpp.

214 {
215 #ifdef __ICC
216 // Disable ICC remark #593: variable "x" was set but never used
217 # pragma warning( push )
218 # pragma warning( disable : 593 )
219 #endif
220 int a, b, c, d;
221 cpuid( 1, a, b, c, d );
222 int sse4_2_mask = 1 << 20;
223 if ( c & sse4_2_mask )
224 return 1;
225 else
226 return 0;
227 #ifdef __ICC
228 # pragma warning( pop )
229 #endif
230 }
gaudirun.c
c
Definition: gaudirun.py:487
cpuid
#define cpuid(func, ax, bx, cx, dx)
Definition: PerfMonAuditor.cpp:73

## ◆ operator=()

PerfMonAuditor& PerfMonAuditor::operator= | ( | const PerfMonAuditor & |  | ) |
| private

## ◆ pausepm()

void PerfMonAuditor::pausepm | ( |  | ) |
| private

Definition at line 496 of file PerfMonAuditor.cpp.

496 {
497 m_pfm.pfm_stop( fd );
498 if ( m_pfm.pfm_read_pmds( fd, pd, inp.pfp_event_count ) == -1 ) { error() << "Could not read pmds" << endmsg; }
499
500 for ( int i = 0; i < used_counters_number; i++ ) { alg_stack.top().second[i] += pd[i].reg_value; }
501
502 close( fd );
503 }
PerfMonAuditor::inp
pfmlib_input_param_t inp
Definition: PerfMonAuditor.cpp:358
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:98
PerfMonAuditor::used_counters_number
int used_counters_number
Definition: PerfMonAuditor.cpp:382
PerfMonAuditor::pd
pfarg_pmd_t pd[NUM_PMDS]
Definition: PerfMonAuditor.cpp:361
PerfMonAuditor::i
unsigned int i
Definition: PerfMonAuditor.cpp:365
PerfMonAuditor::fd
int fd
Definition: PerfMonAuditor.cpp:364
PerfMonAuditor::m_pfm
PFMon & m_pfm
Definition: PerfMonAuditor.cpp:233
pfarg_pmd_t::reg_value
uint64_t reg_value
Definition: perfmon_v2.h:42
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192
pfmlib_input_param_t::pfp_event_count
unsigned int pfp_event_count
Definition: pfmlib.h:108

## ◆ pfm_bv_copy()

void PerfMonAuditor::pfm_bv_copy | ( | uint64_t * | d,
|  | uint64_t * | j,
|  | uint16_t | n
| ) |  |
| inline private

Definition at line 394 of file PerfMonAuditor.cpp.

394 {
395 if ( n <= BPL )
396 *d = *j;
397 else {
398 memcpy( d, j, ( n >> LBPL ) * sizeof( uint64_t ) );
399 }
400 }
uint64_t
unsigned long long uint64_t
Definition: instrset.h:143
GaudiPluginService.cpluginsvc.n
n
Definition: cpluginsvc.py:210
std::memcpy
T memcpy(T... args)
LBPL
#define LBPL
Definition: PerfMonAuditor.cpp:63
BPL
#define BPL
Definition: PerfMonAuditor.cpp:62

## ◆ pfm_bv_isset()

int PerfMonAuditor::pfm_bv_isset | ( | uint64_t * | bv,
|  | uint16_t | rnum
| ) |  |
| inline private

Definition at line 391 of file PerfMonAuditor.cpp.

391 {
392 return bv[rnum >> LBPL] & ( 1UL << ( rnum & ( BPL - 1 ) ) ) ? 1 : 0;
393 }
LBPL
#define LBPL
Definition: PerfMonAuditor.cpp:63
BPL
#define BPL
Definition: PerfMonAuditor.cpp:62

## ◆ pfm_bv_set()

void PerfMonAuditor::pfm_bv_set | ( | uint64_t * | bv,
|  | uint16_t | rnum
| ) |  |
| inline private

Definition at line 390 of file PerfMonAuditor.cpp.

390 { bv[rnum >> LBPL] |= 1UL << ( rnum & ( BPL - 1 ) ); }
LBPL
#define LBPL
Definition: PerfMonAuditor.cpp:63
BPL
#define BPL
Definition: PerfMonAuditor.cpp:62

## ◆ process_smpl_buf()

void PerfMonAuditor::process_smpl_buf | ( | pfm_dfl_smpl_hdr_t * | hdr,
|  | size_t | entry_size
| ) |  |
| static private

Definition at line 584 of file PerfMonAuditor.cpp.

584 {
586 pfm_dfl_smpl_entry_t* ent;
587 size_t pos, count;
588 uint64_t entry;
589 if ( hdr->hdr_overflows == last_overflow && hdr->hdr_count == last_count ) {
590 printf( "skipping identical set of samples...\n" );
591 return;
592 }
593 count = hdr->hdr_count;
594 ent = (pfm_dfl_smpl_entry_t*)( hdr + 1 );
595 pos = (unsigned long)ent;
596 entry = collected_samples;
597 while ( count-- ) {
598 // if(ent->ovfl_pmd>=0 && ent->ovfl_pmd<=3)
599 if ( ent->ovfl_pmd <= 3 ) {
600 ( ( samples[ent->ovfl_pmd] )[( alg_stack.top().first )->name()] )[(unsigned long)( ent->ip )]++;
601 }
602 pos += entry_size;
603 ent = (pfm_dfl_smpl_entry_t*)pos;
604 entry++;
605 }
606 collected_samples = entry;
607 last_overflow = hdr->hdr_overflows;
608 if ( last_count != hdr->hdr_count && ( last_count || last_overflow == 0 ) ) { collected_partial += hdr->hdr_count; }
609 last_count = hdr->hdr_count;
610 return;
611 }
pfm_dfl_smpl_hdr_t::hdr_overflows
uint64_t hdr_overflows
Definition: perfmon_dfl_smpl.h:48
uint64_t
unsigned long long uint64_t
Definition: instrset.h:143
pfm_dfl_smpl_entry_t::ovfl_pmd
uint16_t ovfl_pmd
Definition: perfmon_dfl_smpl.h:69
pfm_dfl_smpl_entry_t::ip
uint64_t ip
Definition: perfmon_dfl_smpl.h:72
pfm_dfl_smpl_entry_t
Definition: perfmon_dfl_smpl.h:67
std::count
T count(T... args)
Auditor::name
const std::string & name() const override
Definition: Auditor.cpp:193
pfm_dfl_smpl_hdr_t::hdr_count
uint64_t hdr_count
Definition: perfmon_dfl_smpl.h:46
std::printf
T printf(T... args)

## ◆ sigio_handler()

void PerfMonAuditor::sigio_handler | ( | int | ,
|  | siginfo_t * | ,
|  | void * |
| ) |  |
| static private

Definition at line 617 of file PerfMonAuditor.cpp.

617 {
618 PFMon& pfm = PFMon::instance();
619 pfarg_msg_t msg;
620 int fd = ctx_fd;
621 int r;
622 if ( fd != ctx_fd ) {
623 // error() << "ERROR: handler does not get valid file descriptor. Aborting..." << endmsg;
624 }
625 if ( pfm.pfm_read_pmds( fd, pd_smpl + 1, 1 ) == -1 ) {
626 // error() << "ERROR: pfm_read_pmds: " << strerror(errno) << ". Aborting..." << endmsg;
627 }
628 while ( true ) {
629 r = read( fd, &msg, sizeof( msg ) );
630 if ( r != sizeof( msg ) ) {
631 if ( r == -1 && errno == EINTR ) {
632 printf( "read interrupted, retrying\n" );
633 continue;
634 }
635 // error() << "ERROR: cannot read overflow message: " << strerror(errno) << ". Aborting..." << endmsg;
636 }
637 break;
638 }
639 switch ( msg.type ) {
640 case PFM_MSG_OVFL: // the sampling buffer is full
641 process_smpl_buf( hdr, entry_size );
642 ovfl_count++;
643 if ( pfm.pfm_restart( fd ) ) {
644 if ( errno != EBUSY ) {
645 // error() << "ERROR: pfm_restart error errno " << errno << ". Aborting..." << endmsg;
646 } else {
647 printf( "pfm_restart: task probably terminated \n" );
648 }
649 }
650 break;
651 default:
652 // error() << "ERROR: unknown message type " << msg.type << ". Aborting..." << endmsg;
653 break;
654 }
655 }
hivetimeline.read
def read(f, regex='.*', skipevents=0)
Definition: hivetimeline.py:22
CommonMessagingBase::msg
MsgStream & msg() const
shortcut for the method msgStream(MSG::INFO)
Definition: CommonMessaging.h:113
PerfMonAuditor::process_smpl_buf
static void process_smpl_buf(pfm_dfl_smpl_hdr_t *hdr, size_t entry_size)
Definition: PerfMonAuditor.cpp:584
pfarg_msg_t
Definition: perfmon.h:205
PerfMonAuditor::fd
int fd
Definition: PerfMonAuditor.cpp:364
PFM_MSG_OVFL
#define PFM_MSG_OVFL
Definition: perfmon.h:210
std::printf
T printf(T... args)

## ◆ start_smpl()

void PerfMonAuditor::start_smpl | ( |  | ) |
| private

Definition at line 661 of file PerfMonAuditor.cpp.

661 {
662 ovfl_count = 0;
663 num_smpl_pmds = 0;
664 last_overflow = ~0;
665 max_pmd = 0;
666 memset( &pfmlib_options, 0, sizeof( pfmlib_options ) );
667 pfmlib_options.pfm_debug = 0;
668 pfmlib_options.pfm_verbose = 0;
669 m_pfm.pfm_set_options( &pfmlib_options );
670 ret = m_pfm.pfm_initialize();
671 if ( ret != PFMLIB_SUCCESS ) {
672 error() << "ERROR: Cannot initialize library: " << m_pfm.pfm_strerror( ret ) << ". Aborting..." << endmsg;
673 }
674 struct sigaction act;
675 memset( &act, 0, sizeof( act ) );
676 act.sa_sigaction = sigio_handler; // dlopen() ==>
677 // act.sa_handler = (sig_t)&sigio_handler;
678 sigaction( SIGIO, &act, 0 );
679 memset( &ctx, 0, sizeof( ctx ) );
680 memset( &buf_arg, 0, sizeof( buf_arg ) );
681 memset( &inp, 0, sizeof( inp ) );
682 memset( &outp, 0, sizeof( outp ) );
683 memset( pd_smpl, 0, sizeof( pd_smpl ) );
684 memset( pc, 0, sizeof( pc ) );
685 memset( &load_args, 0, sizeof( load_args ) );
686 m_pfm.pfm_get_num_counters( &num_counters );
687 memset( &params, 0, sizeof( params ) );
688 memset( &nhm_params, 0, sizeof( nhm_params ) );
689
690 for ( int i = 0; i < used_counters_number; i++ ) {
691 ret = m_pfm.pfm_find_full_event( event_cstr[i], &inp.pfp_events[i] );
692 if ( ret != PFMLIB_SUCCESS ) {
693 error() << "ERROR: cannot find event: " << event_cstr[i] << ". Aborting..." << endmsg;
694 }
695 }
696 inp.pfp_dfl_plm = PFM_PLM3;
697 inp.pfp_event_count = 4;
698 for ( int i = 0; i < used_counters_number; i++ ) {
699 if ( inv[i] ) {
700 ( params.pfp_core_counters[i] ).flags |= PFM_CORE_SEL_INV;
701 ( nhm_params.pfp_nhm_counters[i] ).flags |= PFM_NHM_SEL_INV;
702 }
703 if ( cmask[i] > 0 ) {
704 ( params.pfp_core_counters[i] ).cnt_mask = cmask[i];
705 ( nhm_params.pfp_nhm_counters[i] ).cnt_mask = cmask[i];
706 }
707 }
708 if ( nehalem || westmere ) {
709 ret = m_pfm.pfm_dispatch_events( &inp, &nhm_params, &outp, NULL );
710 } else {
711 ret = m_pfm.pfm_dispatch_events( &inp, &params, &outp, NULL );
712 }
713 if ( ret != PFMLIB_SUCCESS ) {
714 error() << "ERROR: cannot configure events: " << m_pfm.pfm_strerror( ret ) << ". Aborting..." << endmsg;
715 }
716 for ( unsigned int i = 0; i < outp.pfp_pmc_count; i++ ) {
717 pc[i].reg_num = outp.pfp_pmcs[i].reg_num;
718 pc[i].reg_value = outp.pfp_pmcs[i].reg_value;
719 }
720 for ( unsigned int i = 0; i < outp.pfp_pmd_count; i++ ) {
721 pd_smpl[i].reg_num = outp.pfp_pmds[i].reg_num;
722 if ( i ) {
723 pfm_bv_set( pd_smpl[0].reg_smpl_pmds, pd_smpl[i].reg_num );
724 if ( pd_smpl[i].reg_num > max_pmd ) { max_pmd = pd_smpl[i].reg_num; }
725 num_smpl_pmds++;
726 }
727 }
728 for ( int i = 0; i < used_counters_number; i++ ) {
729 pd_smpl[i].reg_flags |= PFM_REGFL_OVFL_NOTIFY | PFM_REGFL_RANDOM;
730 pfm_bv_copy( pd_smpl[i].reg_reset_pmds, pd_smpl[i].reg_smpl_pmds, max_pmd );
731 pd_smpl[i].reg_value = ( uint64_t )( sp[i] * -1 );
732 pd_smpl[i].reg_short_reset = ( uint64_t )( sp[i] * -1 );
733 pd_smpl[i].reg_long_reset = ( uint64_t )( sp[i] * -1 );
734 pd_smpl[i].reg_random_seed = 5; // tocheck
735 pd_smpl[i].reg_random_mask = 0xff; // tocheck
736 }
737 entry_size = sizeof( pfm_dfl_smpl_entry_t ) + ( num_smpl_pmds << 3 );
738 ctx.ctx_flags = 0;
739 buf_arg.buf_size = 3 * getpagesize() + 512;
740 ctx_fd = m_pfm.pfm_create_context( &ctx, (char*)FMT_NAME, &buf_arg, sizeof( buf_arg ) );
741 if ( ctx_fd == -1 ) {
742 if ( errno == ENOSYS ) {
743 error() << "ERROR: Your kernel does not have performance monitoring support! Aborting..." << endmsg;
744 }
745 error() << "ERROR: Can't create PFM context " << strerror( errno ) << ". Aborting..." << endmsg;
746 }
747 buf_addr = mmap( NULL, buf_arg.buf_size, PROT_READ, MAP_PRIVATE, ctx_fd, 0 );
748 if ( buf_addr == MAP_FAILED ) {
749 error() << "ERROR: cannot mmap sampling buffer: " << strerror( errno ) << ". Aborting..." << endmsg;
750 }
751 hdr = (pfm_dfl_smpl_hdr_t*)buf_addr;
752 if ( PFM_VERSION_MAJOR( hdr->hdr_version ) < 1 ) {
753 error() << "ERROR: invalid buffer format version. Aborting..." << endmsg;
754 }
755 if ( m_pfm.pfm_write_pmcs( ctx_fd, pc, outp.pfp_pmc_count ) ) {
756 error() << "ERROR: pfm_write_pmcs error errno " << strerror( errno ) << ". Aborting..." << endmsg;
757 }
758 if ( m_pfm.pfm_write_pmds( ctx_fd, pd_smpl, outp.pfp_pmd_count ) ) {
759 error() << "ERROR: pfm_write_pmds error errno " << strerror( errno ) << ". Aborting..." << endmsg;
760 }
761 load_args.load_pid = getpid();
762 if ( m_pfm.pfm_load_context( ctx_fd, &load_args ) ) {
763 error() << "ERROR: pfm_load_context error errno " << strerror( errno ) << ". Aborting..." << endmsg;
764 }
765 ret = fcntl( ctx_fd, F_SETFL, fcntl( ctx_fd, F_GETFL, 0 ) | O_ASYNC );
766 if ( ret == -1 ) { error() << "ERROR: cannot set ASYNC: " << strerror( errno ) << ". Aborting..." << endmsg; }
767 ret = fcntl( ctx_fd, F_SETOWN, getpid() );
768 if ( ret == -1 ) { error() << "ERROR: cannot setown: " << strerror( errno ) << ". Aborting..." << endmsg; }
769 // pfm_self_start(ctx_fd); ==>
770 m_pfm.pfm_start( ctx_fd, NULL );
771 }
pfmlib_output_param_t::pfp_pmds
pfmlib_reg_t pfp_pmds[PFMLIB_MAX_PMDS]
Definition: pfmlib.h:129
PerfMonAuditor::load_args
pfarg_load_t load_args
Definition: PerfMonAuditor.cpp:408
pfarg_pmd_t::reg_short_reset
uint64_t reg_short_reset
Definition: perfmon_v2.h:44
PerfMonAuditor::params
pfmlib_core_input_param_t params
Definition: PerfMonAuditor.cpp:380
PFM_REGFL_OVFL_NOTIFY
#define PFM_REGFL_OVFL_NOTIFY
Definition: perfmon.h:112
PFM_NHM_SEL_INV
#define PFM_NHM_SEL_INV
Definition: pfmlib_intel_nhm.h:103
pfm_dfl_smpl_arg_t::buf_size
uint64_t buf_size
Definition: perfmon_dfl_smpl.h:35
PFM_PLM3
#define PFM_PLM3
Definition: pfmlib.h:53
pfmlib_input_param_t::pfp_events
pfmlib_event_t pfp_events[PFMLIB_MAX_PMCS]
Definition: pfmlib.h:112
PFM_CORE_SEL_INV
#define PFM_CORE_SEL_INV
Definition: pfmlib_core.h:68
pfmlib_nhm_input_param_t::pfp_nhm_counters
pfmlib_nhm_counter_t pfp_nhm_counters[PMU_NHM_NUM_COUNTERS]
Definition: pfmlib_intel_nhm.h:139
std::strerror
T strerror(T... args)
PerfMonAuditor::inv
bool inv[MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS]
Definition: PerfMonAuditor.cpp:377
PFMLIB_SUCCESS
#define PFMLIB_SUCCESS
Definition: pfmlib.h:267
pfmlib_options_t::pfm_verbose
unsigned int pfm_verbose
Definition: pfmlib.h:138
pfmlib_input_param_t::pfp_dfl_plm
unsigned int pfp_dfl_plm
Definition: pfmlib.h:109
pfarg_pmd_t::reg_num
uint16_t reg_num
Definition: perfmon_v2.h:39
uint64_t
unsigned long long uint64_t
Definition: instrset.h:143
std::memset
T memset(T... args)
PerfMonAuditor::inp
pfmlib_input_param_t inp
Definition: PerfMonAuditor.cpp:358
pfmlib_output_param_t::pfp_pmc_count
unsigned int pfp_pmc_count
Definition: pfmlib.h:126
PerfMonAuditor::pfmlib_options
pfmlib_options_t pfmlib_options
Definition: PerfMonAuditor.cpp:412
boost::spirit
Definition: iter_pos.hpp:14
pfmlib_reg_t::reg_value
unsigned long long reg_value
Definition: pfmlib.h:97
pfmlib_output_param_t::pfp_pmd_count
unsigned int pfp_pmd_count
Definition: pfmlib.h:127
pfarg_pmd_t::reg_random_seed
uint32_t reg_random_seed
Definition: perfmon_v2.h:51
pfarg_pmd_t::reg_long_reset
uint64_t reg_long_reset
Definition: perfmon_v2.h:43
PerfMonAuditor::nhm_params
pfmlib_nhm_input_param_t nhm_params
Definition: PerfMonAuditor.cpp:381
PFM_VERSION_MAJOR
#define PFM_VERSION_MAJOR(x)
Definition: perfmon.h:213
pfarg_ctx_t::ctx_flags
uint32_t ctx_flags
Definition: perfmon_v2.h:19
PerfMonAuditor::pfm_bv_copy
void pfm_bv_copy(uint64_t *d, uint64_t *j, uint16_t n)
Definition: PerfMonAuditor.cpp:394
PerfMonAuditor::pfm_bv_set
void pfm_bv_set(uint64_t *bv, uint16_t rnum)
Definition: PerfMonAuditor.cpp:390
pfm_dfl_smpl_entry_t
Definition: perfmon_dfl_smpl.h:67
pfarg_pmd_t::reg_flags
uint32_t reg_flags
Definition: perfmon_v2.h:41
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:98
PerfMonAuditor::buf_addr
void * buf_addr
Definition: PerfMonAuditor.cpp:409
pfmlib_options_t::pfm_debug
unsigned int pfm_debug
Definition: pfmlib.h:137
pfm_dfl_smpl_hdr_t
Definition: perfmon_dfl_smpl.h:45
pfmlib_reg_t::reg_num
unsigned int reg_num
Definition: pfmlib.h:99
PerfMonAuditor::outp
pfmlib_output_param_t outp
Definition: PerfMonAuditor.cpp:359
pfarg_pmc_t::reg_num
uint16_t reg_num
Definition: perfmon_v2.h:28
PerfMonAuditor::used_counters_number
int used_counters_number
Definition: PerfMonAuditor.cpp:382
PerfMonAuditor::event_cstr
char event_cstr[MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS][MAX_EVENT_NAME_LENGTH]
Definition: PerfMonAuditor.cpp:374
pfarg_load_t::load_pid
uint32_t load_pid
Definition: perfmon_v2.h:69
PerfMonAuditor::i
unsigned int i
Definition: PerfMonAuditor.cpp:365
PerfMonAuditor::pc
pfarg_pmc_t pc[NUM_PMCS]
Definition: PerfMonAuditor.cpp:362
PerfMonAuditor::ctx
pfarg_ctx_t ctx
Definition: PerfMonAuditor.cpp:360
FMT_NAME
#define FMT_NAME
Definition: PerfMonAuditor.cpp:61
PerfMonAuditor::ret
int ret
Definition: PerfMonAuditor.cpp:366
PFM_REGFL_RANDOM
#define PFM_REGFL_RANDOM
Definition: perfmon.h:113
PerfMonAuditor::num_counters
unsigned num_counters
Definition: PerfMonAuditor.cpp:410
PerfMonAuditor::buf_arg
pfm_dfl_smpl_arg_t buf_arg
Definition: PerfMonAuditor.cpp:407
PerfMonAuditor::sigio_handler
static void sigio_handler(int, siginfo_t *, void *)
Definition: PerfMonAuditor.cpp:617
pfarg_pmc_t::reg_value
uint64_t reg_value
Definition: perfmon_v2.h:31
PerfMonAuditor::max_pmd
unsigned int max_pmd
Definition: PerfMonAuditor.cpp:411
PerfMonAuditor::westmere
bool westmere
Definition: PerfMonAuditor.cpp:384
pfmlib_output_param_t::pfp_pmcs
pfmlib_reg_t pfp_pmcs[PFMLIB_MAX_PMCS]
Definition: pfmlib.h:128
pfarg_pmd_t::reg_random_mask
uint64_t reg_random_mask
Definition: perfmon_v2.h:50
pfm_dfl_smpl_hdr_t::hdr_version
uint32_t hdr_version
Definition: perfmon_dfl_smpl.h:51
pfmlib_core_input_param_t::pfp_core_counters
pfmlib_core_counter_t pfp_core_counters[PMU_CORE_NUM_COUNTERS]
Definition: pfmlib_core.h:79
PerfMonAuditor::cmask
unsigned int cmask[MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS]
Definition: PerfMonAuditor.cpp:378
PerfMonAuditor::m_pfm
PFMon & m_pfm
Definition: PerfMonAuditor.cpp:233
pfarg_pmd_t::reg_value
uint64_t reg_value
Definition: perfmon_v2.h:42
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192
pfmlib_input_param_t::pfp_event_count
unsigned int pfp_event_count
Definition: pfmlib.h:108
PerfMonAuditor::nehalem
bool nehalem
Definition: PerfMonAuditor.cpp:383

## ◆ startpm()

void PerfMonAuditor::startpm | ( |  | ) |
| private

Definition at line 421 of file PerfMonAuditor.cpp.

421 {
422 memset( &ctx, 0, sizeof( ctx ) );
423 memset( &inp, 0, sizeof( inp ) );
424 memset( &outp, 0, sizeof( outp ) );
425 memset( pd, 0, sizeof( pd ) );
426 memset( pc, 0, sizeof( pc ) );
427 memset( &load_arg, 0, sizeof( load_arg ) );
428 memset( &params, 0, sizeof( params ) );
429 memset( &nhm_params, 0, sizeof( nhm_params ) );
430
431 for ( int i = 0; i < used_counters_number; i++ ) {
432 ret = m_pfm.pfm_find_full_event( event_cstr[i], &inp.pfp_events[i] );
433 if ( ret != PFMLIB_SUCCESS ) {
434 error() << "ERROR: cannot find event: " << event_cstr[i] << ". Aborting..." << endmsg;
435 }
436 }
437 inp.pfp_dfl_plm = PFM_PLM3;
438 inp.pfp_event_count = 4;
439 for ( int i = 0; i < used_counters_number; i++ ) {
440 if ( inv[i] ) {
441 ( params.pfp_core_counters[i] ).flags |= PFM_CORE_SEL_INV;
442 ( nhm_params.pfp_nhm_counters[i] ).flags |= PFM_NHM_SEL_INV;
443 }
444 if ( cmask[i] > 0 ) {
445 ( params.pfp_core_counters[i] ).cnt_mask = cmask[i];
446 ( nhm_params.pfp_nhm_counters[i] ).cnt_mask = cmask[i];
447 }
448 }
449 if ( nehalem || westmere ) {
450 ret = m_pfm.pfm_dispatch_events( &inp, &nhm_params, &outp, NULL );
451 } else {
452 ret = m_pfm.pfm_dispatch_events( &inp, &params, &outp, NULL );
453 }
454 if ( ret != PFMLIB_SUCCESS ) {
455 error() << "ERROR: cannot dispatch events: " << m_pfm.pfm_strerror( ret ) << ". Aborting..." << endmsg;
456 }
457 for ( unsigned int i = 0; i < outp.pfp_pmc_count; i++ ) {
458 pc[i].reg_num = outp.pfp_pmcs[i].reg_num;
459 pc[i].reg_value = outp.pfp_pmcs[i].reg_value;
460 }
461 for ( unsigned int i = 0; i < outp.pfp_pmd_count; i++ ) {
462 pd[i].reg_num = outp.pfp_pmds[i].reg_num;
463 pd[i].reg_value = 0;
464 }
465 fd = m_pfm.pfm_create_context( &ctx, NULL, 0, 0 );
466 if ( fd == -1 ) { error() << "ERROR: Context not created. Aborting..." << endmsg; }
467 if ( m_pfm.pfm_write_pmcs( fd, pc, outp.pfp_pmc_count ) == -1 ) {
468 error() << "ERROR: Could not write pmcs. Aborting..." << endmsg;
469 }
470 if ( m_pfm.pfm_write_pmds( fd, pd, outp.pfp_pmd_count ) == -1 ) {
471 error() << "ERROR: Could not write pmds. Aborting..." << endmsg;
472 }
473 load_arg.load_pid = getpid();
474 if ( m_pfm.pfm_load_context( fd, &load_arg ) == -1 ) {
475 error() << "ERROR: Could not load context. Aborting..." << endmsg;
476 // error() << "Could not read pmds" << endmsg;
477 }
478
479 m_pfm.pfm_start( fd, NULL );
480 }
pfmlib_output_param_t::pfp_pmds
pfmlib_reg_t pfp_pmds[PFMLIB_MAX_PMDS]
Definition: pfmlib.h:129
PerfMonAuditor::params
pfmlib_core_input_param_t params
Definition: PerfMonAuditor.cpp:380
PFM_NHM_SEL_INV
#define PFM_NHM_SEL_INV
Definition: pfmlib_intel_nhm.h:103
PFM_PLM3
#define PFM_PLM3
Definition: pfmlib.h:53
pfmlib_input_param_t::pfp_events
pfmlib_event_t pfp_events[PFMLIB_MAX_PMCS]
Definition: pfmlib.h:112
PFM_CORE_SEL_INV
#define PFM_CORE_SEL_INV
Definition: pfmlib_core.h:68
pfmlib_nhm_input_param_t::pfp_nhm_counters
pfmlib_nhm_counter_t pfp_nhm_counters[PMU_NHM_NUM_COUNTERS]
Definition: pfmlib_intel_nhm.h:139
PerfMonAuditor::inv
bool inv[MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS]
Definition: PerfMonAuditor.cpp:377
PFMLIB_SUCCESS
#define PFMLIB_SUCCESS
Definition: pfmlib.h:267
pfmlib_input_param_t::pfp_dfl_plm
unsigned int pfp_dfl_plm
Definition: pfmlib.h:109
pfarg_pmd_t::reg_num
uint16_t reg_num
Definition: perfmon_v2.h:39
std::memset
T memset(T... args)
PerfMonAuditor::inp
pfmlib_input_param_t inp
Definition: PerfMonAuditor.cpp:358
pfmlib_output_param_t::pfp_pmc_count
unsigned int pfp_pmc_count
Definition: pfmlib.h:126
pfmlib_reg_t::reg_value
unsigned long long reg_value
Definition: pfmlib.h:97
pfmlib_output_param_t::pfp_pmd_count
unsigned int pfp_pmd_count
Definition: pfmlib.h:127
PerfMonAuditor::nhm_params
pfmlib_nhm_input_param_t nhm_params
Definition: PerfMonAuditor.cpp:381
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:98
pfmlib_reg_t::reg_num
unsigned int reg_num
Definition: pfmlib.h:99
PerfMonAuditor::outp
pfmlib_output_param_t outp
Definition: PerfMonAuditor.cpp:359
pfarg_pmc_t::reg_num
uint16_t reg_num
Definition: perfmon_v2.h:28
PerfMonAuditor::used_counters_number
int used_counters_number
Definition: PerfMonAuditor.cpp:382
PerfMonAuditor::event_cstr
char event_cstr[MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS][MAX_EVENT_NAME_LENGTH]
Definition: PerfMonAuditor.cpp:374
PerfMonAuditor::pd
pfarg_pmd_t pd[NUM_PMDS]
Definition: PerfMonAuditor.cpp:361
pfarg_load_t::load_pid
uint32_t load_pid
Definition: perfmon_v2.h:69
PerfMonAuditor::i
unsigned int i
Definition: PerfMonAuditor.cpp:365
PerfMonAuditor::pc
pfarg_pmc_t pc[NUM_PMCS]
Definition: PerfMonAuditor.cpp:362
PerfMonAuditor::ctx
pfarg_ctx_t ctx
Definition: PerfMonAuditor.cpp:360
PerfMonAuditor::ret
int ret
Definition: PerfMonAuditor.cpp:366
pfarg_pmc_t::reg_value
uint64_t reg_value
Definition: perfmon_v2.h:31
PerfMonAuditor::westmere
bool westmere
Definition: PerfMonAuditor.cpp:384
pfmlib_output_param_t::pfp_pmcs
pfmlib_reg_t pfp_pmcs[PFMLIB_MAX_PMCS]
Definition: pfmlib.h:128
pfmlib_core_input_param_t::pfp_core_counters
pfmlib_core_counter_t pfp_core_counters[PMU_CORE_NUM_COUNTERS]
Definition: pfmlib_core.h:79
PerfMonAuditor::fd
int fd
Definition: PerfMonAuditor.cpp:364
PerfMonAuditor::cmask
unsigned int cmask[MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS]
Definition: PerfMonAuditor.cpp:378
PerfMonAuditor::load_arg
pfarg_load_t load_arg
Definition: PerfMonAuditor.cpp:363
PerfMonAuditor::m_pfm
PFMon & m_pfm
Definition: PerfMonAuditor.cpp:233
pfarg_pmd_t::reg_value
uint64_t reg_value
Definition: perfmon_v2.h:42
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192
pfmlib_input_param_t::pfp_event_count
unsigned int pfp_event_count
Definition: pfmlib.h:108
PerfMonAuditor::nehalem
bool nehalem
Definition: PerfMonAuditor.cpp:383

## ◆ stop_smpl()

void PerfMonAuditor::stop_smpl | ( |  | ) |
| private

Definition at line 777 of file PerfMonAuditor.cpp.

777 {
778 m_pfm.pfm_self_stop( ctx_fd );
779 process_smpl_buf( hdr, entry_size );
780 close( ctx_fd );
781 ret = munmap( hdr, buf_arg.buf_size );
782 if ( ret ) { error() << "Cannot unmap buffer: %s" << strerror( errno ) << endmsg; }
783 return;
784 }
pfm_dfl_smpl_arg_t::buf_size
uint64_t buf_size
Definition: perfmon_dfl_smpl.h:35
std::strerror
T strerror(T... args)
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:98
PerfMonAuditor::process_smpl_buf
static void process_smpl_buf(pfm_dfl_smpl_hdr_t *hdr, size_t entry_size)
Definition: PerfMonAuditor.cpp:584
PerfMonAuditor::ret
int ret
Definition: PerfMonAuditor.cpp:366
PerfMonAuditor::buf_arg
pfm_dfl_smpl_arg_t buf_arg
Definition: PerfMonAuditor.cpp:407
PerfMonAuditor::m_pfm
PFMon & m_pfm
Definition: PerfMonAuditor.cpp:233
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192

## ◆ stoppm()

void PerfMonAuditor::stoppm | ( |  | ) |
| private

Definition at line 486 of file PerfMonAuditor.cpp.

486 {
487 m_pfm.pfm_stop( fd );
488 if ( m_pfm.pfm_read_pmds( fd, pd, inp.pfp_event_count ) == -1 ) { error() << "Could not read pmds" << endmsg; }
489 for ( int i = 0; i < used_counters_number; i++ ) {
490 results[i][( alg_stack.top().first )->name()].push_back( alg_stack.top().second[i] + pd[i].reg_value );
491 }
492
493 close( fd );
494 }
PerfMonAuditor::inp
pfmlib_input_param_t inp
Definition: PerfMonAuditor.cpp:358
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:98
PerfMonAuditor::used_counters_number
int used_counters_number
Definition: PerfMonAuditor.cpp:382
PerfMonAuditor::pd
pfarg_pmd_t pd[NUM_PMDS]
Definition: PerfMonAuditor.cpp:361
PerfMonAuditor::i
unsigned int i
Definition: PerfMonAuditor.cpp:365
Auditor::name
const std::string & name() const override
Definition: Auditor.cpp:193
PerfMonAuditor::fd
int fd
Definition: PerfMonAuditor.cpp:364
PerfMonAuditor::m_pfm
PFMon & m_pfm
Definition: PerfMonAuditor.cpp:233
pfarg_pmd_t::reg_value
uint64_t reg_value
Definition: perfmon_v2.h:42
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192
pfmlib_input_param_t::pfp_event_count
unsigned int pfp_event_count
Definition: pfmlib.h:108

## Member Data Documentation

## ◆ buf_addr

void* PerfMonAuditor::buf_addr
| private

Definition at line 409 of file PerfMonAuditor.cpp.

## ◆ buf_arg

pfm_dfl_smpl_arg_t PerfMonAuditor::buf_arg
| private

Definition at line 407 of file PerfMonAuditor.cpp.

## ◆ cmask

unsigned int PerfMonAuditor::cmask[MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS]
| private

Definition at line 378 of file PerfMonAuditor.cpp.

## ◆ core

bool PerfMonAuditor::core
| private

Definition at line 385 of file PerfMonAuditor.cpp.

## ◆ ctx

pfarg_ctx_t PerfMonAuditor::ctx
| private

Definition at line 360 of file PerfMonAuditor.cpp.

## ◆ event_count_reached

bool PerfMonAuditor::event_count_reached
| private

Definition at line 418 of file PerfMonAuditor.cpp.

## ◆ event_cstr

char PerfMonAuditor::event_cstr[MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS][MAX_EVENT_NAME_LENGTH]
| private

Definition at line 374 of file PerfMonAuditor.cpp.

## ◆ event_str

std::string PerfMonAuditor::event_str[MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS]
| private

Definition at line 371 of file PerfMonAuditor.cpp.

## ◆ family

std::string PerfMonAuditor::family
| private

Definition at line 373 of file PerfMonAuditor.cpp.

## ◆ fd

int PerfMonAuditor::fd
| private

Definition at line 364 of file PerfMonAuditor.cpp.

## ◆ first_alg

bool PerfMonAuditor::first_alg
| private

Definition at line 416 of file PerfMonAuditor.cpp.

## ◆ first_alg_name

std::string PerfMonAuditor::first_alg_name
| private

Definition at line 417 of file PerfMonAuditor.cpp.

## ◆ i

unsigned int PerfMonAuditor::i
| private

Definition at line 365 of file PerfMonAuditor.cpp.

## ◆ inp

pfmlib_input_param_t PerfMonAuditor::inp
| private

Definition at line 358 of file PerfMonAuditor.cpp.

## ◆ inv

bool PerfMonAuditor::inv[MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS]
| private

Definition at line 377 of file PerfMonAuditor.cpp.

## ◆ is_nehalem_ret

int PerfMonAuditor::is_nehalem_ret
| private

Definition at line 356 of file PerfMonAuditor.cpp.

## ◆ level

int PerfMonAuditor::level
| private

Definition at line 414 of file PerfMonAuditor.cpp.

## ◆ load_arg

pfarg_load_t PerfMonAuditor::load_arg
| private

Definition at line 363 of file PerfMonAuditor.cpp.

## ◆ load_args

pfarg_load_t PerfMonAuditor::load_args
| private

Definition at line 408 of file PerfMonAuditor.cpp.

## ◆ m_indent

int PerfMonAuditor::m_indent
| private

Definition at line 352 of file PerfMonAuditor.cpp.

## ◆ m_inEvent

bool PerfMonAuditor::m_inEvent
| private

Definition at line 353 of file PerfMonAuditor.cpp.

## ◆ m_map

Map PerfMonAuditor::m_map
| private

Definition at line 351 of file PerfMonAuditor.cpp.

## ◆ m_pfm

PFMon& PerfMonAuditor::m_pfm
| private

Definition at line 233 of file PerfMonAuditor.cpp.

## ◆ max_pmd

unsigned int PerfMonAuditor::max_pmd
| private

Definition at line 411 of file PerfMonAuditor.cpp.

## ◆ nehalem

bool PerfMonAuditor::nehalem
| private

Definition at line 383 of file PerfMonAuditor.cpp.

## ◆ nhm_params

pfmlib_nhm_input_param_t PerfMonAuditor::nhm_params
| private

Definition at line 381 of file PerfMonAuditor.cpp.

## ◆ num_counters

unsigned PerfMonAuditor::num_counters
| private

Definition at line 410 of file PerfMonAuditor.cpp.

## ◆ outp

pfmlib_output_param_t PerfMonAuditor::outp
| private

Definition at line 359 of file PerfMonAuditor.cpp.

## ◆ params

pfmlib_core_input_param_t PerfMonAuditor::params
| private

Definition at line 380 of file PerfMonAuditor.cpp.

## ◆ pc

pfarg_pmc_t PerfMonAuditor::pc[NUM_PMCS]
| private

Definition at line 362 of file PerfMonAuditor.cpp.

## ◆ pd

pfarg_pmd_t PerfMonAuditor::pd[NUM_PMDS]
| private

Definition at line 361 of file PerfMonAuditor.cpp.

## ◆ pfmlib_options

pfmlib_options_t PerfMonAuditor::pfmlib_options
| private

Definition at line 412 of file PerfMonAuditor.cpp.

## ◆ ph_ev_count

unsigned int PerfMonAuditor::ph_ev_count
| private

Definition at line 376 of file PerfMonAuditor.cpp.

## ◆ prefix

std::string PerfMonAuditor::prefix
| private

Definition at line 372 of file PerfMonAuditor.cpp.

## ◆ prefix_cstr

char PerfMonAuditor::prefix_cstr[MAX_PREFIX_NAME_LENGTH]
| private

Definition at line 375 of file PerfMonAuditor.cpp.

## ◆ ret

int PerfMonAuditor::ret
| private

Definition at line 366 of file PerfMonAuditor.cpp.

## ◆ sampling

bool PerfMonAuditor::sampling
| private

Definition at line 387 of file PerfMonAuditor.cpp.

## ◆ start_at_event

unsigned int PerfMonAuditor::start_at_event
| private

Definition at line 379 of file PerfMonAuditor.cpp.

## ◆ used_counters_number

int PerfMonAuditor::used_counters_number
| private

Definition at line 382 of file PerfMonAuditor.cpp.

## ◆ westmere

bool PerfMonAuditor::westmere
| private

Definition at line 384 of file PerfMonAuditor.cpp.

The documentation for this class was generated from the following file:

- GaudiProfiling/src/component/PerfMonAuditor.cpp