Results 1 to 2 of 2

Thread: different timer_query results on ATI and NVidia; NVidia sync?

  1. #1
    Newbie Newbie
    Join Date
    Sep 2013

    different timer_query results on ATI and NVidia; NVidia sync?


    so I have tested glut and timer_queries on a ATI Radeon HD 5850 and a NVidia GTX 660 to measure the time on the CPU and the GPU.

    One of the test-results are:
    ATI : CPU: 805 ms, GPU: 156 ms
    NVidia: CPU: 215 ms, GPU: 215 ms

    So of course the NVidia card is newer and faster, anyway the point is: why does the GPU on the NVidia card sync with the CPU??
    In all tests the NVidia card sync with the CPU. Why?

    The code I use:

    Code :
    #define QUERY_BUFFERS 2
    #define QUERY_COUNT 1
    unsigned int queryID[QUERY_BUFFERS][QUERY_COUNT];
    unsigned int queryBackBuffer = 0, queryFrontBuffer = 1;
    GLuint64 elapsed_time;
    void genQueries() {
        glGenQueries(QUERY_COUNT, queryID[queryBackBuffer]);
        glGenQueries(QUERY_COUNT, queryID[queryFrontBuffer]);
    void swapQueryBuffers() {
        if (queryBackBuffer) {
            queryBackBuffer = 0;
            queryFrontBuffer = 1;
        else {
            queryBackBuffer = 1;
            queryFrontBuffer = 0;
    void BeginQuery()
    void EndQuery()
    void FinishQuery()
        glGetQueryObjectui64v(queryID[queryFrontBuffer][0], GL_QUERY_RESULT, &elapsed_time);
    GLuint64 GetQuery()
        return elapsed_time;

    Draw Call:
    Code :
    void display(void)
        double timestart = glutGet(GLUT_ELAPSED_TIME);
        milliSecPerFrame_CPU = glutGet(GLUT_ELAPSED_TIME) - timestart;

  2. #2
    Junior Member Newbie
    Join Date
    Jan 2013
    First your code has a bug. glutGet is called after glGetQueryObjectui64v from FnishQuery. glGetQueryObjectui64v is blocking until the result is available. Therefore if the CPU and the GPU time measurement start at the same time they will deliver the same results.

    If the bug above is fixed then there are different scenarios depending if your code is CPU or GPU bound and how the driver dispatches work to the GPU.
    CPU bound: if the glBeginQuery command is send to the CPU immediately then the CPU and GPU times are equal, else the CPU time is higher.
    GPU bound: the CPU time is lower than the GPU time

Similar Threads

  1. NVIDIA G-Sync
    By imported_dimensionX in forum OpenGL: Advanced Coding
    Replies: 5
    Last Post: 05-22-2008, 03:50 PM
  2. Text output on NVIDIA chips: bitmaps vs textures - different results!
    By imported_sansan in forum OpenGL: Advanced Coding
    Replies: 4
    Last Post: 08-23-2005, 10:40 AM
  3. Replies: 2
    Last Post: 02-11-2003, 05:48 AM
  4. Replies: 2
    Last Post: 07-15-2002, 11:47 PM
  5. NVIDIA, GLX, Vertical Sync
    By in forum OpenGL: Linux
    Replies: 1
    Last Post: 07-18-2001, 12:53 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Proudly hosted by Digital Ocean