| The Gaudi Framework v28r2p1 (f1a77ff4)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

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

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

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

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

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

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

## Additional Inherited Members
Public Types inherited from Auditor
typedef Gaudi::PluginService::Factory< IAuditor *, const std::string &, ISvcLocator * > | Factory
Public Types inherited from PropertyHolder< CommonMessaging< implements< IAuditor, IProperty > > >
using | PropertyHolderImpl = PropertyHolder< CommonMessaging< implements< IAuditor, IProperty > > >
| Typedef used to refer to this class from derived classes, as in. More...
Public Types inherited from CommonMessaging< implements< IAuditor, IProperty > >
using | base_class = CommonMessaging
Protected Member Functions inherited from PropertyHolder< CommonMessaging< implements< IAuditor, IProperty > > >
Gaudi::Details::PropertyBase * | property (const std::string &name) const
Protected Member Functions inherited from CommonMessaging< implements< IAuditor, IProperty > >
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 200 of file PerfMonAuditor.cpp.

## Member Typedef Documentation

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

Definition at line 353 of file PerfMonAuditor.cpp.

## Constructor & Destructor Documentation

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

Definition at line 272 of file PerfMonAuditor.cpp.

272 : // standard constructor
273 Auditor(name, pSvc),
274 m_pfm(PFMon::instance()),
275 m_map(),
276 m_indent(0),
277 m_inEvent(false)
278 {
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 }
PerfMonAuditor::is_nehalem
int is_nehalem()
Definition: PerfMonAuditor.cpp:217
PerfMonAuditor::family
std::string family
Definition: PerfMonAuditor.cpp:376
PerfMonAuditor::inv
bool inv[MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS]
Definition: PerfMonAuditor.cpp:380
PropertyHolder< CommonMessaging< implements< IAuditor, IProperty > > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Details::PropertyBase &prop)
Declare a property.
Definition: PropertyHolder.h:99
boost::spirit
Definition: iter_pos.hpp:13
PerfMonAuditor::is_nehalem_ret
int is_nehalem_ret
Definition: PerfMonAuditor.cpp:359
PerfMonAuditor::event_str
std::string event_str[MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS]
Definition: PerfMonAuditor.cpp:374
Auditor::Auditor
Auditor(const std::string &name, ISvcLocator *svcloc)
Constructor.
Definition: Auditor.cpp:12
PerfMonAuditor::prefix
std::string prefix
Definition: PerfMonAuditor.cpp:375
PerfMonAuditor::m_map
Map m_map
Definition: PerfMonAuditor.cpp:354
PerfMonAuditor::m_indent
int m_indent
Definition: PerfMonAuditor.cpp:355
PerfMonAuditor::start_at_event
unsigned int start_at_event
Definition: PerfMonAuditor.cpp:382
PerfMonAuditor::sampling
bool sampling
Definition: PerfMonAuditor.cpp:390
PerfMonAuditor::m_inEvent
bool m_inEvent
Definition: PerfMonAuditor.cpp:356
PerfMonAuditor::cmask
unsigned int cmask[MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS]
Definition: PerfMonAuditor.cpp:381
PerfMonAuditor::m_pfm
PFMon & m_pfm
Definition: PerfMonAuditor.cpp:233

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

Definition at line 345 of file PerfMonAuditor.cpp.

345 {} // virtual destructor

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

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

## Member Function Documentation

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

Definition at line 1057 of file PerfMonAuditor.cpp.

1058 {
1059 switch(evt)
1060 {
1061 case IAuditor::Initialize:
1062 i_afterInitialize(alg);
1063 break;
1064 case IAuditor::Execute:
1065 i_afterExecute(alg);
1066 break;
1067 default:
1068 break;
1069 }
1070 return;
1071 }
PerfMonAuditor::i_afterExecute
void i_afterExecute(INamedInterface *alg)
Definition: PerfMonAuditor.cpp:1125
IAuditor::Initialize
Definition: IAuditor.h:25
IAuditor::Execute
Definition: IAuditor.h:25
PerfMonAuditor::i_afterInitialize
void i_afterInitialize(INamedInterface *alg)
Definition: PerfMonAuditor.cpp:1079
IOTest.evt
evt
Definition: IOTest.py:85

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

Definition at line 1041 of file PerfMonAuditor.cpp.

1042 {
1043 switch(evt)
1044 {
1045 case IAuditor::Initialize:
1046 i_beforeInitialize(alg);
1047 break;
1048 case IAuditor::Execute:
1049 i_beforeExecute(alg);
1050 break;
1051 default:
1052 break;
1053 }
1054 return;
1055 }
IAuditor::Initialize
Definition: IAuditor.h:25
IAuditor::Execute
Definition: IAuditor.h:25
PerfMonAuditor::i_beforeExecute
void i_beforeExecute(INamedInterface *alg)
Definition: PerfMonAuditor.cpp:1085
PerfMonAuditor::i_beforeInitialize
void i_beforeInitialize(INamedInterface *alg)
Definition: PerfMonAuditor.cpp:1073
IOTest.evt
evt
Definition: IOTest.py:85

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

Definition at line 392 of file PerfMonAuditor.cpp.

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

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

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

Reimplemented from Auditor.

Definition at line 1033 of file PerfMonAuditor.cpp.

1034 {
1035 if(sampling == 0) finalizepm();
1036 else finalize_smpl();
1037 return Auditor::finalize();
1038 }
Auditor::finalize
virtual StatusCode finalize()
Definition: Auditor.cpp:200
PerfMonAuditor::finalize_smpl
void finalize_smpl()
Definition: PerfMonAuditor.cpp:912
PerfMonAuditor::finalizepm
void finalizepm()
Definition: PerfMonAuditor.cpp:541
PerfMonAuditor::sampling
bool sampling
Definition: PerfMonAuditor.cpp:390

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

Definition at line 912 of file PerfMonAuditor.cpp.

