pfStats(3pf) OpenGL Performer 3.2.2 libpr C++ Reference Pages pfStats(3pf)NAME
pfStats, pfGetCurStats, pfGfxPipeTimestamp,
pfGetStatsGfxPipeTimestampStatus - Maintain statistics on OpenGL
Performer operations and system usage
FUNCTION SPECIFICATION
#include <Performer/pr/pfStats.h>
pfStats::pfStats();
static pfType * pfStats::getClassType(void);
uint pfStats::setClass(uint enmask, int val);
uint pfStats::getClass(uint enmask);
uint pfStats::setClassMode(int class, uint mask, int val);
uint pfStats::getClassMode(int class);
uint pfStats::open(uint enmask);
static uint pfStats::close(uint enmask);
uint pfStats::getOpen(uint enmask);
uint pfStats::collectGfxPipeStats(uint enmask);
void pfStats::setAttr(int attr, float val);
float pfStats::getAttr(int attr);
int pfStats::getNumGfxPipeTimestamp(void);
static void pfStats::setHwAttr(int attr, float val);
static float pfStats::getHwAttr(int attr);
static void pfStats::enableHw(uint which);
static void pfStats::disableHw(uint which);
static uint pfStats::getHwEnable(uint which);
void pfStats::copy(pfStats *src, uint which);
void pfStats::reset(void);
void pfStats::clear(uint which);
Page 1
pfStats(3pf) OpenGL Performer 3.2.2 libpr C++ Reference Pages pfStats(3pf)
void pfStats::count(pfGeoSet *gset);
void pfStats::accumulate(pfStats *src, uint which);
void pfStats::average(pfStats *src, uint which, int num);
int pfStats::query(uint which, void *dst, int size);
int pfStats::mQuery(uint *which, void *dst, int size);
pfStats * pfGetCurStats(void);
void pfGfxPipeTimestamp(uint flag);
int pfGetStatsGfxPipeTimestampStatus(pfStats* stats,
uint stamp);
PARENT CLASS FUNCTIONS
The OpenGL Performer class pfStats is derived from the parent class
pfObject, so each of these member functions of class pfObject are also
directly usable with objects of class pfStats. This is also true for
ancestor classes of class pfObject.
void* pfObject::operator new(size_t);
void* pfObject::operator new(size_t, void *arena);
void* pfObject::operator new(size_t, pfFluxMemory *fmem);
void pfObject::setUserData(void *data);
void pfObject::setUserData(int slot, void *data);
void* pfObject::getUserData(pfObject *obj);
void* pfObject::getUserData(pfObject *obj, int slot);
int pfObject::getNumUserData();
Since the class pfObject is itself derived from the parent class
pfMemory, objects of class pfStats can also be used with these functions
designed for objects of class pfMemory.
void* pfMemory::getData(const void *ptr);
pfType * pfMemory::getType();
int pfMemory::isOfType(pfType *type);
int pfMemory::isExactType(pfType *type);
const char * pfMemory::getTypeName();
int pfMemory::copy(pfMemory *src);
int pfMemory::compare(const pfMemory *mem);
void pfMemory::print(uint which, uint verbose, char *prefix,
FILE *file);
int pfMemory::getArena(void *ptr);
void* pfMemory::getArena();
int pfMemory::ref();
int pfMemory::unref();
Page 2
pfStats(3pf) OpenGL Performer 3.2.2 libpr C++ Reference Pages pfStats(3pf)
int pfMemory::unrefDelete();
int pfMemory::unrefGetRef();
int pfMemory::getRef();
int pfMemory::checkDelete();
int pfMemory::isFluxed();
void * pfMemory::getArena();
int pfMemory::getSize();
DESCRIPTION
These functions are used to collect, manipulate, print, and query
statistics on state operations, geometry, and graphics and system
operations.
new(arena) allocates a pfStats from the specified memory arena, or from
the process heap if arena is NULL. new allocates a pfStats from the
default memory arena (see pfGetSharedArena). Like other pfObjects,
pfStats cannot be created statically, automatically on the stack or in
arrays. pfStats should be deleted with pfDelete rather than the delete
operator.
pfStats::getClassType returns the pfType* for the class pfStats. The
pfType* returned by pfStats::getClassType is the same as the pfType*
returned by invoking the virtual function getType on any instance of
class pfStats. Because OpenGL Performer allows subclassing of built-in
types, when decisions are made based on the type of an object, it is
usually better to use the member function isOfType to test if an object
is of a type derived from a Performer type rather than to test for strict
equality of the pfType*'s.
pfStats::reset will reset that entire statistics structure to its initial
state.
pfStats::clear takes a bitmask which specifying the statistics that are
to be cleared to zeroes.
pfStats::copy takes a pointer to a pfStats, src, and a bitmask which
specifying the statistics that are to be copied from src. This function
is provided to enable more control over the default pfObject function
pfMemory::copy. Note that only statistics data is copied and not any
enable/disable settings or modes.
Since some statistics can be expensive to gather, and so might possibly
influence other statistics, statistics are divided into different classes
based on the tasks that they monitor and one may select the specific
statistics classes of interest with pfStats::setClass.
Statistics classes also have different modes of collection so that
performance-expensive modes of a particular statistics class many be
disabled with pfStats::setClassMode. The statistics class enables may be
used for directing operations on statistics structures, including
statistics collection, specified via pfStats::open, and also for
printing, copying, clearing, accumulation, and averaging.
Page 3
pfStats(3pf) OpenGL Performer 3.2.2 libpr C++ Reference Pages pfStats(3pf)
Class enables and disables are specified with bitmasks. Each statistics
class has an enable token: a PFSTATS_EN* token that can be OR-ed with
other statistics enable tokens and the result passed in to enable and
disable statistics operations.
Statistics classes that require special hardware support have token names
that start with PFSTATSHW_. These tokens are used as class enable tokens
in the usual statistics routines, and also to enable and disable the
hardware statistics gathering via pfStats::enableHw and
pfStats::disableHw.
Statistics classes also have modes that select different elements of a
class for collection. These modes are set through pfStats::setClassMode.
Each statistics class starts with a default mode setting.
The following tables provide details of the statistics class structure.
The first table lists the statistics classes, their naming tokens, and
their enable tokens for forming bitmasks.
Statistics Class Table
_______________________________________________________________________
Class PFSTATS_ Token PFSTATS_EN token
_______________________________________________________________________
Graphics Rendered PFSTATS_GFX PFSTATS_ENGFX
Pixel Fill PFSTATSHW_GFXPIPE_FILL PFSTATSHW_ENGFXPIPE_FILL
CPU PFSTATSHW_CPU PFSTATSHW_ENCPU
GfxPipe PFSTATSHW_GFXPIPE_TIMES PFSTATSHW_ENGFXPIPE_TIMES
_______________________________________________________________________
|
|
This second table defines the statistics classes and their naming token
and enable tokens for forming bitmasks.
Statistics Mode Table
___________________________________________________________________________
Class PFSTATS_ Token Modes
___________________________________________________________________________
Graphics PFSTATS_GFX PFSTATS_GFX_GEOM
Rendered PFSTATS_GFX_TSTRIP_LENGTHS
PFSTATS_GFX_ATTR_COUNTS
PFSTATS_GFX_STATE
PFSTATS_GFX_XFORM
PFSTATS_GFX_CULL_SIDEKICK
Pixel Fill PFSTATSHW_GFXPIPE_FILL PFSTATSHW_GFXPIPE_FILL_DEPTHCMP
PFSTATSHW_GFXPIPE_FILL_TRANSPARENT
CPU PFSTATSHW_CPU PFSTATSHW_CPU_SYS
PFSTATSHW_CPU_IND
GfxPipe PFSTATSHW_GFXPIPE_TIMES PFSTATSHW_GFXPIPE_TIMES_TOTAL
|
|
Page 4
pfStats(3pf) OpenGL Performer 3.2.2 libpr C++ Reference Pages pfStats(3pf)
PFSTATSHW_GFXPIPE_TIMES_AUTO_COLLECT
___________________________________________________________________________
|
|
The individual stats classes and modes are discussed in more detail in
the explanation of the statistics routines.
pfStats::setClass will set the classes specified in the bitmask, enmask,
according to the val, which must be set to one of the following:
PFSTATS_ON Enables the specified classes.
PFSTATS_OFF Disables the specified classes.
PFSTATS_DEFAULT Resets the specified classes to default
values.
PFSTATS_SET Sets the entire class enable mask to
enmask.
All stats collection can be set at once to on, off, or the default by
using PFSTATS_ALL for the bitmask and the appropriate value for the
enable flag. For example, the following example disables all stats
classes with their current class mode settings.
stats.setClass(PFSTATS_ALL, PFSTATS_OFF);
pfStats::getClass takes the statistics classes of interest specified in
the bitmask, enmask. If any of the statistics classes specified in
enmask are enabled, then pfStats::getClass will return the bitmask of
those classes, and otherwise, will return zero. If classes of an open
pfStats structure are disabled, then collection of those classes stop
immediately and those classes are considered closed.
pfStats::setClassMode takes the name of the class to set, class, a mask
of the modes to set, mask, and the value for the modes, val. The class
modes offer further control over the statistics that are to be
accumulated for a given class. For each statistics class, a set of modes
is enabled by default. Some modes of a statistics class may be somewhat
expensive, and therefore they are not enabled by default. val must be
one of:
PFSTATS_ON Enable the modes specified in mask.
PFSTATS_OFF Disable the modes specified in mask.
PFSTATS_DEFAULT Set modes specified in mask to default
values.
Page 5
pfStats(3pf) OpenGL Performer 3.2.2 libpr C++ Reference Pages pfStats(3pf)
PFSTATS_SET Set class mode mask to the specified mask.
As a convenience, all classes may have all of their modes set to on, off,
or their default values by specifying a class of PFSTATS_CLASSES, and a
mask of PFSTATS_ALL. These defaults may differ between machines and may
change in the future; so, code should not assume the current defaults but
query the mode values for a given class where needed. No statistics for
a given mode are accumulated unless the corresponding class has been
enabled with pfStats::setClass. If modes of an open pfStats structure
are disabled, then collection of those modes stop immediately.
Graphics Statistics Modes
PFSTATS_GFX_GEOM
This counts geometry that is drawn via pfGeoSet::draw.
Statistics include the number of pfGeoSets drawn, and the
numbers of pfGeoSets that have each binding of each attribute,
colors, normals, texture coordinates. The number of each type
of pfGeoSet primitive is counted, as well as the number of base
primitives drawn: total triangles, lines, and points.
Statistics are also kept on the number of triangle strips drawn
and the number of the total triangles that were actually in a
triangle strip. This mode is enabled by default.
PFSTATS_GFX_TSTRIP_LENGTHS
The number of triangles in strips whose length in terms of
triangle count is shorter than PFSTATS_TSTRIP_LENGTHS_MAX is
recorded. Triangles in strips whose triangle count is greater
than or equal to PFSTATS_TSTRIP_LENGTHS_MAX are all counted
together. Quads are counted as strips of length two and
independent triangles are counted as strips of length one. An
average triangle strip length (that uses all of the actual
lengths) is also maintained. Keeping these triangle strip
statistics is expensive for the drawing operation and so this
mode is not enabled by default, but must be enabled with
pfStats::setClassMode.
PFSTATS_GFX_ATTR_COUNTS
The number of each of the different types of geometry
attributes (colors, normals, and texture coordinates) that are
drawn is counted. Keeping attribute statistics is expensive
for the drawing operation and so this mode is not enabled by
default, but must be enabled with pfStats::setClassMode.
PFSTATS_GFX_STATE
This mode enables the counting of calls to state changes, as
well as the number of actual state changes themselves. Such
state changes include the immediate mode routines such as
pfAntialias, and the application of the state structures, such
as pfTexture::apply. Also counted is the number of pfGeoStates
encountered and the number of state stack operations, such as
pfGeoState::load, pfGeoState::apply, pfPushState, and
Page 6
pfStats(3pf) OpenGL Performer 3.2.2 libpr C++ Reference Pages pfStats(3pf)
pfPopState. This mode is enabled by default.
PFSTATS_GFX_XFORM
This mode enables the counting of calls to transformations,
such as pfTranslate, pfScale, and pfRotate, and graphics matrix
stack operations, such as pfLoadMatrix, etc. the number of
actual state changes themselves, as well as the number of
pfGeoStates encountered. This mode is enabled by default.
PFSTATS_GFX_CULL_SIDEKICK
This mode enables counting OpenGL primitives removed by a
CULL_SIDEKICK process.
Graphics Pipe Fill Statistics
These modes enable the accumulation of fill depth-complexity statistics
and require the corresponding hardware statistics to be enabled:
pfStats::enableHw(PFSTATSHW_GFXPIPE_FILL_DEPTHCMP);
PFSTATSHW_GFXPIPE_FILL_DCPAINT
This mode causes pfStats::close to paint the screen according
to the number of times each pixel is touched. This mode is
enabled by default.
PFSTATSHW_GFXPIPE_FILL_DCCOUNT
This mode causes pfStats::close to read back the framebuffer
for the calculation of fill depth-complexity statistics. This
mode is enabled by default.
PFSTATSHW_GFXPIPE_FILL_DEPTHCMP
By default, only actual pixel writes are counted with depth
complexity stats. This mode enables counting of Z compares as
well. This mode is not enabled by default.
PFSTATSHW_GFXPIPE_FILL_TRANSP
This mode enables counting of fully transparent pixels. This
mode is not enabled by default.
CPU Statistics
The CPU statistics keep track of system usage and requires that the
corresponding hardware statistics be enabled:
pfStats::enableHw(PFSTATSHW_ENCPU);
The percentage of time CPUs spend idle, busy, in user code, and waiting
on the Graphics Pipeline, or on the swapping of memory is calculated.
Counted is the number of context switches (process and graphics), the
Page 7
pfStats(3pf) OpenGL Performer 3.2.2 libpr C++ Reference Pages pfStats(3pf)
number of system calls, the number of times the graphics FIFO is found to
be full, the number of times a CPU went to sleep waiting on a full
graphics FIFO, the number of graphics pipeline IOCTLs issued (by the
system), and the number of swapbuffers seen. All of these statistics are
computed over an elapsed period of time, and using an elapsed interval of
at least one second is recommended.
PFSTATSHW_CPU_SYS
This mode enables computation of the above CPU statistics for
the entire system. This includes statistics on system usage,
cpu-graphics interactions, and memory. CPU usage statistics
are summed over all CPUs. This mode is enabled by default.
PFSTATSHW_CPU_IND
This mode enables tracking of CPU statistics for each
individual CPU and is much more expensive than using just the
summed statistics. It is not enabled by default.
pfStats::getClassMode takes the name of the class to query, class. The
return value is the mode of class.
pfStats::open takes a bitmask specifying the statistics classes that are
to be opened for collection in enmask. This statistics structure will
become the one and only statistics structure open for collection. The
return value will be the bitmask for all currently open statistics
classes. If another pfStats structure is already open, then this call to
pfStats::open will be ignored and the return value will be 0. When
statistics classes that use statistics hardware are open for collection,
pfStats::open will access that hardware for initialization. Therefore,
for graphics pipe statistics, it is imperative that the statistics
hardware only be enabled for the drawing process. Furthermore, only one
process at a time should use statistics hardware since it is a shared
global resource. Finally, for statistics that are actually accumulated
in statistics hardware, it is best to let some time elapse before the
statistics are collected (in pfStats::close). Refer the examples at the
end of this manual page.
pfStats::close takes a bitmask which specifying the classes whose
collected statistics are to be accumulated into the current pfStats
structure. Further collection of these statistics are then disabled and
they will have to be re-opened with pfStats::open for further collection.
A pfStats structure is considered to be open until all opened statistics
classes have been closed with pfStats::close. The return value for
pfStats::close is the bitmask of the remaining open classes. If stats
has no open classes, a value of 0 will be returned. When statistics
classes that use statistics hardware are open for collection,
pfStats::close will access that hardware to collect the specified
statistics. Therefore, for graphics pipe statistics, it is imperative
that the statistics hardware only be enabled for the drawing process.
Furthermore, only one processes should be using statistics hardware at a
time since it is a shared global resource.
Page 8
pfStats(3pf) OpenGL Performer 3.2.2 libpr C++ Reference Pages pfStats(3pf)
pfStats::getOpen takes a bitmask enmask specifying the statistics classes
that are being queried. If any of the statistics classes specified in
enmask are open for collection, then the bitmask of those statistics
classes is returned, and otherwise, zero.
pfGetCurStats returns the currently open statistics structure, or NULL if
there is no statistics structure open for accumulation.
pfGfxPipeTimestamp allows the specification of a PFSTATSHW_TIMETAMP_
token for the currently open pfStats structure with
PFSTATSHW_GFXPIPE_TIMES enabled. These tokens may be one of the following
and must be issued once per collection period and in increasing order.
PFSTATSHW_TIMESTAMP_START
signal start of drawing.
PFSTATSHW_TIMESTAMP_END
signal end of drawing.
PFSTATSHW_TIMESTAMP_FRAME_END
signals end of frame and is automatically followed by a
PFSTATSHW_TIMESTAMP_FINISH to flush graphics pipeline.
PFSTATSHW_TIMESTAMP_FINISH
will flush the graphics pipeline to ensure that all drawing is
including in the timing.
The PFSTATSHW_TIMESTAMP_OPEN and PFSTATSHW_TIMESTAMP_CLOSE may be issued
only by OpenGL Performer and these are issued automatically when
PFSTATSHW_GFXPIPE_TIMES statistics are opened and closed.
pfGetStatsGfxPipeTimestampStatus may be used to find out if a given
timestamp for the specified pfStats structure has completed its trip
through the graphics pipeline (and has resulting data ready for
collection).
pfCollectGfxPipeStatspfStats::collectGfxPipe may be used to collect
graphics pipeline statistics for a structure after the statistics for
that structure have been closed. Graphics pipeline statistics must be
gathered in the same order that the timestamps are issued. If separate
collection of graphics pipeline statistics are to be done, the
pfStats::setClassMode of PFSTATSHW_GFXPIPE_TIMES_AUTO_COLLECT (which is
on by default) must be turned off.
pfStats::setAttr takes the name of the attribute to set, attr, and the
attribute value, val. Currently, there are no pfStats attributes.
pfStats::getAttr takes a pointer to a stats structure, stats, and the
name of the attribute to query, attr. The return value is that of
attribute attr.
pfStats::enableHw takes a bitmask which specifying the hardware
statistics that should be enabled. These bitmasks are the statistics
class enable bitmasks that have start with PFSTATSHW_*. Statistics
Page 9
pfStats(3pf) OpenGL Performer 3.2.2 libpr C++ Reference Pages pfStats(3pf)
hardware must be enabled for the corresponding classes of statistics to
be accumulated. Having statistics hardware enabled will have some cost
to performance; however, in most cases, it pays to leave this hardware
enabled if corresponding statistics classes are being frequently enabled
and disabled. When statistics classes that use statistics hardware are
open for collection, pfStats::open and pfStats::close will access that
hardware. For graphics pipe statistics, it is therefore imperative that
the statistics hardware only be enabled for a process that is connected
to the graphics pipeline. Furthermore, only one processes should be
using statistics hardware at a time since it is a shared global resource.
Graphics Statistics Hardware Enables
PFSTATSHW_ENGFXPIPE_TIMES
Enables the tracking of timestamps in the graphics pipeline.
This produces very accurate measurements of elapsed drawing
times with minimal impact. Timestamps are issued automatically
when statistics are opened and closed, and additional stamps
may be issued with pfGfxPipeTimestamp.
PFSTATSHW_ENGFXPIPE_FILL
Enables hardware to support tracking of depth complexity
statistics. When this mode is enabled, the framebuffer keeps
track of the number of times each pixel is touched. This may
require a framebuffer reconfiguration which can be quite
expensive, and which may not be possible in GLX windows.
PFSTATSHW_ENCPU
This mode enable gathering of CPU statistics by the system.
This mode should only be enabled by one process at a time.
pfStats::disableHw takes a bitmask which specifying the hardware
statistics that should be disabled.
pfStats::getHwEnable takes a bitmask which specifying the hardware
statistics that are being queried. If any of the hardware statistics
classes specified in which have their corresponding hardware enabled,
then the bitmask of those statistics classes is returned, and otherwise,
zero is returned.
pfStats::setHwAttr takes the name of the attribute to set, attr, and the
attribute value, val. There is currently one stats hardware attribute:
PFSTATSHW_FILL_DCBITS. Its value must be an integer value in the range
of 1 to 4. The default value is 3. This attribute sets the maximum
number of stencil bits used for tracking fill depth complexity. See the
GL manual page for stensize(3g) for more information on stencil
bitplanes.
pfStats::getHwAttr Returns the value of attribute attr.
Collected statistics can be printed to stderr or a file with
pfMemory::print, and can be queried at run-time with pfStats::query for a
Page 10
pfStats(3pf) OpenGL Performer 3.2.2 libpr C++ Reference Pages pfStats(3pf)
single-value query, and pfStats::mQuery for getting back a collection of
statistics.
pfStats::query takes a query token in which, and a destination buffer
dst. The size of the expected return data is specified by size and if
non-zero, will prevent pfStats::query from writing beyond a buffer that
is too small. The return value is the number of bytes written to the
destination buffer. There are tokens for getting back all of the
statistics, entire sub-structures, and individual values. The exposed
query structure types and query tokens are all defined in
<Performer/pr/pfStats.h>. Every structure and field is commented with
its corresponding query token. For example, the exposed structure type
pfStatsValues can be used to hold the entire contents of a pfStats
structure and has corresponding query token PFSTATSVAL_ALL.
typedef struct pfStatsValues
{ /* to get back all stats: PFSTATSVAL_ALL */
/* PFSTATS_GFX class: PFSTATSVAL_GFX */
pfStatsValGeom geom; /* PFSTATSVAL_GFX_GEOM */
pfStatsValModes modeChanges; /* PFSTATSVAL_GFX_MODECHANGES */
pfStatsValModes modeCalls; /* PFSTATSVAL_GFX_MODECALLS */
pfStatsValState state; /* PFSTATSVAL_GFX_STATE */
pfStatsValXforms xform; /* PFSTATSVAL_GFX_XFORM */
/* PFSTATSHW_GFXPIPE_FILL class: PFSTATSVAL_GFXPIPE_FILL */
pfStatsValFill fill; /* PFSTATSVAL_GFXPIPE_FILL */
/* the PFSTATSHW_CPU class: PFSTATSVAL_CPU */
pfStatsValCPU cpu; /* PFSTATSVAL_CPU */
} pfStatsValues;
The following example will return all of the contents of a pfStats
structure into the contents of a structure of the exposed type
pfStatsValues.
pfStats *stats;
pfStatsValues *val;
stats = new pfStats;
stats->query(PFSTATSVAL_ALL, (float *) val, sizeof(pfStatsValues));
pfStats::mQuery takes a pointer to the start of an array of query tokens
in which, and a destination buffer dst. The array which must be
terminated with the token PFSTATSVAL_NULL. The size of the expected
return data is specified by size and if non-zero, will prevent
pfStats::mQuery from writing beyond a buffer that is too small. The
return value is the number of bytes written to the destination buffer.
pfStats::count takes a pointer to a pfGeoSet, gset, whose geometry
statistics are to be accumulated into stats.
Page 11
pfStats(3pf) OpenGL Performer 3.2.2 libpr C++ Reference Pages pfStats(3pf)
pfStats::accumulate takes a pointer to a statistics structure, src, and a
bitmask which specifying the statistics that are to be accumulated from
src.
pfStats::average takes a pointer to a statistics structure, src, and a
bitmask which, and an integer num. The statistics classes specified by
which will be taken from src, and averaged by num.
For a class of statistics to be collected, the following must be true:
1. A statistics structure must be created.
2. The corresponding statistics class must be enabled with
pfStats::setClass. No statistics classes are enabled by
default.
3. The corresponding statistics class mode must be enabled with
pfStats::setClassMode. However, each statistics class has a
popular set of statistics modes enabled by default.
4. Any relevant hardware must be enabled via pfStats::enableHw.
5. The statistics class must be opened for collection with
pfStats::open.
EXAMPLES
This example creates a statistics structure and enabling the graphics
statistics class with the triangle-strip statistics enabled.
pfStats *stats = NULL;
stats = new pfStats;
stats->setClass(PFSTATS_ENGFX, PFSTATS_ON);
stats->setClassMode(PFSTATS_GFX, PFSTATS_GFX_TSTRIP_LENGTHS, PFSTATS_ON);
This is an example of collecting CPU statistics over an elapsed period of
time.
pfStats *stats = NULL;
double lastTime = 0;
stats = new pfStats;
/* enable the CPU stats class - using the default summed CPU statistics */
stats->setClass(PFSTATSHW, PFSTATS_ON);
/* enable CPU stats hardware */
pfStats::enableHw(PFSTATSHW_ENCPU);
:
/* snap CPU stats every 2 seconds */
if (pfGetTime() - lastTime > 2.0)
Page 12
pfStats(3pf) OpenGL Performer 3.2.2 libpr C++ Reference Pages pfStats(3pf)
{
if (stats->getOpen(PFSTATSHW_ENCPU))
{
/*
* final snap of CPU stats is done here and difference
* between this and the initial snap is calculated.
*/
stats->close(PFSTATSHW_ENCPU);
}
else
{
/* initial snap of CPU stats is done here */
stats->open(PFSTATSHW_ENCPU);
}
}
This example shows the enabling and disabling of fill statistics.
pfStats *stats = NULL;
stats = new pfStats;
/* enable fill statistics collection */
stats->setClass(PFSTATSHW_ENGFXPIPE_FILL, PFSTATS_ON);
/* enable fill stats hardware - put framebuffer in correct configuration */
pfStats::enableHw(PFSTATSHW_ENGFXPIPE_FILL);
/* open fill statistics collection and initialize hardware */
stats->open(PFSTATSHW_ENGFXPIPE_FILL);
/* draw geometry */
:
/*
* paint window by number of times each pixel was touched in the
* previous drawing and read back the framebuffer and
* examine the counts
*/
stats->close(PFSTATSHW_ENGFXPIPE_FILL);
NOTES
Fill stats are currently calculated by using stencil tests and therefore
require stencil bitplanes to be allocated. Furthermore, the
PFSTATSHW_GFXPIPE_FILL_TRANSP mode currently disables modes that reject
fully transparent pixels, such as pfAlphaFunc, which will alter what
pixels get written into the zbuffer and therefore should be used in
conjunction with PFSTATSHW_GFXPIPE_FILL_DEPTHCMP.
Page 13
pfStats(3pf) OpenGL Performer 3.2.2 libpr C++ Reference Pages pfStats(3pf)
The pfStats routines, structures, and constants are defined in the
<Performer/prstats.h> header file.
BUGS
None
SEE ALSO
pfDelete, pfPrint
Page 14