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 ) 141 typedef std::map<std::string, std::vector<std::pair<double, double> > >
stat_map_type;
199 return getNewCounter (name);
217 static void disableTimer (
const std::string& name);
227 static void enableTimer (
const std::string& name);
235 static void zeroOutTimers();
351 computeGlobalTimerStatistics (stat_map_type& statData,
352 std::vector<std::string>& statNames,
355 const std::string& filter=
"");
386 computeGlobalTimerStatistics (stat_map_type& statData,
387 std::vector<std::string>& statNames,
389 const std::string& filter=
"");
459 std::ostream &out=std::cout,
460 const bool alwaysWriteLocal=
false,
461 const bool writeGlobalStats=
true,
462 const bool writeZeroTimers=
true,
464 const std::string& filter=
"",
465 const bool ignoreZeroTimers=
false);
484 summarize (std::ostream& out=std::cout,
485 const bool alwaysWriteLocal=
false,
486 const bool writeGlobalStats=
true,
487 const bool writeZeroTimers=
true,
489 const std::string& filter=
"",
490 const bool ignoreZeroTimers=
false);
573 const std::string& filter,
590 report (std::ostream& out,
591 const std::string& filter,
599 report (std::ostream& out,
610 enum ETimeMonitorReportFormat {
619 enum ETimeMonitorYamlFormat {
641 const ETimeMonitorYamlFormat yamlStyle,
642 const std::string& filter=
"");
649 summarizeToYaml (std::ostream& out,
650 const ETimeMonitorYamlFormat yamlStyle,
651 const std::string& filter=
"");
691 static ETimeMonitorReportFormat reportFormat_;
695 static ETimeMonitorYamlFormat yamlStyle_;
701 static bool alwaysWriteLocal_;
705 static bool writeGlobalStats_;
708 static bool writeZeroTimers_;
715 static bool setParams_;
734 virtual void summarize (std::ostream& out) {
784 if (
is_null (CommandLineProcessor::getTimeMonitorSurrogate ())) {
800 #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.
A list of parameters of arbitrary type.
TimeMonitorSurrogateImplInserter()
Constructor: inject dependency on TimeMonitor into CommandLineProcessor.
Abstract interface for distributed-memory communication.
The Teuchos namespace contains all of the classes, structs and enums used by Teuchos, as well as a number of utility routines.
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.