Public Member Functions | Private Member Functions | Private Attributes

perf::Timer Class Reference
[Performance Timers API]

Timer class -- just throw one of these on the stack with a unique name. More...

#include <perf.h>

Collaboration diagram for perf::Timer:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Timer (const char *name)
 ~Timer (void)

Private Member Functions

 Timer (const Timer &)
const Timeroperator= (const Timer &)

Private Attributes

time_t m_start_time
void * m_context

Detailed Description

Timer class -- just throw one of these on the stack with a unique name.

When the timer destructs, it will register the time. At the end of program execution (actually, at any time!) you can call getTimingSummary() and retrieve the list of all timers encountered and basic statistics.

Example:

        void myFunction(void) {
                perf::Timer timer("myFunction");
                dosomething();
                dosomething_else();
                {
                        perf::Timer timer("myFunction--expensive");
                        dosomething_expensive();
                }
        }

Definition at line 169 of file perf.h.


Constructor & Destructor Documentation

perf::Timer::Timer ( const char *  name  ) 

Definition at line 125 of file perf.cpp.


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