42 #ifndef TEUCHOS_TIMEMONITOR_HPP
43 #define TEUCHOS_TIMEMONITOR_HPP
69 #include "Teuchos_Comm.hpp"
78 #define TEUCHOS_TIMER(funcName, strName) \
79 static Teuchos::Time& funcName() \
80 {static Teuchos::RCP<Time> rtn = \
81 Teuchos::TimeMonitor::getNewCounter(strName); return *rtn;}
92 #define TEUCHOS_FUNC_TIME_MONITOR_DIFF( FUNCNAME, DIFF ) \
93 static Teuchos::RCP<Teuchos::Time> DIFF ## blabla_localTimer; \
94 if(!DIFF ## blabla_localTimer.get()) { \
95 std::ostringstream oss; \
97 DIFF ## blabla_localTimer = Teuchos::TimeMonitor::getNewCounter(oss.str()); \
99 Teuchos::TimeMonitor DIFF ## blabla_localTimeMonitor(*DIFF ## blabla_localTimer)
124 #define TEUCHOS_FUNC_TIME_MONITOR( FUNCNAME ) \
125 TEUCHOS_FUNC_TIME_MONITOR_DIFF( FUNCNAME, main )
144 typedef std::map<std::string, std::vector<std::pair<double, double> > >
stat_map_type;
208 return getNewCounter (name);
226 static void disableTimer (
const std::string& name);
236 static void enableTimer (
const std::string& name);
244 static void zeroOutTimers();
361 std::vector<std::string>& statNames,
364 const std::string& filter=
"");
396 std::vector<std::string>& statNames,
398 const std::string& filter=
"");
468 std::ostream &out=std::cout,
469 const bool alwaysWriteLocal=
false,
470 const bool writeGlobalStats=
true,
471 const bool writeZeroTimers=
true,
473 const std::string& filter=
"",
474 const bool ignoreZeroTimers=
false);
493 summarize (std::ostream& out=std::cout,
494 const bool alwaysWriteLocal=
false,
495 const bool writeGlobalStats=
true,
496 const bool writeZeroTimers=
true,
498 const std::string& filter=
"",
499 const bool ignoreZeroTimers=
false);
582 const std::string& filter,
599 report (std::ostream& out,
600 const std::string& filter,
608 report (std::ostream& out,
627 enum ETimeMonitorReportFormat {
636 enum ETimeMonitorYamlFormat {
656 summarizeToYaml (Ptr<
const Comm<int> > comm,
658 const ETimeMonitorYamlFormat yamlStyle,
659 const std::string& filter=
"");
666 summarizeToYaml (std::ostream& out,
667 const ETimeMonitorYamlFormat yamlStyle,
668 const std::string& filter=
"");
674 static void setReportFormatParameter (ParameterList& plist);
680 static void setYamlFormatParameter (ParameterList& plist);
686 static void setSetOpParameter (ParameterList& plist);
702 static void setReportParameters (
const RCP<ParameterList>& params);
708 static ETimeMonitorReportFormat reportFormat_;
712 static ETimeMonitorYamlFormat yamlStyle_;
718 static bool alwaysWriteLocal_;
722 static bool writeGlobalStats_;
725 static bool writeZeroTimers_;
732 static bool setParams_;
754 virtual void summarize (std::ostream& out) {
804 if (
is_null (CommandLineProcessor::getTimeMonitorSurrogate ())) {
820 #endif // TEUCHOS_TIMEMONITOR_H
std::map< std::string, std::vector< std::pair< double, double > > > stat_map_type
Global statistics collected from timer data.
bool is_null(const std::shared_ptr< T > &p)
Returns true if p.get()==NULL.
Basic wall-clock timer class.
Implementation of TimeMonitorSurrogate that invokes TimeMonitor.
static RCP< Time > getNewTimer(const std::string &name)
Return a new timer with the given name (class method).
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.
TimeMonitorSurrogateImplInserter()
Constructor: inject dependency on TimeMonitor into CommandLineProcessor.
Abstract interface for distributed-memory communication.
Basic command line parser for input from (argc,argv[])
Smart reference counting pointer class for automatic garbage collection.
ECounterSetOp
Set operation type for mergeCounterNames() to perform.
Simple wrapper class for raw pointers to single objects where no persisting relationship exists...
A scope-safe timer wrapper class, that can compute global timer statistics.
Injects run-time dependency of a class on TimeMonitor.