PlasCom2  1.0
XPACC Multi-physics simluation application
ProfilerObj Class Reference

Performance profiling object. More...

Detailed Description

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 &parallel_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< Eventopen_event_list
 construct entry events More...
 
std::list< Eventevent_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...
 
Collaboration diagram for ProfilerObj:

Constructor & Destructor Documentation

◆ ProfilerObj()

Member Function Documentation

◆ Dump()

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().

Here is the caller graph for this function:

◆ DumpEvents()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Finalize()

◆ FinalizeReady()

bool FinalizeReady ( )
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().

Here is the caller graph for this function:

◆ FunctionEntry() [1/2]

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FunctionEntry() [2/2]

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().

Here is the call graph for this function:

◆ FunctionExit() [1/2]

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FunctionExit() [2/2]

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.

Here is the call graph for this function:

◆ FunctionExitAll()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Init() [1/2]

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Init() [2/2]

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().

Here is the call graph for this function:

◆ PopulateScalaMap()

◆ ReadConfig()

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().

Here is the caller graph for this function:

◆ ReadEventsFromFile()

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().

Here is the caller graph for this function:

◆ ReadParallelEventFiles()

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().

Here is the caller graph for this function:

◆ ReadSummaryFiles()

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().

Here is the caller graph for this function:

◆ ScalabilitySummary()

◆ SetErr()

void SetErr ( std::ostream *  Oe)
inline

Set errstream.

Definition at line 496 of file Profiler.H.

Referenced by ix::profiler::Profane().

Here is the caller graph for this function:

◆ SetOut()

void SetOut ( std::ostream *  Os)
inline

Set outstream.

Definition at line 491 of file Profiler.H.

Referenced by ix::profiler::Profane().

Here is the caller graph for this function:

◆ SummarizeParallelExecution()

◆ SummarizeSerialExecution()

void SummarizeSerialExecution ( std::ostream &  Ostr)

◆ WriteEventFile()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ _finalized

bool _finalized
private

whether the profiler has been finalized

Definition at line 568 of file Profiler.H.

Referenced by ProfilerObj::Finalize(), and ProfilerObj::ProfilerObj().

◆ _initd

bool _initd
private

whether the profiler has been initialized

Definition at line 566 of file Profiler.H.

Referenced by ProfilerObj::Init(), and ProfilerObj::ProfilerObj().

◆ _strict

bool _strict
private

mismatch is error - otherwise automatically exit children

Definition at line 564 of file Profiler.H.

◆ configmap

◆ Err

◆ event_list

◆ function_map

FunctionMap function_map
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().

◆ nfunc

unsigned int nfunc
protected

total number of constructs profiled

Definition at line 419 of file Profiler.H.

Referenced by ProfilerObj::FunctionEntry(), and ProfilerObj::ProfilerObj().

◆ open_event_list

std::list<Event> open_event_list
protected

◆ Out

std::ostream* Out
protected

stream for regular output

Definition at line 405 of file Profiler.H.

Referenced by ProfilerObj::ProfilerObj().

◆ profiler_rank

◆ time0

double time0
protected

◆ verblevel

unsigned int verblevel
protected

verbosity level

Definition at line 403 of file Profiler.H.

Referenced by ProfilerObj::ProfilerObj().


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