56 comm_(comm), myOS_(NULL), fileOS_(os), ttype_(tt),
57 typeSelector_(), timers_(), timerMap_(), stopHint_(-1)
62 typeSelector_.reset();
63 typeSelector_.set(ttype_);
65 if (ttype_ == BOTH_TIMERS){
66 typeSelector_.set(MACRO_TIMERS);
67 typeSelector_.set(MICRO_TIMERS);
73 comm_(comm), myOS_(os), fileOS_(NULL), ttype_(tt),
74 typeSelector_(), timers_(), timerMap_(), stopHint_(-1)
79 typeSelector_.reset();
80 typeSelector_.set(ttype_);
82 if (ttype_ == BOTH_TIMERS){
83 typeSelector_.set(MACRO_TIMERS);
84 typeSelector_.set(MICRO_TIMERS);
98 if (!typeSelector_[tt])
101 if (stopHint_>0 && timers_[stopHint_]->name() == name){
102 timers_[stopHint_]->stop();
107 std::map<std::string, int>::iterator curr = timerMap_.find(name);
108 if (curr != timerMap_.end()){
109 timers_[curr->second]->stop();
112 RCP<Teuchos::Time> newTimer = Teuchos::TimeMonitor::getNewTimer(name);
114 timerMap_[name] = timers_.size();
115 timers_.push_back(newTimer);
116 std::cerr << comm_->getRank() <<
": warning, stop with no start:"
117 << name.c_str() << std::endl;
123 if (!typeSelector_[tt])
126 std::map<std::string, int>::iterator curr = timerMap_.find(name);
128 if (curr == timerMap_.end()){
129 RCP<Teuchos::Time> newTimer = Teuchos::TimeMonitor::getNewTimer(name);
130 index = timers_.size();
131 timerMap_[name] = index;
132 timers_.push_back(newTimer);
135 index = curr->second;
138 timers_[index]->start();
139 timers_[index]->incrementNumCalls();
146 Teuchos::TimeMonitor::summarize(comm_.ptr(), *fileOS_);
148 Teuchos::TimeMonitor::summarize(comm_.ptr(), *myOS_);
154 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).