913 {
914 char filename[MAX_OUTPUT_FILENAME_LENGTH];
915 bzero(filename, MAX_OUTPUT_FILENAME_LENGTH);
916 char to_cat[50];
917 gzFile outfile;
918 int err;
919 for(int i=0; i<used_counters_number; i++)
920 {
921 sprintf(filename, "%s_%s", prefix_cstr, event_cstr[i]);
922 for(int j=0; j<(int)strlen(filename); j++)
923 {
924 if(filename[j]==':')
925 {
926 filename[j]='-';
927 }
928 }
929 bzero(to_cat, 50);
930 if(inv[i])
931 {
932 strcpy(to_cat, "_INV_1");
933 }
934 if(cmask[i]>0)
935 {
936 sprintf(to_cat, "%s_CMASK_%d", to_cat, cmask[i]);
937 }
938 sprintf(filename, "%s%s.txt.gz", filename, to_cat);
939 outfile = gzopen(filename, "wb");
940 if(outfile!=NULL)
941 {
942 if(nehalem)
943 {
944 gzprintf(outfile, "NHM ");
945 }
946 else if(westmere)
947 {
948 gzprintf(outfile, "WSM ");
949 }
950 else if(core)
951 {
952 gzprintf(outfile, "CORE ");
953 }
954 if(gzprintf(outfile, "%s %d %d %d\n", event_cstr[i], cmask[i], inv[i], sp[i]) < (int)strlen(event_cstr[i]))
955 {
956 error() << "ERROR: gzputs err: " << gzerror(outfile, &err) << ". Aborting..." << endmsg;
957 }
958 for(std::map<std::string, std::map<unsigned long, unsigned int> >::iterator it=samples[i].begin(); it!=samples[i].end(); it++)
959 {
960 unsigned long long sum = 0;
961 for(std::map<unsigned long, unsigned int>::iterator jt=(it->second).begin(); jt!=(it->second).end(); jt++)
962 {
963 sum += jt->second;
964 }
965 if(gzprintf(outfile, "%s%%%llu\n", (it->first).c_str(), sum) < (int)((it->first).length()))
966 {
967 error() << "ERROR: gzputs err: " << gzerror(outfile, &err) << ". Aborting..." << endmsg;
968 }
969 for(std::map<unsigned long, unsigned int>::iterator jt=(it->second).begin(); jt!=(it->second).end(); jt++)
970 {
971 char sym_name[SYM_NAME_MAX_LENGTH];
972 bzero(sym_name, SYM_NAME_MAX_LENGTH);
973 const char *libName;
974 const char *symbolName;
975 int libOffset = 0;
976 int offset = 0;
977 void *sym_addr = IgHookTrace::tosymbol((void *)(jt->first));
978 if(sym_addr != NULL)
979 {
980 bool success = IgHookTrace::symbol(sym_addr, symbolName, libName, offset, libOffset);
981 if(success)
982 {
983 if(symbolName!=NULL && strlen(symbolName)>0)
984 {
985 strcpy(sym_name, symbolName);
986 strcat(sym_name, " ");
987 }
988 else
989 {
990 strcpy(sym_name, "??? ");
991 }
992 if(libName!=NULL && strlen(libName)>0)
993 {
994 strcat(sym_name, libName);
995 strcat(sym_name, " ");
996 }
997 else
998 {
999 strcat(sym_name, "??? ");
1000 }
1001 sprintf(sym_name, "%s%d ", sym_name, libOffset);
1002 if(strlen(sym_name)<=0)
1003 {
1004 error() << "ERROR: Symbol name length is zero. Aborting..." << endmsg;
1005 }
1006 }
1007 else
1008 {
1009 strcpy(sym_name,"??? ??? 0 ");
1010 }
1011 }
1012 else
1013 {
1014 strcpy(sym_name,"??? ??? 0 ");
1015 }
1016 if(gzprintf(outfile, "%s %d\n", sym_name, jt->second) < (int)strlen(sym_name))
1017 {
1018 error() << "ERROR: gzputs err: " << gzerror(outfile, &err) << endmsg;
1019 }
1020 }
1021 }
1022 }
1023 else
1024 {
1025 error() << "ERROR: Could not open file: " << filename << ". Aborting..." << endmsg;
1026 }
1027 gzclose(outfile);
1028 }
1029 }
std::strcat
T strcat(T...args)
IgHookTrace::tosymbol
static void * tosymbol(void *address)
Definition: IgHook_IgHookTrace.cpp:263
sum
double sum(double x, double y, double z)
Definition: 3DoubleFuncTest.cpp:25
PerfMonAuditor::inv
bool inv[MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS]
Definition: PerfMonAuditor.cpp:380
SYM_NAME_MAX_LENGTH
#define SYM_NAME_MAX_LENGTH
Definition: PerfMonAuditor.cpp:71
MAX_OUTPUT_FILENAME_LENGTH
#define MAX_OUTPUT_FILENAME_LENGTH
Definition: PerfMonAuditor.cpp:72
graphanalysis.filename
string filename
Definition: graphanalysis.py:109
boost::spirit
Definition: iter_pos.hpp:13
std::map
STL class.
CommonMessagingBase::err
MsgStream & err() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:114
begin
auto begin(reverse_wrapper< T > &w)
Definition: reverse.h:48
std::string
STL class.
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:117
std::strlen
T strlen(T...args)
PerfMonAuditor::used_counters_number
int used_counters_number
Definition: PerfMonAuditor.cpp:385
IgHookTrace::symbol
static bool symbol(void *address, const char *&sym, const char *&lib, int &offset, int &liboffset)
Definition: IgHook_IgHookTrace.cpp:227
PerfMonAuditor::event_cstr
char event_cstr[MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS][MAX_EVENT_NAME_LENGTH]
Definition: PerfMonAuditor.cpp:377
end
auto end(reverse_wrapper< T > &w)
Definition: reverse.h:50
PerfMonAuditor::prefix_cstr
char prefix_cstr[MAX_PREFIX_NAME_LENGTH]
Definition: PerfMonAuditor.cpp:378
std::strcpy
T strcpy(T...args)
PerfMonAuditor::i
unsigned int i
Definition: PerfMonAuditor.cpp:368
std::map::begin
T begin(T...args)
PerfMonAuditor::westmere
bool westmere
Definition: PerfMonAuditor.cpp:387
PerfMonAuditor::cmask
unsigned int cmask[MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS]
Definition: PerfMonAuditor.cpp:381
std::sprintf
T sprintf(T...args)
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
PerfMonAuditor::nehalem
bool nehalem
Definition: PerfMonAuditor.cpp:386
PerfMonAuditor::core
bool core
Definition: PerfMonAuditor.cpp:388

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

Definition at line 541 of file PerfMonAuditor.cpp.

542 {
543 info() << "start of finalizepm ucn:" << used_counters_number << endmsg;
544 char filename[MAX_OUTPUT_FILENAME_LENGTH];
545 char to_cat[50];
546 FILE *outfile;
547 for(int i=0; i<used_counters_number; i++)
548 {
549 bzero(filename, MAX_OUTPUT_FILENAME_LENGTH);
550 sprintf(filename, "%s_%s", prefix_cstr, event_cstr[i]);
551 for(int j=0; j<(int)strlen(filename); j++)
552 {
553 if(filename[j]==':')
554 {
555 filename[j]='-';
556 }
557 }
558 bzero(to_cat, 50);
559 if(inv[i])
560 {
561 strcpy(to_cat, "_INV_1");
562 }
563 if(cmask[i]>0)
564 {
565 sprintf(to_cat, "%s_CMASK_%d", to_cat, cmask[i]);
566 }
567 sprintf(filename, "%s%s.txt", filename, to_cat);
568 info() << "Filename:" << filename << endmsg;
569 outfile = fopen(filename, "w");
570 if(nehalem)
571 {
572 fprintf(outfile, "NHM ");
573 }
574 else if(westmere)
575 {
576 fprintf(outfile, "WSM ");
577 }
578 else if(core)
579 {
580 fprintf(outfile, "CORE ");
581 }
582 fprintf(outfile, "%s %d %d %d\n", event_cstr[i], cmask[i], inv[i], sp[i]);
583 for(std::map<std::string, std::vector<unsigned long int> >::iterator it=(results[i]).begin(); it!=(results[i]).end(); it++)
584 {
585 fprintf(outfile, "%s\n", (it->first).c_str());
586 for(std::vector<unsigned long int>::iterator j=(it->second).begin(); j!=(it->second).end(); j++)
587 {
588 fprintf(outfile, "%lu\n", *j);
589 }
590 }
591 fclose(outfile);
592 }
593 }
CommonMessagingBase::info
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
Definition: CommonMessaging.h:123
PerfMonAuditor::inv
bool inv[MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS]
Definition: PerfMonAuditor.cpp:380
MAX_OUTPUT_FILENAME_LENGTH
#define MAX_OUTPUT_FILENAME_LENGTH
Definition: PerfMonAuditor.cpp:72
graphanalysis.filename
string filename
Definition: graphanalysis.py:109
boost::spirit
Definition: iter_pos.hpp:13
std::map
STL class.
begin
auto begin(reverse_wrapper< T > &w)
Definition: reverse.h:48
std::fclose
T fclose(T...args)
std::string
STL class.
std::strlen
T strlen(T...args)
std::fopen
T fopen(T...args)
PerfMonAuditor::used_counters_number
int used_counters_number
Definition: PerfMonAuditor.cpp:385
PerfMonAuditor::event_cstr
char event_cstr[MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS][MAX_EVENT_NAME_LENGTH]
Definition: PerfMonAuditor.cpp:377
end
auto end(reverse_wrapper< T > &w)
Definition: reverse.h:50
PerfMonAuditor::prefix_cstr
char prefix_cstr[MAX_PREFIX_NAME_LENGTH]
Definition: PerfMonAuditor.cpp:378
std::strcpy
T strcpy(T...args)
PerfMonAuditor::i
unsigned int i
Definition: PerfMonAuditor.cpp:368
std::vector
STL class.
std::vector::begin
T begin(T...args)
PerfMonAuditor::westmere
bool westmere
Definition: PerfMonAuditor.cpp:387
PerfMonAuditor::cmask
unsigned int cmask[MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS]
Definition: PerfMonAuditor.cpp:381
std::sprintf
T sprintf(T...args)
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
PerfMonAuditor::nehalem
bool nehalem
Definition: PerfMonAuditor.cpp:386
PerfMonAuditor::core
bool core
Definition: PerfMonAuditor.cpp:388

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

