Base global object. More...
Base global object.
Provides an interface for tracking errors, profiling, and user defined stack information. The idea is that this object or a derived object will be available to every rank local method.
#include <Global.H>
Public Member Functions | |
GlobalObj () | |
Default constructor. Profiling is OFF by default. More... | |
GlobalObj (int narg, char **args) | |
Default constructor. More... | |
GlobalObj (GlobalObj< StackType, ErrorType, ProfilerType > &globin) | |
Constructor with args. More... | |
GlobalObj (const StackType &name) | |
Constructor with args. More... | |
GlobalObj (const StackType &name, int id) | |
Constructor with args. More... | |
virtual int | Init (const StackType &name) |
Initializes the global object and it's profiler object /// Initializes the global object and it's profiler object Profiling is ON by default if Init is invoked. More... | |
virtual int | Init (const StackType &name, unsigned int id) |
Initializes the global object and it's profiler object Profiling is ON by default if Init is invoked. More... | |
virtual int | Finalize () |
Finalizes the global object, and it's profiler object. More... | |
virtual bool | WriteProfiles () |
Get state of enablement for writing profile files. More... | |
virtual bool | WriteProfiles (bool yn) |
Enable or disable profile file writing. More... | |
virtual bool | Profiling () |
Get profiling state. More... | |
virtual bool | Profiling (bool yn) |
Enable or disable profiling. More... | |
virtual void | Report (std::ostream &ReportStream) |
Creates the final profiling report on the specified stream. More... | |
virtual void | Register (const StackType &stackentry) |
Register will push to the Stack only. More... | |
virtual void | DeRegister (const StackType &stackentry) |
DeRegister will pop from the stack only. More... | |
virtual void | FunctionEntry (const StackType &stackentry) |
FunctionEntry updates the Stack as well as the Profiler. More... | |
virtual void | FunctionExit (const StackType &stackentry) |
FunctionExit updates the Stack as well as the Profiler. More... | |
virtual void | FunctionExitAll () |
FunctionExitAll exits all from the Profiler only. More... | |
virtual void | Error (const ErrorType &error) |
Pushes an error onto the error stack. More... | |
virtual void | DumpErrors (std::ostream &Ostr) |
Dumps the errors themselves to the indicated stream. More... | |
virtual void | DumpStack (std::ostream &Ostr) |
Dumps the code construct statck to the indicated stream. More... | |
virtual void | DumpProfile (std::ostream &Ostr) |
Dumps the timing profile to the indicated stream. More... | |
bool | DebugStreamReady () |
Checks debug stream. More... | |
void | SetDebugStream (std::ostream &dbstream) |
Sets the debug stream object. More... | |
std::ostream & | DebugStream () |
Gets the debug stream object. More... | |
std::ostream * | DebugStreamPtr () |
Gets the debug stream pointer. More... | |
bool | ErrStreamReady () |
Checks error stream. More... | |
void | SetErrStream (std::ostream &dbstream) |
Sets the error stream object. More... | |
std::ostream & | ErrStream () |
Gets the error stream object. More... | |
std::ostream * | ErrStreamPtr () |
Gets the error stream pointer. More... | |
bool | OutStreamReady () |
Checks out stream. More... | |
void | SetOutStream (std::ostream &outstream) |
Sets the stdout stream object. More... | |
std::ostream & | OutStream () |
Gets the stdout stream object. More... | |
std::ostream * | OutStreamPtr () |
Gets the stdout stream pointer. More... | |
void | UnsetOutStream () |
Sets outstream to NULL. More... | |
bool | LogStreamReady () |
Checks log stream. More... | |
void | SetLogStream (std::ostream &logstream) |
Sets the stdout stream object. More... | |
std::ostream & | LogStream () |
Gets the log stream object. More... | |
std::ostream * | LogStreamPtr () |
Gets the log stream pointer. More... | |
void | SetProfiler (ProfilerType &profiler) |
Sets the Profiler object. More... | |
virtual void | SetName (const std::string &name) |
virtual void | ReName (const std::string &name) |
virtual const std::string & | Name () |
ProfilerType & | Profiler () |
Gets the debug stream object. More... | |
void | SetDebugLevel (unsigned char l) |
Sets the level of debugging. More... | |
unsigned char | DebugLevel () |
Returns the debugging level. More... | |
void | SetVerbLevel (unsigned char l) |
unsigned char | VerbLevel () |
Returns the verbosity level. More... | |
void | SetLogLevel (unsigned char l) |
unsigned char | LogLevel () |
Returns the verbosity level. More... | |
void | DeSyncIO () |
DeSync IO - relinquish control over IO, revert to standard. More... | |
void | SyncIO () |
Syncronize IO - assume control over IO, using established streams. More... | |
virtual int | ForceOut (const std::string &outstr, unsigned char inlev=1) |
virtual int | StdOut (const std::string &outstr, unsigned char inlev=1) |
virtual int | ErrOut (const std::string &outstr) |
virtual int | DebugOut (const std::string &outstr, int inlev=1) |
virtual int | LogOut (const std::string &outstr, int inlev=0) |
virtual | ~GlobalObj () |
Destructor. More... | |
Protected Attributes | |
std::ostream * | _DebugStream |
DebugStream is useful for parallel programs that cannot stream debugging information to the screen. More... | |
std::ostream * | _OutStream |
std::ostream * | _LogStream |
std::ostream * | _ErrStream |
ProfilerType * | _Profiler |
This is a placeholder for a generic profiling tool. More... | |
Private Member Functions | |
std::string | FName () |
Private Attributes | |
unsigned char | _debug_level |
Debugging level. More... | |
unsigned char | _log_level |
Logging level. More... | |
unsigned char | _verb_level |
Verbosity level. More... | |
std::list< StackType > | _Stack |
Stack provides a list for storing the user defined "stack". More... | |
std::list< ErrorType > | _Errors |
Errors provides a list for storing caught execution errors for later processing. More... | |
bool | _initd |
has been initialized? More... | |
bool | _profiling_enabled |
bool | _profiler_mine |
bool | _write_profiles |
std::string | _name |
std::ostream * | _OutStreamSave |
std::ostream * | _ErrStreamSave |
std::ostream * | _DebugStreamSave |
|
inline |
|
inline |
Default constructor.
If no args, then profiling is OFF by default.
Definition at line 82 of file Global.H.
References GlobalObj< StackType, ErrorType, ProfilerType >::Init(), and ix::util::stripdirs().
|
inline |
Constructor with args.
If this constructor is used, Init is invoked which turns profiling ON by default.
Definition at line 98 of file Global.H.
References GlobalObj< StackType, ErrorType, ProfilerType >::_Stack.
|
inline |
Constructor with args.
If this constructor is used, Init is invoked which turns profiling ON by default.
Definition at line 119 of file Global.H.
References GlobalObj< StackType, ErrorType, ProfilerType >::Init().
|
inline |
Constructor with args.
If this constructor is used, Init is invoked which turns profiling ON by default.
Definition at line 128 of file Global.H.
References GlobalObj< StackType, ErrorType, ProfilerType >::Init().
|
inlinevirtual |
Destructor.
Definition at line 510 of file Global.H.
References GlobalObj< StackType, ErrorType, ProfilerType >::_Profiler, and GlobalObj< StackType, ErrorType, ProfilerType >::Finalize().
|
inline |
|
inlinevirtual |
Definition at line 473 of file Global.H.
References GlobalObj< StackType, ErrorType, ProfilerType >::Name().
|
inline |
|
inline |
|
inlinevirtual |
DeRegister will pop from the stack only.
Should be called upon exit of user defined code constructs where a previous call to Register was made upon entry.
Definition at line 260 of file Global.H.
References GlobalObj< StackType, ErrorType, ProfilerType >::FName().
|
inline |
DeSync IO - relinquish control over IO, revert to standard.
Definition at line 404 of file Global.H.
References GlobalObj< StackType, ErrorType, ProfilerType >::_DebugStream, GlobalObj< StackType, ErrorType, ProfilerType >::_ErrStream, and GlobalObj< StackType, ErrorType, ProfilerType >::_OutStream.
|
inlinevirtual |
Dumps the errors themselves to the indicated stream.
Definition at line 296 of file Global.H.
References ix::util::DumpContents().
Referenced by program::Finalize().
|
inlinevirtual |
Dumps the timing profile to the indicated stream.
Definition at line 306 of file Global.H.
References ProfilerObj::Dump().
|
inlinevirtual |
Dumps the code construct statck to the indicated stream.
Definition at line 301 of file Global.H.
References ix::util::DumpContents().
|
inlinevirtual |
|
inlinevirtual |
Definition at line 456 of file Global.H.
References GlobalObj< StackType, ErrorType, ProfilerType >::Name().
Referenced by program::Finalize(), program::Initialize(), application::ReadDomains(), application::RunMaxwellSolver(), application::RunPlasCom2(), TestGrid_CartesianMetric(), TestGrid_CurvilinearMetric(), TestGrid_CurvilinearVGWavy(), TestGrid_PBS_IntegratedHalo(), TestGrid_RectilinearMetric(), TestMaxwellRHSTimeIntegrate(), and TestPlasCom2Input().
|
inline |
Gets the error stream object.
Definition at line 334 of file Global.H.
Referenced by program::Finalize(), and program::Initialize().
|
inline |
|
inlinevirtual |
Finalizes the global object, and it's profiler object.
Reimplemented in Program< TestGlobal, TestComLine >, ParallelGlobalObj< CommunicatorType, StackType, ErrorType, ProfilerType >, parallelprogram, mpiprogram< ComLineType >, command_line_program< CommandLineT >, and program2.
Definition at line 202 of file Global.H.
References GlobalObj< StackType, ErrorType, ProfilerType >::_Profiler, ProfilerObj::Finalize(), and ProfilerObj::FinalizeReady().
Referenced by program2::Finalize(), ParallelGlobalObj< CommunicatorType, StackType, ErrorType, ProfilerType >::Finalize(), GlobalObj< StackType, ErrorType, ProfilerType >::~GlobalObj(), and ParallelGlobalObj< CommunicatorType, StackType, ErrorType, ProfilerType >::~ParallelGlobalObj().
|
inlineprivate |
Definition at line 519 of file Global.H.
References GlobalObj< StackType, ErrorType, ProfilerType >::Name().
Referenced by GlobalObj< StackType, ErrorType, ProfilerType >::DeRegister(), GlobalObj< StackType, ErrorType, ProfilerType >::FunctionEntry(), GlobalObj< StackType, ErrorType, ProfilerType >::FunctionExit(), GlobalObj< StackType, ErrorType, ProfilerType >::Register(), and GlobalObj< StackType, ErrorType, ProfilerType >::SetName().
|
inlinevirtual |
Definition at line 422 of file Global.H.
References GlobalObj< StackType, ErrorType, ProfilerType >::Name().
|
inlinevirtual |
FunctionEntry updates the Stack as well as the Profiler.
Reimplemented in ParallelGlobalObj< CommunicatorType, StackType, ErrorType, ProfilerType >.
Definition at line 267 of file Global.H.
References GlobalObj< StackType, ErrorType, ProfilerType >::FName(), and ProfilerObj::FunctionEntry().
Referenced by ParallelGlobalObj< CommunicatorType, StackType, ErrorType, ProfilerType >::FunctionEntry().
|
inlinevirtual |
FunctionExit updates the Stack as well as the Profiler.
Reimplemented in ParallelGlobalObj< CommunicatorType, StackType, ErrorType, ProfilerType >.
Definition at line 276 of file Global.H.
References GlobalObj< StackType, ErrorType, ProfilerType >::FName(), and ProfilerObj::FunctionExit().
Referenced by ParallelGlobalObj< CommunicatorType, StackType, ErrorType, ProfilerType >::FunctionExit().
|
inlinevirtual |
FunctionExitAll exits all from the Profiler only.
Definition at line 285 of file Global.H.
References ProfilerObj::FunctionExitAll().
|
inlinevirtual |
Initializes the global object and it's profiler object /// Initializes the global object and it's profiler object Profiling is ON by default if Init is invoked.
Definition at line 136 of file Global.H.
References GlobalObj< StackType, ErrorType, ProfilerType >::_DebugStream, GlobalObj< StackType, ErrorType, ProfilerType >::_ErrStream, GlobalObj< StackType, ErrorType, ProfilerType >::_OutStream, GlobalObj< StackType, ErrorType, ProfilerType >::_Profiler, and ProfilerObj::Init().
Referenced by GlobalObj< StackType, ErrorType, ProfilerType >::GlobalObj(), and ParallelGlobalObj< CommunicatorType, StackType, ErrorType, ProfilerType >::ParallelGlobalObj().
|
inlinevirtual |
Initializes the global object and it's profiler object Profiling is ON by default if Init is invoked.
Definition at line 168 of file Global.H.
References GlobalObj< StackType, ErrorType, ProfilerType >::_DebugStream, GlobalObj< StackType, ErrorType, ProfilerType >::_ErrStream, GlobalObj< StackType, ErrorType, ProfilerType >::_OutStream, GlobalObj< StackType, ErrorType, ProfilerType >::_Profiler, and ProfilerObj::Init().
|
inline |
|
inlinevirtual |
Definition at line 490 of file Global.H.
References ix::sys::LogTime(), and GlobalObj< StackType, ErrorType, ProfilerType >::Name().
|
inline |
|
inline |
|
inlinevirtual |
Definition at line 383 of file Global.H.
Referenced by GlobalObj< StackType, ErrorType, ProfilerType >::DebugOut(), GlobalObj< StackType, ErrorType, ProfilerType >::ErrOut(), GlobalObj< StackType, ErrorType, ProfilerType >::FName(), GlobalObj< StackType, ErrorType, ProfilerType >::ForceOut(), GlobalObj< StackType, ErrorType, ProfilerType >::LogOut(), and GlobalObj< StackType, ErrorType, ProfilerType >::StdOut().
|
inline |
Gets the stdout stream object.
Definition at line 348 of file Global.H.
Referenced by program::Finalize(), and ix::MyTestProgram().
|
inline |
|
inline |
Checks out stream.
Definition at line 340 of file Global.H.
Referenced by program::Finalize().
|
inline |
|
inlinevirtual |
Get profiling state.
Definition at line 229 of file Global.H.
Referenced by program::Initialize(), TestGrid_CartesianMetric(), TestGrid_CurvilinearMetric(), TestGrid_CurvilinearVGWavy(), TestGrid_PBS_IntegratedHalo(), TestGrid_RectilinearMetric(), TestHDF5PBSGridIO(), TestPlasCom2_Scalar_AdvectionDiffusion2DX(), TestPlasCom2_Scalar_AdvectionDiffusion2DY(), TestPlasCom2Input(), and TestPlasCom2Output().
|
inlinevirtual |
|
inlinevirtual |
Register will push to the Stack only.
Can be called upon entry of user defined code constructs where profiling is not desired.
Definition at line 251 of file Global.H.
References GlobalObj< StackType, ErrorType, ProfilerType >::FName().
|
inlinevirtual |
|
inlinevirtual |
Creates the final profiling report on the specified stream.
Definition at line 240 of file Global.H.
References ProfilerObj::Finalize(), and ProfilerObj::SummarizeSerialExecution().
Referenced by program::Finalize().
|
inline |
Sets the level of debugging.
Definition at line 388 of file Global.H.
Referenced by program::Initialize().
|
inline |
Sets the debug stream object.
Definition at line 315 of file Global.H.
Referenced by program::Initialize().
|
inline |
|
inline |
|
inlinevirtual |
Definition at line 381 of file Global.H.
References GlobalObj< StackType, ErrorType, ProfilerType >::FName().
|
inline |
|
inline |
Sets the Profiler object.
Definition at line 371 of file Global.H.
References GlobalObj< StackType, ErrorType, ProfilerType >::_Profiler, ProfilerObj::Finalize(), and ProfilerObj::FinalizeReady().
|
inline |
Definition at line 393 of file Global.H.
Referenced by program::Initialize(), TestGrid_CartesianMetric(), TestGrid_CurvilinearMetric(), TestGrid_CurvilinearVGWavy(), TestGrid_PBS_IntegratedHalo(), TestGrid_RectilinearMetric(), TestHDF5PBSGridIO(), TestPlasCom2_Scalar_AdvectionDiffusion2DX(), TestPlasCom2_Scalar_AdvectionDiffusion2DY(), TestPlasCom2Input(), and TestPlasCom2Output().
|
inlinevirtual |
Definition at line 439 of file Global.H.
References GlobalObj< StackType, ErrorType, ProfilerType >::Name().
Referenced by program::Initialize(), ix::MyTestProgram(), application::RunApplication(), application::RunMaxwellSolver(), application::RunPlasCom2(), testmanager::Test__SystemInfo(), TestGrid_CartesianMetric(), TestGrid_CurvilinearMetric(), TestGrid_CurvilinearVGWavy(), TestGrid_PBS_IntegratedHalo(), TestGrid_RectilinearMetric(), TestHDF5PBSGridIO(), TestMaxwellRHSTimeIntegrate(), TestPlasCom2Input(), and TestPlasCom2Output().
|
inline |
Syncronize IO - assume control over IO, using established streams.
Definition at line 415 of file Global.H.
References GlobalObj< StackType, ErrorType, ProfilerType >::_DebugStreamSave, GlobalObj< StackType, ErrorType, ProfilerType >::_ErrStreamSave, and GlobalObj< StackType, ErrorType, ProfilerType >::_OutStreamSave.
|
inline |
|
inlinevirtual |
|
inlinevirtual |
|
protected |
DebugStream is useful for parallel programs that cannot stream debugging information to the screen.
Each rank can use this to stream debugging output to it's own file for separate analysis.
Definition at line 51 of file Global.H.
Referenced by GlobalObj< StackType, ErrorType, ProfilerType >::DeSyncIO(), and GlobalObj< StackType, ErrorType, ProfilerType >::Init().
|
private |
Definition at line 64 of file Global.H.
Referenced by GlobalObj< StackType, ErrorType, ProfilerType >::SyncIO().
|
private |
|
protected |
Definition at line 54 of file Global.H.
Referenced by GlobalObj< StackType, ErrorType, ProfilerType >::DeSyncIO(), and GlobalObj< StackType, ErrorType, ProfilerType >::Init().
|
private |
Definition at line 63 of file Global.H.
Referenced by GlobalObj< StackType, ErrorType, ProfilerType >::SyncIO().
|
protected |
Definition at line 52 of file Global.H.
Referenced by GlobalObj< StackType, ErrorType, ProfilerType >::DeSyncIO(), and GlobalObj< StackType, ErrorType, ProfilerType >::Init().
|
private |
Definition at line 62 of file Global.H.
Referenced by GlobalObj< StackType, ErrorType, ProfilerType >::SyncIO().
|
protected |
This is a placeholder for a generic profiling tool.
Definition at line 56 of file Global.H.
Referenced by GlobalObj< StackType, ErrorType, ProfilerType >::Finalize(), GlobalObj< StackType, ErrorType, ProfilerType >::Init(), GlobalObj< StackType, ErrorType, ProfilerType >::SetProfiler(), and GlobalObj< StackType, ErrorType, ProfilerType >::~GlobalObj().
|
private |
Stack provides a list for storing the user defined "stack".
It's not a real call stack, but a stack of user defined code constructs.
Definition at line 39 of file Global.H.
Referenced by GlobalObj< StackType, ErrorType, ProfilerType >::GlobalObj().