The Gaudi Framework  v39r1 (adb068b2)
PerfMonAuditor Class Reference
Inheritance diagram for PerfMonAuditor:
Collaboration diagram for PerfMonAuditor:

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 (std::string name, ISvcLocator *svcloc)
 Constructor. More...
 
 Auditor (const Auditor &a)=delete
 
Auditoroperator= (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
 
const std::stringname () const override
 
bool isEnabled () const override
 
SmartIF< ISvcLocator > & serviceLocator () const override
 The standard service locator. More...
 
template<class T >
StatusCode service (std::string_view 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 (std::string_view name, bool createIf=false) const
 
- Public Member Functions inherited from PropertyHolder< CommonMessaging< implements< IAuditor, IProperty > > >
 PropertyHolder ()=default
 
Gaudi::Details::PropertyBasedeclareProperty (Gaudi::Details::PropertyBase &prop)
 Declare a property. More...
 
Gaudi::Details::PropertyBasedeclareProperty (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::PropertyBasedeclareProperty (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::PropertyBasedeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="")
 Declare a remote property. More...
 
StatusCode setProperty (const std::string &name, const Gaudi::Details::PropertyBase &p) override
 set the property from another property with a different name More...
 
StatusCode setProperty (const std::string &s) override
 set the property from the formatted string More...
 
StatusCode setProperty (const Gaudi::Details::PropertyBase &p)
 Set the property from a property. More...
 
virtual StatusCode setProperty (const std::string &name, const Gaudi::Details::PropertyBase &p)=0
 Set the property from a property with a different name. More...
 
virtual StatusCode setProperty (const std::string &s)=0
 Set the property by string. More...
 
StatusCode setProperty (const std::string &name, const char *v)
 Special case for string literals. More...
 
StatusCode setProperty (const std::string &name, const std::string &v)
 Special case for std::string. More...
 
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value More...
 
StatusCode setPropertyRepr (const std::string &n, const std::string &r) override
 set the property from name and value string representation More...
 
StatusCode getProperty (Gaudi::Details::PropertyBase *p) const override
 get the property More...
 
const Gaudi::Details::PropertyBasegetProperty (std::string_view name) const override
 get the property by name More...
 
StatusCode getProperty (std::string_view 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 (std::string_view name) const override
 Return true if we have a property with the given name. More...
 
Gaudi::Details::PropertyBaseproperty (std::string_view name) const
 \fixme property and bindPropertiesTo should be protected More...
 
void bindPropertiesTo (Gaudi::Interfaces::IOptionsSvc &optsSvc)
 
 PropertyHolder (const PropertyHolder &)=delete
 
PropertyHolderoperator= (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...
 

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 &)
 
PerfMonAuditoroperator= (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 { 0 }
 
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 { 0 }
 
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 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 205 of file PerfMonAuditor.cpp.

Member Typedef Documentation

◆ Map

Definition at line 357 of file PerfMonAuditor.cpp.

Constructor & Destructor Documentation

◆ PerfMonAuditor() [1/3]

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

Definition at line 278 of file PerfMonAuditor.cpp.

279  : // standard constructor
280  Auditor( name, pSvc )
281  , m_pfm( PFMon::instance() )
282  , m_map()
283  , m_indent( 0 )
284  , m_inEvent( false ) {
286  declareProperty( "EVENT0", event_str[0] );
287  declareProperty( "EVENT1", event_str[1] );
288  declareProperty( "EVENT2", event_str[2] );
289  declareProperty( "EVENT3", event_str[3] );
290  declareProperty( "FAMILY", family );
291  declareProperty( "PREFIX", prefix );
292  declareProperty( "INV0", inv[0] );
293  declareProperty( "INV1", inv[1] );
294  declareProperty( "INV2", inv[2] );
295  declareProperty( "INV3", inv[3] );
296  declareProperty( "CMASK0", cmask[0] );
297  declareProperty( "CMASK1", cmask[1] );
298  declareProperty( "CMASK2", cmask[2] );
299  declareProperty( "CMASK3", cmask[3] );
300  declareProperty( "SP0", sp[0] );
301  declareProperty( "SP1", sp[1] );
302  declareProperty( "SP2", sp[2] );
303  declareProperty( "SP3", sp[3] );
304  declareProperty( "SAMPLE", sampling );
305  declareProperty( "START_AT_EVENT", start_at_event );
306  declareProperty( "IS_NEHALEM", is_nehalem_ret );
307 
309  /*
310  // loading functions from PFM library
311  void* handle = dlopen("libpfm.so", RTLD_NOW);
312  if (!handle) {
313  // error() << "Cannot open library: " << dlerror() << endmsg;
314  }
315  typedef void (*hello_t)();
316  hello_t hello = (hello_t) dlsym(handle, "hello");
317  if (!hello) {
318  // error() << "Cannot load symbol 'hello': " << dlerror() << endmsg;
319  dlclose(handle);
320  }
321 
322  pfm_start = (pfm_start_t) dlsym(handle, "pfm_start");
323  pfm_stop = (pfm_stop_t) dlsym(handle, "pfm_stop");
324  pfm_self_stop = (pfm_self_stop_t) dlsym(handle, "pfm_stop"); //it's the same
325  pfm_restart = (pfm_restart_t) dlsym(handle, "pfm_restart");
326  //pfm_read_pmds = (pfm_read_pmds_t) dlsym(handle, "pfm_read_pmds");
327  pfm_initialize = (pfm_initialize_t) dlsym(handle, "pfm_initialize");
328  pfm_find_full_event = (pfm_find_full_event_t) dlsym(handle, "pfm_find_full_event");
329  pfm_dispatch_events = (pfm_dispatch_events_t) dlsym(handle, "pfm_dispatch_events");
330  pfm_create_context = (pfm_create_context_t) dlsym(handle, "pfm_create_context");
331  pfm_write_pmcs = (pfm_write_pmcs_t) dlsym(handle, "pfm_write_pmcs");
332  pfm_write_pmds = (pfm_write_pmds_t) dlsym(handle, "pfm_write_pmds");
333  pfm_load_context = (pfm_load_context_t) dlsym(handle, "pfm_load_context");
334  pfm_strerror = (pfm_strerror_t) dlsym(handle, "pfm_strerror");
335  pfm_set_options = (pfm_set_options_t) dlsym(handle, "pfm_set_options");
336  pfm_get_num_counters = (pfm_get_num_counters_t) dlsym(handle, "pfm_get_num_counters");
337  // use it to do the calculation
338  // info() << "Calling hello..." << endmsg;
339  // hello();
340 
341  // close the library
342  // info() << "Closing library..." << endmsg;
343  dlclose(handle);
344  */
345 
347  }

◆ ~PerfMonAuditor()

virtual PerfMonAuditor::~PerfMonAuditor ( )
inlinevirtual

Definition at line 349 of file PerfMonAuditor.cpp.

349 {} // virtual destructor

◆ PerfMonAuditor() [2/3]

PerfMonAuditor::PerfMonAuditor ( )
private

◆ PerfMonAuditor() [3/3]

PerfMonAuditor::PerfMonAuditor ( const PerfMonAuditor )
private

Member Function Documentation

◆ after() [1/5]

void Auditor::after
override

Definition at line 77 of file Auditor.cpp.

139 {}

◆ after() [2/5]

void Auditor::after
override

Definition at line 76 of file Auditor.cpp.

138 {}

◆ after() [3/5]

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

Definition at line 896 of file PerfMonAuditor.cpp.

896  {
897  switch ( evt ) {
900  break;
901  case IAuditor::Execute:
902  i_afterExecute( alg );
903  break;
904  default:
905  break;
906  }
907  return;
908 }

◆ after() [4/5]

void Auditor::after
override

Definition at line 74 of file Auditor.cpp.

136 {}

◆ after() [5/5]

void Auditor::after
override

Definition at line 73 of file Auditor.cpp.

112  {
113  switch ( evt ) {
114  case Initialize:
115  afterInitialize( obj );
116  break;
117  case ReInitialize:
118  afterReinitialize( obj );
119  break;
120  case Execute:
121  afterExecute( obj, sc );
122  break;
123  case Finalize:
124  afterFinalize( obj );
125  break;
126  case Start:
127  break;
128  case Stop:
129  break;
130  case ReStart:
131  break;
132  default:
133  break; // do nothing
134  }
135 }

◆ before() [1/5]

void Auditor::before
override

Definition at line 71 of file Auditor.cpp.

109 {}

◆ before() [2/5]

void Auditor::before
override

Definition at line 70 of file Auditor.cpp.

108 {}

◆ before() [3/5]

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

Definition at line 882 of file PerfMonAuditor.cpp.

882  {
883  switch ( evt ) {
886  break;
887  case IAuditor::Execute:
888  i_beforeExecute( alg );
889  break;
890  default:
891  break;
892  }
893  return;
894 }

◆ before() [4/5]

void Auditor::before
override

Definition at line 68 of file Auditor.cpp.

106 {}

◆ before() [5/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.

82  {
83  switch ( evt ) {
84  case Initialize:
85  beforeInitialize( obj );
86  break;
87  case ReInitialize:
88  beforeReinitialize( obj );
89  break;
90  case Execute:
91  beforeExecute( obj );
92  break;
93  case Finalize:
94  beforeFinalize( obj );
95  break;
96  case Start:
97  break;
98  case Stop:
99  break;
100  case ReStart:
101  break;
102  default:
103  break; // do nothing
104  }
105 }

◆ detect_unavail_pmcs()

int PerfMonAuditor::detect_unavail_pmcs ( int  fd,
pfmlib_regmask_t r_pmcs 
)
inlineprivate

Definition at line 396 of file PerfMonAuditor.cpp.

396 { return detect_unavail_pmu_regs( fd, r_pmcs, NULL ); }

◆ 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 ( )
overridevirtual

Reimplemented from Auditor.

Definition at line 874 of file PerfMonAuditor.cpp.

874  {
875  if ( sampling == 0 )
876  finalizepm();
877  else
878  finalize_smpl();
879  return Auditor::finalize();
880 }

◆ finalize_smpl()

void PerfMonAuditor::finalize_smpl ( )
private

Definition at line 793 of file PerfMonAuditor.cpp.

793  {
794  int err;
795  for ( int i = 0; i < used_counters_number; i++ ) {
797  filename += '_';
798  filename += event_cstr[i];
799 
800  for ( auto& c : filename )
801  if ( c == ':' ) c = '-';
802 
803  if ( inv[i] ) filename += "_INV_1";
804  if ( cmask[i] > 0 ) filename += "_CMASK_" + std::to_string( cmask[i] );
805  filename += ".txt.gz";
806 
807  gzFile outfile = gzopen( filename.c_str(), "wb" );
808  if ( outfile != NULL ) {
809  if ( nehalem ) {
810  gzprintf( outfile, "NHM " );
811  } else if ( westmere ) {
812  gzprintf( outfile, "WSM " );
813  } else if ( core ) {
814  gzprintf( outfile, "CORE " );
815  }
816  if ( gzprintf( outfile, "%s %d %d %d\n", event_cstr[i], cmask[i], inv[i], sp[i] ) <
817  (int)strlen( event_cstr[i] ) ) {
818  error() << "ERROR: gzputs err: " << gzerror( outfile, &err ) << ". Aborting..." << endmsg;
819  }
820  for ( std::map<std::string, std::map<unsigned long, unsigned int>>::iterator it = samples[i].begin();
821  it != samples[i].end(); it++ ) {
822  unsigned long long sum = 0;
823  for ( std::map<unsigned long, unsigned int>::iterator jt = ( it->second ).begin(); jt != ( it->second ).end();
824  jt++ ) {
825  sum += jt->second;
826  }
827  if ( gzprintf( outfile, "%s%%%llu\n", ( it->first ).c_str(), sum ) < (int)( ( it->first ).length() ) ) {
828  error() << "ERROR: gzputs err: " << gzerror( outfile, &err ) << ". Aborting..." << endmsg;
829  }
830  for ( std::map<unsigned long, unsigned int>::iterator jt = ( it->second ).begin(); jt != ( it->second ).end();
831  jt++ ) {
832  char sym_name[SYM_NAME_MAX_LENGTH];
833  bzero( sym_name, SYM_NAME_MAX_LENGTH );
834  const char* libName;
835  const char* symbolName;
836  int libOffset = 0;
837  int offset = 0;
838  void* sym_addr = IgHookTrace::tosymbol( (void*)( jt->first ) );
839  if ( sym_addr != NULL ) {
840  bool success = IgHookTrace::symbol( sym_addr, symbolName, libName, offset, libOffset );
841  if ( success ) {
842  if ( symbolName != NULL && strlen( symbolName ) > 0 ) {
843  strcpy( sym_name, symbolName );
844  strcat( sym_name, " " );
845  } else {
846  strcpy( sym_name, "??? " );
847  }
848  if ( libName != NULL && strlen( libName ) > 0 ) {
849  strcat( sym_name, libName );
850  strcat( sym_name, " " );
851  } else {
852  strcat( sym_name, "??? " );
853  }
854  sprintf( sym_name + strlen( sym_name ), "%d ", libOffset );
855  if ( strlen( sym_name ) <= 0 ) { error() << "ERROR: Symbol name length is zero. Aborting..." << endmsg; }
856  } else {
857  strcpy( sym_name, "??? ??? 0 " );
858  }
859  } else {
860  strcpy( sym_name, "??? ??? 0 " );
861  }
862  if ( gzprintf( outfile, "%s %d\n", sym_name, jt->second ) < (int)strlen( sym_name ) ) {
863  error() << "ERROR: gzputs err: " << gzerror( outfile, &err ) << endmsg;
864  }
865  }
866  }
867  } else {
868  error() << "ERROR: Could not open file: " << filename << ". Aborting..." << endmsg;
869  }
870  gzclose( outfile );
871  }
872 }

◆ finalizepm()

void PerfMonAuditor::finalizepm ( )
private

Definition at line 513 of file PerfMonAuditor.cpp.

513  {
514  info() << "start of finalizepm ucn:" << used_counters_number << endmsg;
515  for ( int i = 0; i < used_counters_number; i++ ) {
517  filename += '_';
518  filename += event_cstr[i];
519 
520  for ( auto& c : filename )
521  if ( c == ':' ) c = '-';
522 
523  if ( inv[i] ) filename += "_INV_1";
524  if ( cmask[i] > 0 ) filename += "_CMASK_" + std::to_string( cmask[i] );
525  filename += ".txt";
526 
527  info() << "Filename:" << filename << endmsg;
528  FILE* outfile = fopen( filename.c_str(), "w" );
529  if ( nehalem ) {
530  fprintf( outfile, "NHM " );
531  } else if ( westmere ) {
532  fprintf( outfile, "WSM " );
533  } else if ( core ) {
534  fprintf( outfile, "CORE " );
535  }
536  fprintf( outfile, "%s %u %d %d\n", event_cstr[i], cmask[i], inv[i], sp[i] );
537  for ( std::map<std::string, std::vector<unsigned long int>>::iterator it = ( results[i] ).begin();
538  it != ( results[i] ).end(); it++ ) {
539  fprintf( outfile, "%s\n", ( it->first ).c_str() );
540  for ( std::vector<unsigned long int>::iterator j = ( it->second ).begin(); j != ( it->second ).end(); j++ ) {
541  fprintf( outfile, "%lu\n", *j );
542  }
543  }
544  fclose( outfile );
545  }
546 }

◆ i_afterExecute()

void PerfMonAuditor::i_afterExecute ( INamedInterface alg)
private

Definition at line 951 of file PerfMonAuditor.cpp.

951  {
952  if ( !alg ) { return; } // info() << "after:inside! " << alg->name() << endmsg;
953 
954  if ( event_count_reached ) {
955  // info() << "after:inside! " << alg->name() << endmsg;
956 
957  if ( sampling == 0 )
958  stoppm();
959  else
960  stop_smpl();
961  alg_stack.pop();
962  --m_indent;
963  if ( !alg_stack.empty() ) {
964  if ( sampling == 0 )
965  startpm();
966  else
967  start_smpl(); // resuming father algorithm counting
968  }
969  }
970 }

◆ i_afterInitialize()

void PerfMonAuditor::i_afterInitialize ( INamedInterface alg)
private

Definition at line 912 of file PerfMonAuditor.cpp.

912 {}

◆ i_beforeExecute()

void PerfMonAuditor::i_beforeExecute ( INamedInterface alg)
private

Definition at line 914 of file PerfMonAuditor.cpp.

914  {
915  if ( !alg ) return;
916  // info() << "before:inside! " << alg->name() << endmsg;
917  if ( first_alg ) {
918  first_alg = false;
919  first_alg_name = alg->name();
920  // info() << "first_alg_name= " << alg->name() << endmsg;
921  }
922  if ( !event_count_reached ) {
923  if ( !first_alg_name.compare( alg->name() ) ) {
924  ph_ev_count++;
925  // info() << "EVENT COUNT: " << ph_ev_count << endmsg;
926  if ( ph_ev_count == start_at_event ) {
927  event_count_reached = true;
928  // info() << "!!! EVENT COUNT REACHED: " << ph_ev_count << endmsg;
929  }
930  }
931  }
932  if ( event_count_reached ) {
933  // info() << "before:inside! " << alg->name() << endmsg;
934 
935  if ( !alg_stack.empty() ) {
936  if ( sampling == 0 )
937  pausepm(); // pausing father algorithm counting
938  else
939  stop_smpl();
940  }
941  ++m_indent;
942  std::vector<unsigned long int> zeroes( 4, 0 );
943  alg_stack.push( std::make_pair( alg, zeroes ) );
944  if ( sampling == 0 )
945  startpm();
946  else
947  start_smpl();
948  }
949 }

◆ i_beforeInitialize()

void PerfMonAuditor::i_beforeInitialize ( INamedInterface alg)
private

Definition at line 910 of file PerfMonAuditor.cpp.

910 {}

◆ initialize()

StatusCode PerfMonAuditor::initialize ( )
overridevirtual

Reimplemented from Auditor.

Definition at line 548 of file PerfMonAuditor.cpp.

548  {
549  if ( !m_pfm.loaded ) {
550  error() << "pfm library could not be loaded" << endmsg;
551  return StatusCode::FAILURE;
552  }
553 
554  info() << "Initializing..." << endmsg;
556  if ( sc.isFailure() ) { return sc; }
558  for ( int i = 0; i < MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS; i++ ) {
559  if ( event_str[i].length() > 0 ) used_counters_number++;
560  }
561  for ( int i = 0; i < MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS; i++ ) { strcpy( event_cstr[i], event_str[i].c_str() ); }
563 
564  if ( m_pfm.pfm_initialize() != PFMLIB_SUCCESS ) { error() << "Cannot initialize perfmon!!" << endmsg; }
565  ph_ev_count = 0;
566  first_alg = true;
567  event_count_reached = false;
568  nehalem = false;
569  core = false;
570  westmere = false;
571  if ( family.compare( "CORE" ) == 0 )
572  core = true;
573  else if ( family.compare( "NEHALEM" ) == 0 )
574  nehalem = true;
575  else if ( family.compare( "WESTMERE" ) == 0 )
576  westmere = true;
577  else { error() << "ERROR: Unsupported processor family " << family << ". aborting..." << endmsg; }
578 
579  info() << "Initialized!" << endmsg;
580  return StatusCode::SUCCESS;
581 }

◆ is_nehalem()

int PerfMonAuditor::is_nehalem ( )
inline

Definition at line 221 of file PerfMonAuditor.cpp.

221  {
222 #ifdef __ICC
223 // Disable ICC remark #593: variable "x" was set but never used
224 # pragma warning( push )
225 # pragma warning( disable : 593 )
226 #endif
227  int a, b, c, d;
228  cpuid( 1, a, b, c, d );
229  int sse4_2_mask = 1 << 20;
230  if ( c & sse4_2_mask )
231  return 1;
232  else
233  return 0;
234 #ifdef __ICC
235 # pragma warning( pop )
236 #endif
237  }

◆ operator=()

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

◆ pausepm()

void PerfMonAuditor::pausepm ( )
private

Definition at line 501 of file PerfMonAuditor.cpp.

501  {
502  m_pfm.pfm_stop( fd );
503  if ( m_pfm.pfm_read_pmds( fd, pd, inp.pfp_event_count ) == -1 ) { error() << "Could not read pmds" << endmsg; }
504 
505  for ( int i = 0; i < used_counters_number; i++ ) { alg_stack.top().second[i] += pd[i].reg_value; }
506 
507  close( fd );
508 }

◆ pfm_bv_copy()

void PerfMonAuditor::pfm_bv_copy ( uint64_t *  d,
uint64_t *  j,
uint16_t  n 
)
inlineprivate

Definition at line 401 of file PerfMonAuditor.cpp.

401  {
402  if ( n <= BPL )
403  *d = *j;
404  else { memcpy( d, j, ( n >> LBPL ) * sizeof( uint64_t ) ); }
405  }

◆ pfm_bv_isset()

int PerfMonAuditor::pfm_bv_isset ( uint64_t *  bv,
uint16_t  rnum 
)
inlineprivate

Definition at line 398 of file PerfMonAuditor.cpp.

398  {
399  return bv[rnum >> LBPL] & ( 1UL << ( rnum & ( BPL - 1 ) ) ) ? 1 : 0;
400  }

◆ pfm_bv_set()

void PerfMonAuditor::pfm_bv_set ( uint64_t *  bv,
uint16_t  rnum 
)
inlineprivate

Definition at line 397 of file PerfMonAuditor.cpp.

397 { bv[rnum >> LBPL] |= 1UL << ( rnum & ( BPL - 1 ) ); }

◆ process_smpl_buf()

void PerfMonAuditor::process_smpl_buf ( pfm_dfl_smpl_hdr_t hdr,
size_t  entry_size 
)
staticprivate

Definition at line 587 of file PerfMonAuditor.cpp.

587  {
590  size_t pos, count;
591  uint64_t entry;
592  if ( hdr->hdr_overflows == last_overflow && hdr->hdr_count == last_count ) {
593  printf( "skipping identical set of samples...\n" );
594  return;
595  }
596  count = hdr->hdr_count;
597  ent = (pfm_dfl_smpl_entry_t*)( hdr + 1 );
598  pos = (unsigned long)ent;
599  entry = collected_samples;
600  while ( count-- ) {
601  // if(ent->ovfl_pmd>=0 && ent->ovfl_pmd<=3)
602  if ( ent->ovfl_pmd <= 3 ) {
603  ( ( samples[ent->ovfl_pmd] )[( alg_stack.top().first )->name()] )[(unsigned long)( ent->ip )]++;
604  }
605  pos += entry_size;
606  ent = (pfm_dfl_smpl_entry_t*)pos;
607  entry++;
608  }
609  collected_samples = entry;
610  last_overflow = hdr->hdr_overflows;
611  if ( last_count != hdr->hdr_count && ( last_count || last_overflow == 0 ) ) { collected_partial += hdr->hdr_count; }
612  last_count = hdr->hdr_count;
613  return;
614 }

◆ sigio_handler()

void PerfMonAuditor::sigio_handler ( int  ,
siginfo_t *  ,
void *   
)
staticprivate

Definition at line 620 of file PerfMonAuditor.cpp.

620  {
621  PFMon& pfm = PFMon::instance();
623  int fd = ctx_fd;
624  int r;
625  if ( fd != ctx_fd ) {
626  // error() << "ERROR: handler does not get valid file descriptor. Aborting..." << endmsg;
627  }
628  if ( pfm.pfm_read_pmds( fd, pd_smpl + 1, 1 ) == -1 ) {
629  // error() << "ERROR: pfm_read_pmds: " << strerror(errno) << ". Aborting..." << endmsg;
630  }
631  while ( true ) {
632  r = read( fd, &msg, sizeof( msg ) );
633  if ( r != sizeof( msg ) ) {
634  if ( r == -1 && errno == EINTR ) {
635  printf( "read interrupted, retrying\n" );
636  continue;
637  }
638  // error() << "ERROR: cannot read overflow message: " << strerror(errno) << ". Aborting..." << endmsg;
639  }
640  break;
641  }
642  switch ( msg.type ) {
643  case PFM_MSG_OVFL: // the sampling buffer is full
644  process_smpl_buf( hdr, entry_size );
645  ovfl_count++;
646  if ( pfm.pfm_restart( fd ) ) {
647  if ( errno != EBUSY ) {
648  // error() << "ERROR: pfm_restart error errno " << errno << ". Aborting..." << endmsg;
649  } else {
650  printf( "pfm_restart: task probably terminated \n" );
651  }
652  }
653  break;
654  default:
655  // error() << "ERROR: unknown message type " << msg.type << ". Aborting..." << endmsg;
656  break;
657  }
658 }

◆ start_smpl()

void PerfMonAuditor::start_smpl ( )
private

Definition at line 664 of file PerfMonAuditor.cpp.

664  {
665  ovfl_count = 0;
666  num_smpl_pmds = 0;
667  last_overflow = ~0;
668  max_pmd = 0;
669  memset( &pfmlib_options, 0, sizeof( pfmlib_options ) );
672  m_pfm.pfm_set_options( &pfmlib_options );
673  ret = m_pfm.pfm_initialize();
674  if ( ret != PFMLIB_SUCCESS ) {
675  error() << "ERROR: Cannot initialize library: " << m_pfm.pfm_strerror( ret ) << ". Aborting..." << endmsg;
676  }
677  struct sigaction act;
678  memset( &act, 0, sizeof( act ) );
679  act.sa_sigaction = sigio_handler; // dlopen() ==>
680  // act.sa_handler = (sig_t)&sigio_handler;
681  sigaction( SIGIO, &act, 0 );
682  memset( &ctx, 0, sizeof( ctx ) );
683  memset( &buf_arg, 0, sizeof( buf_arg ) );
684  memset( &inp, 0, sizeof( inp ) );
685  memset( &outp, 0, sizeof( outp ) );
686  memset( pd_smpl, 0, sizeof( pd_smpl ) );
687  memset( pc, 0, sizeof( pc ) );
688  memset( &load_args, 0, sizeof( load_args ) );
689  m_pfm.pfm_get_num_counters( &num_counters );
690  memset( &params, 0, sizeof( params ) );
691  memset( &nhm_params, 0, sizeof( nhm_params ) );
692 
693  for ( int i = 0; i < used_counters_number; i++ ) {
694  ret = m_pfm.pfm_find_full_event( event_cstr[i], &inp.pfp_events[i] );
695  if ( ret != PFMLIB_SUCCESS ) {
696  error() << "ERROR: cannot find event: " << event_cstr[i] << ". Aborting..." << endmsg;
697  }
698  }
700  inp.pfp_event_count = 4;
701  for ( int i = 0; i < used_counters_number; i++ ) {
702  if ( inv[i] ) {
705  }
706  if ( cmask[i] > 0 ) {
707  ( params.pfp_core_counters[i] ).cnt_mask = cmask[i];
708  ( nhm_params.pfp_nhm_counters[i] ).cnt_mask = cmask[i];
709  }
710  }
711  if ( nehalem || westmere ) {
712  ret = m_pfm.pfm_dispatch_events( &inp, &nhm_params, &outp, NULL );
713  } else {
714  ret = m_pfm.pfm_dispatch_events( &inp, &params, &outp, NULL );
715  }
716  if ( ret != PFMLIB_SUCCESS ) {
717  error() << "ERROR: cannot configure events: " << m_pfm.pfm_strerror( ret ) << ". Aborting..." << endmsg;
718  }
719  for ( unsigned int i = 0; i < outp.pfp_pmc_count; i++ ) {
722  }
723  for ( unsigned int i = 0; i < outp.pfp_pmd_count; i++ ) {
724  pd_smpl[i].reg_num = outp.pfp_pmds[i].reg_num;
725  if ( i ) {
726  pfm_bv_set( pd_smpl[0].reg_smpl_pmds, pd_smpl[i].reg_num );
727  if ( pd_smpl[i].reg_num > max_pmd ) { max_pmd = pd_smpl[i].reg_num; }
728  num_smpl_pmds++;
729  }
730  }
731  for ( int i = 0; i < used_counters_number; i++ ) {
733  pfm_bv_copy( pd_smpl[i].reg_reset_pmds, pd_smpl[i].reg_smpl_pmds, max_pmd );
734  pd_smpl[i].reg_value = (uint64_t)( sp[i] * -1 );
735  pd_smpl[i].reg_short_reset = (uint64_t)( sp[i] * -1 );
736  pd_smpl[i].reg_long_reset = (uint64_t)( sp[i] * -1 );
737  pd_smpl[i].reg_random_seed = 5; // tocheck
738  pd_smpl[i].reg_random_mask = 0xff; // tocheck
739  }
740  entry_size = sizeof( pfm_dfl_smpl_entry_t ) + ( num_smpl_pmds << 3 );
741  ctx.ctx_flags = 0;
742  buf_arg.buf_size = 3 * getpagesize() + 512;
743  ctx_fd = m_pfm.pfm_create_context( &ctx, (char*)FMT_NAME, &buf_arg, sizeof( buf_arg ) );
744  if ( ctx_fd == -1 ) {
745  if ( errno == ENOSYS ) {
746  error() << "ERROR: Your kernel does not have performance monitoring support! Aborting..." << endmsg;
747  }
748  error() << "ERROR: Can't create PFM context " << strerror( errno ) << ". Aborting..." << endmsg;
749  }
750  buf_addr = mmap( NULL, buf_arg.buf_size, PROT_READ, MAP_PRIVATE, ctx_fd, 0 );
751  if ( buf_addr == MAP_FAILED ) {
752  error() << "ERROR: cannot mmap sampling buffer: " << strerror( errno ) << ". Aborting..." << endmsg;
753  }
755  if ( PFM_VERSION_MAJOR( hdr->hdr_version ) < 1 ) {
756  error() << "ERROR: invalid buffer format version. Aborting..." << endmsg;
757  }
758  if ( m_pfm.pfm_write_pmcs( ctx_fd, pc, outp.pfp_pmc_count ) ) {
759  error() << "ERROR: pfm_write_pmcs error errno " << strerror( errno ) << ". Aborting..." << endmsg;
760  }
761  if ( m_pfm.pfm_write_pmds( ctx_fd, pd_smpl, outp.pfp_pmd_count ) ) {
762  error() << "ERROR: pfm_write_pmds error errno " << strerror( errno ) << ". Aborting..." << endmsg;
763  }
764  load_args.load_pid = getpid();
765  if ( m_pfm.pfm_load_context( ctx_fd, &load_args ) ) {
766  error() << "ERROR: pfm_load_context error errno " << strerror( errno ) << ". Aborting..." << endmsg;
767  }
768  ret = fcntl( ctx_fd, F_SETFL, fcntl( ctx_fd, F_GETFL, 0 ) | O_ASYNC );
769  if ( ret == -1 ) { error() << "ERROR: cannot set ASYNC: " << strerror( errno ) << ". Aborting..." << endmsg; }
770  ret = fcntl( ctx_fd, F_SETOWN, getpid() );
771  if ( ret == -1 ) { error() << "ERROR: cannot setown: " << strerror( errno ) << ". Aborting..." << endmsg; }
772  // pfm_self_start(ctx_fd); ==>
773  m_pfm.pfm_start( ctx_fd, NULL );
774 }

◆ startpm()

void PerfMonAuditor::startpm ( )
private

Definition at line 426 of file PerfMonAuditor.cpp.

426  {
427  memset( &ctx, 0, sizeof( ctx ) );
428  memset( &inp, 0, sizeof( inp ) );
429  memset( &outp, 0, sizeof( outp ) );
430  memset( pd, 0, sizeof( pd ) );
431  memset( pc, 0, sizeof( pc ) );
432  memset( &load_arg, 0, sizeof( load_arg ) );
433  memset( &params, 0, sizeof( params ) );
434  memset( &nhm_params, 0, sizeof( nhm_params ) );
435 
436  for ( int i = 0; i < used_counters_number; i++ ) {
437  ret = m_pfm.pfm_find_full_event( event_cstr[i], &inp.pfp_events[i] );
438  if ( ret != PFMLIB_SUCCESS ) {
439  error() << "ERROR: cannot find event: " << event_cstr[i] << ". Aborting..." << endmsg;
440  }
441  }
443  inp.pfp_event_count = 4;
444  for ( int i = 0; i < used_counters_number; i++ ) {
445  if ( inv[i] ) {
448  }
449  if ( cmask[i] > 0 ) {
450  ( params.pfp_core_counters[i] ).cnt_mask = cmask[i];
451  ( nhm_params.pfp_nhm_counters[i] ).cnt_mask = cmask[i];
452  }
453  }
454  if ( nehalem || westmere ) {
455  ret = m_pfm.pfm_dispatch_events( &inp, &nhm_params, &outp, NULL );
456  } else {
457  ret = m_pfm.pfm_dispatch_events( &inp, &params, &outp, NULL );
458  }
459  if ( ret != PFMLIB_SUCCESS ) {
460  error() << "ERROR: cannot dispatch events: " << m_pfm.pfm_strerror( ret ) << ". Aborting..." << endmsg;
461  }
462  for ( unsigned int i = 0; i < outp.pfp_pmc_count; i++ ) {
465  }
466  for ( unsigned int i = 0; i < outp.pfp_pmd_count; i++ ) {
468  pd[i].reg_value = 0;
469  }
470  fd = m_pfm.pfm_create_context( &ctx, NULL, 0, 0 );
471  if ( fd == -1 ) { error() << "ERROR: Context not created. Aborting..." << endmsg; }
472  if ( m_pfm.pfm_write_pmcs( fd, pc, outp.pfp_pmc_count ) == -1 ) {
473  error() << "ERROR: Could not write pmcs. Aborting..." << endmsg;
474  }
475  if ( m_pfm.pfm_write_pmds( fd, pd, outp.pfp_pmd_count ) == -1 ) {
476  error() << "ERROR: Could not write pmds. Aborting..." << endmsg;
477  }
478  load_arg.load_pid = getpid();
479  if ( m_pfm.pfm_load_context( fd, &load_arg ) == -1 ) {
480  error() << "ERROR: Could not load context. Aborting..." << endmsg;
481  // error() << "Could not read pmds" << endmsg;
482  }
483 
484  m_pfm.pfm_start( fd, NULL );
485 }

◆ stop_smpl()

void PerfMonAuditor::stop_smpl ( )
private

Definition at line 780 of file PerfMonAuditor.cpp.

780  {
781  m_pfm.pfm_self_stop( ctx_fd );
782  process_smpl_buf( hdr, entry_size );
783  close( ctx_fd );
784  ret = munmap( hdr, buf_arg.buf_size );
785  if ( ret ) { error() << "Cannot unmap buffer: %s" << strerror( errno ) << endmsg; }
786  return;
787 }

◆ stoppm()

void PerfMonAuditor::stoppm ( )
private

Definition at line 491 of file PerfMonAuditor.cpp.

491  {
492  m_pfm.pfm_stop( fd );
493  if ( m_pfm.pfm_read_pmds( fd, pd, inp.pfp_event_count ) == -1 ) { error() << "Could not read pmds" << endmsg; }
494  for ( int i = 0; i < used_counters_number; i++ ) {
495  results[i][( alg_stack.top().first )->name()].push_back( alg_stack.top().second[i] + pd[i].reg_value );
496  }
497 
498  close( fd );
499 }

Member Data Documentation

◆ buf_addr

void* PerfMonAuditor::buf_addr
private

Definition at line 414 of file PerfMonAuditor.cpp.

◆ buf_arg

pfm_dfl_smpl_arg_t PerfMonAuditor::buf_arg
private

Definition at line 412 of file PerfMonAuditor.cpp.

◆ cmask

unsigned int PerfMonAuditor::cmask[MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS]
private

Definition at line 385 of file PerfMonAuditor.cpp.

◆ core

bool PerfMonAuditor::core
private

Definition at line 392 of file PerfMonAuditor.cpp.

◆ ctx

pfarg_ctx_t PerfMonAuditor::ctx
private

Definition at line 367 of file PerfMonAuditor.cpp.

◆ event_count_reached

bool PerfMonAuditor::event_count_reached
private

Definition at line 423 of file PerfMonAuditor.cpp.

◆ event_cstr

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

Definition at line 381 of file PerfMonAuditor.cpp.

◆ event_str

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

Definition at line 378 of file PerfMonAuditor.cpp.

◆ family

std::string PerfMonAuditor::family
private

Definition at line 380 of file PerfMonAuditor.cpp.

◆ fd

int PerfMonAuditor::fd
private

Definition at line 371 of file PerfMonAuditor.cpp.

◆ first_alg

bool PerfMonAuditor::first_alg
private

Definition at line 421 of file PerfMonAuditor.cpp.

◆ first_alg_name

std::string PerfMonAuditor::first_alg_name
private

Definition at line 422 of file PerfMonAuditor.cpp.

◆ i

unsigned int PerfMonAuditor::i
private

Definition at line 372 of file PerfMonAuditor.cpp.

◆ inp

pfmlib_input_param_t PerfMonAuditor::inp
private

Definition at line 365 of file PerfMonAuditor.cpp.

◆ inv

bool PerfMonAuditor::inv[MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS]
private

Definition at line 384 of file PerfMonAuditor.cpp.

◆ is_nehalem_ret

int PerfMonAuditor::is_nehalem_ret
private

Definition at line 363 of file PerfMonAuditor.cpp.

◆ level

int PerfMonAuditor::level
private

Definition at line 419 of file PerfMonAuditor.cpp.

◆ load_arg

pfarg_load_t PerfMonAuditor::load_arg
private

Definition at line 370 of file PerfMonAuditor.cpp.

◆ load_args

pfarg_load_t PerfMonAuditor::load_args
private

Definition at line 413 of file PerfMonAuditor.cpp.

◆ m_indent

int PerfMonAuditor::m_indent
private

Definition at line 359 of file PerfMonAuditor.cpp.

◆ m_inEvent

bool PerfMonAuditor::m_inEvent
private

Definition at line 360 of file PerfMonAuditor.cpp.

◆ m_map

Map PerfMonAuditor::m_map
private

Definition at line 358 of file PerfMonAuditor.cpp.

◆ m_pfm

PFMon& PerfMonAuditor::m_pfm
private

Definition at line 240 of file PerfMonAuditor.cpp.

◆ max_pmd

unsigned int PerfMonAuditor::max_pmd
private

Definition at line 416 of file PerfMonAuditor.cpp.

◆ nehalem

bool PerfMonAuditor::nehalem
private

Definition at line 390 of file PerfMonAuditor.cpp.

◆ nhm_params

pfmlib_nhm_input_param_t PerfMonAuditor::nhm_params
private

Definition at line 388 of file PerfMonAuditor.cpp.

◆ num_counters

unsigned PerfMonAuditor::num_counters
private

Definition at line 415 of file PerfMonAuditor.cpp.

◆ outp

pfmlib_output_param_t PerfMonAuditor::outp
private

Definition at line 366 of file PerfMonAuditor.cpp.

◆ params

pfmlib_core_input_param_t PerfMonAuditor::params
private

Definition at line 387 of file PerfMonAuditor.cpp.

◆ pc

pfarg_pmc_t PerfMonAuditor::pc[NUM_PMCS]
private

Definition at line 369 of file PerfMonAuditor.cpp.

◆ pd

pfarg_pmd_t PerfMonAuditor::pd[NUM_PMDS]
private

Definition at line 368 of file PerfMonAuditor.cpp.

◆ pfmlib_options

pfmlib_options_t PerfMonAuditor::pfmlib_options
private

Definition at line 417 of file PerfMonAuditor.cpp.

◆ ph_ev_count

unsigned int PerfMonAuditor::ph_ev_count { 0 }
private

Definition at line 383 of file PerfMonAuditor.cpp.

◆ prefix

std::string PerfMonAuditor::prefix
private

Definition at line 379 of file PerfMonAuditor.cpp.

◆ prefix_cstr

char PerfMonAuditor::prefix_cstr[MAX_PREFIX_NAME_LENGTH]
private

Definition at line 382 of file PerfMonAuditor.cpp.

◆ ret

int PerfMonAuditor::ret { 0 }
private

Definition at line 373 of file PerfMonAuditor.cpp.

◆ sampling

bool PerfMonAuditor::sampling
private

Definition at line 394 of file PerfMonAuditor.cpp.

◆ start_at_event

unsigned int PerfMonAuditor::start_at_event
private

Definition at line 386 of file PerfMonAuditor.cpp.

◆ used_counters_number

int PerfMonAuditor::used_counters_number
private

Definition at line 389 of file PerfMonAuditor.cpp.

◆ westmere

bool PerfMonAuditor::westmere
private

Definition at line 391 of file PerfMonAuditor.cpp.


The documentation for this class was generated from the following file:
std::strcpy
T strcpy(T... args)
IOTest.evt
evt
Definition: IOTest.py:107
PerfMonAuditor::params
pfmlib_core_input_param_t params
Definition: PerfMonAuditor.cpp:387
pfm_dfl_smpl_hdr_t::hdr_version
uint32_t hdr_version
Definition: perfmon_dfl_smpl.h:51
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
Auditor::beforeInitialize
void beforeInitialize(INamedInterface *) override
Definition: Auditor.cpp:141
PerfMonAuditor::i_beforeInitialize
void i_beforeInitialize(INamedInterface *alg)
Definition: PerfMonAuditor.cpp:910
pfm_dfl_smpl_arg_t::buf_size
uint64_t buf_size
Definition: perfmon_dfl_smpl.h:35
PerfMonAuditor::inv
bool inv[MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS]
Definition: PerfMonAuditor.cpp:384
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::is_nehalem
int is_nehalem()
Definition: PerfMonAuditor.cpp:221
std::strlen
T strlen(T... args)
pfmlib_options_t::pfm_verbose
unsigned int pfm_verbose
Definition: pfmlib.h:138
std::string
STL class.
pfmlib_output_param_t::pfp_pmd_count
unsigned int pfp_pmd_count
Definition: pfmlib.h:127
pfmlib_input_param_t::pfp_events
pfmlib_event_t pfp_events[PFMLIB_MAX_PMCS]
Definition: pfmlib.h:112
IAuditor::Execute
@ Execute
Definition: IAuditor.h:34
PerfMonAuditor::i_afterExecute
void i_afterExecute(INamedInterface *alg)
Definition: PerfMonAuditor.cpp:951
pfarg_pmd_t::reg_short_reset
uint64_t reg_short_reset
Definition: perfmon_v2.h:44
pfarg_pmc_t::reg_num
uint16_t reg_num
Definition: perfmon_v2.h:28
pfm_dfl_smpl_hdr_t::hdr_overflows
uint64_t hdr_overflows
Definition: perfmon_dfl_smpl.h:48
PerfMonAuditor::inp
pfmlib_input_param_t inp
Definition: PerfMonAuditor.cpp:365
PerfMonAuditor::family
std::string family
Definition: PerfMonAuditor.cpp:380
PerfMonAuditor::core
bool core
Definition: PerfMonAuditor.cpp:392
PerfMonAuditor::load_args
pfarg_load_t load_args
Definition: PerfMonAuditor.cpp:413
pfarg_pmd_t::reg_flags
uint32_t reg_flags
Definition: perfmon_v2.h:41
pfmlib_options_t::pfm_debug
unsigned int pfm_debug
Definition: pfmlib.h:137
std::vector
STL class.
std::strcat
T strcat(T... args)
PerfMonAuditor::stop_smpl
void stop_smpl()
Definition: PerfMonAuditor.cpp:780
ctest_measurements_reporter.results
results
Definition: ctest_measurements_reporter.py:25
GaudiMP.FdsRegistry.msg
msg
Definition: FdsRegistry.py:19
pfarg_pmd_t::reg_value
uint64_t reg_value
Definition: perfmon_v2.h:42
pfarg_pmc_t::reg_value
uint64_t reg_value
Definition: perfmon_v2.h:31
Auditor::beforeReinitialize
void beforeReinitialize(INamedInterface *) override
Definition: Auditor.cpp:143
gaudirun.c
c
Definition: gaudirun.py:525
PerfMonAuditor::pfmlib_options
pfmlib_options_t pfmlib_options
Definition: PerfMonAuditor.cpp:417
Auditor::afterExecute
void afterExecute(INamedInterface *, const StatusCode &) override
Definition: Auditor.cpp:146
PerfMonAuditor::pausepm
void pausepm()
Definition: PerfMonAuditor.cpp:501
SYM_NAME_MAX_LENGTH
#define SYM_NAME_MAX_LENGTH
Definition: PerfMonAuditor.cpp:75
std::strerror
T strerror(T... args)
pfmlib_reg_t::reg_value
unsigned long long reg_value
Definition: pfmlib.h:97
PerfMonAuditor::finalize_smpl
void finalize_smpl()
Definition: PerfMonAuditor.cpp:793
pfm_dfl_smpl_entry_t
Definition: perfmon_dfl_smpl.h:67
PFM_PLM3
#define PFM_PLM3
Definition: pfmlib.h:53
Auditor::finalize
virtual StatusCode finalize()
Definition: Auditor.cpp:190
PerfMonAuditor::pfm_bv_copy
void pfm_bv_copy(uint64_t *d, uint64_t *j, uint16_t n)
Definition: PerfMonAuditor.cpp:401
PerfMonAuditor::outp
pfmlib_output_param_t outp
Definition: PerfMonAuditor.cpp:366
PFM_VERSION_MAJOR
#define PFM_VERSION_MAJOR(x)
Definition: perfmon.h:213
Auditor::initialize
virtual StatusCode initialize()
Definition: Auditor.cpp:79
ManySmallAlgs.alg
alg
Definition: ManySmallAlgs.py:81
Auditor::name
const std::string & name() const override
Definition: Auditor.cpp:192
PerfMonAuditor::first_alg_name
std::string first_alg_name
Definition: PerfMonAuditor.cpp:422
Auditor::beforeFinalize
void beforeFinalize(INamedInterface *) override
Definition: Auditor.cpp:147
PerfMonAuditor::nhm_params
pfmlib_nhm_input_param_t nhm_params
Definition: PerfMonAuditor.cpp:388
pfarg_pmd_t::reg_num
uint16_t reg_num
Definition: perfmon_v2.h:39
Gaudi::Utils::begin
AttribStringParser::Iterator begin(const AttribStringParser &parser)
Definition: AttribStringParser.h:136
StatusCode
Definition: StatusCode.h:65
Auditor::afterReinitialize
void afterReinitialize(INamedInterface *) override
Definition: Auditor.cpp:144
std::sprintf
T sprintf(T... args)
std::fclose
T fclose(T... args)
PerfMonAuditor::pfm_bv_set
void pfm_bv_set(uint64_t *bv, uint16_t rnum)
Definition: PerfMonAuditor.cpp:397
ProduceConsume.j
j
Definition: ProduceConsume.py:104
PerfMonAuditor::startpm
void startpm()
Definition: PerfMonAuditor.cpp:426
IgHookTrace::symbol
static bool symbol(void *address, const char *&sym, const char *&lib, int &offset, int &liboffset)
Definition: IgHook_IgHookTrace.cpp:222
IAuditor::Initialize
@ Initialize
Definition: IAuditor.h:34
Auditor::afterFinalize
void afterFinalize(INamedInterface *) override
Definition: Auditor.cpp:148
std::string::c_str
T c_str(T... args)
PFM_CORE_SEL_INV
#define PFM_CORE_SEL_INV
Definition: pfmlib_core.h:68
pfmlib_reg_t::reg_num
unsigned int reg_num
Definition: pfmlib.h:99
PerfMonAuditor::finalizepm
void finalizepm()
Definition: PerfMonAuditor.cpp:513
pfmlib_output_param_t::pfp_pmcs
pfmlib_reg_t pfp_pmcs[PFMLIB_MAX_PMCS]
Definition: pfmlib.h:128
std::string::compare
T compare(T... args)
PerfMonAuditor::ctx
pfarg_ctx_t ctx
Definition: PerfMonAuditor.cpp:367
std::to_string
T to_string(T... args)
PerfMonAuditor::detect_unavail_pmu_regs
int detect_unavail_pmu_regs(int fd, pfmlib_regmask_t *r_pmcs, pfmlib_regmask_t *r_pmds)
LBPL
#define LBPL
Definition: PerfMonAuditor.cpp:73
std::fopen
T fopen(T... args)
IgHookTrace::tosymbol
static void * tosymbol(void *address)
Definition: IgHook_IgHookTrace.cpp:247
PerfMonAuditor::is_nehalem_ret
int is_nehalem_ret
Definition: PerfMonAuditor.cpp:363
Auditor::afterInitialize
void afterInitialize(INamedInterface *) override
Definition: Auditor.cpp:142
PerfMonAuditor::stoppm
void stoppm()
Definition: PerfMonAuditor.cpp:491
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:203
FMT_NAME
#define FMT_NAME
Definition: PerfMonAuditor.cpp:71
pfmlib_input_param_t::pfp_dfl_plm
unsigned int pfp_dfl_plm
Definition: pfmlib.h:109
PerfMonAuditor::m_map
Map m_map
Definition: PerfMonAuditor.cpp:358
std::map
STL class.
PerfMonAuditor::event_str
std::string event_str[MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS]
Definition: PerfMonAuditor.cpp:378
pfmlib_input_param_t::pfp_event_count
unsigned int pfp_event_count
Definition: pfmlib.h:108
PerfMonAuditor::ret
int ret
Definition: PerfMonAuditor.cpp:373
PerfMonAuditor::buf_addr
void * buf_addr
Definition: PerfMonAuditor.cpp:414
PerfMonAuditor::m_indent
int m_indent
Definition: PerfMonAuditor.cpp:359
PFM_NHM_SEL_INV
#define PFM_NHM_SEL_INV
Definition: pfmlib_intel_nhm.h:103
pfm_dfl_smpl_hdr_t
Definition: perfmon_dfl_smpl.h:45
cpluginsvc.n
n
Definition: cpluginsvc.py:234
PerfMonAuditor::num_counters
unsigned num_counters
Definition: PerfMonAuditor.cpp:415
PerfMonAuditor::prefix
std::string prefix
Definition: PerfMonAuditor.cpp:379
PerfMonAuditor::buf_arg
pfm_dfl_smpl_arg_t buf_arg
Definition: PerfMonAuditor.cpp:412
Auditor::beforeExecute
void beforeExecute(INamedInterface *) override
Definition: Auditor.cpp:145
PFMLIB_SUCCESS
#define PFMLIB_SUCCESS
Definition: pfmlib.h:267
pfm_dfl_smpl_entry_t::ip
uint64_t ip
Definition: perfmon_dfl_smpl.h:72
PerfMonAuditor::event_count_reached
bool event_count_reached
Definition: PerfMonAuditor.cpp:423
PerfMonAuditor::westmere
bool westmere
Definition: PerfMonAuditor.cpp:391
StatusCode::isFailure
bool isFailure() const
Definition: StatusCode.h:129
hivetimeline.read
def read(f, regex=".*", skipevents=0)
Definition: hivetimeline.py:32
pfarg_pmd_t::reg_random_mask
uint64_t reg_random_mask
Definition: perfmon_v2.h:50
PerfMonAuditor::i
unsigned int i
Definition: PerfMonAuditor.cpp:372
PerfMonAuditor::pc
pfarg_pmc_t pc[NUM_PMCS]
Definition: PerfMonAuditor.cpp:369
PerfMonAuditor::start_at_event
unsigned int start_at_event
Definition: PerfMonAuditor.cpp:386
PropertyHolder< CommonMessaging< implements< IAuditor, IProperty > > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Details::PropertyBase &prop)
Declare a property.
Definition: PropertyHolder.h:106
pfarg_ctx_t::ctx_flags
uint32_t ctx_flags
Definition: perfmon_v2.h:19
PerfMonAuditor::first_alg
bool first_alg
Definition: PerfMonAuditor.cpp:421
PerfMonAuditor::process_smpl_buf
static void process_smpl_buf(pfm_dfl_smpl_hdr_t *hdr, size_t entry_size)
Definition: PerfMonAuditor.cpp:587
MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS
#define MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS
Definition: PerfMonAuditor.cpp:81
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:100
PFM_REGFL_RANDOM
#define PFM_REGFL_RANDOM
Definition: perfmon.h:113
PerfMonAuditor::m_inEvent
bool m_inEvent
Definition: PerfMonAuditor.cpp:360
PerfMonAuditor::used_counters_number
int used_counters_number
Definition: PerfMonAuditor.cpp:389
PerfMonAuditor::event_cstr
char event_cstr[MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS][MAX_EVENT_NAME_LENGTH]
Definition: PerfMonAuditor.cpp:381
PerfMonAuditor::fd
int fd
Definition: PerfMonAuditor.cpp:371
std::map::begin
T begin(T... args)
PerfMonAuditor::m_pfm
PFMon & m_pfm
Definition: PerfMonAuditor.cpp:240
pfarg_msg_t
Definition: perfmon.h:205
PerfMonAuditor::pd
pfarg_pmd_t pd[NUM_PMDS]
Definition: PerfMonAuditor.cpp:368
Auditor::Auditor
Auditor(std::string name, ISvcLocator *svcloc)
Constructor.
Definition: Auditor.cpp:21
std::count
T count(T... args)
BPL
#define BPL
Definition: PerfMonAuditor.cpp:72
PerfMonAuditor::prefix_cstr
char prefix_cstr[MAX_PREFIX_NAME_LENGTH]
Definition: PerfMonAuditor.cpp:382
pfm_dfl_smpl_entry_t::ovfl_pmd
uint16_t ovfl_pmd
Definition: perfmon_dfl_smpl.h:69
PerfMonAuditor::nehalem
bool nehalem
Definition: PerfMonAuditor.cpp:390
PerfMonAuditor::i_afterInitialize
void i_afterInitialize(INamedInterface *alg)
Definition: PerfMonAuditor.cpp:912
std::memcpy
T memcpy(T... args)
pfmlib_output_param_t::pfp_pmds
pfmlib_reg_t pfp_pmds[PFMLIB_MAX_PMDS]
Definition: pfmlib.h:129
PerfMonAuditor::cmask
unsigned int cmask[MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS]
Definition: PerfMonAuditor.cpp:385
std::make_pair
T make_pair(T... args)
PFM_MSG_OVFL
#define PFM_MSG_OVFL
Definition: perfmon.h:210
PerfMonAuditor::ph_ev_count
unsigned int ph_ev_count
Definition: PerfMonAuditor.cpp:383
IOTest.end
end
Definition: IOTest.py:125
PerfMonAuditor::max_pmd
unsigned int max_pmd
Definition: PerfMonAuditor.cpp:416
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:101
PerfMonAuditor::sigio_handler
static void sigio_handler(int, siginfo_t *, void *)
Definition: PerfMonAuditor.cpp:620
PerfMonAuditor::i_beforeExecute
void i_beforeExecute(INamedInterface *alg)
Definition: PerfMonAuditor.cpp:914
PerfMonAuditor::start_smpl
void start_smpl()
Definition: PerfMonAuditor.cpp:664
pfmlib_output_param_t::pfp_pmc_count
unsigned int pfp_pmc_count
Definition: pfmlib.h:126
pfarg_pmd_t::reg_long_reset
uint64_t reg_long_reset
Definition: perfmon_v2.h:43
pfm_dfl_smpl_hdr_t::hdr_count
uint64_t hdr_count
Definition: perfmon_dfl_smpl.h:46
graphanalysis.filename
filename
Definition: graphanalysis.py:130
PerfMonAuditor::sampling
bool sampling
Definition: PerfMonAuditor.cpp:394
pfarg_pmd_t::reg_random_seed
uint32_t reg_random_seed
Definition: perfmon_v2.h:51
cpuid
#define cpuid(func, ax, bx, cx, dx)
Definition: PerfMonAuditor.cpp:83
PerfMonAuditor::load_arg
pfarg_load_t load_arg
Definition: PerfMonAuditor.cpp:370
pfarg_load_t::load_pid
uint32_t load_pid
Definition: perfmon_v2.h:69
std::memset
T memset(T... args)
PFM_REGFL_OVFL_NOTIFY
#define PFM_REGFL_OVFL_NOTIFY
Definition: perfmon.h:112