Definition at line 1125 of file PerfMonAuditor.cpp.

1126 {
1127 if(!alg) {
1128 return;
1129 }// info() << "after:inside! " << alg->name() << endmsg;
1130
1131 if(event_count_reached) {
1132 //info() << "after:inside! " << alg->name() << endmsg;
1133
1134 if(sampling == 0) stoppm();
1135 else stop_smpl();
1136 alg_stack.pop();
1137 --m_indent;
1138 if(!alg_stack.empty())
1139 {
1140 if(sampling == 0) startpm();
1141 else start_smpl(); //resuming father algorithm counting
1142 }
1143 }
1144 }
PerfMonAuditor::stop_smpl
void stop_smpl()
Definition: PerfMonAuditor.cpp:894
PerfMonAuditor::startpm
void startpm()
Definition: PerfMonAuditor.cpp:419
PerfMonAuditor::stoppm
void stoppm()
Definition: PerfMonAuditor.cpp:505
PerfMonAuditor::m_indent
int m_indent
Definition: PerfMonAuditor.cpp:355
PerfMonAuditor::event_count_reached
bool event_count_reached
Definition: PerfMonAuditor.cpp:414
PerfMonAuditor::start_smpl
void start_smpl()
Definition: PerfMonAuditor.cpp:747
PerfMonAuditor::sampling
bool sampling
Definition: PerfMonAuditor.cpp:390

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

Definition at line 1079 of file PerfMonAuditor.cpp.

1080 {
1081 if(!alg) return;
1082 return;
1083 }

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

Definition at line 1085 of file PerfMonAuditor.cpp.

1086 {
1087 if(!alg) return;
1088 //info() << "before:inside! " << alg->name() << endmsg;
1089 if(first_alg)
1090 {
1091 first_alg = false;
1092 first_alg_name = alg->name();
1093 //info() << "first_alg_name= " << alg->name() << endmsg;
1094 }
1095 if(!event_count_reached)
1096 {
1097 if(!first_alg_name.compare(alg->name()))
1098 {
1099 ph_ev_count++;
1100 //info() << "EVENT COUNT: " << ph_ev_count << endmsg;
1101 if(ph_ev_count==start_at_event)
1102 {
1103 event_count_reached = true;
1104 //info() << "!!! EVENT COUNT REACHED: " << ph_ev_count << endmsg;
1105 }
1106 }
1107 }
1108 if(event_count_reached)
1109 {
1110 //info() << "before:inside! " << alg->name() << endmsg;
1111
1112 if(!alg_stack.empty())
1113 {
1114 if(sampling == 0) pausepm(); //pausing father algorithm counting
1115 else stop_smpl();
1116 }
1117 ++m_indent;
1118 std::vector <unsigned long int> zeroes(4,0);
1119 alg_stack.push(std::make_pair(alg, zeroes));
1120 if(sampling == 0) startpm();
1121 else start_smpl();
1122 }
1123 }
PerfMonAuditor::stop_smpl
void stop_smpl()
Definition: PerfMonAuditor.cpp:894
PerfMonAuditor::startpm
void startpm()
Definition: PerfMonAuditor.cpp:419
PerfMonAuditor::pausepm
void pausepm()
Definition: PerfMonAuditor.cpp:521
PerfMonAuditor::first_alg_name
std::string first_alg_name
Definition: PerfMonAuditor.cpp:413
std::make_pair
T make_pair(T...args)
PerfMonAuditor::m_indent
int m_indent
Definition: PerfMonAuditor.cpp:355
PerfMonAuditor::ph_ev_count
unsigned int ph_ev_count
Definition: PerfMonAuditor.cpp:379
std::vector
STL class.
PerfMonAuditor::event_count_reached
bool event_count_reached
Definition: PerfMonAuditor.cpp:414
PerfMonAuditor::start_smpl
void start_smpl()
Definition: PerfMonAuditor.cpp:747
PerfMonAuditor::start_at_event
unsigned int start_at_event
Definition: PerfMonAuditor.cpp:382
PerfMonAuditor::sampling
bool sampling
Definition: PerfMonAuditor.cpp:390
PerfMonAuditor::first_alg
bool first_alg
Definition: PerfMonAuditor.cpp:412
INamedInterface::name
virtual const std::string & name() const =0
Retrieve the name of the instance.
std::string::compare
T compare(T...args)

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

Definition at line 1073 of file PerfMonAuditor.cpp.

1074 {
1075 if(!alg) return;
1076 return;
1077 }

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

Reimplemented from Auditor.

Definition at line 595 of file PerfMonAuditor.cpp.

