40#ifndef TEUCHOS_TIMEMONITOR_HPP
41#define TEUCHOS_TIMEMONITOR_HPP
77#define TEUCHOS_TIMER(funcName, strName) \
78 static Teuchos::Time& funcName() \
79 {static Teuchos::RCP<Time> rtn = \
80 Teuchos::TimeMonitor::getNewCounter(strName); return *rtn;}
91#define TEUCHOS_FUNC_TIME_MONITOR_DIFF( FUNCNAME, DIFF ) \
92 static Teuchos::RCP<Teuchos::Time> DIFF ## blabla_localTimer; \
93 if(!DIFF ## blabla_localTimer.get()) { \
94 std::ostringstream oss; \
96 DIFF ## blabla_localTimer = Teuchos::TimeMonitor::getNewCounter(oss.str()); \
98 Teuchos::TimeMonitor DIFF ## blabla_localTimeMonitor(*DIFF ## blabla_localTimer)
123#define TEUCHOS_FUNC_TIME_MONITOR( FUNCNAME ) \
124 TEUCHOS_FUNC_TIME_MONITOR_DIFF( FUNCNAME, main )
143typedef std::map<std::string, std::vector<std::pair<double, double> > >
stat_map_type;
211 return getNewCounter (name);
229 static void disableTimer (
const std::string& name);
239 static void enableTimer (
const std::string& name);
247 static void zeroOutTimers();
369 const std::string&
filter=
"");
410 const std::string&
filter=
"");
481 std::ostream &out=std::cout,
486 const std::string&
filter=
"",
507 summarize (std::ostream& out=std::cout,
512 const std::string&
filter=
"",
599 const std::string&
filter,
616 report (std::ostream& out,
617 const std::string&
filter,
625 report (std::ostream& out,
677 const std::string&
filter=
"");
684 summarizeToYaml (std::ostream& out,
686 const std::string&
filter=
"");
Basic command line parser for input from (argc,argv[])
#define TEUCHOSCOMM_LIB_DLL_EXPORT
Templated Parameter List class.
Basic wall-clock timer class.
Interface by which CommandLineProcessor may use TimeMonitor.
static RCP< TimeMonitorSurrogate > getTimeMonitorSurrogate()
static void setTimeMonitorSurrogate(const RCP< TimeMonitorSurrogate > &timeMonitorSurrogate)
A list of parameters of arbitrary type.
Simple wrapper class for raw pointers to single objects where no persisting relationship exists.
Concrete serial communicator subclass.
A TimeMonitor that waits at a MPI barrier before destruction.
~SyncTimeMonitor() override
Destructor: stops the timer.
SyncTimeMonitor()=delete
Default constructor is deleted, since it would be unsafe.
Ptr< const Comm< int > > comm_
Injects run-time dependency of a class on TimeMonitor.
TimeMonitorSurrogateImplInserter()
Constructor: inject dependency on TimeMonitor into CommandLineProcessor.
Implementation of TimeMonitorSurrogate that invokes TimeMonitor.
virtual void summarize(std::ostream &out)
Summarize timings over all process(es) to the given output stream.
Scope guard for Time, that can compute MPI collective timer statistics.
ETimeMonitorReportFormat
Valid output formats for report().
ETimeMonitorYamlFormat
Valid YAML output formats for report().
static ETimeMonitorReportFormat reportFormat_
Parameters for the report() class method.
static bool writeZeroTimers_
Whether report() should report timers with zero call counts.
static void summarize(Ptr< const Comm< int > > comm, std::ostream &out=std::cout, const bool alwaysWriteLocal=false, const bool writeGlobalStats=true, const bool writeZeroTimers=true, const ECounterSetOp setOp=Intersection, const std::string &filter="", const bool ignoreZeroTimers=false)
Print summary statistics for all timers on the given communicator.
static Teuchos::RCP< Teuchos::StackedTimer > stackedTimer_
Stacked timer for optional injection of timing from TimeMonitor-enabled objects.
static bool writeGlobalStats_
Whether report() should always compute global timer statistics.
static RCP< Time > getNewTimer(const std::string &name)
Return a new timer with the given name (class method).
static ECounterSetOp setOp_
Whether report() should use the intersection or union of timers over (MPI) processes.
static ETimeMonitorYamlFormat yamlStyle_
Current output style for report(), when using YAML output.
static bool alwaysWriteLocal_
Whether report() should always report (MPI) Process 0's local timer results.
TimeMonitor()=delete
Default constructor is deleted, since it would be unsafe.
static bool setParams_
Whether setReportParameters() completed successfully.
bool is_null(const std::shared_ptr< T > &p)
Returns true if p.get()==NULL.
ECounterSetOp
Set operation type for mergeCounterNames() to perform.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Deprecated.
std::map< std::string, std::vector< std::pair< double, double > > > stat_map_type
Global statistics collected from timer data.