Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members

# XFcProfiler Class Reference

Profiler static class. More...

List of all members.

## Static Public Member Functions
XFCIMPORT void | initEventLog ()
| Initializes profiling log.
XFCIMPORT CHAR * | getEventLog ()
| Gets pointer to the profiling log.
XFCIMPORT void | addEvent (const CHAR *aName)
| Adds an event to the log (name should preferably be 6 characters).
XFCIMPORT void | frameEvent (INT32 aFlags=0)
| Marks end of an event, calculates framerate and adds it to the list.
XFCIMPORT void | resetEvent (const CHAR *aLastname, const CHAR *aNextname)
| Resets the event log.
XFCIMPORT void | startSampler (const CHAR *aFilename=XFCSTR("sampler_dump.dat"), INT aStartPaused=0)
| Starts the sampling profiler.
XFCIMPORT void | pauseSampler ()
| Pauses sampler.
XFCIMPORT void | resumeSampler ()
| Resumes sampler.
XFCIMPORT void | endSampler ()
| Ends sampler.

## Detailed Description

Profiler static class.

X-Forge Core supports two kinds of profiling: event log profiling and sampling. The event log system works on all platforms; the sampling system currently only works on WinCE.

  The event log profiling scheme works like this:

       initEventLog(); // run this first in some initialization function.
       ..
       addEvent("somefx1"); // call AddEvent before each event
       ..
       addEvent("somefx2");
       ..
       addEvent("somefx3");
       ..
       frameEvent(); // call frameEvent before printing out
       printOut(GetEventLog());
       resetEvent("print ","somefx0"); // reset log
       ..
       addEvent("core.."); // call this before ending the render function, or the
                           // last logged event will get the core time as well.

  The sampling profiler stores samples of the instruction pointer which can be used to make a map of function timings using .map file generated with the compiler.

## Member Function Documentation

XFCIMPORT void XFcProfiler::addEvent | ( | const CHAR * | aName | ) | `[static]`

| Adds an event to the log (name should preferably be 6 characters). Note: Keep the descriptions short, as the allocated space for the whole log is approximately only 1 KB or so. Do not delete[] the buffer; it is owned by the core.

XFCIMPORT void XFcProfiler::endSampler | ( |  | ) | `[static]`

| Ends sampler. Note: Calling this is important, as it closes the file and shuts down worker threads etc.

XFCIMPORT void XFcProfiler::frameEvent | ( | INT32 | aFlags = 0 | ) | `[static]`

| Marks end of an event, calculates framerate and adds it to the list. The log is printable after this call. Note: Next call after this should be resetEvent. See also: resetEvent

XFCIMPORT CHAR* XFcProfiler::getEventLog | ( |  | ) | `[static]`

| Gets pointer to the profiling log.

XFCIMPORT void XFcProfiler::initEventLog | ( |  | ) | `[static]`

| Initializes profiling log. Note: Call this only once.

XFCIMPORT void XFcProfiler::pauseSampler | ( |  | ) | `[static]`

| Pauses sampler.

XFCIMPORT void XFcProfiler::resetEvent | ( | const CHAR * | aLastname,
|  | const CHAR * | aNextname
| ) | `[static]`

  | Resets the event log. Parameters:
  aLastname | name of the event preceding this call.
  aNextname | name of the event following this call.

XFCIMPORT void XFcProfiler::resumeSampler | ( |  | ) | `[static]`

| Resumes sampler.

XFCIMPORT void XFcProfiler::startSampler | ( | const CHAR * | aFilename = XFCSTR("sampler_dump.dat"),
|  | INT | aStartPaused = 0
| ) | `[static]`

| Starts the sampling profiler. Note: Sampling profiler requires about 64KB of memory. Not supported on all platforms. Core must be compiled with XFC_USE_SAMPLINGPROFILER to enable it. Under WinCE, you must link toolhelp.lib to the application when sampling profiler is used.

|  | X-Forge Documentation Confidential Copyright © 2002-2003 Fathammer |  | Documentation generated with doxygen by Dimitri van Heesch