1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2<html> 3 4<head> 5<META http-equiv="Content-Type" content="text/html; charset=windows-1252"> 6<META name="GENERATOR" content="Microsoft FrontPage 5.0"> 7<META http-equiv="Content-Style-Type" content="text/css"> 8<LINK rel="stylesheet" type="text/css" href="../../CSS/revolution.css"> 9<title>GXReadGPMetric</title> 10</head> 11 12<body> 13 14<h1 align="left">GXReadGPMetric</h1> 15 16<h2>Syntax</h2> 17<dl><dd><pre class="construction"> 18#include <revolution/gx.h> 19 20void GXReadGPMetric( u32* cnt0, u32* cnt1 ); 21</pre></dd></dl> 22 23<h2>Arguments</h2> 24<TABLE class="arguments" border="1" > 25 <tr> 26<TH>cnt0</TH> 27<TD>Returns the current value of GP Counter 0.</TD> 28 </tr> 29 <tr> 30<TH>cnt1</TH> 31<TD>Returns the current value of GP Counter 1.</TD> 32 </tr> 33</TABLE> 34 35<h2>Return Values</h2> 36<p>None.</p> 37 38<H2>Description</H2> 39<P>The graphics processor (GP) can count many internal events that give detailed information on performance. This function returns the count of previous performance metrics that were set using the <A href="GXSetGPMetric.html"><CODE>GXSetGPMetric</CODE></A>, <A href="GXSetGPMetric.html"><CODE>GXSetGP0Metric</CODE></A> or <A href="GXSetGPMetric.html"><CODE>GXSetGP1Metric</CODE></A> function. The counters can be cleared using the <A href="GXClearGPMetric.html"><CODE>GXClearGPMetric</CODE></A>, <A href="GXClearGPMetric.html"><CODE>GXClearGP0Metric</CODE></A> or <A href="GXClearGPMetric.html"><CODE>GXClearGP1Metric</CODE></A> function.</P> 40<P>Because this function reads results from CPU-accessible registers in the GP, this command must not be used in a display list. It may also be necessary to send a render synchronization token using the <A href="../Management/GXSetDrawSync.html"><CODE>GXSetDrawSync</CODE></A> function, or call the <A href="../Management/GXSetDrawDone.html"><CODE>GXSetDrawDone</CODE></A> function after the <A href="GXReadGPMetric.html"><CODE>GXReadGPMetric</CODE></A> function to ensure that the state has actually been processed by the GP.</P> 41<DL><DD><CODE>GXSetGPMetric( GX_PERF0_VERTICES, GX_PERF1_TEXELS );<BR> GXClearGPMetric( );<BR> drawSphere();<BR> GXSetDrawSync(0xbabe);<BR> while (0xbabe != GXReadDrawSync())<BR> ;<BR> GXReadGPMetric(&verts, &texels);<BR> OSReport("vertices in sphere %d, texels %d\n", verts, texels);</CODE></DD></DL> 42<P>The <A href="GXReadGPMetric.html"><CODE>GXReadGPMetric</CODE></A> and <A href="GXClearGPMetric.html"><CODE>GXClearGPMetric</CODE></A> functions can be used in the callback associated with the render synchronization interrupt. See the <A href="../Management/GXSetDrawSyncCallback.html"><CODE>GXSetDrawSyncCallback</CODE></A> function. The <A href="GXSetGPMetric.html"><CODE>GXSetGPMetric</CODE></A> function should not be used in the render synchronization callback, because it will randomly insert tokens in the GP command stream.</P> 43<DL><DD><CODE>#define OBJECTS 3<BR> u32 count[OBJECTS][2]</CODE></DD></DL> 44<DL><DD><CODE>void myDrawSyncCallback( u16 token ) <BR> {<BR> GXReadGPMetric(&count[token-1][0], &count[token-1][1]);<BR> GXClearGPMetric();<BR> }</CODE></DD></DL> 45<DL><DD><CODE>void myDraw( void ) <BR> {<BR> GXSetDrawSyncCallback( myDrawSyncCallback );<BR> GXSetGPMetric( GX_PERF0_VERTICES, GX_PERF1_TEXELS );<BR> drawSphere();<BR> GXSetDrawSync(1);<BR> drawCube();<BR> GXSetDrawSync(2);<BR> drawCylinder();<BR> GXSetDrawSync(3);<BR> GXDrawDone();<BR> for (i = 0; i < OBJECTS; i++)<BR> OSReport("object %d: vertices %d, texels %d\n", i, count[i][0],<BR> count[i][1]);<BR> }</CODE></DD></DL> 46 47<H3>Convenient Functions</H3> 48<P>The <A href="GXReadGP0Metric.html"><CODE>GXReadGP0Metric</CODE></A> and <A href="GXReadGP1Metric.html"><CODE>GXReadGP1Metric</CODE></A> functions can be used to read only one counter. Be aware that <a href="GXReadGP0Metric.html"><code>GXReadGP0Metric</code></a> and <a href="GXReadGP1Metric.html"><code>GXReadGP1Metric</code></a> should not be called at the same time. Call the <A href="GXReadGPMetric.html"><CODE>GXReadGPMetric</CODE></A> function instead.</P> 49 50<H3>Counter 0 Details</H3> 51<P>Refer to the <CODE><A href="GXSetGPMetric.html">GXSetGP0Metric</A></CODE> function for details on counter 0 metrics.</P> 52 53<H3>Counter 1 Details</H3> 54<P>Refer to the <CODE><A href="GXSetGPMetric.html">GXSetGP1Metric</A></CODE> function for details on counter 1 metrics.</P> 55 56<h2>See Also</h2> 57<P class="reference"> 58<a href="GXReadMemMetric.html">GXReadMemMetric</a>, 59<a href="GXClearMemMetric.html">GXClearMemMetric</a>, 60<a href="GXReadPixMetric.html">GXReadPixMetric</a>, 61<a href="GXClearPixMetric.html">GXClearPixMetric</a>, 62<a href="GXReadVCacheMetric.html">GXReadVCacheMetric</a>, 63<a href="GXClearVCacheMetric.html">GXClearVCacheMetric</a>, 64<a href="GXSetVCacheMetric.html">GXSetVCacheMetric</a> 65</p> 66 67<H2>Revision History</H2> 68<P> 692006/03/01 Initial version.<br> 70</P> 71 72<hr><p>CONFIDENTIAL</p></body> 73</HTML>