Lines Matching refs:Timer
28 // function does nothing. Otherwise, it prints resource types measured by Timer
32 // calling Timer::Report() to inform what those fields printed by
33 // Timer::Report() indicate (or spvtools::utils::PrintTimerDescription() must be
52 spvtools::utils::ScopedTimer<spvtools::utils::Timer> timer##__LINE__( \
58 // Prints the description of resource types measured by Timer class. If |out| is
62 // calling Timer::Report() to inform what those fields printed by
63 // Timer::Report() indicate.
66 // Status of Timer. kGetrusageFailed means it failed in calling getrusage().
77 // Timer measures the resource utilization for a range of code. The resource
84 // spvtools::utils::Timer timer(std::cout);
85 // timer.Start(); // <-- set |usage_before_|, |wall_before_|,
90 // timer.Stop(); // <-- set |cpu_after_|, |wall_after_|, and
92 // timer.Report(tag); // <-- print tag and the resource utilization to
94 class Timer {
96 Timer(std::ostream* out, bool measure_mem_usage = false)
115 // time of calling Timer::Start() and the time of calling Timer::Stop(). If we
169 virtual ~Timer() {}
196 // Timer::Start() is called. It is used as the base status of CPU time.
200 // Timer::Start() is called. It is used as the base status of WALL time.
203 // Variable to save the result of getrusage() when Timer::Start() is called.
208 // Timer::Stop() is called. It is used as the last status of CPU time. The
213 // Timer::Stop() is called. It is used as the last status of WALL time. The
217 // Variable to save the result of getrusage() when Timer::Stop() is called. It
222 // If true, Timer reports the memory usage information too. Otherwise, Timer
229 // Timer::Start() and it calls Timer::Stop() and Timer::Report() at the end of
231 // proper Timer class (for class TimerType template) in advance. This class
238 // spvtools::utils::ScopedTimer<spvtools::utils::Timer>
246 // The template<class TimerType> is used to choose a Timer class. Currently,
247 // only options for the Timer class are Timer and MockTimer in the unit test.
253 : timer(new TimerType(out, measure_mem_usage)), tag_(tag) {
254 timer->Start();
260 timer->Stop();
261 timer->Report(tag_);
262 delete timer;
266 // Actual timer that measures the resource utilization. It must be an instance
267 // of Timer class if there is no special reason to use other class.
268 TimerType* timer;
270 // A tag that will be printed in front of the trace reported by Timer class.
274 // CumulativeTimer is the same as Timer class, but it supports a cumulative
294 class CumulativeTimer : public Timer {
297 : Timer(out, measure_mem_usage),
308 Timer::Stop();
310 if (cpu_time_ >= 0 && Timer::CPUTime() >= 0)
311 cpu_time_ += Timer::CPUTime();
315 if (wall_time_ >= 0 && Timer::WallTime() >= 0)
316 wall_time_ += Timer::WallTime();
320 if (usr_time_ >= 0 && Timer::UserTime() >= 0)
321 usr_time_ += Timer::UserTime();
325 if (sys_time_ >= 0 && Timer::SystemTime() >= 0)
326 sys_time_ += Timer::SystemTime();
330 if (rss_ >= 0 && Timer::RSS() >= 0)
331 rss_ += Timer::RSS();
335 if (pgfaults_ >= 0 && Timer::PageFault() >= 0)
336 pgfaults_ += Timer::PageFault();