Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
Profile module overview

Overview

The profile module contains the following logical groups:

  • high level hierarchical timer and logical profiling (frame based and global)
  • function level hierarchical timer based profiling (frame based and global)

Profiling data can be accessed in different ways:

  • using debug commands to query for profiling data
  • using debug commands to set up a write-to-file mode for profile data
  • using the C++ interface herein

High Level Profiling

High level profiling can be done both timer based and logical. An example for a logical profile would be the number of texture changes per frame or the number of triangles rendered.

The hierarchy is enforced by using a hierarchical naming scheme. For timer based profiles this hierachy is build automatically, for logical profiles each profile must be named accordingly when being created.

High level profiling is available in all build configurations. All high level profile functions are optimized for speed (at least while profiling is disabled) so that there is an almost zero cost for having profiling in all configurations.

Function Level Profiling

Function level profiling determines general call statistics, e.g. call count per frame/total, time spent in function, time per call, time spend in function and children, etc.

Function level profiling is available in the 'profile' build configuration only since it relies on the fact that the compiler generates '_penter' function calls at the beginning of each function.

Profile frames

Instead of just providing frame based profiles this module has the concept of profile ranges. A range is a period of time specified by a Begin and and End function call. All data within this range is recorded as a range.

It is possible to capture to more than one active range at the same time.

Ordinary frame capturing can be achieved by recording a range back-to-back.

Using ranges makes it very easy to profile logically connected events, e.g. profiling a level load time.

Command interface

This module provides a Debug Module command interface called 'profile'. The commands in this command interface are basically:

  • enabling/disabling profiles, either for frame counts or ranges
  • querying of current profile data
  • enabling write-to-file mode for profile data