596 {
597 if (!m_pfm.loaded) {
598 error() << "pfm library could not be loaded" << endmsg;
599 return false;
600 }
601
602 info() << "Initializing..." << endmsg;
603 StatusCode sc = Auditor::initialize() ;
604 if(sc.isFailure())
605 {
606 return sc;
607 }
608 used_counters_number = 0;
609 for(int i=0; i<MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS; i++)
610 {
611 if(event_str[i].length()>0) used_counters_number++;
612 }
613 for(int i=0; i<MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS; i++)
614 {
615 strcpy(event_cstr[i], event_str[i].c_str());
616 }
617 strcpy(prefix_cstr, prefix.c_str());
618
619 if(m_pfm.pfm_initialize() != PFMLIB_SUCCESS)
620 {
621 error() << "Cannot initialize perfmon!!" << endmsg;
622 }
623 ph_ev_count = 0;
624 first_alg = true;
625 event_count_reached = false;
626 nehalem = false;
627 core = false;
628 westmere = false;
629 if(family.compare("CORE")==0) core = true;
630 else if(family.compare("NEHALEM")==0) nehalem = true;
631 else if(family.compare("WESTMERE")==0) westmere = true;
632 else
633 {
634 error() << "ERROR: Unsupported processor family " << family << ". aborting..." << endmsg;
635 }
636
637 info() << "Initialized!" << endmsg;
638 return StatusCode::SUCCESS ;
639 }
StatusCode::SUCCESS
Definition: StatusCode.h:30
PerfMonAuditor::family
std::string family
Definition: PerfMonAuditor.cpp:376
CommonMessagingBase::info
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
Definition: CommonMessaging.h:123
PFMLIB_SUCCESS
#define PFMLIB_SUCCESS
Definition: pfmlib.h:283
StatusCode::isFailure
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:84
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:117
PerfMonAuditor::event_str
std::string event_str[MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS]
Definition: PerfMonAuditor.cpp:374
PerfMonAuditor::prefix
std::string prefix
Definition: PerfMonAuditor.cpp:375
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
PerfMonAuditor::used_counters_number
int used_counters_number
Definition: PerfMonAuditor.cpp:385
PerfMonAuditor::event_cstr
char event_cstr[MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS][MAX_EVENT_NAME_LENGTH]
Definition: PerfMonAuditor.cpp:377
PerfMonAuditor::prefix_cstr
char prefix_cstr[MAX_PREFIX_NAME_LENGTH]
Definition: PerfMonAuditor.cpp:378
std::strcpy
T strcpy(T...args)
PerfMonAuditor::i
unsigned int i
Definition: PerfMonAuditor.cpp:368
PerfMonAuditor::ph_ev_count
unsigned int ph_ev_count
Definition: PerfMonAuditor.cpp:379
PerfMonAuditor::event_count_reached
bool event_count_reached
Definition: PerfMonAuditor.cpp:414
std::string::c_str
T c_str(T...args)
PerfMonAuditor::westmere
bool westmere
Definition: PerfMonAuditor.cpp:387
Auditor::initialize
virtual StatusCode initialize()
Definition: Auditor.cpp:70
PerfMonAuditor::first_alg
bool first_alg
Definition: PerfMonAuditor.cpp:412
MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS
#define MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS
Definition: PerfMonAuditor.cpp:77
PerfMonAuditor::m_pfm
PFMon & m_pfm
Definition: PerfMonAuditor.cpp:233
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
std::string::compare
T compare(T...args)
PerfMonAuditor::nehalem
bool nehalem
Definition: PerfMonAuditor.cpp:386
PerfMonAuditor::core
bool core
Definition: PerfMonAuditor.cpp:388

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

Definition at line 217 of file PerfMonAuditor.cpp.

217 {
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 }
gaudirun.c
c
Definition: gaudirun.py:391
cpuid
#define cpuid(func, ax, bx, cx, dx)
Definition: PerfMonAuditor.cpp:79

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

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

Definition at line 521 of file PerfMonAuditor.cpp.

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 }
PerfMonAuditor::inp
pfmlib_input_param_t inp
Definition: PerfMonAuditor.cpp:361
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:117
PerfMonAuditor::used_counters_number
int used_counters_number
Definition: PerfMonAuditor.cpp:385
PerfMonAuditor::pd
pfarg_pmd_t pd[NUM_PMDS]
Definition: PerfMonAuditor.cpp:364
PerfMonAuditor::i
unsigned int i
Definition: PerfMonAuditor.cpp:368
PerfMonAuditor::fd
int fd
Definition: PerfMonAuditor.cpp:367
PerfMonAuditor::m_pfm
PFMon & m_pfm
Definition: PerfMonAuditor.cpp:233
pfarg_pmd_t::reg_value
uint64_t reg_value
Definition: perfmon_v2.h:42
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
pfmlib_input_param_t::pfp_event_count
unsigned int pfp_event_count
Definition: pfmlib.h:109

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

Definition at line 395 of file PerfMonAuditor.cpp.

395 {if(n<=BPL) *d = *j; else {memcpy(d, j, (n>>LBPL)*sizeof(uint64_t));}}
uint64_t
unsigned long long uint64_t
Definition: instrset.h:144
GaudiPluginService.cpluginsvc.n
n
Definition: cpluginsvc.py:217
std::memcpy
T memcpy(T...args)
LBPL
#define LBPL
Definition: PerfMonAuditor.cpp:69
BPL
#define BPL
Definition: PerfMonAuditor.cpp:68

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

Definition at line 394 of file PerfMonAuditor.cpp.

394 {return bv[rnum>>LBPL] & (1UL <<(rnum&(BPL-1))) ? 1 : 0;}
LBPL
#define LBPL
Definition: PerfMonAuditor.cpp:69
BPL
#define BPL
Definition: PerfMonAuditor.cpp:68

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

Definition at line 393 of file PerfMonAuditor.cpp.

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

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

Definition at line 645 of file PerfMonAuditor.cpp.

646 {
648 pfm_dfl_smpl_entry_t *ent;
649 size_t pos, count;
650 uint64_t entry;
651 if(hdr->hdr_overflows == last_overflow && hdr->hdr_count == last_count)
652 {
653 printf("skipping identical set of samples...\n");
654 return;
655 }
656 count = hdr->hdr_count;
657 ent = (pfm_dfl_smpl_entry_t *)(hdr+1);
658 pos = (unsigned long)ent;
659 entry = collected_samples;
660 while(count--)
661 {
662 //if(ent->ovfl_pmd>=0 && ent->ovfl_pmd<=3)
663 if(ent->ovfl_pmd<=3)
664 {
665 ((samples[ent->ovfl_pmd])[(alg_stack.top().first)->name()])[(unsigned long)(ent->ip)]++;
666 }
667 pos += entry_size;
668 ent = (pfm_dfl_smpl_entry_t *)pos;
669 entry++;
670 }
671 collected_samples = entry;
672 last_overflow = hdr->hdr_overflows;
673 if (last_count != hdr->hdr_count && (last_count || last_overflow == 0))
674 {
675 collected_partial += hdr->hdr_count;
676 }
677 last_count = hdr->hdr_count;
678 return;
679 }
pfm_dfl_smpl_hdr_t::hdr_overflows
uint64_t hdr_overflows
Definition: perfmon_dfl_smpl.h:49
uint64_t
unsigned long long uint64_t
Definition: instrset.h:144
pfm_dfl_smpl_entry_t::ovfl_pmd
uint16_t ovfl_pmd
Definition: perfmon_dfl_smpl.h:70
pfm_dfl_smpl_entry_t::ip
uint64_t ip
Definition: perfmon_dfl_smpl.h:73
pfm_dfl_smpl_entry_t
Definition: perfmon_dfl_smpl.h:68
std::count
T count(T...args)
pfm_dfl_smpl_hdr_t::hdr_count
uint64_t hdr_count
Definition: perfmon_dfl_smpl.h:47
std::printf
T printf(T...args)
Auditor::name
const std::string & name() const override
Definition: Auditor.cpp:202

void PerfMonAuditor::sigio_handler | ( | int | ,
|  | struct siginfo * | ,
|  | struct sigcontext * |
| ) |  |
| static private

Definition at line 686 of file PerfMonAuditor.cpp.

