[PATCH] Retrace: Add per frame timing

José Fonseca jose.r.fonseca at gmail.com
Mon Oct 31 17:50:40 PDT 2011


On Sat, Oct 29, 2011 at 1:26 AM, Anuj Phogat <anuj.phogat at gmail.com> wrote:
>
>>On Mon, Oct 24, 2011 at 5:44 AM, José Fonseca <jose.r.fonseca at gmail.com>
[..]

>>My idea was to have glretrace output the timings to stdout in a TSV format
>> like:
>># call no    function name    cpu start   cpu stop    gpu start    gpu stop
>>50 glDrawArrays 1.4  1.5     2.4 2.5
>> ...
>>The GUI could then use this to produce a joint visualization of both
>>cpu and gpu timelines.
> As gpu executes the gl commands asynchronously, I didn't find a way to query
> the gpu start time.
> Is there any way to query the gpu start/stop time per gl call?

http://www.opengl.org/registry/specs/ARB/timer_query.txt has example
code for that, namely example 2.

Of course, durations are quite useful. But having absolute times would
enable pretty graphs on Qt gui.

> I'll appreciate your comments on above patch.
> Sample time.log file:
> Call#             Function Name         CPU Time
> GPU Time
>     7              glShadeModel         cpu time = 0.0060  ms
>     8              glClearColor            cpu time = 0.0040  ms
>     9                   glClear              cpu time = 0.3240  ms
> gpu time = 0.0040  ms
>    10                 glColor3f             cpu time = 0.0120  ms
>    11              glPushMatrix         cpu time = 0.0050  ms
>    12                 glRotatef             cpu time = 0.0040  ms
>    13                   glBegin             cpu time = 0.0200  ms
>    14                glVertex2f            cpu time = 0.0040  ms
>    15                glVertex2f
>    16                glVertex2f
>    17                     glEnd              cpu time = 0.0020  ms
>    18               glPopMatrix           cpu time = 16.2530  ms
>    21                   glFlush             cpu time = 0.0020  ms
>    22                glViewport            cpu time = 0.0030  ms
>    23              glMatrixMode         cpu time = 0.0020  ms
>    24            glLoadIdentity           cpu time = 0.0020  ms
>    25                   glOrtho             cpu time = 0.0030  ms
>    27                   glFlush
>    28                glViewport
>    29              glMatrixMode
>    30            glLoadIdentity
>    31                   glOrtho
>    33              glShadeModel
>    34              glClearColor
>    35                   glClear             cpu time = 40.7830  ms
>  gpu time = 0.1890  ms
>    36                 glColor3f            cpu time = 0.0030  ms
>    37              glPushMatrix         cpu time = 0.0020  ms
>    38                 glRotatef            cpu time = 0.0030  ms
>
> Thanks
> Anuj


Jose


More information about the apitrace mailing list