Performance profiling object. More...
Performance profiling object.
Profiler is a profiling object that keeps track of call durations for user defined code constructs. Profiler will also monitor platform hardware counters if they are available in PAPI or HPM. The PAPI interface is currently under construction to use the version independent implementation
Definition at line 398 of file Profiler.H.
#include <Profiler.H>
Public Member Functions | |
ProfilerObj () | |
int | Init (int id) |
integer only inteface for init More... | |
int | Init (const std::string &name, int id) |
initialization More... | |
int | FunctionEntry (const std::string &name) |
mark construct entry More... | |
int | FunctionEntry (int id) |
mark construct entry (int only interface) More... | |
int | FunctionExit (const std::string &name) |
mark construct exit More... | |
int | FunctionExit (int id) |
mark construct exit (int only) More... | |
int | FunctionExitAll () |
Force all open profiling Events to close (emergency) More... | |
int | Dump (std::ostream &Ostr) |
dumps closed events, clears memory More... | |
void | SetOut (std::ostream *Os) |
Set outstream. More... | |
void | SetErr (std::ostream *Oe) |
Set errstream. More... | |
void | SummarizeSerialExecution (std::ostream &Ostr) |
Profiling output for serial application. More... | |
void | WriteEventFile () |
Writes final even file. More... | |
void | DumpEvents (std::ostream &Ostr) |
?Not sure? More... | |
bool | FinalizeReady () |
Ready to finalize? More... | |
int | Finalize (bool writeFiles=true) |
Shut down profiler. More... | |
int | ReadConfig (const std::string &fname) |
Read configuration from file. More... | |
int | ReadEventsFromFile (const std::string &filename) |
Read serial event file. More... | |
int | ReadParallelEventFiles (const std::vector< std::string > &infiles, PEventList &par_event_list) |
Read event files from parallel run. More... | |
int | SummarizeParallelExecution (std::ostream &Ostr, std::ostream &Ouf, PEventList ¶llel_event_list) |
Profiling output for single parallel run. More... | |
int | ReadSummaryFiles (const std::vector< std::string > &input_files, ScalaMap &scala_map) |
Read summary files from multiple parallel runs. More... | |
int | PopulateScalaMap (ScalaMap &scala_map, ScalaStatMap &scala_statmap, bool is_scaled) |
Build scalability stats for multiple parallel runs. More... | |
int | ScalabilitySummary (ScalaStatMap &scala_statmap, std::ostream &Out) |
Scalability analysis output for multiple parallel runs. More... | |
Protected Attributes | |
unsigned int | profiler_rank |
parallel processor id More... | |
unsigned int | verblevel |
verbosity level More... | |
std::ostream * | Out |
stream for regular output More... | |
std::ostream * | Err |
stream for errors More... | |
double | time0 |
creation/init time More... | |
std::list< Event > | open_event_list |
construct entry events More... | |
std::list< Event > | event_list |
completed events More... | |
FunctionMap | function_map |
map from construct name to unique id More... | |
ConfigMap | configmap |
map from unique id to construct name More... | |
unsigned int | nfunc |
total number of constructs profiled More... | |
Private Attributes | |
bool | _strict |
mismatch is error - otherwise automatically exit children More... | |
bool | _initd |
whether the profiler has been initialized More... | |
bool | _finalized |
whether the profiler has been finalized More... | |
ProfilerObj | ( | ) |
Definition at line 154 of file Profiler.C.
References ProfilerObj::_finalized, ProfilerObj::_initd, ProfilerObj::Err, ProfilerObj::nfunc, ProfilerObj::Out, ProfilerObj::profiler_rank, and ProfilerObj::verblevel.
int Dump | ( | std::ostream & | Ostr | ) |
dumps closed events, clears memory
dump closed events to Ostr, clear mem
Definition at line 363 of file Profiler.C.
Referenced by GlobalObj< StackType, ErrorType, ProfilerType >::DumpProfile().
void DumpEvents | ( | std::ostream & | Ostr | ) |
?Not sure?
Definition at line 469 of file Profiler.C.
References ix::util::DumpContents(), ProfilerObj::event_list, and ProfilerObj::profiler_rank.
Referenced by ProfilerObj::WriteEventFile().
int Finalize | ( | bool | writeFiles = true | ) |
Shut down profiler.
Definition at line 493 of file Profiler.C.
References ProfilerObj::_finalized, ProfilerObj::configmap, ProfilerObj::event_list, ProfilerObj::function_map, ProfilerObj::open_event_list, ProfilerObj::profiler_rank, ix::profiler::Time(), and ProfilerObj::WriteEventFile().
Referenced by GlobalObj< StackType, ErrorType, ProfilerType >::Finalize(), GlobalObj< StackType, ErrorType, ProfilerType >::Report(), GlobalObj< StackType, ErrorType, ProfilerType >::SetProfiler(), and testmanager::Test__BasicTimer().
|
inline |
Ready to finalize?
Definition at line 516 of file Profiler.H.
Referenced by GlobalObj< StackType, ErrorType, ProfilerType >::Finalize(), and GlobalObj< StackType, ErrorType, ProfilerType >::SetProfiler().
int FunctionEntry | ( | const std::string & | name | ) |
mark construct entry
Programs call this upon entry into a code construct which needs to be profiled.
Definition at line 211 of file Profiler.C.
References ProfilerObj::configmap, Event::exclusive(), ProfilerObj::function_map, ProfilerObj::nfunc, ProfilerObj::open_event_list, ix::profiler::Time(), and ProfilerObj::time0.
Referenced by GlobalObj< StackType, ErrorType, ProfilerType >::FunctionEntry(), and testmanager::Test__BasicTimer().
int FunctionEntry | ( | int | id | ) |
mark construct entry (int only interface)
Programs call this upon entry into a code construct which needs to be profiled.
Definition at line 235 of file Profiler.C.
References ProfilerObj::configmap, Event::exclusive(), ProfilerObj::function_map, ProfilerObj::open_event_list, ix::profiler::Time(), ProfilerObj::time0, and Event::timestamp().
int FunctionExit | ( | const std::string & | name | ) |
mark construct exit
Programs call this upon exit from a code construct which needs to be profiled. The resulting Event is added to the completed Events list.
Definition at line 259 of file Profiler.C.
References ProfilerObj::configmap, ProfilerObj::event_list, ProfilerObj::function_map, ProfilerObj::open_event_list, ProfilerObj::profiler_rank, ix::profiler::Time(), and ProfilerObj::time0.
Referenced by GlobalObj< StackType, ErrorType, ProfilerType >::FunctionExit(), and testmanager::Test__BasicTimer().
int FunctionExit | ( | int | id | ) |
mark construct exit (int only)
Programs call this upon exit from a code construct which needs to be profiled. The resulting Event is added to the completed Events list.
Definition at line 299 of file Profiler.C.
References ProfilerObj::event_list, ProfilerObj::open_event_list, ix::profiler::Time(), and ProfilerObj::time0.
int FunctionExitAll | ( | ) |
Force all open profiling Events to close (emergency)
Close all preparing for some emergency exit probably.
Programs call this when they want to exit unexpectedly, for example.
Definition at line 329 of file Profiler.C.
References ProfilerObj::event_list, ProfilerObj::open_event_list, ix::profiler::Time(), and ProfilerObj::time0.
Referenced by GlobalObj< StackType, ErrorType, ProfilerType >::FunctionExitAll().
int Init | ( | int | id | ) |
integer only inteface for init
For compatibility with languages other than C/C++
Definition at line 166 of file Profiler.C.
References ProfilerObj::_initd, ProfilerObj::configmap, ProfilerObj::function_map, ProfilerObj::open_event_list, ProfilerObj::profiler_rank, ix::profiler::Time(), and ProfilerObj::time0.
Referenced by GlobalObj< StackType, ErrorType, ProfilerType >::Init(), ProfilerObj::Init(), and testmanager::Test__BasicTimer().
int Init | ( | const std::string & | name, |
int | id | ||
) |
initialization
Gets the profiler ready to produce profiles of the application named "name". The id parameter typically specifies the mpi rank of the process upon which this instance of the ProfilerObj lives.
Definition at line 198 of file Profiler.C.
References ProfilerObj::_initd, ProfilerObj::configmap, ProfilerObj::function_map, and ProfilerObj::Init().
int PopulateScalaMap | ( | ScalaMap & | scala_map, |
ScalaStatMap & | scala_statmap, | ||
bool | is_scaled | ||
) |
Build scalability stats for multiple parallel runs.
Definition at line 902 of file Profiler.C.
References ix::profiler::EMAX_E, ix::profiler::EMAX_S, ix::profiler::EMAX_T, ix::profiler::EMEAN_E, ix::profiler::EMEAN_S, ix::profiler::EMEAN_T, ix::profiler::EMIN_E, ix::profiler::EMIN_S, ix::profiler::EMIN_T, ProfilerObj::Err, ix::profiler::IMAX_E, ix::profiler::IMAX_S, ix::profiler::IMAX_T, ix::profiler::IMEAN_E, ix::profiler::IMEAN_S, ix::profiler::IMEAN_T, ix::profiler::IMIN_E, ix::profiler::IMIN_S, ix::profiler::IMIN_T, scalability_stats::nprocs, and scalability_stats::sstats.
Referenced by ix::profiler::Profane().
int ReadConfig | ( | const std::string & | fname | ) |
Read configuration from file.
Definition at line 364 of file Profiler.C.
References ProfilerObj::configmap, ProfilerObj::Err, and ProfilerObj::function_map.
Referenced by ix::profiler::Profane().
int ReadEventsFromFile | ( | const std::string & | filename | ) |
Read serial event file.
Definition at line 540 of file Profiler.C.
References ProfilerObj::Err, ProfilerObj::event_list, and ProfilerObj::profiler_rank.
Referenced by ix::profiler::Profane().
int ReadParallelEventFiles | ( | const std::vector< std::string > & | infiles, |
profiler::PEventList & | par_event_list | ||
) |
Read event files from parallel run.
Definition at line 558 of file Profiler.C.
References ProfilerObj::Err, ProfilerObj::event_list, and ProfilerObj::profiler_rank.
Referenced by ix::profiler::Profane().
int ReadSummaryFiles | ( | const std::vector< std::string > & | input_files, |
ScalaMap & | scala_map | ||
) |
Read summary files from multiple parallel runs.
Definition at line 819 of file Profiler.C.
References ProfilerObj::Err, parallel_stats::incl_max, parallel_stats::incl_maxrank, parallel_stats::incl_mean, parallel_stats::incl_min, parallel_stats::incl_minrank, and parallel_stats::incl_stdev.
Referenced by ix::profiler::Profane().
int ScalabilitySummary | ( | ScalaStatMap & | scala_statmap, |
std::ostream & | Out | ||
) |
Scalability analysis output for multiple parallel runs.
Definition at line 1043 of file Profiler.C.
References a, ProfilerObj::configmap, ix::profiler::EMAX_E, ix::profiler::EMAX_S, ix::profiler::EMAX_T, ix::profiler::EMEAN_E, ix::profiler::EMEAN_S, ix::profiler::EMEAN_T, ix::profiler::EMIN_E, ix::profiler::EMIN_S, ix::profiler::EMIN_T, ix::profiler::IMAX_E, ix::profiler::IMAX_S, ix::profiler::IMAX_T, ix::profiler::IMEAN_E, ix::profiler::IMEAN_S, ix::profiler::IMEAN_T, ix::profiler::IMIN_E, ix::profiler::IMIN_S, ix::profiler::IMIN_T, scalability_stats::nprocs, and scalability_stats::sstats.
Referenced by ix::profiler::Profane().
|
inline |
Set errstream.
Definition at line 496 of file Profiler.H.
Referenced by ix::profiler::Profane().
|
inline |
Set outstream.
Definition at line 491 of file Profiler.H.
Referenced by ix::profiler::Profane().
int SummarizeParallelExecution | ( | std::ostream & | Ostr, |
std::ostream & | Ouf, | ||
PEventList & | parallel_event_list | ||
) |
Profiling output for single parallel run.
Definition at line 593 of file Profiler.C.
References parallel_stats::call_max, parallel_stats::call_maxrank, parallel_stats::call_mean, parallel_stats::call_min, parallel_stats::call_minrank, parallel_stats::call_stdev, ProfilerObj::configmap, ProfilerObj::Err, cumulative_stats::excl, cumulative_stats::excl_dev, parallel_stats::excl_max, parallel_stats::excl_maxrank, parallel_stats::excl_mean, parallel_stats::excl_min, parallel_stats::excl_minrank, parallel_stats::excl_stdev, cumulative_stats::incl, cumulative_stats::incl_dev, parallel_stats::incl_max, parallel_stats::incl_maxrank, parallel_stats::incl_mean, parallel_stats::incl_min, parallel_stats::incl_minrank, parallel_stats::incl_stdev, cumulative_stats::ncalls, and ProfilerObj::profiler_rank.
Referenced by ix::profiler::Profane().
void SummarizeSerialExecution | ( | std::ostream & | Ostr | ) |
Profiling output for serial application.
Definition at line 393 of file Profiler.C.
References ProfilerObj::configmap, ProfilerObj::event_list, cumulative_stats::excl, cumulative_stats::excl_dev, cumulative_stats::incl, cumulative_stats::incl_dev, and cumulative_stats::ncalls.
Referenced by ix::profiler::Profane(), GlobalObj< StackType, ErrorType, ProfilerType >::Report(), and testmanager::Test__BasicTimer().
void WriteEventFile | ( | ) |
Writes final even file.
Definition at line 475 of file Profiler.C.
References ProfilerObj::configmap, ProfilerObj::DumpEvents(), and ProfilerObj::profiler_rank.
Referenced by ProfilerObj::Finalize().
|
private |
whether the profiler has been finalized
Definition at line 568 of file Profiler.H.
Referenced by ProfilerObj::Finalize(), and ProfilerObj::ProfilerObj().
|
private |
whether the profiler has been initialized
Definition at line 566 of file Profiler.H.
Referenced by ProfilerObj::Init(), and ProfilerObj::ProfilerObj().
|
private |
mismatch is error - otherwise automatically exit children
Definition at line 564 of file Profiler.H.
|
protected |
map from unique id to construct name
Definition at line 417 of file Profiler.H.
Referenced by ProfilerObj::Finalize(), ProfilerObj::FunctionEntry(), ProfilerObj::FunctionExit(), ProfilerObj::Init(), ProfilerObj::ReadConfig(), ProfilerObj::ScalabilitySummary(), ProfilerObj::SummarizeParallelExecution(), ProfilerObj::SummarizeSerialExecution(), and ProfilerObj::WriteEventFile().
|
protected |
stream for errors
Definition at line 407 of file Profiler.H.
Referenced by ProfilerObj::PopulateScalaMap(), ProfilerObj::ProfilerObj(), ProfilerObj::ReadConfig(), ProfilerObj::ReadEventsFromFile(), ProfilerObj::ReadParallelEventFiles(), ProfilerObj::ReadSummaryFiles(), and ProfilerObj::SummarizeParallelExecution().
|
protected |
completed events
Definition at line 413 of file Profiler.H.
Referenced by ProfilerObj::DumpEvents(), ProfilerObj::Finalize(), ProfilerObj::FunctionExit(), ProfilerObj::FunctionExitAll(), ProfilerObj::ReadEventsFromFile(), ProfilerObj::ReadParallelEventFiles(), and ProfilerObj::SummarizeSerialExecution().
|
protected |
map from construct name to unique id
Definition at line 415 of file Profiler.H.
Referenced by ProfilerObj::Finalize(), ProfilerObj::FunctionEntry(), ProfilerObj::FunctionExit(), ProfilerObj::Init(), and ProfilerObj::ReadConfig().
|
protected |
total number of constructs profiled
Definition at line 419 of file Profiler.H.
Referenced by ProfilerObj::FunctionEntry(), and ProfilerObj::ProfilerObj().
|
protected |
construct entry events
Definition at line 411 of file Profiler.H.
Referenced by ProfilerObj::Finalize(), ProfilerObj::FunctionEntry(), ProfilerObj::FunctionExit(), ProfilerObj::FunctionExitAll(), and ProfilerObj::Init().
|
protected |
stream for regular output
Definition at line 405 of file Profiler.H.
Referenced by ProfilerObj::ProfilerObj().
|
protected |
parallel processor id
Definition at line 401 of file Profiler.H.
Referenced by ProfilerObj::DumpEvents(), ProfilerObj::Finalize(), ProfilerObj::FunctionExit(), ProfilerObj::Init(), ProfilerObj::ProfilerObj(), ProfilerObj::ReadEventsFromFile(), ProfilerObj::ReadParallelEventFiles(), ProfilerObj::SummarizeParallelExecution(), and ProfilerObj::WriteEventFile().
|
protected |
creation/init time
Definition at line 409 of file Profiler.H.
Referenced by ProfilerObj::FunctionEntry(), ProfilerObj::FunctionExit(), ProfilerObj::FunctionExitAll(), and ProfilerObj::Init().
|
protected |
verbosity level
Definition at line 403 of file Profiler.H.
Referenced by ProfilerObj::ProfilerObj().