4
\$\begingroup\$

I am trying to profile my LibGDX game, It runs on 60FPS on PC and 42-45 FPS on MY mobile phone. Either I improve performance and raise it to 60, or lock it at 30 (I don´t want to do this).

I have found GLProfiler on the LibGDX wiki, and I am giving it a try. (GLProfiler)

Here is how I am using it:

@Override
public void render(float stateTime) 
{

    //my Render Code

    System.out.println(
            "  Drawcalls: " + GLProfiler.drawCalls +
                    ", Calls: " + GLProfiler.calls +
                    ", TextureBindings: " + GLProfiler.textureBindings +
                    ", ShaderSwitches:  " + GLProfiler.shaderSwitches +
                    "vertexCount: " + GLProfiler.vertexCount.value
    );
    GLProfiler.reset();
}

with GLProfiler.enable() on the create() function.

with GLProfiler.disable() on the dispose() function.

And this is my output:

Drawcalls: 35, Calls: 666, TextureBindings: 35, ShaderSwitches: 60, vertexCount: 36.0

Drawcalls: 33, Calls: 626, TextureBindings: 33, ShaderSwitches: 56, vertexCount: 36.0

Drawcalls: 33, Calls: 626, TextureBindings: 33, ShaderSwitches: 56, vertexCount: 36.0

Drawcalls: 33, Calls: 626, TextureBindings: 33, ShaderSwitches: 56, vertexCount: 36.0

Drawcalls: 33, Calls: 626, TextureBindings: 33, ShaderSwitches: 56, vertexCount: 36.0

Drawcalls: 33, Calls: 626, TextureBindings: 33, ShaderSwitches: 56, vertexCount: 36.0

Drawcalls: 35, Calls: 666, TextureBindings: 35, ShaderSwitches: 60, vertexCount: 36.0

Drawcalls: 35, Calls: 666, TextureBindings: 35, ShaderSwitches: 60, vertexCount: 36.0

Drawcalls: 35, Calls: 666, TextureBindings: 35, ShaderSwitches: 60, vertexCount: 36.0

Drawcalls: 35, Calls: 666, TextureBindings: 35, ShaderSwitches: 60, vertexCount: 36.0

Drawcalls: 33, Calls: 626, TextureBindings: 33, ShaderSwitches: 56, vertexCount: 36.0

Drawcalls: 33, Calls: 626, TextureBindings: 33, ShaderSwitches: 56, vertexCount: 36.0

This is just a couple frames, enough for the example.

I have been looking for information on how to read these numbers, I found nothing.

Do you guys know how can I learn from this information? (Identify problems maybe?)

\$\endgroup\$
2
  • \$\begingroup\$ What is your question? Is it just "What do these terms mean"? \$\endgroup\$
    – Elva
    Jan 12, 2016 at 15:49
  • \$\begingroup\$ Not exactly, I know what a call is, I know what a Texture binding is, I know what they are on libgdx, but not on a lower level, I don´t know how they affect performance. \$\endgroup\$
    – Mayuso
    Jan 12, 2016 at 15:51

2 Answers 2

8
+100
\$\begingroup\$

You seem to lack some insight on your issue.

A couple of things to consider:

  1. Is your true maximum frame rate on your PC really 60 or is it more? NVida drivers limit the frame rate to the maximum draw rate of the monitor, typically 60 Hz; this is due to the fact that there is no need to ask to draw faster than what the monitor is able to process.

    By asking your driver to not limit to the VSync, you'll be able to see how you're doing on PC.

  2. Input/output operations (System.out.println) typically take a lot of resource, so this might cause slowdowns and show more on your phone than on your PC, especially when testing with the print-outs.

  3. Are you sure your bottleneck is GPU bound? Did you try to profile the rest of your application? Phones GPUs are not the only parts of a device that are less powerful than on PCs, CPUs and memory are also less powerful.

    I would suggest you show us first that your issues are really related to how you use the GPU, otherwise, chances are you're probably barking the wrong tree.

As a final note, according to my current OpenGL knowledge:

  • The amount of vertices you have seems to be quite low, which is OK
  • I would think the ShaderSwitches correspond to how often OpenGL changes the states of what to send to the GPU. I think the common consensus is that these are the most expensive actions to do on a GPU and you would want to keep them minimal.
  • I can't comment on the other items you mention.

P.S.

Also, this is none of my business and it's really up to you, but I think it should be considered: on a phone, a higher frame rate means more battery consumption, so you should also probably test what advantages you gain by running at 60 FPS vs running at 30 or 45. (E.g. can you play twice as long with a battery fully charged at 30 FPS compared to running it at 60 FPS?)

\$\endgroup\$
2
  • 2
    \$\begingroup\$ THIS is a really good answer, thank you, I got really nice ideas from here. 1) and 2) where things I already considered, but 3) and the final notes really opened my eyes. Thank you, I will select this as best answer, I think it is good enough for people to learn a couple things. (I did xD) \$\endgroup\$
    – Mayuso
    Jan 28, 2016 at 22:07
  • \$\begingroup\$ Glad I could help! \$\endgroup\$
    – Vaillancourt
    Jan 28, 2016 at 22:11
0
\$\begingroup\$

I ended up giving up on GLProfiler. I will keep the question open in case someone knows the answer.

Here is how I did basic profiling without GLProfiler:

long lastTime = System.nanoTime();

//mycode

System.out.println(System.nanoTime() - lastTime);

Not as good as using a proper Profiler, but at least I can measure times on runtime, and identify bottlenecks.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .