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 )
143 typedef 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();
366 std::vector<std::string>& statNames,
369 const std::string& filter=
"");
408 std::vector<std::string>& statNames,
410 const std::string& filter=
"");
481 std::ostream &out=std::cout,
482 const bool alwaysWriteLocal=
false,
483 const bool writeGlobalStats=
true,
484 const bool writeZeroTimers=
true,
486 const std::string& filter=
"",
487 const bool ignoreZeroTimers=
false);
507 summarize (std::ostream& out=std::cout,
508 const bool alwaysWriteLocal=
false,
509 const bool writeGlobalStats=
true,
510 const bool writeZeroTimers=
true,
512 const std::string& filter=
"",
513 const bool ignoreZeroTimers=
false);
599 const std::string& filter,
616 report (std::ostream& out,
617 const std::string& filter,
625 report (std::ostream& out,
676 const ETimeMonitorYamlFormat yamlStyle,
677 const std::string& filter=
"");
684 summarizeToYaml (std::ostream& out,
685 const ETimeMonitorYamlFormat yamlStyle,
686 const std::string& filter=
"");
880 #endif // TEUCHOS_TIMEMONITOR_H
SyncTimeMonitor()=delete
Default constructor is deleted, since it would be unsafe.
static bool alwaysWriteLocal_
Whether report() should always report (MPI) Process 0's local timer results.
static bool writeGlobalStats_
Whether report() should always compute global timer statistics.
static ETimeMonitorYamlFormat yamlStyle_
Current output style for report(), when using YAML output.
std::map< std::string, std::vector< std::pair< double, double > > > stat_map_type
Global statistics collected from timer data.
virtual void summarize(std::ostream &out)
Summarize timings over all process(es) to the given output stream.
static ECounterSetOp setOp_
Whether report() should use the intersection or union of timers over (MPI) processes.
bool is_null(const std::shared_ptr< T > &p)
Returns true if p.get()==NULL.
Basic wall-clock timer class.
static bool writeZeroTimers_
Whether report() should report timers with zero call counts.
A TimeMonitor that waits at a MPI barrier before destruction.
Implementation of TimeMonitorSurrogate that invokes TimeMonitor.
static RCP< Time > getNewTimer(const std::string &name)
Return a new timer with the given name (class method).
static Teuchos::RCP< Teuchos::StackedTimer > stackedTimer_
Stacked timer for optional injection of timing from TimeMonitor-enabled objects.
static void setTimeMonitorSurrogate(const RCP< TimeMonitorSurrogate > &timeMonitorSurrogate)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Deprecated.
Templated Parameter List class.
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.
Interface by which CommandLineProcessor may use TimeMonitor.
static ETimeMonitorReportFormat reportFormat_
Parameters for the report() class method.
static RCP< TimeMonitorSurrogate > getTimeMonitorSurrogate()
A list of parameters of arbitrary type.
Ptr< const Comm< int > > comm_
TimeMonitorSurrogateImplInserter()
Constructor: inject dependency on TimeMonitor into CommandLineProcessor.
ETimeMonitorReportFormat
Valid output formats for report().
ETimeMonitorYamlFormat
Valid YAML output formats for report().
Basic command line parser for input from (argc,argv[])
#define TEUCHOSCOMM_LIB_DLL_EXPORT
~SyncTimeMonitor() override
Destructor: stops the timer.
Smart reference counting pointer class for automatic garbage collection.
static bool setParams_
Whether setReportParameters() completed successfully.
ECounterSetOp
Set operation type for mergeCounterNames() to perform.
Simple wrapper class for raw pointers to single objects where no persisting relationship exists...
Scope guard for Time, that can compute MPI collective timer statistics.
Injects run-time dependency of a class on TimeMonitor.