The Gaudi Framework  v28r3 (cc1cf868)
PerfMonAuditor.cpp
Go to the documentation of this file.
1 #include "GaudiKernel/Auditor.h"
2 #include "GaudiKernel/IToolSvc.h"
5 #include "GaudiKernel/IToolSvc.h"
7 #include "GaudiKernel/HashMap.h"
9 
10 /*BEGIN: perfmon*/
11 #include <iostream>
12 #include <string>
13 #include <cstring>
14 #include <fstream>
15 #include <perfmon/pfmlib.h>
16 #include <perfmon/pfmlib_core.h>
18 #include <vector>
19 #include <map>
20 #include <utility>
21 #include <sstream>
22 
23 #include <perfmon/perfmon.h>
25 
27 
29 
30 
31 
32 #include <sys/types.h>
33 #include <stdio.h>
34 #include <stdlib.h>
35 #include <stdarg.h>
36 #include <errno.h>
37 #include <unistd.h>
38 #include <string.h>
39 #include <signal.h>
40 #include <stdarg.h>
41 #include <stdint.h>
42 #include <getopt.h>
43 #include <time.h>
44 #include <sys/ptrace.h>
45 #include <sys/wait.h>
46 #include <sys/mman.h>
47 #include <sys/time.h>
48 #include <sys/resource.h>
49 #include <unistd.h>
50 #include <fcntl.h>
51 #include <zlib.h>
52 
53 #include <algorithm>
54 #include <list>
55 #include <stack>
56 #include <cmath>
57 #include <sys/stat.h>
58 #include "IgHook_IgHookTrace.h"
59 
60 // dlopen (link with -ldl)
61 #include <dlfcn.h>
62 
63 
64 #define MAX_EVT_NAME_LEN 256
65 #define NUM_PMCS PFMLIB_MAX_PMCS
66 #define NUM_PMDS PFMLIB_MAX_PMDS
67 #define FMT_NAME PFM_DFL_SMPL_NAME
68 #define BPL (sizeof(uint64_t)<<3)
69 #define LBPL 6
70 
71 #define SYM_NAME_MAX_LENGTH 10000
72 #define MAX_OUTPUT_FILENAME_LENGTH 1024
73 #define MAX_EVENT_NAME_LENGTH 500
74 #define MAX_PREFIX_NAME_LENGTH 1024
75 #define FILENAME_MAX_LENGTH 1024
76 
77 #define MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS 4
78 
79 #define cpuid(func,ax,bx,cx,dx) __asm__ __volatile__ ("cpuid": "=a" (ax), "=b" (bx), "=c" (cx), "=d" (dx) : "a" (func));
80 
81 
82 static pfarg_pmd_t pd_smpl[NUM_PMDS];
83 static uint64_t collected_samples, collected_partial;
84 static int ctx_fd;
85 static pfm_dfl_smpl_hdr_t *hdr;
86 static uint64_t ovfl_count;
87 static size_t entry_size;
88 static unsigned int num_smpl_pmds;
89 static std::vector<std::map<std::string, std::map<unsigned long, unsigned int> > > samples(MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS); //a map of modules each containing numbers of samples of their addresses
90 static std::vector<std::map<std::string, std::vector<unsigned long int> > > results(MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS); //a map of modules and their result values across multiple events
91 static uint64_t last_overflow;
92 static uint64_t last_count;
94 
96 /*END: perfmon*/
97 
98 
99 
100 namespace {
102  template <typename T>
103  inline T function_cast(void *p) {
104  union {
105  void* object;
106  T function;
107  } caster;
108  caster.object = p;
109  return caster.function;
110  }
111  class PFMon {
112  public:
113  bool loaded;
114  typedef void (*pfm_stop_t)(int);
115  pfm_stop_t pfm_stop;
116  typedef void (*pfm_self_stop_t)(int);
117  pfm_self_stop_t pfm_self_stop;
118  typedef os_err_t (*pfm_restart_t)(int);
119  pfm_restart_t pfm_restart;
120  typedef int (*pfm_read_pmds_t)(int, pfarg_pmd_t*, int);
121  pfm_read_pmds_t pfm_read_pmds;
122  typedef pfm_err_t (*pfm_initialize_t)();
123  pfm_initialize_t pfm_initialize;
124  typedef pfm_err_t (*pfm_find_full_event_t)(const char *, pfmlib_event_t *);
125  pfm_find_full_event_t pfm_find_full_event;
126  typedef pfm_err_t (*pfm_dispatch_events_t)(pfmlib_input_param_t *, void *, pfmlib_output_param_t *, void *);
127  pfm_dispatch_events_t pfm_dispatch_events;
128  typedef os_err_t (*pfm_create_context_t)(pfarg_ctx_t *, char *, void *, size_t);
129  pfm_create_context_t pfm_create_context;
130  typedef os_err_t (*pfm_write_pmcs_t)(int, pfarg_pmc_t *, int);
131  pfm_write_pmcs_t pfm_write_pmcs;
132  typedef os_err_t (*pfm_write_pmds_t)(int, pfarg_pmd_t *, int);
133  pfm_write_pmds_t pfm_write_pmds;
134  typedef os_err_t (*pfm_load_context_t)(int, pfarg_load_t *);
135  pfm_load_context_t pfm_load_context;
136  typedef os_err_t (*pfm_start_t)(int fd, pfarg_start_t *);
137  pfm_start_t pfm_start;
138  typedef char* (*pfm_strerror_t)(int);
139  pfm_strerror_t pfm_strerror;
140  typedef pfm_err_t (*pfm_set_options_t)(pfmlib_options_t *);
141  pfm_set_options_t pfm_set_options;
142  typedef pfm_err_t (*pfm_get_num_counters_t)(unsigned int *);
143  pfm_get_num_counters_t pfm_get_num_counters;
144  static PFMon &instance() {
145  return s_instance;
146  }
147  private:
148  // static void failure() { throw 1; }
149 
150  void* handle;
151 
152  PFMon() {
153  handle = dlopen("libpfm.so", RTLD_NOW);
154  if (handle) { loaded = true; } else { loaded = false; }
155  if (loaded) {
156  pfm_start = function_cast<pfm_start_t>(dlsym(handle, "pfm_start"));
157  pfm_stop = function_cast<pfm_stop_t>(dlsym(handle, "pfm_stop"));
158  pfm_self_stop = function_cast<pfm_self_stop_t>(dlsym(handle, "pfm_stop")); //it's the same
159  pfm_restart = function_cast<pfm_restart_t>(dlsym(handle, "pfm_restart"));
160  pfm_read_pmds = function_cast<pfm_read_pmds_t>(dlsym(handle, "pfm_read_pmds"));
161  pfm_initialize = function_cast<pfm_initialize_t>(dlsym(handle, "pfm_initialize"));
162  pfm_find_full_event = function_cast<pfm_find_full_event_t>(dlsym(handle, "pfm_find_full_event"));
163  pfm_dispatch_events = function_cast<pfm_dispatch_events_t>(dlsym(handle, "pfm_dispatch_events"));
164  pfm_create_context = function_cast<pfm_create_context_t>(dlsym(handle, "pfm_create_context"));
165  pfm_write_pmcs = function_cast<pfm_write_pmcs_t>(dlsym(handle, "pfm_write_pmcs"));
166  pfm_write_pmds = function_cast<pfm_write_pmds_t>(dlsym(handle, "pfm_write_pmds"));
167  pfm_load_context = function_cast<pfm_load_context_t>(dlsym(handle, "pfm_load_context"));
168  pfm_strerror = function_cast<pfm_strerror_t>(dlsym(handle, "pfm_strerror"));
169  pfm_set_options = function_cast<pfm_set_options_t>(dlsym(handle, "pfm_set_options"));
170  pfm_get_num_counters = function_cast<pfm_get_num_counters_t>(dlsym(handle, "pfm_get_num_counters"));
171  } else {
172  // pfm_start = pfm_stop = pfm_self_stop = pfm_restart = pfm_read_pmds = pfm_initialize = pfm_find_full_event = pfm_dispatch_events = pfm_create_context = pfm_write_pmcs = pfm_write_pmds = pfm_load_context = pfm_strerror = pfm_set_options = pfm_get_num_counters = failure;
173  }
174  }
175  ~PFMon() {
176  if (handle) dlclose(handle);
177  }
178 
179  static PFMon s_instance;
180  };
181 
182  PFMon PFMon::s_instance;
183 }
184 
185 
186 
187 // ============================================================================
188 // GaudiAlg
189 // ============================================================================
190 // ============================================================================
200 class PerfMonAuditor: virtual public Auditor
201 {
202  public:
203  void before(StandardEventType evt, INamedInterface* alg) override;
204  void after(StandardEventType evt, INamedInterface* alg, const StatusCode &sc) override;
205  using Auditor::before;
206  using Auditor::after;
207 
208  private:
209  void i_beforeInitialize(INamedInterface* alg);
210  void i_afterInitialize(INamedInterface* alg);
211  void i_beforeExecute(INamedInterface* alg);
212  void i_afterExecute(INamedInterface* alg);
213 
214  public:
215  StatusCode initialize() override;
216  StatusCode finalize() override;
217  int is_nehalem() {
218 #ifdef __ICC
219 // Disable ICC remark #593: variable "x" was set but never used
220 #pragma warning(push)
221 #pragma warning(disable:593)
222 #endif
223  int a,b,c,d;
224  cpuid(1,a,b,c,d);
225  int sse4_2_mask = 1 << 20;
226  if(c & sse4_2_mask) return 1; else return 0;
227 #ifdef __ICC
228 #pragma warning(pop)
229 #endif
230  }
231 
232  private:
233  PFMon &m_pfm;
234 /*
235  typedef void (*pfm_stop_t)(int);
236  pfm_stop_t pfm_stop;
237  typedef void (*pfm_self_stop_t)(int);
238  pfm_self_stop_t pfm_self_stop;
239 
240  typedef os_err_t (*pfm_restart_t)(int);
241  pfm_restart_t pfm_restart;
242 
243  //typedef int (*pfm_read_pmds_t)(int, pfarg_pmd_t*, int);
244  //pfm_read_pmds_t pfm_read_pmds;
245 
246  typedef pfm_err_t (*pfm_initialize_t)();
247  pfm_initialize_t pfm_initialize;
248  typedef pfm_err_t (*pfm_find_full_event_t)(const char *, pfmlib_event_t *);
249  pfm_find_full_event_t pfm_find_full_event;
250  typedef pfm_err_t (*pfm_dispatch_events_t)(pfmlib_input_param_t *, void *, pfmlib_output_param_t *, void *);
251  pfm_dispatch_events_t pfm_dispatch_events;
252  typedef os_err_t (*pfm_create_context_t)(pfarg_ctx_t *, char *, void *, size_t);
253  pfm_create_context_t pfm_create_context;
254  typedef os_err_t (*pfm_write_pmcs_t)(int, pfarg_pmc_t *, int);
255  pfm_write_pmcs_t pfm_write_pmcs;
256  typedef os_err_t (*pfm_write_pmds_t)(int, pfarg_pmd_t *, int);
257  pfm_write_pmds_t pfm_write_pmds;
258  typedef os_err_t (*pfm_load_context_t)(int, pfarg_load_t *);
259  pfm_load_context_t pfm_load_context;
260  typedef os_err_t (*pfm_start_t)(int fd, pfarg_start_t *);
261  pfm_start_t pfm_start;
262  typedef char* (*pfm_strerror_t)(int);
263  pfm_strerror_t pfm_strerror;
264  typedef pfm_err_t (*pfm_set_options_t)(pfmlib_options_t *);
265  pfm_set_options_t pfm_set_options;
266  typedef pfm_err_t (*pfm_get_num_counters_t)(unsigned int *);
267  pfm_get_num_counters_t pfm_get_num_counters;
268 */
269 
270 
271  public:
272  PerfMonAuditor(const std::string& name, ISvcLocator* pSvc): // standard constructor
273  Auditor(name, pSvc),
274  m_pfm(PFMon::instance()),
275  m_map(),
276  m_indent(0),
277  m_inEvent(false)
278  {
279 is_nehalem_ret = is_nehalem();
280 declareProperty("EVENT0", event_str[0]);
281 declareProperty("EVENT1", event_str[1]);
282 declareProperty("EVENT2", event_str[2]);
283 declareProperty("EVENT3", event_str[3]);
284 declareProperty("FAMILY", family);
285 declareProperty("PREFIX", prefix);
286 declareProperty("INV0", inv[0]);
287 declareProperty("INV1", inv[1]);
288 declareProperty("INV2", inv[2]);
289 declareProperty("INV3", inv[3]);
290 declareProperty("CMASK0", cmask[0]);
291 declareProperty("CMASK1", cmask[1]);
292 declareProperty("CMASK2", cmask[2]);
293 declareProperty("CMASK3", cmask[3]);
294 declareProperty("SP0", sp[0]);
295 declareProperty("SP1", sp[1]);
296 declareProperty("SP2", sp[2]);
297 declareProperty("SP3", sp[3]);
298 declareProperty("SAMPLE", sampling);
299 declareProperty("START_AT_EVENT", start_at_event);
300 declareProperty("IS_NEHALEM", is_nehalem_ret);
301 
302 
304 /*
305 // loading functions from PFM library
306  void* handle = dlopen("libpfm.so", RTLD_NOW);
307  if (!handle) {
308 // error() << "Cannot open library: " << dlerror() << endmsg;
309  }
310  typedef void (*hello_t)();
311  hello_t hello = (hello_t) dlsym(handle, "hello");
312  if (!hello) {
313 // error() << "Cannot load symbol 'hello': " << dlerror() << endmsg;
314  dlclose(handle);
315  }
316 
317  pfm_start = (pfm_start_t) dlsym(handle, "pfm_start");
318  pfm_stop = (pfm_stop_t) dlsym(handle, "pfm_stop");
319  pfm_self_stop = (pfm_self_stop_t) dlsym(handle, "pfm_stop"); //it's the same
320  pfm_restart = (pfm_restart_t) dlsym(handle, "pfm_restart");
321  //pfm_read_pmds = (pfm_read_pmds_t) dlsym(handle, "pfm_read_pmds");
322  pfm_initialize = (pfm_initialize_t) dlsym(handle, "pfm_initialize");
323  pfm_find_full_event = (pfm_find_full_event_t) dlsym(handle, "pfm_find_full_event");
324  pfm_dispatch_events = (pfm_dispatch_events_t) dlsym(handle, "pfm_dispatch_events");
325  pfm_create_context = (pfm_create_context_t) dlsym(handle, "pfm_create_context");
326  pfm_write_pmcs = (pfm_write_pmcs_t) dlsym(handle, "pfm_write_pmcs");
327  pfm_write_pmds = (pfm_write_pmds_t) dlsym(handle, "pfm_write_pmds");
328  pfm_load_context = (pfm_load_context_t) dlsym(handle, "pfm_load_context");
329  pfm_strerror = (pfm_strerror_t) dlsym(handle, "pfm_strerror");
330  pfm_set_options = (pfm_set_options_t) dlsym(handle, "pfm_set_options");
331  pfm_get_num_counters = (pfm_get_num_counters_t) dlsym(handle, "pfm_get_num_counters");
332  // use it to do the calculation
333 // info() << "Calling hello..." << endmsg;
334 // hello();
335 
336  // close the library
337 // info() << "Closing library..." << endmsg;
338  dlclose(handle);
339 */
340 
342 
343  }
344 
345  virtual ~PerfMonAuditor() {} // virtual destructor
346 
347  private:
348  PerfMonAuditor(); // the default constructor is disabled
349  PerfMonAuditor(const PerfMonAuditor&); // copy constructor is disabled
350  PerfMonAuditor& operator=(const PerfMonAuditor&); // assignement operator is disabled
351 
352  private:
354  Map m_map;
355  int m_indent; // indentation level
356  bool m_inEvent; // "In event" flag
357 
358  private:
360 
361  pfmlib_input_param_t inp;
362  pfmlib_output_param_t outp;
363  pfarg_ctx_t ctx;
364  pfarg_pmd_t pd[NUM_PMDS];
365  pfarg_pmc_t pc[NUM_PMCS];
367  int fd;
368  unsigned int i;
369  int ret;
370  void startpm();
371  void pausepm();
372  void stoppm();
373  void finalizepm();
378  char prefix_cstr[MAX_PREFIX_NAME_LENGTH];
379  unsigned int ph_ev_count;
382  unsigned int start_at_event;
386  bool nehalem;
387  bool westmere;
388  bool core;
389 
390  bool sampling;
391  int detect_unavail_pmu_regs(int fd, pfmlib_regmask_t *r_pmcs, pfmlib_regmask_t *r_pmds);
392  int detect_unavail_pmcs(int fd, pfmlib_regmask_t *r_pmcs){return detect_unavail_pmu_regs(fd, r_pmcs, NULL);}
393  void pfm_bv_set(uint64_t *bv, uint16_t rnum){bv[rnum>>LBPL] |= 1UL << (rnum&(BPL-1));}
394  int pfm_bv_isset(uint64_t *bv, uint16_t rnum){return bv[rnum>>LBPL] & (1UL <<(rnum&(BPL-1))) ? 1 : 0;}
395  void pfm_bv_copy(uint64_t *d, uint64_t *j, uint16_t n){if(n<=BPL) *d = *j; else {memcpy(d, j, (n>>LBPL)*sizeof(uint64_t));}}
396  static void process_smpl_buf(pfm_dfl_smpl_hdr_t *hdr, size_t entry_size);
397  static void sigio_handler(int, struct siginfo *, struct sigcontext *); // dlopen ==>
398  //void sigio_handler(int, struct siginfo *, struct sigcontext *);
399  void start_smpl();
400  void stop_smpl();
401  void finalize_smpl();
404  void *buf_addr;
405  unsigned num_counters;
406  unsigned int max_pmd;
408 
409 
410  int level;
411 
412  bool first_alg;
415 
416 
417 };
418 
420 {
421  memset(&ctx,0, sizeof(ctx));
422  memset(&inp,0, sizeof(inp));
423  memset(&outp,0, sizeof(outp));
424  memset(pd, 0, sizeof(pd));
425  memset(pc, 0, sizeof(pc));
426  memset(&load_arg, 0, sizeof(load_arg));
427  memset(&params, 0, sizeof(params));
428  memset(&nhm_params, 0, sizeof(nhm_params));
429 
430  for(int i=0; i<used_counters_number; i++)
431  {
432  ret = m_pfm.pfm_find_full_event(event_cstr[i], &inp.pfp_events[i]);
433  if(ret != PFMLIB_SUCCESS)
434  {
435  error() << "ERROR: cannot find event: " << event_cstr[i] << ". Aborting..." << endmsg;
436  }
437  }
438  inp.pfp_dfl_plm = PFM_PLM3;
439  inp.pfp_event_count = 4;
440  for(int i=0; i<used_counters_number; i++)
441  {
442  if(inv[i])
443  {
444  (params.pfp_core_counters[i]).flags |= PFM_CORE_SEL_INV;
445  (nhm_params.pfp_nhm_counters[i]).flags |= PFM_NHM_SEL_INV;
446  }
447  if(cmask[i]>0)
448  {
449  (params.pfp_core_counters[i]).cnt_mask = cmask[i];
450  (nhm_params.pfp_nhm_counters[i]).cnt_mask = cmask[i];
451  }
452  }
453  if(nehalem || westmere)
454  {
455  ret = m_pfm.pfm_dispatch_events(&inp, &nhm_params, &outp, NULL);
456  }
457  else
458  {
459  ret = m_pfm.pfm_dispatch_events(&inp, &params, &outp, NULL);
460  }
461  if(ret != PFMLIB_SUCCESS)
462  {
463  error() << "ERROR: cannot dispatch events: " << m_pfm.pfm_strerror(ret) << ". Aborting..." << endmsg;
464  }
465  for(unsigned int i=0; i<outp.pfp_pmc_count; i++)
466  {
467  pc[i].reg_num = outp.pfp_pmcs[i].reg_num;
468  pc[i].reg_value = outp.pfp_pmcs[i].reg_value;
469  }
470  for(unsigned int i=0; i<outp.pfp_pmd_count; i++)
471  {
472  pd[i].reg_num = outp.pfp_pmds[i].reg_num;
473  pd[i].reg_value = 0;
474  }
475  fd = m_pfm.pfm_create_context(&ctx, NULL, 0, 0);
476  if(fd == -1)
477  {
478  error() << "ERROR: Context not created. Aborting..." << endmsg;
479  }
480  if(m_pfm.pfm_write_pmcs(fd, pc, outp.pfp_pmc_count) == -1)
481  {
482  error() << "ERROR: Could not write pmcs. Aborting..." << endmsg;
483  }
484  if(m_pfm.pfm_write_pmds(fd, pd, outp.pfp_pmd_count) == -1)
485  {
486  error() << "ERROR: Could not write pmds. Aborting..." << endmsg;
487  }
488  load_arg.load_pid = getpid();
489  if(m_pfm.pfm_load_context(fd, &load_arg) == -1)
490  {
491  error() << "ERROR: Could not load context. Aborting..." << endmsg;
492 // error() << "Could not read pmds" << endmsg;
493  }
494 
495  m_pfm.pfm_start(fd, NULL);
496 }
497 
498 
499 
500 
501 
502  // stoppm()
503  // const ModuleDescription& desc : description of the module that just finished its execution (we are only interested in its name)
504  // stops the counting calling pfm_stop() and stores the counting results into the "results" map
506 {
507  m_pfm.pfm_stop(fd);
508  if(m_pfm.pfm_read_pmds(fd, pd, inp.pfp_event_count) == -1)
509  {
510  error() << "Could not read pmds" << endmsg;
511  }
512  for(int i=0; i<used_counters_number; i++)
513  {
514  results[i][(alg_stack.top().first)->name()].push_back(alg_stack.top().second[i] + pd[i].reg_value);
515  }
516 
517  close(fd);
518 }
519 
520 
522 {
523  m_pfm.pfm_stop(fd);
524  if(m_pfm.pfm_read_pmds(fd, pd, inp.pfp_event_count) == -1)
525  {
526  error() << "Could not read pmds" << endmsg;
527  }
528 
529  for(int i=0; i<used_counters_number; i++)
530  {
531  alg_stack.top().second[i] += pd[i].reg_value;
532  }
533 
534  close(fd);
535 }
536 
537 
538  // finalizepm()
539  // called when all the countings of the current event are finished, it dumps the results
540  // into the output file corresponding to the event being counted
542 {
543  info() << "start of finalizepm ucn:" << used_counters_number << endmsg;
544  for(int i=0; i<used_counters_number; i++)
545  {
546  std::string filename = prefix_cstr;
547  filename += '_';
548  filename += event_cstr[i];
549 
550  for(auto& c: filename) if ( c == ':' ) c = '-';
551 
552  if(inv[i]) filename += "_INV_1";
553  if(cmask[i]>0) filename += "_CMASK_" + std::to_string(cmask[i]);
554  filename += ".txt";
555 
556  info() << "Filename:" << filename << endmsg;
557  FILE* outfile = fopen(filename.c_str(), "w");
558  if(nehalem)
559  {
560  fprintf(outfile, "NHM ");
561  }
562  else if(westmere)
563  {
564  fprintf(outfile, "WSM ");
565  }
566  else if(core)
567  {
568  fprintf(outfile, "CORE ");
569  }
570  fprintf(outfile, "%s %d %d %d\n", event_cstr[i], cmask[i], inv[i], sp[i]);
571  for(std::map<std::string, std::vector<unsigned long int> >::iterator it=(results[i]).begin(); it!=(results[i]).end(); it++)
572  {
573  fprintf(outfile, "%s\n", (it->first).c_str());
574  for(std::vector<unsigned long int>::iterator j=(it->second).begin(); j!=(it->second).end(); j++)
575  {
576  fprintf(outfile, "%lu\n", *j);
577  }
578  }
579  fclose(outfile);
580  }
581 }
582 
584 {
585  if (!m_pfm.loaded) {
586  error() << "pfm library could not be loaded" << endmsg;
587  return false;
588  }
589 
590  info() << "Initializing..." << endmsg;
592  if(sc.isFailure())
593  {
594  return sc;
595  }
596  used_counters_number = 0;
597  for(int i=0; i<MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS; i++)
598  {
599  if(event_str[i].length()>0) used_counters_number++;
600  }
601  for(int i=0; i<MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS; i++)
602  {
603  strcpy(event_cstr[i], event_str[i].c_str());
604  }
605  strcpy(prefix_cstr, prefix.c_str());
606 
607  if(m_pfm.pfm_initialize() != PFMLIB_SUCCESS)
608  {
609  error() << "Cannot initialize perfmon!!" << endmsg;
610  }
611  ph_ev_count = 0;
612  first_alg = true;
613  event_count_reached = false;
614  nehalem = false;
615  core = false;
616  westmere = false;
617  if(family.compare("CORE")==0) core = true;
618  else if(family.compare("NEHALEM")==0) nehalem = true;
619  else if(family.compare("WESTMERE")==0) westmere = true;
620  else
621  {
622  error() << "ERROR: Unsupported processor family " << family << ". aborting..." << endmsg;
623  }
624 
625  info() << "Initialized!" << endmsg;
626  return StatusCode::SUCCESS ;
627 }
628 
629  // process_smpl_buf()
630  // pfm_dfl_smpl_hdr_t *hdr : pointer to header of the buffer containing addresses sampled during the sampling process
631  // size_t entry_size : size of each entry, used to navigate through the various entries
632  // called when the sampling buffer is full, saves the samples into memory ("samples" map)
634 {
637  size_t pos, count;
638  uint64_t entry;
639  if(hdr->hdr_overflows == last_overflow && hdr->hdr_count == last_count)
640  {
641  printf("skipping identical set of samples...\n");
642  return;
643  }
644  count = hdr->hdr_count;
645  ent = (pfm_dfl_smpl_entry_t *)(hdr+1);
646  pos = (unsigned long)ent;
647  entry = collected_samples;
648  while(count--)
649  {
650  //if(ent->ovfl_pmd>=0 && ent->ovfl_pmd<=3)
651  if(ent->ovfl_pmd<=3)
652  {
653  ((samples[ent->ovfl_pmd])[(alg_stack.top().first)->name()])[(unsigned long)(ent->ip)]++;
654  }
655  pos += entry_size;
656  ent = (pfm_dfl_smpl_entry_t *)pos;
657  entry++;
658  }
659  collected_samples = entry;
660  last_overflow = hdr->hdr_overflows;
661  if (last_count != hdr->hdr_count && (last_count || last_overflow == 0))
662  {
663  collected_partial += hdr->hdr_count;
664  }
665  last_count = hdr->hdr_count;
666  return;
667 }
668 
669  // sigio_handler()
670  // int n : signal number of the signal being delivered
671  // struct siginfo *info : pointer to a siginfo_t structure containing info about the signal
672  // struct sigcontext *sc : context of the signal, NULL in our case
673  // signal handler used to catch sampling buffer overflows. When they occur it calls the process_smpl_buf() function
674 void PerfMonAuditor::sigio_handler(int /*n*/, struct siginfo */*info*/, struct sigcontext */*sc*/)
675 {
676  PFMon& pfm = PFMon::instance();
678  int fd = ctx_fd;
679  int r;
680  if(fd != ctx_fd)
681  {
682  //error() << "ERROR: handler does not get valid file descriptor. Aborting..." << endmsg;
683  }
684  if(pfm.pfm_read_pmds(fd, pd_smpl+1, 1) == -1)
685  {
686  //error() << "ERROR: pfm_read_pmds: " << strerror(errno) << ". Aborting..." << endmsg;
687  }
688  while(true)
689  {
690  r = read(fd, &msg, sizeof(msg));
691  if(r!=sizeof(msg))
692  {
693  if(r==-1 && errno==EINTR)
694  {
695  printf("read interrupted, retrying\n");
696  continue;
697  }
698  //error() << "ERROR: cannot read overflow message: " << strerror(errno) << ". Aborting..." << endmsg;
699  }
700  break;
701  }
702  switch(msg.type)
703  {
704  case PFM_MSG_OVFL: // the sampling buffer is full
705  process_smpl_buf(hdr, entry_size);
706  ovfl_count++;
707  if(pfm.pfm_restart(fd))
708  {
709  if(errno!=EBUSY)
710  {
711  //error() << "ERROR: pfm_restart error errno " << errno << ". Aborting..." << endmsg;
712  }
713  else
714  {
715  printf("pfm_restart: task probably terminated \n");
716  }
717  }
718  break;
719  default:
720  //error() << "ERROR: unknown message type " << msg.type << ". Aborting..." << endmsg;
721  break;
722  }
723 
724 }
725 
726 
727 
728 
729 
730 
731 
732  // start_smpl()
733  // const ModuleDescription& desc : description of the module that is just starting its execution (we are only interested in its name)
734  // initializes all the necessary structures to start the sampling, calling pfm_self_start()
736 {
737  ovfl_count = 0;
738  num_smpl_pmds = 0;
739  last_overflow = ~0;
740  max_pmd = 0;
741  memset(&pfmlib_options, 0, sizeof(pfmlib_options));
742  pfmlib_options.pfm_debug = 0;
743  pfmlib_options.pfm_verbose = 0;
744  m_pfm.pfm_set_options(&pfmlib_options);
745  ret = m_pfm.pfm_initialize();
746  if(ret != PFMLIB_SUCCESS)
747  {
748  error() << "ERROR: Cannot initialize library: " << m_pfm.pfm_strerror(ret) << ". Aborting..." << endmsg;
749  }
750  struct sigaction act;
751  memset(&act, 0, sizeof(act));
752  act.sa_handler = (sig_t)sigio_handler; // dlopen() ==>
753  //act.sa_handler = (sig_t)&sigio_handler;
754  sigaction(SIGIO, &act, 0);
755  memset(&ctx, 0, sizeof(ctx));
756  memset(&buf_arg, 0, sizeof(buf_arg));
757  memset(&inp,0, sizeof(inp));
758  memset(&outp,0, sizeof(outp));
759  memset(pd_smpl, 0, sizeof(pd_smpl));
760  memset(pc, 0, sizeof(pc));
761  memset(&load_args, 0, sizeof(load_args));
762  m_pfm.pfm_get_num_counters(&num_counters);
763  memset(&params, 0, sizeof(params));
764  memset(&nhm_params, 0, sizeof(nhm_params));
765 
766  for(int i=0; i<used_counters_number; i++)
767  {
768  ret = m_pfm.pfm_find_full_event(event_cstr[i], &inp.pfp_events[i]);
769  if(ret != PFMLIB_SUCCESS)
770  {
771  error() << "ERROR: cannot find event: " << event_cstr[i] << ". Aborting..." << endmsg;
772  }
773  }
774  inp.pfp_dfl_plm = PFM_PLM3;
775  inp.pfp_event_count = 4;
776  for(int i=0; i<used_counters_number; i++)
777  {
778  if(inv[i])
779  {
780  (params.pfp_core_counters[i]).flags |= PFM_CORE_SEL_INV;
781  (nhm_params.pfp_nhm_counters[i]).flags |= PFM_NHM_SEL_INV;
782  }
783  if(cmask[i]>0)
784  {
785  (params.pfp_core_counters[i]).cnt_mask = cmask[i];
786  (nhm_params.pfp_nhm_counters[i]).cnt_mask = cmask[i];
787  }
788  }
789  if(nehalem || westmere)
790  {
791  ret = m_pfm.pfm_dispatch_events(&inp, &nhm_params, &outp, NULL);
792  }
793  else
794  {
795  ret = m_pfm.pfm_dispatch_events(&inp, &params, &outp, NULL);
796  }
797  if(ret != PFMLIB_SUCCESS)
798  {
799  error() << "ERROR: cannot configure events: " << m_pfm.pfm_strerror(ret) << ". Aborting..." << endmsg;
800  }
801  for(unsigned int i=0; i<outp.pfp_pmc_count; i++)
802  {
803  pc[i].reg_num = outp.pfp_pmcs[i].reg_num;
804  pc[i].reg_value = outp.pfp_pmcs[i].reg_value;
805  }
806  for(unsigned int i=0; i<outp.pfp_pmd_count; i++)
807  {
808  pd_smpl[i].reg_num = outp.pfp_pmds[i].reg_num;
809  if(i)
810  {
811  pfm_bv_set(pd_smpl[0].reg_smpl_pmds, pd_smpl[i].reg_num);
812  if(pd_smpl[i].reg_num>max_pmd)
813  {
814  max_pmd = pd_smpl[i].reg_num;
815  }
816  num_smpl_pmds++;
817  }
818  }
819  for(int i=0; i<used_counters_number; i++)
820  {
822  pfm_bv_copy(pd_smpl[i].reg_reset_pmds, pd_smpl[i].reg_smpl_pmds, max_pmd);
823  pd_smpl[i].reg_value = (uint64_t)(sp[i] * -1);
824  pd_smpl[i].reg_short_reset = (uint64_t)(sp[i] * -1);
825  pd_smpl[i].reg_long_reset = (uint64_t)(sp[i] * -1);
826  pd_smpl[i].reg_random_seed = 5; //tocheck
827  pd_smpl[i].reg_random_mask = 0xff; //tocheck
828  }
829  entry_size = sizeof(pfm_dfl_smpl_entry_t)+(num_smpl_pmds<<3);
830  ctx.ctx_flags = 0;
831  buf_arg.buf_size = 3*getpagesize()+512;
832  ctx_fd = m_pfm.pfm_create_context(&ctx, (char *)FMT_NAME, &buf_arg, sizeof(buf_arg));
833  if(ctx_fd==-1)
834  {
835  if(errno==ENOSYS)
836  {
837  error() << "ERROR: Your kernel does not have performance monitoring support! Aborting..." << endmsg;
838  }
839  error() << "ERROR: Can't create PFM context " << strerror(errno) << ". Aborting..." << endmsg;
840  }
841  buf_addr = mmap(NULL, (size_t)buf_arg.buf_size, PROT_READ, MAP_PRIVATE, ctx_fd, 0);
842  if(buf_addr==MAP_FAILED)
843  {
844  error() << "ERROR: cannot mmap sampling buffer: " << strerror(errno) << ". Aborting..." << endmsg;
845  }
846  hdr = (pfm_dfl_smpl_hdr_t *)buf_addr;
847  if(PFM_VERSION_MAJOR(hdr->hdr_version)<1)
848  {
849  error() << "ERROR: invalid buffer format version. Aborting..." << endmsg;
850  }
851  if(m_pfm.pfm_write_pmcs(ctx_fd, pc, outp.pfp_pmc_count))
852  {
853  error() << "ERROR: pfm_write_pmcs error errno " << strerror(errno) << ". Aborting..." << endmsg;
854  }
855  if(m_pfm.pfm_write_pmds(ctx_fd, pd_smpl, outp.pfp_pmd_count))
856  {
857  error() << "ERROR: pfm_write_pmds error errno " << strerror(errno) << ". Aborting..." << endmsg;
858  }
859  load_args.load_pid = getpid();
860  if(m_pfm.pfm_load_context(ctx_fd, &load_args))
861  {
862  error() << "ERROR: pfm_load_context error errno " << strerror(errno) << ". Aborting..." << endmsg;
863  }
864  ret = fcntl(ctx_fd, F_SETFL, fcntl(ctx_fd, F_GETFL, 0) | O_ASYNC);
865  if(ret == -1)
866  {
867  error() << "ERROR: cannot set ASYNC: " << strerror(errno) << ". Aborting..." << endmsg;
868  }
869  ret = fcntl(ctx_fd, F_SETOWN, getpid());
870  if(ret == -1)
871  {
872  error() << "ERROR: cannot setown: " << strerror(errno) << ". Aborting..." << endmsg;
873  }
874  //pfm_self_start(ctx_fd); ==>
875  m_pfm.pfm_start(ctx_fd, NULL);
876  }
877 
878 
879  // stop_smpl()
880  // const ModuleDescription& desc : description of the module that just finished its execution (we are only interested in its name)
881  // stops the sampling and calls process_smpl_buf() one last time to process all the remaining samples
883  {
884  m_pfm.pfm_self_stop(ctx_fd);
885  process_smpl_buf(hdr, entry_size);
886  close(ctx_fd);
887  ret = munmap(hdr, (size_t)buf_arg.buf_size);
888  if(ret)
889  {
890  error() << "Cannot unmap buffer: %s" << strerror(errno) << endmsg;
891  }
892  return;
893  }
894 
895 
896 
897  // finalize_smpl()
898  // processes the sampling results in order to find library and offset of each sampled address, using the symbol() and tosymbol() functions,
899  // and then dumps the new found information into gzipped output files, to be processed later
901 {
902  int err;
903  for(int i=0; i<used_counters_number; i++)
904  {
905  std::string filename = prefix_cstr;
906  filename += '_';
907  filename += event_cstr[i];
908 
909  for(auto& c: filename) if ( c == ':' ) c = '-';
910 
911  if(inv[i]) filename += "_INV_1";
912  if(cmask[i]>0) filename += "_CMASK_" + std::to_string(cmask[i]);
913  filename += ".txt.gz";
914 
915  gzFile outfile = gzopen(filename.c_str(), "wb");
916  if(outfile!=NULL)
917  {
918  if(nehalem)
919  {
920  gzprintf(outfile, "NHM ");
921  }
922  else if(westmere)
923  {
924  gzprintf(outfile, "WSM ");
925  }
926  else if(core)
927  {
928  gzprintf(outfile, "CORE ");
929  }
930  if(gzprintf(outfile, "%s %d %d %d\n", event_cstr[i], cmask[i], inv[i], sp[i]) < (int)strlen(event_cstr[i]))
931  {
932  error() << "ERROR: gzputs err: " << gzerror(outfile, &err) << ". Aborting..." << endmsg;
933  }
934  for(std::map<std::string, std::map<unsigned long, unsigned int> >::iterator it=samples[i].begin(); it!=samples[i].end(); it++)
935  {
936  unsigned long long sum = 0;
937  for(std::map<unsigned long, unsigned int>::iterator jt=(it->second).begin(); jt!=(it->second).end(); jt++)
938  {
939  sum += jt->second;
940  }
941  if(gzprintf(outfile, "%s%%%llu\n", (it->first).c_str(), sum) < (int)((it->first).length()))
942  {
943  error() << "ERROR: gzputs err: " << gzerror(outfile, &err) << ". Aborting..." << endmsg;
944  }
945  for(std::map<unsigned long, unsigned int>::iterator jt=(it->second).begin(); jt!=(it->second).end(); jt++)
946  {
947  char sym_name[SYM_NAME_MAX_LENGTH];
948  bzero(sym_name, SYM_NAME_MAX_LENGTH);
949  const char *libName;
950  const char *symbolName;
951  int libOffset = 0;
952  int offset = 0;
953  void *sym_addr = IgHookTrace::tosymbol((void *)(jt->first));
954  if(sym_addr != NULL)
955  {
956  bool success = IgHookTrace::symbol(sym_addr, symbolName, libName, offset, libOffset);
957  if(success)
958  {
959  if(symbolName!=NULL && strlen(symbolName)>0)
960  {
961  strcpy(sym_name, symbolName);
962  strcat(sym_name, " ");
963  }
964  else
965  {
966  strcpy(sym_name, "??? ");
967  }
968  if(libName!=NULL && strlen(libName)>0)
969  {
970  strcat(sym_name, libName);
971  strcat(sym_name, " ");
972  }
973  else
974  {
975  strcat(sym_name, "??? ");
976  }
977  sprintf(sym_name, "%s%d ", sym_name, libOffset);
978  if(strlen(sym_name)<=0)
979  {
980  error() << "ERROR: Symbol name length is zero. Aborting..." << endmsg;
981  }
982  }
983  else
984  {
985  strcpy(sym_name,"??? ??? 0 ");
986  }
987  }
988  else
989  {
990  strcpy(sym_name,"??? ??? 0 ");
991  }
992  if(gzprintf(outfile, "%s %d\n", sym_name, jt->second) < (int)strlen(sym_name))
993  {
994  error() << "ERROR: gzputs err: " << gzerror(outfile, &err) << endmsg;
995  }
996  }
997  }
998  }
999  else
1000  {
1001  error() << "ERROR: Could not open file: " << filename << ". Aborting..." << endmsg;
1002  }
1003  gzclose(outfile);
1004  }
1005  }
1006 
1007 
1008 
1010 {
1011  if(sampling == 0) finalizepm();
1012  else finalize_smpl();
1013  return Auditor::finalize();
1014 }
1015 
1016 
1017 void PerfMonAuditor::before(StandardEventType evt, INamedInterface *alg)
1018 {
1019  switch(evt)
1020  {
1021  case IAuditor::Initialize:
1022  i_beforeInitialize(alg);
1023  break;
1024  case IAuditor::Execute:
1025  i_beforeExecute(alg);
1026  break;
1027  default:
1028  break;
1029  }
1030  return;
1031 }
1032 
1033 void PerfMonAuditor::after(StandardEventType evt, INamedInterface *alg, const StatusCode &)
1034 {
1035  switch(evt)
1036  {
1037  case IAuditor::Initialize:
1038  i_afterInitialize(alg);
1039  break;
1040  case IAuditor::Execute:
1041  i_afterExecute(alg);
1042  break;
1043  default:
1044  break;
1045  }
1046  return;
1047 }
1048 
1050 {
1051  if(!alg) return;
1052  return;
1053 }
1054 
1056 {
1057  if(!alg) return;
1058  return;
1059 }
1060 
1062 {
1063  if(!alg) return;
1064  //info() << "before:inside! " << alg->name() << endmsg;
1065  if(first_alg)
1066  {
1067  first_alg = false;
1068  first_alg_name = alg->name();
1069  //info() << "first_alg_name= " << alg->name() << endmsg;
1070  }
1071  if(!event_count_reached)
1072  {
1073  if(!first_alg_name.compare(alg->name()))
1074  {
1075  ph_ev_count++;
1076  //info() << "EVENT COUNT: " << ph_ev_count << endmsg;
1077  if(ph_ev_count==start_at_event)
1078  {
1079  event_count_reached = true;
1080  //info() << "!!! EVENT COUNT REACHED: " << ph_ev_count << endmsg;
1081  }
1082  }
1083  }
1084  if(event_count_reached)
1085  {
1086  //info() << "before:inside! " << alg->name() << endmsg;
1087 
1088  if(!alg_stack.empty())
1089  {
1090  if(sampling == 0) pausepm(); //pausing father algorithm counting
1091  else stop_smpl();
1092  }
1093  ++m_indent;
1094  std::vector <unsigned long int> zeroes(4,0);
1095  alg_stack.push(std::make_pair(alg, zeroes));
1096  if(sampling == 0) startpm();
1097  else start_smpl();
1098  }
1099 }
1100 
1102 {
1103  if(!alg) {
1104  return;
1105  }// info() << "after:inside! " << alg->name() << endmsg;
1106 
1107  if(event_count_reached) {
1108  //info() << "after:inside! " << alg->name() << endmsg;
1109 
1110  if(sampling == 0) stoppm();
1111  else stop_smpl();
1112  alg_stack.pop();
1113  --m_indent;
1114  if(!alg_stack.empty())
1115  {
1116  if(sampling == 0) startpm();
1117  else start_smpl(); //resuming father algorithm counting
1118  }
1119  }
1120 }
1121 
pfarg_load_t load_args
int pfm_err_t
Definition: pfmlib.h:151
uint64_t reg_short_reset
Definition: perfmon_v2.h:44
pfmlib_core_input_param_t params
os_err_t pfm_write_pmds(int fd, pfarg_pmd_t *pmds, int count)
virtual StatusCode finalize()
Definition: Auditor.cpp:200
#define PFM_REGFL_OVFL_NOTIFY
Definition: perfmon.h:113
#define MAX_PREFIX_NAME_LENGTH
T empty(T...args)
#define PFM_NHM_SEL_INV
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
os_err_t pfm_create_context(pfarg_ctx_t *ctx, char *smpl_name, void *smpl_arg, size_t smpl_size)
#define PFM_PLM3
Definition: pfmlib.h:53
PerfMonAuditor(const std::string &name, ISvcLocator *pSvc)
std::string family
char * pfm_strerror(int code)
#define PFM_CORE_SEL_INV
Definition: pfmlib_core.h:68
static void * tosymbol(void *address)
double sum(double x, double y, double z)
#define PFMLIB_SUCCESS
Definition: pfmlib.h:283
T to_string(T...args)
pfm_err_t pfm_get_num_counters(unsigned int *num)
#define SYM_NAME_MAX_LENGTH
T pop(T...args)
constexpr double pc
class MergingTransformer< Out(const vector_of_const_< In > void
T top(T...args)
int os_err_t
Definition: perfmon.h:69
def read(f, regex='.*', skipevents=0)
Definition: hivetimeline.py:19
uint16_t reg_num
Definition: perfmon_v2.h:39
unsigned long long uint64_t
Definition: instrset.h:144
void i_afterExecute(INamedInterface *alg)
pfmlib_input_param_t inp
unsigned short int uint16_t
Definition: instrset.h:140
uint32_t type
Definition: perfmon.h:209
os_err_t pfm_write_pmcs(int fd, pfarg_pmc_t *pmcs, int count)
Performance Monitoring Auditor that uses Perfmon2 library to monitor algorithms.
pfm_err_t pfm_dispatch_events(pfmlib_input_param_t *p, void *model_in, pfmlib_output_param_t *q, void *model_out)
T push(T...args)
pfmlib_options_t pfmlib_options
bool is_nehalem()
Definition: CPUFamily.cpp:17
static void sigio_handler(int, struct siginfo *, struct sigcontext *)
STL class.
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:84
uint32_t reg_random_seed
Definition: perfmon_v2.h:51
std::string first_alg_name
pfm_err_t pfm_find_full_event(const char *str, pfmlib_event_t *e)
uint64_t reg_long_reset
Definition: perfmon_v2.h:43
StatusCode finalize() override
#define MAX_EVENT_NAME_LENGTH
pfmlib_nhm_input_param_t nhm_params
#define DECLARE_COMPONENT(type)
Definition: PluginService.h:36
auto begin(reverse_wrapper< T > &w)
Definition: reverse.h:48
#define NUM_PMCS
PropertyMgr & operator=(const PropertyMgr &)=delete
STL class.
#define PFM_VERSION_MAJOR(x)
Definition: perfmon.h:216
void pfm_bv_copy(uint64_t *d, uint64_t *j, uint16_t n)
int detect_unavail_pmcs(int fd, pfmlib_regmask_t *r_pmcs)
uint16_t ovfl_pmd
uint64_t ip
void pfm_bv_set(uint64_t *bv, uint16_t rnum)
uint32_t reg_flags
Definition: perfmon_v2.h:41
os_err_t pfm_restart(int fd)
STL class.
#define NUM_PMDS
std::string prefix
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
Gaudi::Details::PropertyBase * declareProperty(const std::string &name, TYPE &value, const std::string &doc="none")
Declare a property (templated)
pfmlib_output_param_t outp
void after(StandardEventType, INamedInterface *, const StatusCode &) override
Definition: Auditor.cpp:110
static bool symbol(void *address, const char *&sym, const char *&lib, int &offset, int &liboffset)
T make_pair(T...args)
auto end(reverse_wrapper< T > &w)
Definition: reverse.h:50
#define LBPL
void after(StandardEventType evt, INamedInterface *alg, const StatusCode &sc) override
os_err_t pfm_start(int fd, pfarg_start_t *start)
pfm_err_t pfm_initialize(void)
#define BPL
unsigned int i
IInterface compliant class extending IInterface with the name() method.
unsigned int ph_ev_count
STL class.
int pfm_bv_isset(uint64_t *bv, uint16_t rnum)
T begin(T...args)
#define FMT_NAME
unsigned int start_at_event
static void process_smpl_buf(pfm_dfl_smpl_hdr_t *hdr, size_t entry_size)
os_err_t pfm_load_context(int fd, pfarg_load_t *load)
#define cpuid(func, ax, bx, cx, dx)
#define PFM_REGFL_RANDOM
Definition: perfmon.h:114
pfm_dfl_smpl_arg_t buf_arg
os_err_t pfm_read_pmds(int fd, pfarg_pmd_t *pmds, int count)
unsigned int max_pmd
uint64_t reg_random_mask
Definition: perfmon_v2.h:50
StatusCode initialize() override
void i_beforeExecute(INamedInterface *alg)
virtual StatusCode initialize()
Definition: Auditor.cpp:70
#define MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS
void i_afterInitialize(INamedInterface *alg)
void i_beforeInitialize(INamedInterface *alg)
pfarg_load_t load_arg
#define PFM_MSG_OVFL
Definition: perfmon.h:213
os_err_t pfm_stop(int fd)
virtual ~PerfMonAuditor()
GaudiUtils::VectorMap< const INamedInterface *, int > Map
void before(StandardEventType, INamedInterface *) override
The following methods are meant to be implemented by the child class...
Definition: Auditor.cpp:73
uint64_t reg_value
Definition: perfmon_v2.h:42
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
virtual const std::string & name() const =0
Retrieve the name of the instance.
void before(StandardEventType evt, INamedInterface *alg) override
evt
Definition: IOTest.py:85
pfm_err_t pfm_set_options(pfmlib_options_t *opt)
Base class from which all concrete auditor classes should be derived.
Definition: Auditor.h:35