vSMC  v3.0.0
Scalable Monte Carlo
Public Types | Public Member Functions | List of all members
vsmc::StopWatchClockAdapter< ClockType > Class Template Reference

StopWatch as an adapter of C++11 clock. More...

#include <vsmc/utility/stop_watch.hpp>

Public Types

using clock_type = ClockType
 

Public Member Functions

 StopWatchClockAdapter ()
 
double cycles () const
 Return the accumulated cycles. More...
 
double hours () const
 Return the accumulated elapsed time in hours. More...
 
double microseconds () const
 Return the accumulated elapsed time in microseconds. More...
 
double milliseconds () const
 Return the accumulated elapsed time in milliseconds. More...
 
double minutes () const
 Return the accumulated elapsed time in minutes. More...
 
double nanoseconds () const
 Return the accumulated elapsed time in nanoseconds. More...
 
void reset ()
 Stop and reset the elapsed time to zero. More...
 
bool running () const
 If the watch is running. More...
 
double seconds () const
 Return the accumulated elapsed time in seconds. More...
 
bool start ()
 Start the watch, no effect if already started. More...
 
bool stop ()
 Stop the watch, no effect if already stopped. More...
 

Detailed Description

template<typename ClockType>
class vsmc::StopWatchClockAdapter< ClockType >

StopWatch as an adapter of C++11 clock.

Definition at line 117 of file stop_watch.hpp.

Member Typedef Documentation

template<typename ClockType>
using vsmc::StopWatchClockAdapter< ClockType >::clock_type = ClockType

Definition at line 120 of file stop_watch.hpp.

Constructor & Destructor Documentation

template<typename ClockType>
vsmc::StopWatchClockAdapter< ClockType >::StopWatchClockAdapter ( )
inline

Definition at line 122 of file stop_watch.hpp.

Member Function Documentation

template<typename ClockType>
double vsmc::StopWatchClockAdapter< ClockType >::cycles ( ) const
inline

Return the accumulated cycles.

Definition at line 181 of file stop_watch.hpp.

template<typename ClockType>
double vsmc::StopWatchClockAdapter< ClockType >::hours ( ) const
inline

Return the accumulated elapsed time in hours.

Definition at line 224 of file stop_watch.hpp.

template<typename ClockType>
double vsmc::StopWatchClockAdapter< ClockType >::microseconds ( ) const
inline

Return the accumulated elapsed time in microseconds.

Definition at line 192 of file stop_watch.hpp.

template<typename ClockType>
double vsmc::StopWatchClockAdapter< ClockType >::milliseconds ( ) const
inline

Return the accumulated elapsed time in milliseconds.

Definition at line 200 of file stop_watch.hpp.

template<typename ClockType>
double vsmc::StopWatchClockAdapter< ClockType >::minutes ( ) const
inline

Return the accumulated elapsed time in minutes.

Definition at line 216 of file stop_watch.hpp.

template<typename ClockType>
double vsmc::StopWatchClockAdapter< ClockType >::nanoseconds ( ) const
inline

Return the accumulated elapsed time in nanoseconds.

Definition at line 184 of file stop_watch.hpp.

template<typename ClockType>
void vsmc::StopWatchClockAdapter< ClockType >::reset ( )
inline

Stop and reset the elapsed time to zero.

Definition at line 172 of file stop_watch.hpp.

template<typename ClockType>
bool vsmc::StopWatchClockAdapter< ClockType >::running ( ) const
inline

If the watch is running.

If start() has been called and no stop() call since, then it is running, otherwise it is stoped.

Definition at line 133 of file stop_watch.hpp.

template<typename ClockType>
double vsmc::StopWatchClockAdapter< ClockType >::seconds ( ) const
inline

Return the accumulated elapsed time in seconds.

Definition at line 208 of file stop_watch.hpp.

template<typename ClockType>
bool vsmc::StopWatchClockAdapter< ClockType >::start ( )
inline

Start the watch, no effect if already started.

Returns
true if it is started by this call, and the elapsed time will be incremented next time stop() is called. The increment will be relative to the time point of this call. false if it is already started earlier.

Definition at line 141 of file stop_watch.hpp.

template<typename ClockType>
bool vsmc::StopWatchClockAdapter< ClockType >::stop ( )
inline

Stop the watch, no effect if already stopped.

Returns
true if it is stoped by this call, and the elapsed time has been incremented. false if it is already stopped or wasn't started before.

Definition at line 158 of file stop_watch.hpp.