b2api
B2000++ API Reference Manual, VERSION 4.6
 
Loading...
Searching...
No Matches
b2000::Timing Class Reference

#include "b2timing.H"

Public Member Functions

void start ()
 
void stop ()
 
double avg_duration () const
 
size_t count () const
 
double duration () const
 Get the overall duration of this timing recorded so far.
 
void print (std::ostream &out) const
 

Detailed Description

A class to hold a timing of a code segment.

It is not thread safe and thus, starting and stopping the timing should only happen outside thread parallel regions.

The Timing data can be obtained with the methods duration(), avg_duration() and count(). None of them perform any checks on whether any measurement is currently ongoing. If there is an ongoing measurement the returned values are for those measurements previous to the current time interval.

The data can be printed in CSV format via the print function, which is also provided via an overload of the "<<" function for std::ostream.

Different timings may overlap in the program execution.

New timing objects are inactive upon creation, their total duration is 0 and their count starts at 0.

Member Function Documentation

◆ avg_duration()

double b2000::Timing::avg_duration ( ) const

Get the average duration of the timing intervals recorded in this timing so far.

◆ count()

size_t b2000::Timing::count ( ) const

Get the number of time intervals recorded in this timing so far.

◆ print()

void b2000::Timing::print ( std::ostream &  out) const

Print the timing information to the given output stream.

The data is provided on a row with comma separated values in the order: duration, avg_duration, count.

◆ start()

void b2000::Timing::start ( )

Start the timing

Only has an effect when the timing has not already been started. Not thread safe, only use outside of threads!

◆ stop()

void b2000::Timing::stop ( )

Stop the timing

Only has an effect when the timing has been already started. Increments the count and of this timing and the accumulated time. Not thread safe, only use outside of threads!


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