10 #ifndef TEUCHOS_TIMEMONITOR_HPP
11 #define TEUCHOS_TIMEMONITOR_HPP
47 #define TEUCHOS_TIMER(funcName, strName) \
48 static Teuchos::Time& funcName() \
49 {static Teuchos::RCP<Time> rtn = \
50 Teuchos::TimeMonitor::getNewCounter(strName); return *rtn;}
61 #define TEUCHOS_FUNC_TIME_MONITOR_DIFF( FUNCNAME, DIFF ) \
62 static Teuchos::RCP<Teuchos::Time> DIFF ## blabla_localTimer; \
63 if(!DIFF ## blabla_localTimer.get()) { \
64 std::ostringstream oss; \
66 DIFF ## blabla_localTimer = Teuchos::TimeMonitor::getNewCounter(oss.str()); \
68 Teuchos::TimeMonitor DIFF ## blabla_localTimeMonitor(*DIFF ## blabla_localTimer)
93 #define TEUCHOS_FUNC_TIME_MONITOR( FUNCNAME ) \
94 TEUCHOS_FUNC_TIME_MONITOR_DIFF( FUNCNAME, main )
113 typedef std::map<std::string, std::vector<std::pair<double, double> > >
stat_map_type;
181 return getNewCounter (name);
199 static void disableTimer (
const std::string& name);
209 static void enableTimer (
const std::string& name);
217 static void zeroOutTimers();
336 std::vector<std::string>& statNames,
339 const std::string& filter=
"");
378 std::vector<std::string>& statNames,
380 const std::string& filter=
"");
451 std::ostream &out=std::cout,
452 const bool alwaysWriteLocal=
false,
453 const bool writeGlobalStats=
true,
454 const bool writeZeroTimers=
true,
456 const std::string& filter=
"",
457 const bool ignoreZeroTimers=
false);
477 summarize (std::ostream& out=std::cout,
478 const bool alwaysWriteLocal=
false,
479 const bool writeGlobalStats=
true,
480 const bool writeZeroTimers=
true,
482 const std::string& filter=
"",
483 const bool ignoreZeroTimers=
false);
569 const std::string& filter,
586 report (std::ostream& out,
587 const std::string& filter,
595 report (std::ostream& out,
646 const ETimeMonitorYamlFormat yamlStyle,
647 const std::string& filter=
"");
654 summarizeToYaml (std::ostream& out,
655 const ETimeMonitorYamlFormat yamlStyle,
656 const std::string& filter=
"");
850 #endif // TEUCHOS_TIMEMONITOR_H
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
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.