Profiling

Performance measurement counter functions

Check D2FB_PERFCOUNT bit of d2_getrevisionhw to see if performance counters are available.

Summary
ProfilingPerformance measurement counter functions
Performance counting
d2_setperfcounteventSet the event to be counted by performance counter.
d2_setperfcountvalueSet the current performance counter value.
d2_getperfcountvalueGet the current performance counter value.

Performance counting

d2_setperfcountevent

d2_s32 d2_setperfcountevent(d2_device *handle,
d2_u32 counter,
d2_u32 event)

Set the event to be counted by performance counter.

Does not work while D/AVE is active!  When calling this while D/AVE is active executing a display list, rendering errors or even hangups can occur.

parameters

handledevice pointer (see: d2_opendevice)
counter0 or 1: which of both available performance counters to use
eventwhich events the selected performance counter has to count

events

d2_pc_disabledisable performance counter
d2_pc_davecyclesDAVE active cycles
d2_pc_fbreadsframebuffer read access
d2_pc_fbwritesframebuffer write access
d2_pc_texreadstexture read access
d2_pc_invpixelsinvisible pixels (enumerated but selected with alpha 0%)
d2_pc_invpixels_missinvisible pixels while internal fifo is empty (lost cycles)
d2_pc_dlrcyclesdisplaylist reader active cycles
d2_pc_fbreadhitsframebuffer read hits
d2_pc_fbreadmissesframebuffer read misses
d2_pc_fbwritehitsframebuffer write hits
d2_pc_fbwritemissesframebuffer write misses
d2_pc_texreadhitstexture read hits
d2_pc_texreadmissestexture read misses
d2_pc_clkcyclesevery clock cycle (for use as timer)
d2_pc_dlrburstreadsdisplaylist reader burst reads
d2_pc_dlrwordsreaddisplaylist reader words read
d2_pc_rlerewindstexture rle decoder rewinds
d2_pc_texburstreadstexture cache burst reads
d2_pc_texwordsreadtexture cache words read
d2_pc_fbburstreadsframebuffer cache burst reads
d2_pc_fbwordsreadframebuffer cache words read
d2_pc_fbburstwritesframebuffer cache burst writes
d2_pc_fbwordswrittenframebuffer cache words written

returns

errorcode (D2_OK if successfull) see list of Errorcodes for details

d2_setperfcountvalue

d2_s32 d2_setperfcountvalue(d2_device *handle,
d2_u32 counter,
d2_slong value)

Set the current performance counter value.

Does not work while D/AVE is active!  When calling this while D/AVE is active executing a display list, rendering errors or even hangups can occur.

parameters

handledevice pointer (see: d2_opendevice)
counter0 or 1: which of both available performance counters to use
valuevalue to be set: 0 for reset

returns

errorcode (D2_OK if successfull) see list of Errorcodes for details

d2_getperfcountvalue

d2_slong d2_getperfcountvalue(d2_device *handle,
d2_u32 counter)

Get the current performance counter value.

parameters

handledevice pointer (see: d2_opendevice)
counter0 or 1: which of both available performance counters to use

returns

current counter register value

d2_s32 d2_setperfcountevent(d2_device *handle,
d2_u32 counter,
d2_u32 event)
Set the event to be counted by performance counter.
d2_s32 d2_setperfcountvalue(d2_device *handle,
d2_u32 counter,
d2_slong value)
Set the current performance counter value.
d2_slong d2_getperfcountvalue(d2_device *handle,
d2_u32 counter)
Get the current performance counter value.
d2_u32 d2_getrevisionhw(const d2_device *handle)
Query hw revisionID.
d2_device * d2_opendevice(d2_u32 flags)
Create a new device handle.
List of all dave driver errorcodes.
Close