42 #ifndef TEUCHOS_TIMEMONITOR_HPP 43 #define TEUCHOS_TIMEMONITOR_HPP 69 #include "Teuchos_Comm.hpp" 75 #define TEUCHOS_TIMER(funcName, strName) \ 76 static Teuchos::Time& funcName() \ 77 {static Teuchos::RCP<Time> rtn = \ 78 Teuchos::TimeMonitor::getNewCounter(strName); return *rtn;} 86 #define TEUCHOS_FUNC_TIME_MONITOR_DIFF( FUNCNAME, DIFF ) \ 87 static Teuchos::RCP<Teuchos::Time> DIFF ## blabla_localTimer; \ 88 if(!DIFF ## blabla_localTimer.get()) { \ 89 std::ostringstream oss; \ 91 DIFF ## blabla_localTimer = Teuchos::TimeMonitor::getNewCounter(oss.str()); \ 93 Teuchos::TimeMonitor DIFF ## blabla_localTimeMonitor(*DIFF ## blabla_localTimer) 118 #define TEUCHOS_FUNC_TIME_MONITOR( FUNCNAME ) \ 119 TEUCHOS_FUNC_TIME_MONITOR_DIFF( FUNCNAME, main ) 135 typedef std::map<std::string, std::vector<std::pair<double, double> > >
stat_map_type;
193 return getNewCounter (name);
211 static void disableTimer (
const std::string& name);
221 static void enableTimer (
const std::string& name);
229 static void zeroOutTimers();
345 computeGlobalTimerStatistics (stat_map_type& statData,
346 std::vector<std::string>& statNames,
349 const std::string& filter=
"");
380 computeGlobalTimerStatistics (stat_map_type& statData,
381 std::vector<std::string>& statNames,
383 const std::string& filter=
"");
448 std::ostream &out=std::cout,
449 const bool alwaysWriteLocal=
false,
450 const bool writeGlobalStats=
true,
451 const bool writeZeroTimers=
true,
453 const std::string& filter=
"");
472 summarize (std::ostream& out=std::cout,
473 const bool alwaysWriteLocal=
false,
474 const bool writeGlobalStats=
true,
475 const bool writeZeroTimers=
true,
477 const std::string& filter=
"");
560 const std::string& filter,
577 report (std::ostream& out,
578 const std::string& filter,
586 report (std::ostream& out,
597 enum ETimeMonitorReportFormat {
606 enum ETimeMonitorYamlFormat {
628 const ETimeMonitorYamlFormat yamlStyle,
629 const std::string& filter=
"");
636 summarizeToYaml (std::ostream& out,
637 const ETimeMonitorYamlFormat yamlStyle,
638 const std::string& filter=
"");
678 static ETimeMonitorReportFormat reportFormat_;
682 static ETimeMonitorYamlFormat yamlStyle_;
688 static bool alwaysWriteLocal_;
692 static bool writeGlobalStats_;
695 static bool writeZeroTimers_;
702 static bool setParams_;
721 virtual void summarize (std::ostream& out) {
771 if (
is_null (CommandLineProcessor::getTimeMonitorSurrogate ())) {
787 #endif // TEUCHOS_TIMEMONITOR_H bool is_null(const boost::shared_ptr< T > &p)
Returns true if p.get()==NULL.
std::map< std::string, std::vector< std::pair< double, double > > > stat_map_type
Global statistics collected from timer data.
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).
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="")
Print summary statistics for all timers on the given communicator.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Deprecated.
Templated Parameter List class.
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.