Crystal Space: CS::MeasureTime Class Reference (Crystal Space Public API Reference)

| ## Public API Reference

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# CS::MeasureTime Class Reference
[Utilities]

Simple helper class to measure execution time of a block. More...

`#include <csutil/measuretime.h>`

List of all members.

## Public Member Functions
| MeasureTime (const char *format,...)
| Construct with a formatted description string.
void | PrintIntermediate (const char *descr,...)
| Print an intermediate measurement.
| ~MeasureTime ()
## Protected Attributes
int64 | offsetTime
csString | text

## Detailed Description

Simple helper class to measure execution time of a block.

When destructed, csPrintf()s the time that has passed between construction and destruction in microseconds.

Use like:

     void Foo (int x)
     {
       CS::MeasureTime measureFoo ("Foo (%d) time", x);

       // ...
     }

This will print the total execution time of Foo().

Definition at line 54 of file measuretime.h.

## Constructor & Destructor Documentation

CS::MeasureTime::MeasureTime | ( | const char * | format,
|  |  | ... |
| ) |  |  | `[inline]`

Construct with a formatted description string.

Definition at line 64 of file measuretime.h.

References csGetMicroTicks().

## Member Function Documentation

void CS::MeasureTime::PrintIntermediate | ( | const char * | descr,
|  |  | ... |
| ) |  |  | `[inline]`

Print an intermediate measurement.

Definition at line 82 of file measuretime.h.

References csGetMicroTicks(), csPrintf(), and csPrintfV().

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

- csutil/measuretime.h