TSimpleProfiler Class Reference

This represents simple profiler. More...

#include <SimpleProfiler.h>

List of all members.

Public Member Functions

 TSimpleProfiler (const char *name)
 Constructor.
 ~TSimpleProfiler (void)
 Destroy object.
void Call (void)
 Increments number of calling by one.
void TimeStart (void)
 Start profiling - save actual time.
void TimeEnd (void)
 End profiling - compute difference between times.
void PrintStat (void)
 Print statistic for this object.
const char * GetName (void) const
 Returns name registered for this profiler.
long long GetCalls (void) const
 Return total number of calls for this profiler.
long long GetTotalTime (void) const
 Return total time measuerd by this profiler.

Static Public Member Functions

static void AddObject (TSimpleProfiler *obj)
 Add object to list of objects.
static void PrintAllStats (void)
 Prints statistic about all objects.
static void PrintAllToFile (const char *file)
 Print statistics into file in TABLE format - items are separated by semicolon.
static void RemoveAllProfilers (void)
 This method remove all profilers registered in list of profilers.

Static Public Attributes

static TListItem * m_array = NULL
 linked list of this items
static TListItem * m_arrayLast = NULL
 last item in linked list

Classes

struct  TListItem


Detailed Description

This represents simple profiler.

You should use it only via macros created above!!!

Each profiling object should be created as STATIC in place where profiling will be performed. In constructor this static object write himself to list of objects type TSimpleProfiler. With this you can get all information about application at end of program.

Because each profiler allocate static object on its place INLINE function cannot be inline! This may decrease performance but after disabling profilers INLINE will be used as INLINE.

Warning:
Object use malloc/free from CRT - this is one exception in framework. It is possible because TSimpleProfiler will be used only via macros and in RELEASE version there will be no such objects.

Definition at line 92 of file SimpleProfiler.h.


Constructor & Destructor Documentation

TSimpleProfiler::TSimpleProfiler const char *  name  ) 
 

Constructor.

Creates object and add it to listo of objects of this type.

Definition at line 31 of file SimpleProfiler.cpp.

References AddObject().

Here is the call graph for this function:

TSimpleProfiler::~TSimpleProfiler void   ) 
 

Destroy object.

Don't remove object from list of objects!!!

Definition at line 46 of file SimpleProfiler.cpp.


Member Function Documentation

void TSimpleProfiler::AddObject TSimpleProfiler obj  )  [static]
 

Add object to list of objects.

Parameters:
obj [in] pointer to static object (it isn't dynamically allocated)

Definition at line 89 of file SimpleProfiler.cpp.

References m_array, and m_arrayLast.

Referenced by TSimpleProfiler().

void TSimpleProfiler::Call void   )  [inline]
 

Increments number of calling by one.

Definition at line 141 of file SimpleProfiler.h.

long long TSimpleProfiler::GetCalls void   )  const [inline]
 

Return total number of calls for this profiler.

Definition at line 155 of file SimpleProfiler.h.

const char * TSimpleProfiler::GetName void   )  const [inline]
 

Returns name registered for this profiler.

Definition at line 148 of file SimpleProfiler.h.

long long TSimpleProfiler::GetTotalTime void   )  const [inline]
 

Return total time measuerd by this profiler.

Definition at line 162 of file SimpleProfiler.h.

void TSimpleProfiler::PrintAllStats void   )  [static]
 

Prints statistic about all objects.

Definition at line 111 of file SimpleProfiler.cpp.

References m_array.

void TSimpleProfiler::PrintAllToFile const char *  file  )  [static]
 

Print statistics into file in TABLE format - items are separated by semicolon.

Parameters:
file [in] name of file.

Definition at line 126 of file SimpleProfiler.cpp.

References m_array.

void TSimpleProfiler::PrintStat void   ) 
 

Print statistic for this object.

Definition at line 52 of file SimpleProfiler.cpp.

void TSimpleProfiler::RemoveAllProfilers void   )  [static]
 

This method remove all profilers registered in list of profilers.

Profilers aren't removed physically - they are static objects. Only linked list of items is released and set to NULL.

Warning:
This method should be called at end of program after stats from profilers are write to file or screen.

Definition at line 158 of file SimpleProfiler.cpp.

References m_array.

void TSimpleProfiler::TimeEnd void   ) 
 

End profiling - compute difference between times.

Must be called after TimeStart!!!. Also increase number of calls.

Definition at line 73 of file SimpleProfiler.cpp.

void TSimpleProfiler::TimeStart void   ) 
 

Start profiling - save actual time.

Definition at line 59 of file SimpleProfiler.cpp.


Member Data Documentation

TSimpleProfiler::TListItem * TSimpleProfiler::m_array = NULL [static]
 

linked list of this items

Definition at line 129 of file SimpleProfiler.h.

Referenced by AddObject(), PrintAllStats(), PrintAllToFile(), and RemoveAllProfilers().

TSimpleProfiler::TListItem * TSimpleProfiler::m_arrayLast = NULL [static]
 

last item in linked list

Definition at line 130 of file SimpleProfiler.h.

Referenced by AddObject().


The documentation for this class was generated from the following files:
Generated on Wed Nov 28 22:43:53 2007 for Joy4D by  doxygen 1.4.6-NO