Android app run times vary greatly

I’m making some very simple mods to one of the LunarG Vulkan API Samples (draw_cube) and running on the 970 board. Based on timestamps just before and just after a frame is drawn, different runs of the same app can take a very different amount of time to execute – sometimes different by a factor of 4 - like 75 msec vs. 300 msec. Also if I have a lot of draw calls in one frame, I start getting messages like this in the logcat: I/Choreographer: Skipped 59 frames! The application may be doing too much work on its main thread.
Any advice?

Three pieces of advice;

  1. 75-300 ms is too small of a window to make reasonable measurements. You need to stretch it out much longer to get a proper idea of the performance. In very short tests, anything can happen that can impact your results, like a GC hits, for example.
  2. Along the same line of thought, what’s going on with the CPU speed? Is it possible that the CPU frequency is a lot higher on the 75ms test than the 300?
  3. If it says you’re doing too much work on the main thread, then you should consider creating additional threads to do all your heavy lifting. Bogging down the main thread will cause your UI updates to have to wait for the big jobs to finish, and having ALL the work done on a single thread fails to take advantage of all the CPU cores you have available. Hikey970 is an 8 core processor, so why would you want to limit your work to a single core? Spread the work around, and keep the main thread for the UI.

Thanks for your reply. I switched over to a different code base and things are a bit better, but looking at frame rate over several minutes, there is still lots of variation - for instance 10fps to 20fps with an average of 15fps. What might be causing this? I’m wondering about GPU clock rate. Is there a way to lock the GPU frequency? Would that involve modifying any AOSP drivers?

I’m not sure if there is any way to lock the gpu speed. Any changes would be in the kernel, nothing to do with aosp.

What does the CPU load look like? Especially when the framerate is lower. Are you now distributing the work more evenly across more cores?
What does the workload look like? Is the work more complex when the framerate is lower?
Have you done anything to maintain constant or higher CPU speed? This will involve adjusting the cpu governor.