I have profiled my mixed Java\C++ Android game and I got the following result:

android app profile

As you can see, the pink think is a C++ functions that updates the game. It does things like updating the logic but it mostly it generates a "request list" for rendering. The thing is, I generate DrawLists on C++ and then send them to Java to process and draw using GLES2.0.

Since then I was able to improve update from 9ms down to about 7ms, but I would like to ask if I would benefit from multi threading the update?

As I understand from that diagram is that the function that takes the most time is the one you see it's color on the timeline. So the pink area is taken mostly by update. The other area has MainOpenGL.Handle as it's main contributor(whch is my java function), but since it's not drawn to the top of the diagram I can conclude other things are happening at the same time that use the CPU? Or even GPU stuff that isn't shown in this diagram.

I am not sure how the GPU works on this. Does it calculate stuff in parallel to the CPU? Or is it part of the CPU usage as in SoC? I am not sure. Anyway, in case GPU things DO happen in parallel to CPU, then I would guess that if I do this C++ Update in parallel to the thread that makes the OpenGL calls, I might make use of "dead CPU time" due to GPU stalling or maybe have the GPU calls getting processed earlier because it won't have to wait for Update to finish?

How do you suggest to improve performance based on that?

  • \$\begingroup\$ Very important, what "device" are you capturing your data on? Emulator or real mobile device? \$\endgroup\$
    – Cristina
    Commented May 1, 2013 at 20:33

1 Answer 1


Your image is hard to see, could you please upload a bigger one?

GPU does happen in parallel to CPU but both sync when swapping buffers. I would move your updates to a different thread, even more than one thread and throw stuff to render to your GLThread. If done correctly you can even use different update frequencies for different stuff in your scene.

  • 1
    \$\begingroup\$ Drag the image to a new tab, to see it in full res. \$\endgroup\$
    – user15805
    Commented Apr 1, 2013 at 18:38

You must log in to answer this question.

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