687 {
688 PFMon& pfm = PFMon::instance();
689 pfarg_msg_t msg;
690 int fd = ctx_fd;
691 int r;
692 if(fd != ctx_fd)
693 {
694 //error() << "ERROR: handler does not get valid file descriptor. Aborting..." << endmsg;
695 }
696 if(pfm.pfm_read_pmds(fd, pd_smpl+1, 1) == -1)
697 {
698 //error() << "ERROR: pfm_read_pmds: " << strerror(errno) << ". Aborting..." << endmsg;
699 }
700 while(true)
701 {
702 r = read(fd, &msg, sizeof(msg));
703 if(r!=sizeof(msg))
704 {
705 if(r==-1 && errno==EINTR)
706 {
707 printf("read interrupted, retrying\n");
708 continue;
709 }
710 //error() << "ERROR: cannot read overflow message: " << strerror(errno) << ". Aborting..." << endmsg;
711 }
712 break;
713 }
714 switch(msg.type)
715 {
716 case PFM_MSG_OVFL: // the sampling buffer is full
717 process_smpl_buf(hdr, entry_size);
718 ovfl_count++;
719 if(pfm.pfm_restart(fd))
720 {
721 if(errno!=EBUSY)
722 {
723 //error() << "ERROR: pfm_restart error errno " << errno << ". Aborting..." << endmsg;
724 }
725 else
726 {
727 printf("pfm_restart: task probably terminated \n");
728 }
729 }
730 break;
731 default:
732 //error() << "ERROR: unknown message type " << msg.type << ". Aborting..." << endmsg;
733 break;
734 }
735
736 }
CommonMessagingBase::msg
MsgStream & msg() const
shortcut for the method msgStream(MSG::INFO)
Definition: CommonMessaging.h:132
hivetimeline.read
def read(f, regex='.*', skipevents=0)
Definition: hivetimeline.py:19
pfarg_msg_t::type
uint32_t type
Definition: perfmon.h:209
PerfMonAuditor::process_smpl_buf
static void process_smpl_buf(pfm_dfl_smpl_hdr_t *hdr, size_t entry_size)
Definition: PerfMonAuditor.cpp:645
pfarg_msg_t
Definition: perfmon.h:208
PerfMonAuditor::fd
int fd
Definition: PerfMonAuditor.cpp:367
PFM_MSG_OVFL
#define PFM_MSG_OVFL
Definition: perfmon.h:213
std::printf
T printf(T...args)

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

Definition at line 747 of file PerfMonAuditor.cpp.

