40 #ifndef TEUCHOS_TIMEMONITOR_HPP
41 #define TEUCHOS_TIMEMONITOR_HPP
68 #include "Teuchos_Comm.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,
645 enum ETimeMonitorReportFormat {
654 enum ETimeMonitorYamlFormat {
674 summarizeToYaml (Ptr<
const Comm<int> > comm,
676 const ETimeMonitorYamlFormat yamlStyle,
677 const std::string& filter=
"");
684 summarizeToYaml (std::ostream& out,
685 const ETimeMonitorYamlFormat yamlStyle,
686 const std::string& filter=
"");
692 static void setReportFormatParameter (ParameterList& plist);
698 static void setYamlFormatParameter (ParameterList& plist);
704 static void setSetOpParameter (ParameterList& plist);
720 static void setReportParameters (
const RCP<ParameterList>& params);
728 static ETimeMonitorReportFormat reportFormat_;
733 static ETimeMonitorYamlFormat yamlStyle_;
741 static bool alwaysWriteLocal_;
748 static bool writeGlobalStats_;
751 static bool writeZeroTimers_;
758 static bool setParams_;
814 virtual void summarize (std::ostream& out) {
864 if (
is_null (CommandLineProcessor::getTimeMonitorSurrogate ())) {
880 #endif // TEUCHOS_TIMEMONITOR_H
SyncTimeMonitor()=delete
Default constructor is deleted, since it would be unsafe.
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.
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.
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.
Basic command line parser for input from (argc,argv[])
~SyncTimeMonitor() override
Destructor: stops the timer.
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...
Scope guard for Time, that can compute MPI collective timer statistics.
Injects run-time dependency of a class on TimeMonitor.