|
|
|
|
Documentation |
|
Main Page Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages Search
NLMISC::CHTimer Class ReferenceHierarchical timing system.
More...
#include <hierarchical_timer.h>
List of all members.
Public Types |
enum | TSortCriterion {
NoSort,
TotalTime,
TotalTimeWithoutSons,
MeanTime,
NumVisits,
MaxTime,
MinTime,
SortCriterionsLast
} |
Public Methods |
| CHTimer (const char *name, bool isRoot=false) |
| ctor. More...
|
void | before () |
| Starts a measuring session. More...
|
void | after (bool displayAfter=false) |
const char * | getName () const |
Static Public Methods |
void | startBench (bool wantStandardDeviation=false, bool quick=false) |
| Starts a bench session. More...
|
void | bench () |
| For backward compatibility. More...
|
void | adjust () |
| For backward compatibility. More...
|
void | endBench () |
| Ends a bench session. More...
|
void | display (CLog *log=InfoLog, TSortCriterion criterion=TotalTime, bool displayInline=true, bool displayEx=true) |
| Display results. More...
|
void | displayByExecutionPath (CLog *log=InfoLog, TSortCriterion criterion=TotalTime, bool displayInline=true, bool alignPaths=true, bool displayEx=true) |
| Display results by execution paths. More...
|
void | displayHierarchical (CLog *log=InfoLog, bool displayEx=true, uint labelNumChar=32, uint indentationStep=2) |
| Hierarchical display, no sorting is done. More...
|
void | displayHierarchicalByExecutionPath (CLog *log=InfoLog, bool displayEx=true, uint labelNumChar=32, uint indentationStep=2) |
| Hierarchical display, no sorting is done. More...
|
void | displayHierarchicalByExecutionPathSorted (CLog *log=InfoLog, TSortCriterion criterion=TotalTime, bool displayEx=true, uint labelNumChar=32, uint indentationStep=2) |
| Hierarchical display, sorting is done in branchs. More...
|
void | clear () |
| Clears stats, and reinits all timer structure. More...
|
Private Types |
typedef std::vector< CNode * > | TNodeVect |
typedef std::vector< CHTimer * > | TTimerVect |
Private Methods |
void | walkTreeToCurrent () |
Private Attributes |
const char * | _Name |
CHTimer * | _Parent |
TTimerVect | _Sons |
bool | _IsRoot |
Static Private Attributes |
CNode | _RootNode |
CNode * | _CurrNode = &_RootNode |
CHTimer | _RootTimer |
CSimpleClock | _PreambuleClock |
| This clock is used to measure the preambule of methods such as CHTimer::before() This is static, but the Hierarchical Timer doesn't support multithreading anyway.. More...
|
double | _MsPerTick |
bool | _Benching = false |
bool | _BenchStartedOnce = false |
bool | _WantStandardDeviation = false |
CHTimer * | _CurrTimer = &_RootTimer |
Detailed Description
Hierarchical timing system.
Allows to accurately measure performance of routines, and displays results hierarchically. To time a piece of code, just declare a static CHTimer object and encapsulate code between calls to before() and after() methods. ex: void myFunction()
{
static CHTimer myTimer("myFunction");
myTimer.before();
myTimer.after();
}
*
Don't forget to call after() to avoid timing wrongness or assertion crashes !
-
Warning:
-
Supports only single-threaded applications.
-
Supports only Intel processors.
-
Author:
-
Benjamin Legros , Nicolas Vizerie , Nevrax France
-
Date:
-
2001, 2002
Definition at line 205 of file hierarchical_timer.h.
Member Typedef Documentation
typedef std::vector<CNode *> NLMISC::CHTimer::TNodeVect [private]
|
|
typedef std::vector<CHTimer *> NLMISC::CHTimer::TTimerVect [private]
|
|
Member Enumeration Documentation
enum NLMISC::CHTimer::TSortCriterion
|
|
|
-
Enumeration values:
-
NoSort |
|
TotalTime |
|
TotalTimeWithoutSons |
|
MeanTime |
|
NumVisits |
|
MaxTime |
|
MinTime |
|
SortCriterionsLast |
|
Definition at line 209 of file hierarchical_timer.h. |
Constructor & Destructor Documentation
NLMISC::CHTimer::CHTimer |
( |
const char * |
name, |
|
|
bool |
isRoot = false |
|
) |
[inline] |
|
Member Function Documentation
void NLMISC::CHTimer::adjust |
( |
|
) |
[inline, static] |
|
void NLMISC::CHTimer::after |
( |
bool |
displayAfter = false |
) |
|
|
|
Definition at line 827 of file hierarchical_timer.cpp.
References _Benching, _CurrNode, _CurrTimer, _MsPerTick, _Name, _Parent, _PreambuleClock, NLMISC::CHTimer::CNode::Clock, NLMISC::CHTimer::CNode::LastSonsTotalTime, NLMISC::CHTimer::CNode::MaxTime, NLMISC::CHTimer::CNode::Measures, min, NLMISC::CHTimer::CNode::MinTime, nlinfo, NLMISC::CHTimer::CNode::NumVisits, NLMISC::CHTimer::CNode::Parent, NLMISC::CHTimer::CNode::SonsPreambule, NLMISC::CHTimer::CNode::SonsTotalTime, and NLMISC::CHTimer::CNode::TotalTime. |
void NLMISC::CHTimer::before |
( |
|
) |
|
|
void NLMISC::CHTimer::bench |
( |
|
) |
[inline, static] |
|
void NLMISC::CHTimer::clear |
( |
|
) |
[static] |
|
void NLMISC::CHTimer::display |
( |
CLog * |
log = InfoLog, |
|
|
TSortCriterion |
criterion = TotalTime, |
|
|
bool |
displayInline = true, |
|
|
bool |
displayEx = true |
|
) |
[static] |
|
|
Display results.
-
Parameters:
-
displayEx |
true to display more detailed infos |
Definition at line 284 of file hierarchical_timer.cpp.
References _BenchStartedOnce, _CurrNode, _MsPerTick, _RootNode, _WantStandardDeviation, format, NoSort, NLMISC::smprintf, NLMISC::CHTimer::CNode::SonsPreambule, TNodeVect, and NLMISC::toString. |
void NLMISC::CHTimer::displayByExecutionPath |
( |
CLog * |
log = InfoLog, |
|
|
TSortCriterion |
criterion = TotalTime, |
|
|
bool |
displayInline = true, |
|
|
bool |
alignPaths = true, |
|
|
bool |
displayEx = true |
|
) |
[static] |
|
|
Display results by execution paths.
-
Parameters:
-
displayInline |
true to display each result on a single line. |
alignPaths |
true to display all execution paths aligned. |
displayEx |
true to display more detailed infos. |
Definition at line 371 of file hierarchical_timer.cpp.
References _BenchStartedOnce, _CurrNode, _MsPerTick, _RootNode, _WantStandardDeviation, format, NLMISC::CHTimer::CNode::getNumNodes, nlassert, NoSort, NLMISC::smprintf, NLMISC::CHTimer::CNode::SonsPreambule, TNodeVect, and NLMISC::toString. |
void NLMISC::CHTimer::displayHierarchical |
( |
CLog * |
log = InfoLog, |
|
|
bool |
displayEx = true, |
|
|
uint |
labelNumChar = 32, |
|
|
uint |
indentationStep = 2 |
|
) |
[static] |
|
|
Hierarchical display, no sorting is done.
-
Parameters:
-
displayEx |
true to display more detailed infos. |
labelNumChar |
|
Definition at line 468 of file hierarchical_timer.cpp.
References _BenchStartedOnce, _CurrNode, _MsPerTick, _RootNode, _RootTimer, _WantStandardDeviation, CHTimer, depth, min, nlassert, NLMISC::CHTimer::CNode::SonsPreambule, and TNodeVect. |
void NLMISC::CHTimer::displayHierarchicalByExecutionPath |
( |
CLog * |
log = InfoLog, |
|
|
bool |
displayEx = true, |
|
|
uint |
labelNumChar = 32, |
|
|
uint |
indentationStep = 2 |
|
) |
[static] |
|
void NLMISC::CHTimer::displayHierarchicalByExecutionPathSorted |
( |
CLog * |
log = InfoLog, |
|
|
TSortCriterion |
criterion = TotalTime, |
|
|
bool |
displayEx = true, |
|
|
uint |
labelNumChar = 32, |
|
|
uint |
indentationStep = 2 |
|
) |
[static] |
|
void NLMISC::CHTimer::endBench |
( |
|
) |
[static] |
|
const char* NLMISC::CHTimer::getName |
( |
|
) |
const [inline] |
|
void NLMISC::CHTimer::startBench |
( |
bool |
wantStandardDeviation = false, |
|
|
bool |
quick = false |
|
) |
[static] |
|
|
Starts a bench session.
-
Parameters:
-
wantStandardDeviation |
When true, benchs will report the standard deviation of values. This require more memory, howeve, because each samples must be kept. |
quick |
if true, quick compute the frequency of the processor |
Definition at line 247 of file hierarchical_timer.cpp.
References _Benching, _BenchStartedOnce, _MsPerTick, _RootNode, _RootTimer, _WantStandardDeviation, clear, nlassert, and NLMISC::CHTimer::CNode::Owner.
Referenced by bench. |
void NLMISC::CHTimer::walkTreeToCurrent |
( |
|
) |
[private] |
|
Member Data Documentation
bool NLMISC::CHTimer::_Benching = false [static, private]
|
|
bool NLMISC::CHTimer::_BenchStartedOnce = false [static, private]
|
|
CHTimer * NLMISC::CHTimer::_CurrTimer = &_RootTimer [static, private]
|
|
bool NLMISC::CHTimer::_IsRoot [private]
|
|
double NLMISC::CHTimer::_MsPerTick [static, private]
|
|
const char* NLMISC::CHTimer::_Name [private]
|
|
CHTimer* NLMISC::CHTimer::_Parent [private]
|
|
CSimpleClock NLMISC::CHTimer::_PreambuleClock [static, private]
|
|
|
This clock is used to measure the preambule of methods such as CHTimer::before() This is static, but the Hierarchical Timer doesn't support multithreading anyway..
Definition at line 49 of file hierarchical_timer.cpp.
Referenced by after, and before. |
CHTimer NLMISC::CHTimer::_RootTimer [static, private]
|
|
bool NLMISC::CHTimer::_WantStandardDeviation = false [static, private]
|
|
The documentation for this class was generated from the following files:
|
|