748 {
749 ovfl_count = 0;
750 num_smpl_pmds = 0;
751 last_overflow = ~0;
752 max_pmd = 0;
753 memset(&pfmlib_options, 0, sizeof(pfmlib_options));
754 pfmlib_options.pfm_debug = 0;
755 pfmlib_options.pfm_verbose = 0;
756 m_pfm.pfm_set_options(&pfmlib_options);
757 ret = m_pfm.pfm_initialize();
758 if(ret != PFMLIB_SUCCESS)
759 {
760 error() << "ERROR: Cannot initialize library: " << m_pfm.pfm_strerror(ret) << ". Aborting..." << endmsg;
761 }
762 struct sigaction act;
763 memset(&act, 0, sizeof(act));
764 act.sa_handler = (sig_t)sigio_handler; // dlopen() ==>
765 //act.sa_handler = (sig_t)&sigio_handler;
766 sigaction(SIGIO, &act, 0);
767 memset(&ctx, 0, sizeof(ctx));
768 memset(&buf_arg, 0, sizeof(buf_arg));
769 memset(&inp,0, sizeof(inp));
770 memset(&outp,0, sizeof(outp));
771 memset(pd_smpl, 0, sizeof(pd_smpl));
772 memset(pc, 0, sizeof(pc));
773 memset(&load_args, 0, sizeof(load_args));
774 m_pfm.pfm_get_num_counters(&num_counters);
775 memset(&params, 0, sizeof(params));
776 memset(&nhm_params, 0, sizeof(nhm_params));
777
778 for(int i=0; i<used_counters_number; i++)
779 {
780 ret = m_pfm.pfm_find_full_event(event_cstr[i], &inp.pfp_events[i]);
781 if(ret != PFMLIB_SUCCESS)
782 {
783 error() << "ERROR: cannot find event: " << event_cstr[i] << ". Aborting..." << endmsg;
784 }
785 }
786 inp.pfp_dfl_plm = PFM_PLM3;
787 inp.pfp_event_count = 4;
788 for(int i=0; i<used_counters_number; i++)
789 {
790 if(inv[i])
791 {
792 (params.pfp_core_counters[i]).flags |= PFM_CORE_SEL_INV;
793 (nhm_params.pfp_nhm_counters[i]).flags |= PFM_NHM_SEL_INV;
794 }
795 if(cmask[i]>0)
796 {
797 (params.pfp_core_counters[i]).cnt_mask = cmask[i];
798 (nhm_params.pfp_nhm_counters[i]).cnt_mask = cmask[i];
799 }
800 }
801 if(nehalem || westmere)
802 {
803 ret = m_pfm.pfm_dispatch_events(&inp, &nhm_params, &outp, NULL);
804 }
805 else
806 {
807 ret = m_pfm.pfm_dispatch_events(&inp, &params, &outp, NULL);
808 }
809 if(ret != PFMLIB_SUCCESS)
810 {
811 error() << "ERROR: cannot configure events: " << m_pfm.pfm_strerror(ret) << ". Aborting..." << endmsg;
812 }
813 for(unsigned int i=0; i<outp.pfp_pmc_count; i++)
814 {
815 pc[i].reg_num = outp.pfp_pmcs[i].reg_num;
816 pc[i].reg_value = outp.pfp_pmcs[i].reg_value;
817 }
818 for(unsigned int i=0; i<outp.pfp_pmd_count; i++)
819 {
820 pd_smpl[i].reg_num = outp.pfp_pmds[i].reg_num;
821 if(i)
822 {
823 pfm_bv_set(pd_smpl[0].reg_smpl_pmds, pd_smpl[i].reg_num);
824 if(pd_smpl[i].reg_num>max_pmd)
825 {
826 max_pmd = pd_smpl[i].reg_num;
827 }
828 num_smpl_pmds++;
829 }
830 }
831 for(int i=0; i<used_counters_number; i++)
832 {
833 pd_smpl[i].reg_flags |= PFM_REGFL_OVFL_NOTIFY | PFM_REGFL_RANDOM;
834 pfm_bv_copy(pd_smpl[i].reg_reset_pmds, pd_smpl[i].reg_smpl_pmds, max_pmd);
835 pd_smpl[i].reg_value = (uint64_t)(sp[i] * -1);
836 pd_smpl[i].reg_short_reset = (uint64_t)(sp[i] * -1);
837 pd_smpl[i].reg_long_reset = (uint64_t)(sp[i] * -1);
838 pd_smpl[i].reg_random_seed = 5; //tocheck
839 pd_smpl[i].reg_random_mask = 0xff; //tocheck
840 }
841 entry_size = sizeof(pfm_dfl_smpl_entry_t)+(num_smpl_pmds<<3);
842 ctx.ctx_flags = 0;
843 buf_arg.buf_size = 3*getpagesize()+512;
844 ctx_fd = m_pfm.pfm_create_context(&ctx, (char *)FMT_NAME, &buf_arg, sizeof(buf_arg));
845 if(ctx_fd==-1)
846 {
847 if(errno==ENOSYS)
848 {
849 error() << "ERROR: Your kernel does not have performance monitoring support! Aborting..." << endmsg;
850 }
851 error() << "ERROR: Can't create PFM context " << strerror(errno) << ". Aborting..." << endmsg;
852 }
853 buf_addr = mmap(NULL, (size_t)buf_arg.buf_size, PROT_READ, MAP_PRIVATE, ctx_fd, 0);
854 if(buf_addr==MAP_FAILED)
855 {
856 error() << "ERROR: cannot mmap sampling buffer: " << strerror(errno) << ". Aborting..." << endmsg;
857 }
858 hdr = (pfm_dfl_smpl_hdr_t *)buf_addr;
859 if(PFM_VERSION_MAJOR(hdr->hdr_version)<1)
860 {
861 error() << "ERROR: invalid buffer format version. Aborting..." << endmsg;
862 }
863 if(m_pfm.pfm_write_pmcs(ctx_fd, pc, outp.pfp_pmc_count))
864 {
865 error() << "ERROR: pfm_write_pmcs error errno " << strerror(errno) << ". Aborting..." << endmsg;
866 }
867 if(m_pfm.pfm_write_pmds(ctx_fd, pd_smpl, outp.pfp_pmd_count))
868 {
869 error() << "ERROR: pfm_write_pmds error errno " << strerror(errno) << ". Aborting..." << endmsg;
870 }
871 load_args.load_pid = getpid();
872 if(m_pfm.pfm_load_context(ctx_fd, &load_args))
873 {
874 error() << "ERROR: pfm_load_context error errno " << strerror(errno) << ". Aborting..." << endmsg;
875 }
876 ret = fcntl(ctx_fd, F_SETFL, fcntl(ctx_fd, F_GETFL, 0) | O_ASYNC);
877 if(ret == -1)
878 {
879 error() << "ERROR: cannot set ASYNC: " << strerror(errno) << ". Aborting..." << endmsg;
880 }
881 ret = fcntl(ctx_fd, F_SETOWN, getpid());
882 if(ret == -1)
883 {
884 error() << "ERROR: cannot setown: " << strerror(errno) << ". Aborting..." << endmsg;
885 }
886 //pfm_self_start(ctx_fd); ==>
887 m_pfm.pfm_start(ctx_fd, NULL);
888 }
pfmlib_output_param_t::pfp_pmds
pfmlib_reg_t pfp_pmds[PFMLIB_MAX_PMDS]
Definition: pfmlib.h:130
PerfMonAuditor::load_args
pfarg_load_t load_args
Definition: PerfMonAuditor.cpp:403
pfarg_pmd_t::reg_short_reset
uint64_t reg_short_reset
Definition: perfmon_v2.h:44
PerfMonAuditor::params
pfmlib_core_input_param_t params
Definition: PerfMonAuditor.cpp:383
PFM_REGFL_OVFL_NOTIFY
#define PFM_REGFL_OVFL_NOTIFY
Definition: perfmon.h:113
PFM_NHM_SEL_INV
#define PFM_NHM_SEL_INV
Definition: pfmlib_intel_nhm.h:103
pfm_dfl_smpl_arg_t::buf_size
uint64_t buf_size
Definition: perfmon_dfl_smpl.h:36
PFM_PLM3
#define PFM_PLM3
Definition: pfmlib.h:53
pfmlib_input_param_t::pfp_events
pfmlib_event_t pfp_events[PFMLIB_MAX_PMCS]
Definition: pfmlib.h:113
PFM_CORE_SEL_INV
#define PFM_CORE_SEL_INV
Definition: pfmlib_core.h:68
pfmlib_nhm_input_param_t::pfp_nhm_counters
pfmlib_nhm_counter_t pfp_nhm_counters[PMU_NHM_NUM_COUNTERS]
Definition: pfmlib_intel_nhm.h:140
std::strerror
T strerror(T...args)
PerfMonAuditor::inv
bool inv[MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS]
Definition: PerfMonAuditor.cpp:380
PFMLIB_SUCCESS
#define PFMLIB_SUCCESS
Definition: pfmlib.h:283
pfmlib_options_t::pfm_verbose
unsigned int pfm_verbose
Definition: pfmlib.h:139
pfmlib_input_param_t::pfp_dfl_plm
unsigned int pfp_dfl_plm
Definition: pfmlib.h:110
pfarg_pmd_t::reg_num
uint16_t reg_num
Definition: perfmon_v2.h:39
uint64_t
unsigned long long uint64_t
Definition: instrset.h:144
std::memset
T memset(T...args)
PerfMonAuditor::inp
pfmlib_input_param_t inp
Definition: PerfMonAuditor.cpp:361
pfmlib_output_param_t::pfp_pmc_count
unsigned int pfp_pmc_count
Definition: pfmlib.h:127
PerfMonAuditor::pfmlib_options
pfmlib_options_t pfmlib_options
Definition: PerfMonAuditor.cpp:407
boost::spirit
Definition: iter_pos.hpp:13
pfmlib_reg_t::reg_value
unsigned long long reg_value
Definition: pfmlib.h:98
pfmlib_output_param_t::pfp_pmd_count
unsigned int pfp_pmd_count
Definition: pfmlib.h:128
PerfMonAuditor::sigio_handler
static void sigio_handler(int, struct siginfo *, struct sigcontext *)
Definition: PerfMonAuditor.cpp:686
pfarg_pmd_t::reg_random_seed
uint32_t reg_random_seed
Definition: perfmon_v2.h:51
pfarg_pmd_t::reg_long_reset
uint64_t reg_long_reset
Definition: perfmon_v2.h:43
PerfMonAuditor::nhm_params
pfmlib_nhm_input_param_t nhm_params
Definition: PerfMonAuditor.cpp:384
PFM_VERSION_MAJOR
#define PFM_VERSION_MAJOR(x)
Definition: perfmon.h:216
pfarg_ctx_t::ctx_flags
uint32_t ctx_flags
Definition: perfmon_v2.h:19
PerfMonAuditor::pfm_bv_copy
void pfm_bv_copy(uint64_t *d, uint64_t *j, uint16_t n)
Definition: PerfMonAuditor.cpp:395
PerfMonAuditor::pfm_bv_set
void pfm_bv_set(uint64_t *bv, uint16_t rnum)
Definition: PerfMonAuditor.cpp:393
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:117
pfm_dfl_smpl_entry_t
Definition: perfmon_dfl_smpl.h:68
pfarg_pmd_t::reg_flags
uint32_t reg_flags
Definition: perfmon_v2.h:41
PerfMonAuditor::buf_addr
void * buf_addr
Definition: PerfMonAuditor.cpp:404
pfmlib_options_t::pfm_debug
unsigned int pfm_debug
Definition: pfmlib.h:138
pfm_dfl_smpl_hdr_t
Definition: perfmon_dfl_smpl.h:46
pfmlib_reg_t::reg_num
unsigned int reg_num
Definition: pfmlib.h:100
PerfMonAuditor::outp
pfmlib_output_param_t outp
Definition: PerfMonAuditor.cpp:362
pfarg_pmc_t::reg_num
uint16_t reg_num
Definition: perfmon_v2.h:28
PerfMonAuditor::used_counters_number
int used_counters_number
Definition: PerfMonAuditor.cpp:385
PerfMonAuditor::event_cstr
char event_cstr[MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS][MAX_EVENT_NAME_LENGTH]
Definition: PerfMonAuditor.cpp:377
pfarg_load_t::load_pid
uint32_t load_pid
Definition: perfmon_v2.h:69
PerfMonAuditor::i
unsigned int i
Definition: PerfMonAuditor.cpp:368
PerfMonAuditor::pc
pfarg_pmc_t pc[NUM_PMCS]
Definition: PerfMonAuditor.cpp:365
PerfMonAuditor::ctx
pfarg_ctx_t ctx
Definition: PerfMonAuditor.cpp:363
FMT_NAME
#define FMT_NAME
Definition: PerfMonAuditor.cpp:67
PerfMonAuditor::ret
int ret
Definition: PerfMonAuditor.cpp:369
PFM_REGFL_RANDOM
#define PFM_REGFL_RANDOM
Definition: perfmon.h:114
PerfMonAuditor::num_counters
unsigned num_counters
Definition: PerfMonAuditor.cpp:405
PerfMonAuditor::buf_arg
pfm_dfl_smpl_arg_t buf_arg
Definition: PerfMonAuditor.cpp:402
pfarg_pmc_t::reg_value
uint64_t reg_value
Definition: perfmon_v2.h:31
PerfMonAuditor::max_pmd
unsigned int max_pmd
Definition: PerfMonAuditor.cpp:406
PerfMonAuditor::westmere
bool westmere
Definition: PerfMonAuditor.cpp:387
pfmlib_output_param_t::pfp_pmcs
pfmlib_reg_t pfp_pmcs[PFMLIB_MAX_PMCS]
Definition: pfmlib.h:129
pfarg_pmd_t::reg_random_mask
uint64_t reg_random_mask
Definition: perfmon_v2.h:50
pfm_dfl_smpl_hdr_t::hdr_version
uint32_t hdr_version
Definition: perfmon_dfl_smpl.h:52
pfmlib_core_input_param_t::pfp_core_counters
pfmlib_core_counter_t pfp_core_counters[PMU_CORE_NUM_COUNTERS]
Definition: pfmlib_core.h:79
PerfMonAuditor::cmask
unsigned int cmask[MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS]
Definition: PerfMonAuditor.cpp:381
PerfMonAuditor::m_pfm
PFMon & m_pfm
Definition: PerfMonAuditor.cpp:233
pfarg_pmd_t::reg_value
uint64_t reg_value
Definition: perfmon_v2.h:42
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
pfmlib_input_param_t::pfp_event_count
unsigned int pfp_event_count
Definition: pfmlib.h:109
PerfMonAuditor::nehalem
bool nehalem
Definition: PerfMonAuditor.cpp:386

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

