Mantid
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
Mantid::Kernel::CPUTimer Class Reference

CPUTimer : Timer that uses the CPU time, rather than wall-clock time to measure execution time. More...

#include <CPUTimer.h>

Public Member Functions

float CPUfraction (bool doReset=true)
 Return the fraction of the CPU used (CPUTime/wall-clock time). More...
 
 CPUTimer ()
 Constructor. More...
 
float elapsedCPU (bool doReset=true)
 Calculate the elapsed CPU time, reseting the timer if specified. More...
 
float elapsedWallClock (bool doReset=true)
 Calculate the elapsed wall-clock time, reseting the timer if specified. More...
 
void reset ()
 Explicitly reset the timer. More...
 
std::string str ()
 Convert the elapsed time (without reseting) to a string. More...
 

Private Attributes

clock_t m_start
 The starting time (implementation dependent format) More...
 
Timer m_wallClockTime
 The regular (wall-clock time). More...
 

Detailed Description

CPUTimer : Timer that uses the CPU time, rather than wall-clock time to measure execution time.

Author
Janik Zikovsky
Date
2011-04-04 12:17:48.579100

Definition at line 24 of file CPUTimer.h.

Constructor & Destructor Documentation

◆ CPUTimer()

Mantid::Kernel::CPUTimer::CPUTimer ( )

Constructor.

Definition at line 17 of file CPUTimer.cpp.

References reset().

Member Function Documentation

◆ CPUfraction()

float Mantid::Kernel::CPUTimer::CPUfraction ( bool  doReset = true)

Return the fraction of the CPU used (CPUTime/wall-clock time).

This can be > 1 on multi-CPU systems.

Parameters
doReset:: true to reset both timers
Returns

Definition at line 67 of file CPUTimer.cpp.

References Mantid::Kernel::Timer::elapsed(), elapsedCPU(), m_wallClockTime, and reset().

Referenced by str().

◆ elapsedCPU()

float Mantid::Kernel::CPUTimer::elapsedCPU ( bool  doReset = true)

Calculate the elapsed CPU time, reseting the timer if specified.

Parameters
doReset:: true to reset the timer
Returns
time in CPU seconds

Definition at line 36 of file CPUTimer.cpp.

References m_start, reset(), and UNUSED_ARG.

Referenced by CPUfraction().

◆ elapsedWallClock()

float Mantid::Kernel::CPUTimer::elapsedWallClock ( bool  doReset = true)

Calculate the elapsed wall-clock time, reseting the timer if specified.

Parameters
doReset:: true to reset the timer
Returns
wall-clock time, in seconds

Definition at line 54 of file CPUTimer.cpp.

References Mantid::Kernel::Timer::elapsed(), m_wallClockTime, and reset().

Referenced by Mantid::DataHandling::NexusTester::exec().

◆ reset()

void Mantid::Kernel::CPUTimer::reset ( )

◆ str()

std::string Mantid::Kernel::CPUTimer::str ( )

Convert the elapsed time (without reseting) to a string.

Definition at line 77 of file CPUTimer.cpp.

References CPUfraction(), Mantid::Kernel::Timer::elapsed_no_reset(), m_wallClockTime, and reset().

Member Data Documentation

◆ m_start

clock_t Mantid::Kernel::CPUTimer::m_start
private

The starting time (implementation dependent format)

Definition at line 35 of file CPUTimer.h.

Referenced by elapsedCPU(), and reset().

◆ m_wallClockTime

Timer Mantid::Kernel::CPUTimer::m_wallClockTime
private

The regular (wall-clock time).

Definition at line 38 of file CPUTimer.h.

Referenced by CPUfraction(), elapsedWallClock(), reset(), and str().


The documentation for this class was generated from the following files: