OpenGL Profiler

Sage
Posts: 1,066
Joined: 2004.07
Post: #1
I'm trying to use the profiler to fine tune my program and figure out why my program runs at 14fps normal and 20-22 when zoomed in (there's no drawing of the player mesh when zoomed in). I don't see why the numbers are so slow considering my use of display lists.

Can someone help explain the statistics window and others in the profiler so I can figure out what I should look for and be worried about? Right now I just see a bunch of numbers that really don't mean much to me.
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #2
Start with Shark, you don't even know that OpenGL is your problem yet. That will tell you a) how much CPU time you're using ( less than 100% is bad Wink ) and b) which functions are taking all your time. If it turns out that you are using all the CPU time and the top most expensive functions are in GL, then it's time to break out the OpenGL profiler.
Quote this message in a reply
Sage
Posts: 1,066
Joined: 2004.07
Post: #3
Well in Shark I found that 32.4% of my time is being spent on something called gldGetString and 8.2% on gldUpdateDispatch and 7.8% on gldGetQueryInfo all coming from ATIRadeon9700GLDriver. What does this mean and how can I take care of this? Or is this not a bad thing? Quite frankly, optimization sucks and it confuses me.
Quote this message in a reply
Sage
Posts: 1,066
Joined: 2004.07
Post: #4
Spoke to soon. After opening a ton of trees, I found my Mesh::Draw() function to be the first mentioned. Here's the code for it so I'm not sure how to optimize it.
Code:
    void Draw()                                    
    {
        glPushMatrix();
        glTranslatef(translate.GetX(),translate.GetY(),translate.GetZ());
        glRotated(rotateAngle,rotate.GetX(),rotate.GetY(),rotate.GetZ());
        glScalef(scale.GetX(),scale.GetY(),scale.GetZ());
        glCallList(list);
        glPopMatrix();
    }

Any suggestions? It's called every frame for rendering but maybe that's not how I should do it.
Quote this message in a reply
Sage
Posts: 1,066
Joined: 2004.07
Post: #5
The program points to my glCallList(list) as being 99.9% of the problem. It says "This function is relatively long, but it has a large number of samples in its function prologue and/or epilogue. This means that the function might have an early exit condition. To improve performance, have calling functions check for the early exit condition themselves before making a call to this function." That doesn't make sense to me. What does that mean?
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #6
it does sound like glCallList is taking a lot of time.

How many triangles are in your list?

How many times are you calling glCallList each frame?
Quote this message in a reply
Sage
Posts: 1,232
Joined: 2002.10
Post: #7
OneSadCookie Wrote:( less than 100% is bad Wink )
While this is probably true in this case, it's not a truism.

If you're GPU limited, you should be using as little CPU as possible.
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #8
really, you should be shooting for 100% CPU and 100% GPU usage on your minimum spec hardware, for "action" games at least. If you're not using 100% of both, you can either do more work (better AI or physics, or prettier graphics), or one is a bottlneck holding the other back, and you need to do some optimization.

obviously, you're never going to manager 100% CPU and 100% GPU usage on all hardware, particularly not once you turn on vsync, but it's a good target to aim for.
Quote this message in a reply
Member
Posts: 116
Joined: 2002.04
Post: #9
gld calls are generally a red herring in Shark. That is to say, Shark doesn't really have any way to profile the OpenGL driver. So until you've looked at absolutely every other part of your application, ignore the gld stuff. Once you're sure OpenGL is your problem, use OpenGL profiler, not Shark to optimize the OpenGL.

Wade
Quote this message in a reply
Sage
Posts: 1,232
Joined: 2002.10
Post: #10
OneSadCookie Wrote:If you're not using 100% of both, you can either do more work, or one is a bottlneck holding the other back.
That's true, if your app is a moving target.

I was thinking of an application where, for example, I know I must blend 10,000 fullscreen quads on top of each other every frame.
Quote this message in a reply
Sage
Posts: 1,066
Joined: 2004.07
Post: #11
wadesworld Wrote:gld calls are generally a red herring in Shark. That is to say, Shark doesn't really have any way to profile the OpenGL driver. So until you've looked at absolutely every other part of your application, ignore the gld stuff. Once you're sure OpenGL is your problem, use OpenGL profiler, not Shark to optimize the OpenGL.
Well everything that even has a percent leads back to that function with the weird 'early exit' message. What does that message mean?

And how do I use profiler? Shark was nice to use but I don't understand why my program doesn't really run in profiler.
Quote this message in a reply
Sage
Posts: 1,066
Joined: 2004.07
Post: #12
In profiler, I found that CGLFlushDrawable is like 98% of everything. That's great. What does that mean? I never made a call to that function so I'm not sure how to optimize it. Any advice?
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #13
CGLFlushDrawable is SwapBuffers. Spending all your time there usually means that you're rendering too fast for the graphics card...
Quote this message in a reply
Sage
Posts: 1,066
Joined: 2004.07
Post: #14
really? What can I do to fix that? I'm only rendering the scene once per frame with vsync on so it's limited. I'll try some things. Advice, please?
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #15
ah, vsync. Try turning that off for debugging purposes.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Is the profiler lying/can GL use previous binds/will... Jones 50 16,392 Sep 26, 2006 03:53 PM
Last Post: akb825
  OpenGL profiler 3.2 - 0.0 Frame Rate? kelvin 0 2,543 Mar 3, 2006 01:21 AM
Last Post: kelvin
  OpenGL Profiler, or, "where did all my files go?" sealfin 2 2,766 Sep 3, 2004 12:19 AM
Last Post: sealfin
  OpenGL profiler & display lists MattDiamond 9 4,297 Sep 1, 2003 08:07 PM
Last Post: MattDiamond
  OpenGL profiler LongJumper 11 4,408 Apr 4, 2003 08:18 PM
Last Post: Fenris