Definition at line 419 of file PerfMonAuditor.cpp.

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 }
pfmlib_output_param_t::pfp_pmds
pfmlib_reg_t pfp_pmds[PFMLIB_MAX_PMDS]
Definition: pfmlib.h:130
PerfMonAuditor::params
pfmlib_core_input_param_t params
Definition: PerfMonAuditor.cpp:383
PFM_NHM_SEL_INV
#define PFM_NHM_SEL_INV
Definition: pfmlib_intel_nhm.h:103
PFM_PLM3
#define PFM_PLM3
Definition: pfmlib.h:53
pfmlib_input_param_t::pfp_events
pfmlib_event_t pfp_events[PFMLIB_MAX_PMCS]
Definition: pfmlib.h:113
PFM_CORE_SEL_INV
#define PFM_CORE_SEL_INV
Definition: pfmlib_core.h:68
pfmlib_nhm_input_param_t::pfp_nhm_counters
pfmlib_nhm_counter_t pfp_nhm_counters[PMU_NHM_NUM_COUNTERS]
Definition: pfmlib_intel_nhm.h:140
PerfMonAuditor::inv
bool inv[MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS]
Definition: PerfMonAuditor.cpp:380
PFMLIB_SUCCESS
#define PFMLIB_SUCCESS
Definition: pfmlib.h:283
pfmlib_input_param_t::pfp_dfl_plm
unsigned int pfp_dfl_plm
Definition: pfmlib.h:110
pfarg_pmd_t::reg_num
uint16_t reg_num
Definition: perfmon_v2.h:39
std::memset
T memset(T...args)
PerfMonAuditor::inp
pfmlib_input_param_t inp
Definition: PerfMonAuditor.cpp:361
pfmlib_output_param_t::pfp_pmc_count
unsigned int pfp_pmc_count
Definition: pfmlib.h:127
pfmlib_reg_t::reg_value
unsigned long long reg_value
Definition: pfmlib.h:98
pfmlib_output_param_t::pfp_pmd_count
unsigned int pfp_pmd_count
Definition: pfmlib.h:128
PerfMonAuditor::nhm_params
pfmlib_nhm_input_param_t nhm_params
Definition: PerfMonAuditor.cpp:384
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:117
pfmlib_reg_t::reg_num
unsigned int reg_num
Definition: pfmlib.h:100
PerfMonAuditor::outp
pfmlib_output_param_t outp
Definition: PerfMonAuditor.cpp:362
pfarg_pmc_t::reg_num
uint16_t reg_num
Definition: perfmon_v2.h:28
PerfMonAuditor::used_counters_number
int used_counters_number
Definition: PerfMonAuditor.cpp:385
PerfMonAuditor::event_cstr
char event_cstr[MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS][MAX_EVENT_NAME_LENGTH]
Definition: PerfMonAuditor.cpp:377
PerfMonAuditor::pd
pfarg_pmd_t pd[NUM_PMDS]
Definition: PerfMonAuditor.cpp:364
pfarg_load_t::load_pid
uint32_t load_pid
Definition: perfmon_v2.h:69
PerfMonAuditor::i
unsigned int i
Definition: PerfMonAuditor.cpp:368
PerfMonAuditor::pc
pfarg_pmc_t pc[NUM_PMCS]
Definition: PerfMonAuditor.cpp:365
PerfMonAuditor::ctx
pfarg_ctx_t ctx
Definition: PerfMonAuditor.cpp:363
PerfMonAuditor::ret
int ret
Definition: PerfMonAuditor.cpp:369
pfarg_pmc_t::reg_value
uint64_t reg_value
Definition: perfmon_v2.h:31
PerfMonAuditor::westmere
bool westmere
Definition: PerfMonAuditor.cpp:387
pfmlib_output_param_t::pfp_pmcs
pfmlib_reg_t pfp_pmcs[PFMLIB_MAX_PMCS]
Definition: pfmlib.h:129
pfmlib_core_input_param_t::pfp_core_counters
pfmlib_core_counter_t pfp_core_counters[PMU_CORE_NUM_COUNTERS]
Definition: pfmlib_core.h:79
PerfMonAuditor::fd
int fd
Definition: PerfMonAuditor.cpp:367
PerfMonAuditor::cmask
unsigned int cmask[MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS]
Definition: PerfMonAuditor.cpp:381
PerfMonAuditor::load_arg
pfarg_load_t load_arg
Definition: PerfMonAuditor.cpp:366
PerfMonAuditor::m_pfm
PFMon & m_pfm
Definition: PerfMonAuditor.cpp:233
pfarg_pmd_t::reg_value
uint64_t reg_value
Definition: perfmon_v2.h:42
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
pfmlib_input_param_t::pfp_event_count
unsigned int pfp_event_count
Definition: pfmlib.h:109
PerfMonAuditor::nehalem
bool nehalem
Definition: PerfMonAuditor.cpp:386

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

