PlasCom2  1.0
XPACC Multi-physics simluation application
Profiler.C
Go to the documentation of this file.
1 #include <cmath>
7 #include <iomanip>
8 
9 #include "Profiler.H"
10 #include "primitive_utilities.H"
11 
12 namespace ix {
13  namespace profiler {
14 
18  inline struct timeval
19  operator-(const struct timeval &t1, const struct timeval &t2)
20  {
21  struct timeval rtv;
22  rtv.tv_usec = t1.tv_usec - t2.tv_usec;
23  rtv.tv_sec = t1.tv_sec - t2.tv_sec;
24  return(rtv);
25  }
26 
30  inline struct timeval &
31  operator-=(struct timeval &t1,const struct timeval &t2)
32  {
33  t1.tv_usec -= t2.tv_usec;
34  t1.tv_sec -= t2.tv_sec;
35  return(t1);
36  }
37 
41  inline struct timeval
42  operator+(const struct timeval &t1,const struct timeval &t2)
43  {
44  struct timeval rtv;
45  rtv.tv_usec = t1.tv_usec + t2.tv_usec;
46  rtv.tv_sec = t1.tv_sec + t2.tv_sec;
47  return(rtv);
48  }
49 
53  inline struct timeval &
54  operator+=(struct timeval &t1,const struct timeval &t2)
55  {
56  t1.tv_usec += t2.tv_usec;
57  t1.tv_sec += t2.tv_sec;
58  return(t1);
59  }
60 
64  inline bool
65  operator==(const struct timeval &t1,const struct timeval &t2)
66  {
67  return((t1.tv_sec + (t1.tv_usec/1000000.0)) ==
68  (t2.tv_sec + (t2.tv_usec/1000000.0)));
69  }
70 
74  inline bool
75  operator!=(const struct timeval &t1,const struct timeval &t2)
76  {
77  return(!(t1==t2));
78  }
79 
83  inline bool
84  operator<(const timeval &t1,const timeval &t2)
85  {
86  return((t1.tv_sec + (t1.tv_usec/1000000.0)) <
87  (t2.tv_sec + (t2.tv_usec/1000000.0)));
88  }
89 
93  inline bool
94  operator>(const struct timeval &t1,const struct timeval &t2)
95  {
96  return((t1.tv_sec + (t1.tv_usec/1000000.0)) >
97  (t2.tv_sec + (t2.tv_usec/1000000.0)));
98  }
99 
103  inline bool
104  operator<=(const struct timeval &t1,const struct timeval &t2)
105  {
106  return((t1 < t2) || (t1 == t2));
107  }
108 
112  inline bool
113  operator>=(const struct timeval &t1,const struct timeval &t2)
114  {
115  return((t1 > t2) || (t1 == t2));
116  }
117 
118 
122  bool
123  operator<(const std::pair<unsigned int,std::list<Event> > &p1,
124  const std::pair<unsigned int,std::list<Event> > &p2)
125  {
126  return (p1.first < p2.first);
127  };
128 
130  std::ostream &
131  operator<<(std::ostream &ost,const Event &e)
132  {
133  ost << e._id << " " << e._timestamp << " "
134  << e._inclusive << " " << e._exclusive;
135  return(ost);
136  }
137 
139  std::istream &
140  operator>>(std::istream &ist,Event &e)
141  {
142  ist >> e._id >> e._timestamp >> e._inclusive >> e._exclusive;
143  return(ist);
144  }
145 
146  // TYPE DEFINITIONS
147  typedef std::map<unsigned int,cumulative_stats> StatMap;
148  typedef std::list<std::pair<unsigned int,StatMap> > PStatList;
149  typedef std::map<unsigned int,parallel_stats> PStatMap;
150  typedef std::map<unsigned int,PStatMap> ScalaMap;
151  typedef std::list<std::pair<unsigned int,std::list<Event> > > PEventList;
152  typedef std::map<unsigned int,scalability_stats> ScalaStatMap;
153 
155  profiler_rank = 0;
156  verblevel = 0;
157  Out = NULL;
158  Err = NULL;
159  // function_map["Application"] = 0;
160  // configmap[0] = "Application";
161  nfunc = 0;
162  _initd = false;
163  _finalized = false;
164  };
165 
166  int ProfilerObj::Init(int id){
167  if(_initd){
168  std::cerr << "ProfilerObj::Init: Error: already initialized." << std::endl;
169  return(1);
170  }
171  profiler_rank = (unsigned int)id;
172 #ifdef WITH_HPM_TOOLKIT
173  hpmInit((int)id,(char *)configmap[0].c_str());
174 #endif
175 #ifdef _PROFILER_WITH_PAPI_
176  init_papi();
177  // Init PAPI Library
178  // if(!PAPIX_library_init())
179  // exit(1);
180  // Find max number of counters and set num_hwc
181  // Read config file or environment variables for possible user settings
182  // Default for any remaining unset settings
183  // Populate EventSet
184 #endif
185  if(function_map.empty()){
186  function_map["Application"] = 0;
187  configmap[0] = "Application";
188  }
189  _initd = true;
190  Event begin(0);
191  open_event_list.push_back(begin);
192  Event &begref(open_event_list.front());
193  time0 = Time();
194  begref.timestamp(time0);
195  return(0);
196  };
197 
198  int ProfilerObj::Init(const std::string &name,int id){
199  if(_initd){
200  std::cerr << "ProfilerObj::Init: Error: already initialized. Tried to reinit with "
201  << name << "." << std::endl;
202  return(1);
203  } // ProfileName = name.c_str();
204  // function_map.insert(make_pair(name,0));
205  function_map[name] = 0;
206  configmap[0] = name;
207  // event_file.assign(name);
208  return(Init(id));
209  };
210 
211  int ProfilerObj::FunctionEntry(const std::string &name){
212  unsigned int id = function_map[name];
213  if(id == 0){
214  id = ++nfunc;
215  function_map[name] = id;
216  configmap[id] = name;
217  }
218  Event e(id);
219 #ifdef WITH_HPM_TOOLKIT
220  hpmStart(id,(char *)name.c_str());
221 #endif
222 #ifdef _PROFILER_WITH_PAPI_
223  // Read HWC into e.hwc_vals,e.hwc_tree to 0
224 #endif
225  open_event_list.push_front(e);
226  Event &eref(open_event_list.front());
227  eref.exclusive(0.0);
228  eref.timestamp(0.0);
229  double t = Time() - time0;
230  // assert(t > 0);
231  eref.timestamp(t);
232  return(0);
233  };
234 
236  assert(!((unsigned int)id <= 0));
237  Event e((unsigned int)id);
238  double t = Time() - time0;
239  e.timestamp(t);
240  e.exclusive(0.0);
241 #ifdef WITH_HPM_TOOLKIT
242  std::string name = configmap[id];
243  if(name.empty()){
244  std::ostringstream Ostr;
245  Ostr << "Function" << id;
246  name = Ostr.str();
247  function_map[name] = id;
248  configmap[id] = name;
249  }
250  hpmStart(id,(char *)name.c_str());
251 #endif
252 #ifdef _PROFILER_WITH_PAPI_
253  // Read HWC into e.hwc_vals,e.hwc_tree to 0
254 #endif
255  open_event_list.push_front(e);
256  return(0);
257  };
258 
259  int ProfilerObj::FunctionExit(const std::string &name){
260  double t = Time() - time0;
261  unsigned int id = function_map[name];
262  std::list<Event>::iterator ei = open_event_list.begin();
263  // This means unmatched function name
264  if(id == 0)
265  std::cerr << "Mismatched(" << profiler_rank
266  << "):" << name
267  << ", expected " << configmap[ei->id()]
268  << std::endl;
269  assert(id != 0);
270  if(id != ei->id())
271  std::cerr << "Mismatched(" << profiler_rank
272  << "):" << name << ", expected "
273  << configmap[ei->id()] << std::endl;
274  assert(id == ei->id());
275  double inclusive = t - ei->timestamp();
276  double exclusive = inclusive - ei->exclusive();
277  // assert(inclusive > 0 && exclusive > 0);
278  ei->inclusive(inclusive);
279  ei->exclusive(exclusive);
280 #ifdef WITH_HPM_TOOLKIT
281  hpmStop(id);
282 #endif
283 #ifdef _PROFILER_WITH_PAPI_
284  // Read HWC
285  // ei->hwc_vals = hwc_vals - ei->hwc_vals;
286  // ei->hwc_tree = ei->hwc_vals - ei->hwc_tree;
287  // hwc_vals = ei->hwc_vals;
288 #endif
289  event_list.push_back(*ei++);
290  // ei++;
291  t = ei->exclusive();
292  ei->exclusive(t + inclusive);
293 #ifdef _PROFILER_WITH_PAPI_
294  // ei->hwc_tree += hwc_vals;
295 #endif
296  open_event_list.pop_front();
297  return(0);
298  };
300 #ifdef WITH_HPM_TOOLKIT
301  hpmStop((int)id);
302 #endif
303  std::list<Event>::iterator ei = open_event_list.begin();
304  assert((unsigned int)id == ei->id());
305  double t = Time() - time0;
306  double inclusive = t - ei->timestamp();
307  double exclusive = inclusive - ei->exclusive();
308  // assert(inclusive > 0 && exclusive > 0);
309  ei->inclusive(inclusive);
310  ei->exclusive(exclusive);
311 #ifdef _PROFILER_WITH_PAPI_
312  // Read HWC
313  // ei->hwc_vals = hwc_vals - ei->hwc_vals;
314  // ei->hwc_tree = ei->hwc_vals - ei->hwc_tree;
315  // hwc_vals = ei->hwc_vals;
316 #endif
317  event_list.push_back(*ei);
318  ei++;
319  t = ei->exclusive();
320  ei->exclusive(t + inclusive);
321 #ifdef _PROFILER_WITH_PAPI_
322  // ei->hwc_tree += hwc_vals;
323 #endif
324  open_event_list.pop_front();
325  return(0);
326  };
327 
330  std::list<Event>::iterator ei = open_event_list.begin();
331  while(ei != open_event_list.end()){
332  unsigned int id = ei->id();
333 #ifdef WITH_HPM_TOOLKIT
334  hpmStop((int)id);
335 #endif
336  double t = Time() - time0;
337  double inclusive = t - ei->timestamp();
338  double exclusive = inclusive - ei->exclusive();
339  // assert(inclusive > 0 && exclusive > 0);
340  ei->inclusive(inclusive);
341  ei->exclusive(exclusive);
342 #ifdef _PROFILER_WITH_PAPI_
343  // Read HWC
344  // ei->hwc_vals = hwc_vals - ei->hwc_vals;
345  // ei->hwc_tree = ei->hwc_vals - ei->hwc_tree;
346  // hwc_vals = ei->hwc_vals;
347 #endif
348  event_list.push_back(*ei);
349  ei++;
350  if(ei != open_event_list.end()){
351  t = ei->exclusive();
352  ei->exclusive(t + inclusive);
353  }
354  open_event_list.pop_front();
355  }
356 #ifdef _PROFILER_WITH_PAPI_
357  // ei->hwc_tree += hwc_vals;
358 #endif
359  return(0);
360  };
361 
363  int ProfilerObj::Dump(std::ostream &Ostr){return(0);};
364  int ProfilerObj::ReadConfig(const std::string &cfname)
365  {
366  if(cfname.empty()){
367  if(Err)
368  *Err << "ProfilerObj::Error: Config file name empty."
369  << std::endl;
370  return(1);
371  }
372  std::ifstream conf_file;
373  unsigned int cid;
374  std::string routine;
375  conf_file.open(cfname.c_str());
376  if(!conf_file){
377  if(Err)
378  *Err << "ProfilerObj::Error: Could not open config file, "
379  << cfname << "." << std::endl;
380  return(1);
381  }
382  std::string configline;
383  while(std::getline(conf_file,configline)){
384  std::istringstream Istr(configline);
385  Istr >> cid;
386  std::getline(Istr,routine);
387  configmap[cid] = routine;
388  function_map[routine] = cid;
389  }
390  conf_file.close();
391  return(0);
392  }
393  void ProfilerObj::SummarizeSerialExecution(std::ostream &Ostr)
394  {
395  std::string application_name = "Application";
396  std::map<unsigned int,cumulative_stats> statmap;
397  std::list<Event>::iterator ei = event_list.begin();
398  ei++;
399  while(ei != event_list.end()){
400  std::map<unsigned int,cumulative_stats>::iterator si;
401  si = statmap.find(ei->id());
402  if(si == statmap.end()){
403  cumulative_stats cs;
404  cs.incl = ei->inclusive();
405  cs.excl = ei->exclusive();
406  cs.ncalls = 1;
407  cs.incl_dev = cs.incl * cs.incl;
408  cs.excl_dev = cs.excl * cs.excl;
409  statmap.insert(std::make_pair(ei->id(),cs));
410  }
411  else{
412  si->second.incl += ei->inclusive();
413  si->second.excl += ei->exclusive();
414  si->second.ncalls++;
415  si->second.incl_dev += (ei->inclusive() * ei->inclusive());
416  si->second.excl_dev += (ei->exclusive() * ei->exclusive());
417  }
418  ei++;
419  }
420  std::map<unsigned int,cumulative_stats>::iterator si = statmap.begin();
421  std::map<unsigned int,std::string>::iterator cmi = configmap.find(0);
422  if(cmi != configmap.end())
423  application_name = cmi->second;
424  ei = event_list.begin();
425  Ostr << "#Statistics for " << application_name << ":" << std::endl
426  << "#Total Execution Time: " << ei->inclusive() << std::endl
427  << "#------------------------------------------"
428  << "Breakdown by Routine"
429  << "------------------------------------------" << std::endl
430  << "#Routine Name Inclusive Exclusive"
431  << " Count I-Mean"
432  << " I-Std E-Mean E-Std " << std::endl
433  << "#------------------------------- ------------ ------------"
434  << " ----- ------------"
435  << " ------------ ------------ ------------" << std::endl;
436  while(si != statmap.end()){
437  std::string routine_name = "Unknown";
438  cmi = configmap.find(si->first);
439  Ostr << std::setiosflags(std::ios::left);
440  if(cmi != configmap.end())
441  routine_name = cmi->second;
442  else{
443  std::ostringstream Ostr;
444  Ostr << routine_name << " (" << si->first << ")";
445  routine_name = Ostr.str();
446  }
447  double imean = si->second.incl/(double)si->second.ncalls;
448  double emean = si->second.excl/(double)si->second.ncalls;
449  double imean2 = si->second.incl_dev/(double)si->second.ncalls;
450  double emean2 = si->second.excl_dev/(double)si->second.ncalls;
451  Ostr << std::setw(32) << routine_name << " ";
452  Ostr << std::setprecision(5)
453  << std::setw(12) << si->second.incl << " "
454  << std::setw(12) << si->second.excl << " "
455  << std::setw(12) << si->second.ncalls << " "
456  << std::setw(12) << imean << " "
457  << std::setw(12)
458  << (si->second.ncalls == 1 ? 0 :
459  sqrt(std::fabs(imean2-(imean*imean))))
460  << " "
461  << std::setw(12) << emean << " "
462  << std::setw(12)
463  << (si->second.ncalls == 1 ? 0 :
464  sqrt(std::fabs(emean2-(emean*emean))))
465  << std::endl;
466  si++;
467  }
468  };
469  void ProfilerObj::DumpEvents(std::ostream &Ostr)
470  {
471  Ostr << profiler_rank << std::endl;
473  Ostr << std::endl;
474  }
476  {
477  std::ofstream eventfile;
478  std::ostringstream Ostr;
479  Ostr << configmap[0] << ".prof_";
480  if(!(profiler_rank/10000))
481  Ostr << "0";
482  if(!(profiler_rank/1000))
483  Ostr << "0";
484  if(!(profiler_rank/100))
485  Ostr << "0";
486  if(!(profiler_rank/10))
487  Ostr << "0";
488  Ostr << profiler_rank;
489  eventfile.open(Ostr.str().c_str());
490  DumpEvents(eventfile);
491  eventfile.close();
492  };
493  int ProfilerObj::Finalize(bool writeFiles){
494  if(_finalized)
495  return(0);
496  double t = Time();
497  // This means there are unclosed events
498  assert(open_event_list.size() == 1);
499  std::list<Event>::iterator ei = open_event_list.begin();
500  ei->inclusive(t - ei->timestamp());
501  ei->exclusive(ei->inclusive()-ei->exclusive());
502  ei->timestamp(0.);
503 #ifdef _PROFILER_WITH_PAPI_
504  // Read the HWC
505  // Update the overall counter (begin - from init):
506  // - begin.hwc_vals = hwc_vals - begin.hwc_vals;
507  // - begin..hwc_tree = begin.hwc_vals - begin.hwc_tree;
508 #endif
509  event_list.push_front(*ei);
510  event_list.sort();
511  if(writeFiles){
512  if(profiler_rank == 0){
513  if(!configmap[0].empty()){
514  std::ofstream configfile;
515  std::ostringstream Bfn;
516  Bfn << configmap[0] << ".rpconfig";
517  configfile.open(Bfn.str().c_str());
518  FunctionMap::iterator fmi = function_map.begin();
519  while(fmi != function_map.end()){
520  configfile << fmi->second << " " << fmi->first << std::endl;
521  fmi++;
522  }
523  configfile.close();
524  }
525  }
526  WriteEventFile();
527  }
528  // if(summary && profiler_rank==0)
529  // summarize_execution();
530 #ifdef WITH_HPM_TOOLKIT
531  hpmTerminate(profiler_rank);
532 #endif
533 #ifdef _PROFILER_WITH_PAPI_
534  // Shutdown PAPI lib? Maybe this is not needed.
535 #endif
536  _finalized = true;
537  return(0);
538  };
539 
540  int ProfilerObj::ReadEventsFromFile(const std::string &filename){
541  std::ifstream datafile;
542  datafile.open(filename.c_str());
543  if(!datafile){
544  if(Err)
545  *Err << "ProfilerObj::ReadEventsFromFile: Error: Could not"
546  << " open datafile, " << filename << "." << std::endl;
547  return(1);
548  }
549  profiler::Event e;
550  datafile >> profiler_rank;
551  while(datafile >> e)
552  event_list.push_back(e);
553  datafile.close();
554  return(0);
555  }
556 
557  int
558  ProfilerObj::ReadParallelEventFiles(const std::vector<std::string> &ifiles,
559  profiler::PEventList &par_event_list)
560  {
561  if(ifiles.empty()){
562  if(Err)
563  *Err << "ProfilerObj::ReadParallelEventFiles:Error: No input files."
564  << std::endl;
565  return(1);
566  }
567  // unsigned int number_of_processors = ifiles.size();
568  std::vector<std::string>::const_iterator ifi = ifiles.begin();
569  while(ifi != ifiles.end()){
570  std::ifstream Inf;
571  Inf.open(ifi->c_str());
572  if(!Inf){
573  if(Err)
574  *Err << "ProfilerObj::ReadParallelEventFiles:Error: Unable to open"
575  << " event file, " << *ifi << "." << std::endl;
576  return(1);
577  }
578  event_list.clear();
579  Inf >> profiler_rank;
580  Event e;
581  while(Inf >> e)
582  event_list.push_back(e);
583  Inf.close();
584  event_list.sort();
585  par_event_list.push_back(std::make_pair(profiler_rank,event_list));
586  ifi++;
587  }
588  par_event_list.sort();
589  return(0);
590  }
591 
592 
594  std::ostream &Ouf,
595  PEventList &parallel_event_list)
596  {
597  if(parallel_event_list.empty())
598  return(1);
599  std::string application_name = "Application";
600  std::map<unsigned int,std::string>::iterator cmi = configmap.find(0);
601  if(cmi != configmap.end())
602  application_name = cmi->second;
603  PEventList::reverse_iterator peri = parallel_event_list.rbegin();
604  // Assuming ranks of 0 to nproc-1
605  unsigned int number_of_processors = peri->first + 1;
606  Ouf << number_of_processors << std::endl;
607  PStatMap pstat_map;
608  PStatList parallel_cstat_list;
609  std::map<unsigned int,cumulative_stats> statmap;
610  PEventList::iterator peli = parallel_event_list.begin();
611  while(peli != parallel_event_list.end()){
612  profiler_rank = peli->first;
613  std::list<Event>::const_iterator eli = peli->second.begin();
614  while(eli != peli->second.end()){
615  std::map<unsigned int,cumulative_stats>::iterator si;
616  si = statmap.find(eli->id());
617  if(si == statmap.end()){
618  cumulative_stats cs;
619  cs.incl = eli->inclusive();
620  cs.excl = eli->exclusive();
621  cs.ncalls = 1;
622  cs.incl_dev = cs.incl * cs.incl;
623  cs.excl_dev = cs.excl * cs.excl;
624  statmap.insert(std::make_pair(eli->id(),cs));
625  }
626  else{
627  if(eli->inclusive() < 0){
628  if(Err)
629  *Err << "ProfilerObj::SummarizeParallelExecution:Error: "
630  << "Read existing negative inclusive value:"
631  << eli->inclusive() << std::endl;
632  return(1);
633  }
634  if(eli->exclusive() < 0){
635  if(Err)
636  *Err << "ProfilerObj::SummarizeParallelExecution:Error: "
637  << "Read existing negative exclusive value:"
638  << eli->inclusive() << std::endl;
639  return(1);
640  }
641  si->second.incl += eli->inclusive();
642  si->second.excl += eli->exclusive();
643  si->second.ncalls++;
644  si->second.incl_dev += (eli->inclusive() * eli->inclusive());
645  si->second.excl_dev += (eli->exclusive() * eli->exclusive());
646  }
647  eli++;
648  }
649  parallel_cstat_list.push_back(std::make_pair(profiler_rank,statmap));
650  statmap.clear();
651  peli++;
652  }
653  // Loop over the cumulative stats on each processor, and build the map
654  // containing the Min, Max, Mean, StdDev, of the cumulative times and
655  // the number of calls for each routine.
656  PStatList::iterator psli = parallel_cstat_list.begin();
657  // Loop over processors
658  while(psli != parallel_cstat_list.end()){
659  profiler_rank = psli->first;
660  // Loop over routines
661  std::map<unsigned int,cumulative_stats>::iterator si =
662  psli->second.begin();
663  while(si != psli->second.end()){
664  std::map<unsigned int,parallel_stats>::iterator psmi;
665  // Find the entry in the pstat_map that is for this routine
666  psmi = pstat_map.find(si->first);
667  // Process the very first entry for this routine.
668  if(psmi == pstat_map.end()){
669  parallel_stats ps;
670  ps.incl_min = si->second.incl;
671  ps.incl_max = si->second.incl;
672  ps.incl_mean = si->second.incl;
673  ps.incl_stdev = si->second.incl * si->second.incl;
676  ps.excl_min = si->second.excl;
677  ps.excl_max = si->second.excl;
678  ps.excl_mean = si->second.excl;
679  ps.excl_stdev = si->second.excl * si->second.excl;
682  ps.call_max = si->second.ncalls;
683  ps.call_min = si->second.ncalls;
684  ps.call_mean = si->second.ncalls;
685  ps.call_stdev = si->second.ncalls * si->second.ncalls;
688  pstat_map.insert(std::make_pair(si->first,ps));
689  }
690  // Accumulate data for existing entry
691  else {
692  if(psmi->second.incl_min > si->second.incl){
693  psmi->second.incl_min = si->second.incl;
694  psmi->second.incl_minrank = profiler_rank;
695  }
696  if(psmi->second.incl_max < si->second.incl){
697  psmi->second.incl_max = si->second.incl;
698  psmi->second.incl_maxrank = profiler_rank;
699  }
700  psmi->second.incl_mean += si->second.incl;
701  psmi->second.incl_stdev += si->second.incl * si->second.incl;
702 
703  if(psmi->second.excl_min > si->second.excl){
704  psmi->second.excl_min = si->second.excl;
705  psmi->second.excl_minrank = profiler_rank;
706  }
707  if(psmi->second.excl_max < si->second.excl){
708  psmi->second.excl_max = si->second.excl;
709  psmi->second.excl_maxrank = profiler_rank;
710  }
711  psmi->second.excl_mean += si->second.excl;
712  psmi->second.excl_stdev += si->second.excl * si->second.excl;
713 
714  if(psmi->second.call_max < si->second.ncalls){
715  psmi->second.call_max = si->second.ncalls;
716  psmi->second.call_maxrank = profiler_rank;
717  }
718  if(psmi->second.call_min > si->second.ncalls){
719  psmi->second.call_min = si->second.ncalls;
720  psmi->second.call_minrank = profiler_rank;
721  }
722  psmi->second.call_mean += si->second.ncalls;
723  psmi->second.call_stdev += si->second.ncalls * si->second.ncalls;
724  }
725  si++;
726  }
727  psli++;
728  }
729  std::map<unsigned int,parallel_stats>::iterator si = pstat_map.begin();
730  Ostr << "#Statistics for " << application_name << " ("
731  << number_of_processors << " procs):" << std::endl << std::endl
732  << "#----------------------------------Inclusive Statistics"
733  << "------------------------------" << std::endl
734  << "# Min Inc Min "
735  << "Max Inc Max"
736  << " Mean Inc " << std::endl
737  << "#Routine Name Duration Rank "
738  << "Duration Rank"
739  << " Duration Std Dev " << std::endl
740  << "#-------------------- ------------ ----- "
741  << "------------ -----"
742  << " ------------ ------------" << std::endl;
743  while(si != pstat_map.end()){
744  std::string routine_name = "Unknown";
745  cmi = configmap.find(si->first);
746  Ostr << std::setiosflags(std::ios::left);
747  if(cmi != configmap.end())
748  routine_name = cmi->second;
749  else{
750  std::ostringstream Ostr2;
751  Ostr2 << routine_name << " (" << si->first << ")";
752  routine_name = Ostr2.str();
753  }
754  double imean = si->second.incl_mean/(double)number_of_processors;
755  double imean2 = (si->second.incl_min == si->second.incl_max ? 0 :
756  (sqrt(fabs((si->second.incl_stdev/
757  (double)number_of_processors)
758  - (imean * imean)))));
759  Ostr << std::setw(32) << routine_name << " "
760  << std::setw(12) << si->second.incl_min << " "
761  << std::setw(5) << si->second.incl_minrank << " "
762  << std::setw(12) << si->second.incl_max << " "
763  << std::setw(5) << si->second.incl_maxrank << " "
764  << std::setw(12) << imean << " "
765  << std::setw(12) << imean2 << " "
766  << std::endl;
767  Ouf << si->first << " " << si->second.incl_min << " "
768  << si->second.incl_minrank << " "
769  << si->second.incl_max << " " << si->second.incl_maxrank
770  << " " << imean << " " << imean2 << std::endl;
771  si++;
772  }
773  si = pstat_map.begin();
774  Ostr << "#----------------------------------Exclusive Statistics"
775  << "------------------------------" << std::endl
776  << "# Min Exc Min "
777  << "Max Exc Max"
778  << " Mean Exc " << std::endl
779  << "#Routine Name Duration Rank "
780  << "Duration Rank"
781  << " Duration Std Dev " << std::endl
782  << "#-------------------- ------------ ----- "
783  << "------------ -----"
784  << " ------------ ------------" << std::endl;
785  while(si != pstat_map.end()){
786  std::string routine_name = "Unknown";
787  cmi = configmap.find(si->first);
788  Ostr << std::setiosflags(std::ios::left);
789  if(cmi != configmap.end())
790  routine_name = cmi->second;
791  else{
792  std::ostringstream Ostr2;
793  Ostr2 << routine_name << " (" << si->first << ")";
794  routine_name = Ostr2.str();
795  }
796  double emean = si->second.excl_mean/(double)number_of_processors;
797  double emean2 = (si->second.excl_max == si->second.excl_min ? 0 :
798  (sqrt(fabs((si->second.excl_stdev/
799  (double)number_of_processors)
800  - (emean * emean)))));
801  Ostr << std::setw(32) << routine_name << " "
802  << std::setw(12) << si->second.excl_min << " "
803  << std::setw(5) << si->second.excl_minrank << " "
804  << std::setw(12) << si->second.excl_max << " "
805  << std::setw(5) << si->second.excl_maxrank << " "
806  << std::setw(12) << emean << " "
807  << std::setw(12) << emean2 << " "
808  << std::endl;
809  Ouf << si->first << " " << si->second.excl_min << " "
810  << si->second.excl_minrank << " "
811  << si->second.excl_max << " " << si->second.excl_maxrank
812  << " " << emean << " " << emean2 << std::endl;
813  si++;
814  }
815  return(0);
816  }
817 
818  int
819  ProfilerObj::ReadSummaryFiles(const std::vector<std::string> &input_files,
820  ScalaMap &scala_map)
821  {
822 
823  // I guess it's okay to have only a single summary file - it's only a
824  // problem if it's intended use is a scalability summary
825  int number_of_runs = input_files.size();
826  if(number_of_runs < 1){
827  if(Err)
828  *Err << "ProfilerObj::ReadSummaryFiles:Error: No input files."
829  << std::endl;
830  return(1);
831  }
832  std::vector<int> problem_sizes;
833  problem_sizes.resize(number_of_runs);
834  number_of_runs = 0;
835  unsigned int runsize = 0;
836  std::vector<std::string>::const_iterator ifi = input_files.begin();
837  while(ifi != input_files.end()){
838  PStatMap pstats;
839  std::ifstream Inf;
840  Inf.open(ifi->c_str());
841  if(!Inf){
842  if(Err)
843  *Err << "ProfilerObj::ReadSummaryFiles:Error: Cannot open summary "
844  << "file, " << *ifi << "." << std::endl;
845  return(1);
846  }
847  unsigned int id, minrank, maxrank;
848  double min, max, mean, stddev;
849  Inf >> runsize;
850  while(Inf >> id >> min >> minrank >> max >> maxrank >> mean >> stddev){
851  // if this function's id cannot be found in (PStatMap)pstats, then it's
852  // the inclusive section, populate a new parallel_stats object and add
853  // it and the id to the pstats object.
854  PStatMap::iterator psi = pstats.find(id);
855  if(psi == pstats.end()){
856  parallel_stats pso;
857  pso.incl_min = min;
858  pso.incl_minrank = minrank;
859  pso.incl_max = max;
860  pso.incl_maxrank = maxrank;
861  pso.incl_mean = mean;
862  pso.incl_stdev = stddev;
863  pstats.insert(std::make_pair(id,pso));
864  }
865  // - else -
866  // it's the exclusive section, retrieve the existing parallel_stats
867  // from the pstats and populate the exclusive items.
868  else {
869  psi->second.excl_min = min;
870  psi->second.excl_minrank = minrank;
871  psi->second.excl_max = max;
872  psi->second.excl_maxrank = maxrank;
873  psi->second.excl_mean = mean;
874  psi->second.excl_stdev = stddev;
875  }
876  }
877  Inf.close();
878  // Add the (PStatMap)pstats and the number of processors (runsize) to the
879  // ScalaMap object
880  //
881  // First, if a run of this size exists already, then fail as we have no
882  // idea how to handle that (yet).
883  ScalaMap::iterator smi = scala_map.find(runsize);
884  if(smi != scala_map.end()){
885  if(Err)
886  *Err << "ProfilerObj::ReadSummaryFiles:Error: Cannot process "
887  << "multiple runs of the same size." << std::endl;
888  return(1);
889  }
890  problem_sizes[number_of_runs++] = runsize;
891  // vout << "Processed problem size: " << runsize << endl;
892  scala_map.insert(std::make_pair(runsize,pstats));
893  ifi++;
894  }
895  return(0);
896  }
897 
901 
903  ScalaStatMap &scala_statmap,
904  bool is_scaled)
905  {
906 
907  if(scala_map.empty() || (scala_map.size() == 1)){
908  if(Err)
909  *Err << "ProfilerObj::Error: Invalid number of runs for scalability analysis."
910  << std::endl;
911  return(1);
912  }
913 
914  // When we loop thru problem sizes, make sure it's ascending order
915  // sort(problem_sizes.begin(),problem_sizes.end());
916  // unsigned int number_of_runs = problem_sizes.size();
917  // tagit(DEBUGV,"populate_scalamap");
918  // vout << "Number of runs: " << number_of_runs << endl;
919  // For every problem size
920  ScalaMap::iterator scalamap_i = scala_map.begin();
921  // for(unsigned int ps = 0;ps < number_of_runs;ps++){
922  while(scalamap_i != scala_map.end()){
923  int number_of_processors = scalamap_i->first;
924  // tagit(DEBUGV,"populate_scalamap");
925  // vout << "Processing run: " << number_of_processors << endl;
926  // if(scalamap_i == scala_map.end()){
927  // tagit(1,"populate_scalamap");
928  // vout << "Error: No data for " << number_of_processors << " processors."
929  // << endl;
930  // return(false);
931  // }
932  // For every Fid in the ScalaMap's PStat object
933  PStatMap::iterator psm_i = scalamap_i->second.begin();
934  while(psm_i != scalamap_i->second.end()){
935  // Look for this function's id in the scalastatmap
936  ScalaStatMap::iterator ssmi = scala_statmap.find(psm_i->first);
937  if(ssmi == scala_statmap.end()){ // Not found
938  // Make a new entry for this Fid
940  ss.nprocs.push_back(number_of_processors);
941  unsigned int cpos = ss.nprocs.size() - 1;
942  double probsize = (is_scaled ? number_of_processors : 1);
943  double probsize0 = (is_scaled ? ss.nprocs[0] : 1);
944  ss.sstats[IMIN_T].push_back(psm_i->second.incl_min);
945  ss.sstats[IMAX_T].push_back(psm_i->second.incl_max);
946  ss.sstats[IMEAN_T].push_back(psm_i->second.incl_mean);
947  ss.sstats[IMIN_E].push_back(((ss.sstats[IMIN_T][0]*ss.nprocs[0])/
948  probsize0)/((ss.sstats[IMIN_T][cpos]*
949  ss.nprocs[cpos])/probsize));
950  ss.sstats[IMAX_E].push_back(((ss.sstats[IMAX_T][0]*ss.nprocs[0])/
951  probsize0)/((ss.sstats[IMAX_T][cpos]*
952  ss.nprocs[cpos])/probsize));
953  ss.sstats[IMEAN_E].push_back(((ss.sstats[IMEAN_T][0]*ss.nprocs[0])/
954  probsize0)/((ss.sstats[IMEAN_T][cpos]*
955  ss.nprocs[cpos])/probsize));
956  ss.sstats[IMIN_S].push_back(ss.sstats[IMIN_E][cpos]*
957  number_of_processors);
958  ss.sstats[IMAX_S].push_back(ss.sstats[IMAX_E][cpos]*
959  number_of_processors);
960  ss.sstats[IMEAN_S].push_back(ss.sstats[IMEAN_E][cpos]*
961  number_of_processors);
962 
963  ss.sstats[EMIN_T].push_back(psm_i->second.excl_min);
964  ss.sstats[EMAX_T].push_back(psm_i->second.excl_max);
965  ss.sstats[EMEAN_T].push_back(psm_i->second.excl_mean);
966  ss.sstats[EMIN_E].push_back(((ss.sstats[EMIN_T][0]*ss.nprocs[0])/
967  probsize0)/((ss.sstats[EMIN_T][cpos]*
968  ss.nprocs[cpos])/probsize));
969  ss.sstats[EMAX_E].push_back(((ss.sstats[EMAX_T][0]*ss.nprocs[0])/
970  probsize0)/((ss.sstats[EMAX_T][cpos]*
971  ss.nprocs[cpos])/probsize));
972  ss.sstats[EMEAN_E].push_back(((ss.sstats[EMEAN_T][0]*ss.nprocs[0])/
973  probsize0)/((ss.sstats[EMEAN_T][cpos]*
974  ss.nprocs[cpos])/probsize));
975  ss.sstats[EMIN_S].push_back(ss.sstats[EMIN_E][cpos]*
976  number_of_processors);
977  ss.sstats[EMAX_S].push_back(ss.sstats[EMAX_E][cpos]*
978  number_of_processors);
979  ss.sstats[EMEAN_S].push_back(ss.sstats[EMEAN_E][cpos]*
980  number_of_processors);
981  // Add an entry for this function into the scala_statmap
982  scala_statmap.insert(std::make_pair(psm_i->first,ss));
983  }
984  // There was an entry, this function had statistics at some other
985  // runsize. Add to it's scalastats entries for this problem size.
986  else {
987  // Make a new entry for this Fid
988  ssmi->second.nprocs.push_back(number_of_processors);
989  unsigned int cpos = ssmi->second.nprocs.size() - 1;
990  double probsize = (is_scaled ? number_of_processors : 1);
991  double probsize0 = (is_scaled ? ssmi->second.nprocs[0] : 1);
992  ssmi->second.sstats[IMIN_T].push_back(psm_i->second.incl_min);
993  ssmi->second.sstats[IMAX_T].push_back(psm_i->second.incl_max);
994  ssmi->second.sstats[IMEAN_T].push_back(psm_i->second.incl_mean);
995  ssmi->second.sstats[IMIN_E].push_back
996  (((ssmi->second.sstats[IMIN_T][0]*ssmi->second.nprocs[0])/probsize0)/
997  ((ssmi->second.sstats[IMIN_T][cpos]*ssmi->second.nprocs[cpos])/
998  probsize));
999  ssmi->second.sstats[IMAX_E].push_back
1000  (((ssmi->second.sstats[IMAX_T][0]*ssmi->second.nprocs[0])/probsize0)/
1001  ((ssmi->second.sstats[IMAX_T][cpos]*ssmi->second.nprocs[cpos])/
1002  probsize));
1003  ssmi->second.sstats[IMEAN_E].push_back
1004  (((ssmi->second.sstats[IMEAN_T][0]*ssmi->second.nprocs[0])/
1005  probsize0)/((ssmi->second.sstats[IMEAN_T][cpos]*
1006  ssmi->second.nprocs[cpos])/probsize));
1007  ssmi->second.sstats[IMIN_S].push_back
1008  (ssmi->second.sstats[IMIN_E][cpos]*number_of_processors);
1009  ssmi->second.sstats[IMAX_S].push_back
1010  (ssmi->second.sstats[IMAX_E][cpos]*number_of_processors);
1011  ssmi->second.sstats[IMEAN_S].push_back
1012  (ssmi->second.sstats[IMEAN_E][cpos]*number_of_processors);
1013 
1014  ssmi->second.sstats[EMIN_T].push_back(psm_i->second.excl_min);
1015  ssmi->second.sstats[EMAX_T].push_back(psm_i->second.excl_max);
1016  ssmi->second.sstats[EMEAN_T].push_back(psm_i->second.excl_mean);
1017  ssmi->second.sstats[EMIN_E].push_back
1018  (((ssmi->second.sstats[EMIN_T][0]*ssmi->second.nprocs[0])/
1019  probsize0)/((ssmi->second.sstats[EMIN_T][cpos]*
1020  ssmi->second.nprocs[cpos])/probsize));
1021  ssmi->second.sstats[EMAX_E].push_back
1022  (((ssmi->second.sstats[EMAX_T][0]*ssmi->second.nprocs[0])/
1023  probsize0)/((ssmi->second.sstats[EMAX_T][cpos]*
1024  ssmi->second.nprocs[cpos])/probsize));
1025  ssmi->second.sstats[EMEAN_E].push_back
1026  (((ssmi->second.sstats[EMEAN_T][0]*ssmi->second.nprocs[0])/
1027  probsize0)/((ssmi->second.sstats[EMEAN_T][cpos]*
1028  ssmi->second.nprocs[cpos])/probsize));
1029  ssmi->second.sstats[EMIN_S].push_back
1030  (ssmi->second.sstats[EMIN_E][cpos]*number_of_processors);
1031  ssmi->second.sstats[EMAX_S].push_back
1032  (ssmi->second.sstats[EMAX_E][cpos]*number_of_processors);
1033  ssmi->second.sstats[EMEAN_S].push_back
1034  (ssmi->second.sstats[EMEAN_E][cpos]*number_of_processors);
1035  }
1036  psm_i++;
1037  }
1038  scalamap_i++;
1039  }
1040  return(0);
1041  }
1042 
1043  int ProfilerObj::ScalabilitySummary(ScalaStatMap &scala_statmap,std::ostream &Out)
1044  {
1045  std::string appname = "Unknown";
1046  std::map<unsigned int,std::string>::iterator cfi = configmap.find(0);
1047  if(cfi != configmap.end())
1048  appname.assign(cfi->second);
1049  // For every routine in the scalamap, print out the scalability information
1050  ScalaStatMap::iterator ssm_i = scala_statmap.begin();
1051  Out << "############# Scalability Summary for " << appname << " "
1052  << "#############" << std::endl;
1053  while(ssm_i != scala_statmap.end()){
1054  std::string routine_name;
1055  std::map<unsigned int,std::string>::iterator cfi = configmap.find(ssm_i->first);
1056  if(cfi != configmap.end())
1057  routine_name.assign(cfi->second);
1058  else {
1059  std::ostringstream Ostr;
1060  Ostr << "Unknown(" << ssm_i->first << ")";
1061  routine_name.assign(Ostr.str());
1062  }
1063  scalability_stats ss = ssm_i->second;
1064  unsigned int nps = ss.nprocs.size();
1065  // tagit(DEBUGV,"scalability_summary");
1066  // vout << "Number of runs to process = " << nps << endl;
1067  Out << "# " << routine_name << ":" << std::endl
1068  << "#-------------------------------------------------"
1069  << "------------------------------------------------------------"
1070  << "-----------------------------------------------" << std::endl
1071  << "# Inclusive Max Inclusive Mean "
1072  << " Inclusive Min Exclusive Max "
1073  << " Exclusive Mean"
1074  << " Exclusive Min" << std::endl
1075  << "# NProc Time(Eff)(Speedup) Time(Eff)(Speedup)"
1076  << " Time(Eff)(Speedup) Time(Eff)(Speedup) "
1077  << "Time(Eff)(Speedup) Time(Eff)(Speedup)" << std::endl
1078  << "#-------------------------------------------------"
1079  << "------------------------------------------------------------"
1080  << "-----------------------------------------------" << std::endl;
1081  for(unsigned int a = 0;a < nps;a++){
1082  Out << std::resetiosflags(std::ios::floatfield)
1083  << std::setiosflags(std::ios::right) << std::setprecision(0)
1084  << std::setw(5) << ss.nprocs[a] << " "
1085 
1086  << std::setprecision(3) << std::showpoint << std::fixed
1087  << std::setw(9) << std::setiosflags(std::ios::right) << ss.sstats[IMAX_T][a]
1088  << " " << std::setiosflags(std::ios::left) << std::setprecision(2)
1089  << std::setw(4) << ss.sstats[IMAX_E][a] << " "
1090  << std::setw(7) << std::setprecision(1) << ss.sstats[IMAX_S][a] << " "
1091 
1092  << std::setprecision(3) << std::showpoint << std::fixed
1093  << std::setw(9) << std::setiosflags(std::ios::right) << ss.sstats[IMEAN_T][a]
1094  << " " << std::setiosflags(std::ios::left) << std::setprecision(2) << std::setw(4)
1095  << ss.sstats[IMEAN_E][a] << " "
1096  << std::setw(7) << std::setprecision(1) << ss.sstats[IMEAN_S][a] << " "
1097 
1098  << std::setprecision(3) << std::showpoint << std::fixed
1099  << std::setw(9) << std::setiosflags(std::ios::right) << ss.sstats[IMIN_T][a]
1100  << " " << std::setiosflags(std::ios::left) << std::setprecision(2) << std::setw(4)
1101  << ss.sstats[IMIN_E][a] << " "
1102  << std::setw(7) << std::setprecision(1) << ss.sstats[IMIN_S][a] << " "
1103 
1104  << std::setprecision(3) << std::showpoint << std::fixed
1105  << std::setw(9) << std::setiosflags(std::ios::right) << ss.sstats[EMAX_T][a]
1106  << " " << std::setiosflags(std::ios::left) << std::setprecision(2) << std::setw(4)
1107  << ss.sstats[EMAX_E][a] << " "
1108  << std::setw(7) << std::setprecision(1) << ss.sstats[EMAX_S][a] << " "
1109 
1110  << std::setprecision(3) << std::showpoint << std::fixed
1111  << std::setw(9) << std::setiosflags(std::ios::right) << ss.sstats[EMEAN_T][a]
1112  << " " << std::setiosflags(std::ios::left) << std::setprecision(2) << std::setw(4)
1113  << ss.sstats[EMEAN_E][a] << " "
1114  << std::setw(7) << std::setprecision(1) << ss.sstats[EMEAN_S][a] << " "
1115 
1116  << std::setprecision(3) << std::showpoint << std::fixed
1117  << std::setw(9) << std::setiosflags(std::ios::right) << ss.sstats[EMIN_T][a]
1118  << " " << std::setiosflags(std::ios::left) << std::setprecision(2) << std::setw(4)
1119  << ss.sstats[EMIN_E][a] << " "
1120  << std::setw(7) << std::setprecision(1) << ss.sstats[EMIN_S][a] << std::endl;
1121  }
1122  Out << "#-------------------------------------------------"
1123  << "------------------------------------------------------------"
1124  << "-----------------------------------------------" << std::endl << std::endl
1125  << std::endl;
1126 
1127  ssm_i++;
1128  }
1129  return(0);
1130  }
1131 #ifdef _PROFILER_WITH_PAPI_
1132  void init_papi()
1133  {
1134  PAPI_library_init(PAPI_VER_CURRENT);
1135  papiEventSet = PAPI_NULL;
1136  if(PAPI_create_eventset(&papiEventSet) != PAPI_OK){
1137  std::cerr << "PAPI Init Error: Could not create eventset."
1138  << std::endl;
1139  exit(1);
1140  }
1141  }
1142 #endif
1143  };
1144 };
double _inclusive
tree time
Definition: Profiler.H:161
std::list< std::pair< unsigned int, StatMap > > PStatList
Definition: Profiler.H:365
std::ostream * Out
stream for regular output
Definition: Profiler.H:405
bool operator==(const struct timeval &t1, const struct timeval &t2)
faster timeval math
Definition: Profiler.C:65
int FunctionExit(const std::string &name)
mark construct exit
Definition: Profiler.C:259
bool _initd
whether the profiler has been initialized
Definition: Profiler.H:566
double & timestamp()
Definition: Profiler.H:266
int ReadEventsFromFile(const std::string &filename)
Read serial event file.
Definition: Profiler.C:540
Utility struct.
Definition: Profiler.H:108
bool _finalized
whether the profiler has been finalized
Definition: Profiler.H:568
bool operator!=(const struct timeval &t1, const struct timeval &t2)
faster timeval math
Definition: Profiler.C:75
std::map< unsigned int, parallel_stats > PStatMap
Definition: Profiler.H:366
std::ostream * Err
stream for errors
Definition: Profiler.H:407
bool operator<(const timeval &t1, const timeval &t2)
faster timeval math
Definition: Profiler.C:84
int ReadParallelEventFiles(const std::vector< std::string > &infiles, PEventList &par_event_list)
Read event files from parallel run.
Definition: Profiler.C:558
double & exclusive()
Definition: Profiler.H:242
double _timestamp
raw timestamp
Definition: Profiler.H:163
void DumpContents(std::ostream &Ostr, const ContainerType &c, std::string del="\)
Dump container contents.
std::list< Event > event_list
completed events
Definition: Profiler.H:413
Basic utility header.
int ScalabilitySummary(ScalaStatMap &scala_statmap, std::ostream &Out)
Scalability analysis output for multiple parallel runs.
Definition: Profiler.C:1043
unsigned int verblevel
verbosity level
Definition: Profiler.H:403
int Finalize(bool writeFiles=true)
Shut down profiler.
Definition: Profiler.C:493
Defines MPI-specific parallel global and program classes.
FunctionMap function_map
map from construct name to unique id
Definition: Profiler.H:415
struct timeval & operator-=(struct timeval &t1, const struct timeval &t2)
faster timeval math
Definition: Profiler.C:31
unsigned int _id
unique identifyer
Definition: Profiler.H:157
Performance Profiling interface definition.
unsigned int profiler_rank
parallel processor id
Definition: Profiler.H:401
void SummarizeSerialExecution(std::ostream &Ostr)
Profiling output for serial application.
Definition: Profiler.C:393
ConfigMap configmap
map from unique id to construct name
Definition: Profiler.H:417
std::vector< double > sstats[18]
Definition: Profiler.H:143
std::ostream & operator<<(std::ostream &ost, const Event &e)
EVENT&#39;s stream operator.
Definition: Profiler.C:131
static double Time()
Simple timer.
Definition: Profiler.H:347
int Dump(std::ostream &Ostr)
dumps closed events, clears memory
Definition: Profiler.C:363
double _exclusive
self time
Definition: Profiler.H:159
int PopulateScalaMap(ScalaMap &scala_map, ScalaStatMap &scala_statmap, bool is_scaled)
Build scalability stats for multiple parallel runs.
Definition: Profiler.C:902
void WriteEventFile()
Writes final even file.
Definition: Profiler.C:475
int FunctionExitAll()
Force all open profiling Events to close (emergency)
Definition: Profiler.C:329
std::map< unsigned int, scalability_stats > ScalaStatMap
Definition: Profiler.H:370
Marks construct entry/exit.
Definition: Profiler.H:152
bool operator>(const struct timeval &t1, const struct timeval &t2)
faster timeval math
Definition: Profiler.C:94
std::list< Event > open_event_list
construct entry events
Definition: Profiler.H:411
void size_t int size_t int size_t int int int int double int int double double *void size_t int size_t int int int int int double int size_t size_t size_t double double *void size_t int size_t int size_t size_t int double int double double *void size_t size_t size_t double * a
std::istream & operator>>(std::istream &ist, Event &e)
EVENT&#39;s stream operator.
Definition: Profiler.C:140
void DumpEvents(std::ostream &Ostr)
?Not sure?
Definition: Profiler.C:469
bool operator>=(const struct timeval &t1, const struct timeval &t2)
faster timeval math
Definition: Profiler.C:113
unsigned int nfunc
total number of constructs profiled
Definition: Profiler.H:419
std::vector< unsigned int > nprocs
Definition: Profiler.H:142
std::list< std::pair< unsigned int, std::list< Event > > > PEventList
Definition: Profiler.H:368
int SummarizeParallelExecution(std::ostream &Ostr, std::ostream &Ouf, PEventList &parallel_event_list)
Profiling output for single parallel run.
Definition: Profiler.C:593
int FunctionEntry(const std::string &name)
mark construct entry
Definition: Profiler.C:211
int ReadConfig(const std::string &fname)
Read configuration from file.
Definition: Profiler.C:364
struct timeval & operator+=(struct timeval &t1, const struct timeval &t2)
faster timeval math
Definition: Profiler.C:54
int Init(int id)
integer only inteface for init
Definition: Profiler.C:166
std::map< unsigned int, PStatMap > ScalaMap
Definition: Profiler.H:367
bool operator<=(const struct timeval &t1, const struct timeval &t2)
faster timeval math
Definition: Profiler.C:104
std::map< unsigned int, cumulative_stats > StatMap
Definition: Profiler.H:364
int ReadSummaryFiles(const std::vector< std::string > &input_files, ScalaMap &scala_map)
Read summary files from multiple parallel runs.
Definition: Profiler.C:819
double time0
creation/init time
Definition: Profiler.H:409