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

A simple class that provides a wall-clock (not processor time) timer. More...

#include <Timer.h>

Public Member Functions

float elapsed (bool reset=true)
 Returns the wall-clock time elapsed in seconds since the Timer object's creation, or the last call to elapsed. More...
 
float elapsed_no_reset () const
 Returns the wall-clock time elapsed in seconds since the Timer object's creation, or the last call to elapsed. More...
 
void reset ()
 Explicitly reset the timer. More...
 
std::string str () const
 Convert the elapsed time (without reseting) to a string. More...
 
 Timer ()
 Constructor. More...
 
virtual ~Timer ()=default
 

Private Attributes

time_point_ns m_start
 The starting time. More...
 

Detailed Description

A simple class that provides a wall-clock (not processor time) timer.

Author
Russell Taylor, Tessella plc
Date
29/04/2010

Definition at line 27 of file Timer.h.

Constructor & Destructor Documentation

◆ Timer()

Mantid::Kernel::Timer::Timer ( )

Constructor.

Instantiating the object starts the timer.

Definition at line 20 of file Timer.cpp.

◆ ~Timer()

virtual Mantid::Kernel::Timer::~Timer ( )
virtualdefault

Member Function Documentation

◆ elapsed()

float Mantid::Kernel::Timer::elapsed ( bool  reset = true)

Returns the wall-clock time elapsed in seconds since the Timer object's creation, or the last call to elapsed.

Parameters
reset:: set to true to reset the clock (default)
Returns
time in seconds

Definition at line 28 of file Timer.cpp.

References elapsed_no_reset(), and reset().

Referenced by Mantid::Kernel::CPUTimer::CPUfraction(), Mantid::API::Algorithm::doCallProcessGroups(), Mantid::Kernel::CPUTimer::elapsedWallClock(), Mantid::API::Algorithm::executeInternal(), Mantid::MDAlgorithms::LoadSQW2::readPixelDataIntoWorkspace(), Mantid::MDAlgorithms::LoadSQW2::setupBoxController(), and Mantid::DataHandling::SaveToSNSHistogramNexus::WriteOutDataOrErrors().

◆ elapsed_no_reset()

float Mantid::Kernel::Timer::elapsed_no_reset ( ) const

Returns the wall-clock time elapsed in seconds since the Timer object's creation, or the last call to elapsed.

Returns
time in seconds

Definition at line 40 of file Timer.cpp.

References m_start.

Referenced by elapsed(), MantidQt::MantidWidgets::NotificationService::showMessage(), Mantid::Kernel::CPUTimer::str(), str(), and MantidQt::MantidWidgets::AlgorithmProgressPresenter::updateProgressBarSlot().

◆ reset()

void Mantid::Kernel::Timer::reset ( )

◆ str()

std::string Mantid::Kernel::Timer::str ( ) const

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

Definition at line 51 of file Timer.cpp.

References elapsed_no_reset().

Member Data Documentation

◆ m_start

time_point_ns Mantid::Kernel::Timer::m_start
private

The starting time.

Definition at line 38 of file Timer.h.

Referenced by elapsed_no_reset(), and reset().


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