Definition at line 894 of file PerfMonAuditor.cpp.

895 {
896 m_pfm.pfm_self_stop(ctx_fd);
897 process_smpl_buf(hdr, entry_size);
898 close(ctx_fd);
899 ret = munmap(hdr, (size_t)buf_arg.buf_size);
900 if(ret)
901 {
902 error() << "Cannot unmap buffer: %s" << strerror(errno) << endmsg;
903 }
904 return;
905 }
pfm_dfl_smpl_arg_t::buf_size
uint64_t buf_size
Definition: perfmon_dfl_smpl.h:36
std::strerror
T strerror(T...args)
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:117
PerfMonAuditor::process_smpl_buf
static void process_smpl_buf(pfm_dfl_smpl_hdr_t *hdr, size_t entry_size)
Definition: PerfMonAuditor.cpp:645
PerfMonAuditor::ret
int ret
Definition: PerfMonAuditor.cpp:369
PerfMonAuditor::buf_arg
pfm_dfl_smpl_arg_t buf_arg
Definition: PerfMonAuditor.cpp:402
PerfMonAuditor::m_pfm
PFMon & m_pfm
Definition: PerfMonAuditor.cpp:233
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

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

Definition at line 505 of file PerfMonAuditor.cpp.

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 }
PerfMonAuditor::inp
pfmlib_input_param_t inp
Definition: PerfMonAuditor.cpp:361
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:117
PerfMonAuditor::used_counters_number
int used_counters_number
Definition: PerfMonAuditor.cpp:385
PerfMonAuditor::pd
pfarg_pmd_t pd[NUM_PMDS]
Definition: PerfMonAuditor.cpp:364
PerfMonAuditor::i
unsigned int i
Definition: PerfMonAuditor.cpp:368
PerfMonAuditor::fd
int fd
Definition: PerfMonAuditor.cpp:367
PerfMonAuditor::m_pfm
PFMon & m_pfm
Definition: PerfMonAuditor.cpp:233
Auditor::name
const std::string & name() const override
Definition: Auditor.cpp:202
pfarg_pmd_t::reg_value
uint64_t reg_value
Definition: perfmon_v2.h:42
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
pfmlib_input_param_t::pfp_event_count
unsigned int pfp_event_count
Definition: pfmlib.h:109

## Member Data Documentation

void* PerfMonAuditor::buf_addr
| private

Definition at line 404 of file PerfMonAuditor.cpp.

pfm_dfl_smpl_arg_t PerfMonAuditor::buf_arg
| private

Definition at line 402 of file PerfMonAuditor.cpp.

unsigned int PerfMonAuditor::cmask[MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS]
| private

Definition at line 381 of file PerfMonAuditor.cpp.

bool PerfMonAuditor::core
| private

Definition at line 388 of file PerfMonAuditor.cpp.

pfarg_ctx_t PerfMonAuditor::ctx
| private

Definition at line 363 of file PerfMonAuditor.cpp.

bool PerfMonAuditor::event_count_reached
| private

Definition at line 414 of file PerfMonAuditor.cpp.

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

Definition at line 377 of file PerfMonAuditor.cpp.

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

Definition at line 374 of file PerfMonAuditor.cpp.

std::string PerfMonAuditor::family
| private

Definition at line 376 of file PerfMonAuditor.cpp.

int PerfMonAuditor::fd
| private

Definition at line 367 of file PerfMonAuditor.cpp.

bool PerfMonAuditor::first_alg
| private

Definition at line 412 of file PerfMonAuditor.cpp.

std::string PerfMonAuditor::first_alg_name
| private

Definition at line 413 of file PerfMonAuditor.cpp.

unsigned int PerfMonAuditor::i
| private

Definition at line 368 of file PerfMonAuditor.cpp.

pfmlib_input_param_t PerfMonAuditor::inp
| private

Definition at line 361 of file PerfMonAuditor.cpp.

bool PerfMonAuditor::inv[MAX_NUMBER_OF_PROGRAMMABLE_COUNTERS]
| private

Definition at line 380 of file PerfMonAuditor.cpp.

int PerfMonAuditor::is_nehalem_ret
| private

Definition at line 359 of file PerfMonAuditor.cpp.

int PerfMonAuditor::level
| private

Definition at line 410 of file PerfMonAuditor.cpp.

pfarg_load_t PerfMonAuditor::load_arg
| private

Definition at line 366 of file PerfMonAuditor.cpp.

pfarg_load_t PerfMonAuditor::load_args
| private

Definition at line 403 of file PerfMonAuditor.cpp.

int PerfMonAuditor::m_indent
| private

Definition at line 355 of file PerfMonAuditor.cpp.

bool PerfMonAuditor::m_inEvent
| private

Definition at line 356 of file PerfMonAuditor.cpp.

Map PerfMonAuditor::m_map
| private

Definition at line 354 of file PerfMonAuditor.cpp.

PFMon& PerfMonAuditor::m_pfm
| private

Definition at line 233 of file PerfMonAuditor.cpp.

unsigned int PerfMonAuditor::max_pmd
| private

Definition at line 406 of file PerfMonAuditor.cpp.

bool PerfMonAuditor::nehalem
| private

Definition at line 386 of file PerfMonAuditor.cpp.

pfmlib_nhm_input_param_t PerfMonAuditor::nhm_params
| private

Definition at line 384 of file PerfMonAuditor.cpp.

unsigned PerfMonAuditor::num_counters
| private

Definition at line 405 of file PerfMonAuditor.cpp.

pfmlib_output_param_t PerfMonAuditor::outp
| private

Definition at line 362 of file PerfMonAuditor.cpp.

pfmlib_core_input_param_t PerfMonAuditor::params
| private

Definition at line 383 of file PerfMonAuditor.cpp.

pfarg_pmc_t PerfMonAuditor::pc[NUM_PMCS]
| private

Definition at line 365 of file PerfMonAuditor.cpp.

pfarg_pmd_t PerfMonAuditor::pd[NUM_PMDS]
| private

Definition at line 364 of file PerfMonAuditor.cpp.

pfmlib_options_t PerfMonAuditor::pfmlib_options
| private

Definition at line 407 of file PerfMonAuditor.cpp.

unsigned int PerfMonAuditor::ph_ev_count
| private

Definition at line 379 of file PerfMonAuditor.cpp.

std::string PerfMonAuditor::prefix
| private

Definition at line 375 of file PerfMonAuditor.cpp.

char PerfMonAuditor::prefix_cstr[MAX_PREFIX_NAME_LENGTH]
| private

Definition at line 378 of file PerfMonAuditor.cpp.

int PerfMonAuditor::ret
| private

Definition at line 369 of file PerfMonAuditor.cpp.

bool PerfMonAuditor::sampling
| private

Definition at line 390 of file PerfMonAuditor.cpp.

unsigned int PerfMonAuditor::start_at_event
| private

Definition at line 382 of file PerfMonAuditor.cpp.

int PerfMonAuditor::used_counters_number
| private

Definition at line 385 of file PerfMonAuditor.cpp.

bool PerfMonAuditor::westmere
| private

Definition at line 387 of file PerfMonAuditor.cpp.

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

- GaudiProfiling/src/component/PerfMonAuditor.cpp