SOFA API  1a4bb3e7
Open source framework for multi-physics simuation
sofa::helper::Record Class Reference

#include <AdvancedTimer.h>

Detailed Description

Advanced timer, meant to gather precise statistics for results in published papers. Not so advanced for now, but it will be...

Usage examples :

When all computations start (i.e., Simulation::step): AdvancedTimer::begin("Animate");

When all computations stop (i.e., Simulation::step): AdvancedTimer::end("Animate");

Using a local variable to automatically call end when current instruction block (i.e. method) ends : AdvancedTimer::TimerVar("Animate");

When a part of the computation starts: AdvancedTimer::stepBegin("Collision");

When a part of the computation stops: AdvancedTimer::stepEnd("Collision");

Both operations combined: AdvancedTimer::stepNext("Collision", "Mechanical");

Using a local variable to automatically call stepEnd when current instruction block (i.e. method) ends : AdvancedTimer::StepVar("UpdateMapping");

Specifying the object being processed: AdvancedTimer::StepVar("Collision", objPtr);

When a noteworthy milestone happens: AdvancedTimer::step("Event1");

When a noteworthy value must be stored: AdvancedTimer::valSet("contacts",nbContacts);

When a noteworthy value must be accumulated: AdvancedTimer::valAdd("dofs",mstate->getSize());

When reloading/reseting the simulation: AdvancedTimer::clear();

The produced stats will looks like:

==== Animate ====

Trace of last iteration : 0 ms > begin Collision : var nbCM = 10 10 ms > begin BP 20 ms < end NP > begin NP 120 ms < end NP : var nbContacts = 100 > begin Response 150 ms < end Response < end Collision > begin Mechanical > begin CGSolve on Torus1 : var dofs += 300 ... 434 ms END

Steps Duration Statistics (in ms) : LEVEL START NUM MEAN MAX TOTAL ID 0 0 100 222.2 546.3 22220 TOTAL 1 0 1 80.5 120.7 80.5 Collision 2 0 1 7.2 8.4 7.2 BP 2 7.2 0.95 65.4 104.8 62.3 NP 2 69.5 1 11.0 13.7 11.0 Response 1 80.5 1 131.1 308.9 131.1 Mechanical 2 80.5 10 13.1 45.7 131.0 CGSolve ...

Values Statistics : MIN MAX MEAN ID 10 10 10 nbCM 0 1230 420.3 nbContacts 5000 5000 5000 dofs

==== END ====

Public Attributes

sofa::helper::system::thread::ctime_t time
 
enum sofa::helper::Record::Type type
 
std::string label
 
unsigned int id
 
unsigned int obj
 
double val
 

Public Member Functions

 Record ()
 

Attribute details

◆ id

unsigned int sofa::helper::Record::id

◆ label

std::string sofa::helper::Record::label

◆ obj

unsigned int sofa::helper::Record::obj

◆ time

sofa::helper::system::thread::ctime_t sofa::helper::Record::time

◆ type

enum sofa::helper::Record::Type sofa::helper::Record::type

◆ val

double sofa::helper::Record::val

Constructor details

◆ Record()

sofa::helper::Record::Record ( )
inline

Enum details

◆ Type

Enumerator
RNONE 
RBEGIN 
REND 
RSTEP_BEGIN 
RSTEP_END 
RSTEP 
RVAL_SET 
RVAL_ADD