## Chapter 17. GL Profile Analyzer

## Overview

The GL Profile Analyzer can be used to analyse the run-time performance of an X-Forge application.

The analysis consists of two phases. First, samples are recoded by using the profiling GL device (by calling the `xfcUseGLDefaultProfiler()` function in `xfcAppInit()`). Each time the device is initialized it creates a file by the name of `xflog000.dat` in the application directory, and starts storing event information into that file.

Events stored by default include frame events and polygon draw events. User can add more events by calling the `xfcGLProfilerLog(UINT32 aEvent, UINT32 aValue)` function (defined in the `XFcGLProfiler.h` header file).

The second part of the analysis is done by feeding the binary log file to GLProfileAnalyzer tool (located at `/tools/GLProfileAnalyzer` in the x-forge distribution). This tool parses the binary information and outputs several tabbed text files, which can be imported to Microsoft Excel or some other spreadsheet program for further study.

### Tip

If you're only interested in the frame events (or if you want to use the fillers' id values for some other reason), call xfcGLUseDefaults() after you initialize the gl device. This will override the profiler fillers can will call the fillers directly.

### Binary log format

Each sample in the binary log consists of a single 16-bit value, split between 6-bit event id (0..63) and 10-bit event value (0..1023).

Event id 0 is the frame event; the value is the frame time, in milliseconds.

Event ids 1 through 41 are fillers; complete list of the events can be found in the `XFcGLProfiler.h` header file. The value for the fillers is in approximate pixels drawn (any triangles with more than 1023 pixels are recorded as taking 1023 pixels, so this value is not useful for calculating overdraw complexity).

Event ids 42 through 63 are currently unused.

### GLProfileAnalyzer output

The GLProfileAnalyzer tool outputs four tabbed files: `framestats.txt`, `framestats_detailed.txt`, `PolySizeTotal.txt` and `PolySizeDetailed.txt`.

The `framestats.txt` file contains three pieces of information per frame: the FPS, polycount and pixel count.

### Note

Since the samples are recorded at polygon filler level, the polycounts listed here are rasterized polygons, not the ones the application wants to render. Culling, clipping, etc. drops polycount as much as 50% in a typical case.

For more detailed view, the `framestats_detailed.txt` file contains the frame time in milliseconds, and polygon and pixel counts per filler.

The `PolySizeTotal.txt` file contains counts of the polygon sizes. This can be used to see whether there is an abnormal amount of large polygons, for example.

Finally, the `PolySizeDetailed.txt` contains the polygon counts per size for every filler.

All of the charts above were generated with Microsoft Excel.

|  | X-Forge Documentation Confidential Copyright © 2003 Fathammer