Open CASCADE Technology Reference Manual 8.0.0
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions
OSD_PerfMeter Class Reference

This class enables measuring the CPU time between two points of code execution, regardless of the scope of these points of code. A meter is identified by its name (string). So multiple objects in various places of user code may point to the same meter. The results will be printed on stdout upon finish of the program. For details see OSD_PerfMeter.h. More...

#include <OSD_PerfMeter.hxx>

Public Member Functions

 OSD_PerfMeter ()=default
 Constructs a void meter (to further call Init and Start).
 
 OSD_PerfMeter (const TCollection_AsciiString &theMeterName, const bool theToAutoStart=true)
 Constructs and starts (if autoStart is true) the named meter.
 
 ~OSD_PerfMeter ()
 Destructs this meter handler. Note that the meter itself is not destructed and will be printed on stdout upon finish of the program. The meter with the name Specified in the constructor can still be used in other places of the code.
 
void Init (const TCollection_AsciiString &theMeterName)
 Prepares the named meter. If the meter with such name was already created, it will be used. Otherwise, a new meter will be created.
 
void Start () const
 Starts the meter. If the meter was already started, it will be reset. Note that the meter with the name specified in the constructor can still be used in other places of the code.
 
void Stop () const
 Stops the meter.
 
double Elapsed () const
 Returns the elapsed time in seconds since the meter was started.
 
void Kill () const
 Outputs the meter data and resets it to initial state.
 
TCollection_AsciiString Print () const
 Prints the data of this meter.
 

Static Public Member Functions

static TCollection_AsciiString PrintALL ()
 Prints the data of all meters with non-zero elapsed time.
 
static void ResetALL ()
 Resets all meters.
 

Detailed Description

This class enables measuring the CPU time between two points of code execution, regardless of the scope of these points of code. A meter is identified by its name (string). So multiple objects in various places of user code may point to the same meter. The results will be printed on stdout upon finish of the program. For details see OSD_PerfMeter.h.

Constructor & Destructor Documentation

◆ OSD_PerfMeter() [1/2]

OSD_PerfMeter::OSD_PerfMeter ( )
default

Constructs a void meter (to further call Init and Start).

◆ OSD_PerfMeter() [2/2]

OSD_PerfMeter::OSD_PerfMeter ( const TCollection_AsciiString & theMeterName,
const bool theToAutoStart = true )

Constructs and starts (if autoStart is true) the named meter.

Parameters
theMeterNameName of the meter. If the meter with such name was already created, and hasn't been killed, it will be used.
theToAutoStartIf true, the meter will be started immediately after creation. Otherwise, the user should call Start() method to start the meter. Note that if meter already exists, theToAutoStart == true will reset it.

◆ ~OSD_PerfMeter()

OSD_PerfMeter::~OSD_PerfMeter ( )

Destructs this meter handler. Note that the meter itself is not destructed and will be printed on stdout upon finish of the program. The meter with the name Specified in the constructor can still be used in other places of the code.

Member Function Documentation

◆ Elapsed()

double OSD_PerfMeter::Elapsed ( ) const

Returns the elapsed time in seconds since the meter was started.

◆ Init()

void OSD_PerfMeter::Init ( const TCollection_AsciiString & theMeterName)

Prepares the named meter. If the meter with such name was already created, it will be used. Otherwise, a new meter will be created.

◆ Kill()

void OSD_PerfMeter::Kill ( ) const

Outputs the meter data and resets it to initial state.

◆ Print()

TCollection_AsciiString OSD_PerfMeter::Print ( ) const

Prints the data of this meter.

◆ PrintALL()

static TCollection_AsciiString OSD_PerfMeter::PrintALL ( )
static

Prints the data of all meters with non-zero elapsed time.

◆ ResetALL()

static void OSD_PerfMeter::ResetALL ( )
static

Resets all meters.

◆ Start()

void OSD_PerfMeter::Start ( ) const

Starts the meter. If the meter was already started, it will be reset. Note that the meter with the name specified in the constructor can still be used in other places of the code.

◆ Stop()

void OSD_PerfMeter::Stop ( ) const

Stops the meter.


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