20 comm_(comm), myOS_(NULL), fileOS_(os), ttype_(tt),
21 typeSelector_(), timers_(), timerMap_(), stopHint_(-1)
26 typeSelector_.reset();
27 typeSelector_.set(ttype_);
37 comm_(comm), myOS_(os), fileOS_(NULL), ttype_(tt),
38 typeSelector_(), timers_(), timerMap_(), stopHint_(-1)
43 typeSelector_.reset();
44 typeSelector_.set(ttype_);
62 if (!typeSelector_[tt])
65 if (stopHint_>0 && timers_[stopHint_]->name() == name){
66 timers_[stopHint_]->stop();
71 std::map<std::string, int>::iterator curr = timerMap_.find(name);
72 if (curr != timerMap_.end()){
73 timers_[curr->second]->stop();
76 RCP<Teuchos::Time> newTimer = Teuchos::TimeMonitor::getNewTimer(name);
78 timerMap_[name] = timers_.size();
79 timers_.push_back(newTimer);
80 std::cerr << comm_->getRank() <<
": warning, stop with no start:"
81 << name.c_str() << std::endl;
87 if (!typeSelector_[tt])
90 std::map<std::string, int>::iterator curr = timerMap_.find(name);
92 if (curr == timerMap_.end()){
93 RCP<Teuchos::Time> newTimer = Teuchos::TimeMonitor::getNewTimer(name);
94 index = timers_.size();
95 timerMap_[name] = index;
96 timers_.push_back(newTimer);
102 timers_[index]->start();
103 timers_[index]->incrementNumCalls();
110 Teuchos::TimeMonitor::summarize(comm_.ptr(), *fileOS_);
112 Teuchos::TimeMonitor::summarize(comm_.ptr(), *myOS_);
118 Teuchos::TimeMonitor::zeroOutTimers();
Declarations for TimerManager.
void stop(TimerType tt, const std::string &name)
Stop the named timer.
void print() const
Print out global summary, do not reset timers.
void start(TimerType tt, const std::string &name)
Start the named timer.
void printAndResetToZero()
Print out global summary of timers and reset timers to zero.
TimerManager(const RCP< const Comm< int > > &comm, std::ofstream *of, TimerType tt)
Constructor for output to a file.
~TimerManager()
Destructor.
Created by mbenlioglu on Aug 31, 2020.
TimerType
The type of timers which should be active.
@ NO_TIMERS
No timing data will be collected (the default).
@ MACRO_TIMERS
Time an algorithm (or other entity) as a whole.
@ MICRO_TIMERS
Time the substeps of an entity.
@ BOTH_TIMERS
Run both MACRO and MICRO timers.