- Home /
How to deal with an insanely high "cpu-present" stats?
Hi there,
I'm currently profiling my game on my android nexus one and I'm getting very high numbers in cpu-present which, if I understand correctly, means that I'm gpu bound. My game consists of a straight road with lots of objects that you have to avoid and they are flat sprites. I know alpha testing/blending can be hard on performance but I'm getting an average cpu-present of 50-60 which is insanely high.
However, before trying to optimize anything, I did some tests and an empty scene with only a few hud elements still gives me an average cpu-present of 30ms, that seems pretty unacceptable. Look at these profiler stats from my Nexus One from a totally empty scene.
----------------------------------------
Android Unity internal profiler stats:
cpu-player> min: 2.2 max: 20.5 avg: 6.0
cpu-ogles-drv> min: 0.2 max: 1.5 avg: 0.4
cpu-present> min: 8.2 max: 33.3 avg: 23.0
frametime> min: 15.2 max: 42.4 avg: 29.4
draw-call #> min: 1 max: 1 avg: 1 | batched: 0
tris #> min: 2 max: 2 avg: 2 | batched: 0
verts #> min: 4 max: 4 avg: 4 | batched: 0
player-detail> physx: 0.4 animation: 0.1 culling 0.0 skinning: 0.0 batching: 0.0 render: 2.0 fixed-update-count: 1 .. 2
mono-scripts> update: 2.6 fixedUpdate: 0.0 coroutines: 0.2
mono-memory> used heap: 4317184 allocated heap: 5033984 max number of collections: 0 collection total duration: 0.0
----------------------------------------
I even went further and created an empty unity project and published to my android and I still get avg 15 for cpu-present, is Unity Android still unoptimized? I can't even get 60fps with an EMPTY scene, that's pretty insane.
Furthermore, I get very decent framerates on the iPad 1 and the iPhone 3GS with the same project, absolutly nothing like these profiler numbers.
Does anyone have ideas or pointers to fix that?
Answer by Peter G · Jul 18, 2011 at 03:26 PM
Check out this thread.
It pretty much covers everything. And yes it means you are GPU bound more than likely. And that's just a matter of optimizing your graphics. The list is everywhere of what you need to do... reduce drawcalls, batching, avoid transparency where you can. Alpha Blending and Alpha Testing are both costly, but you should lean towards alpha blending when you can.
Yeah, I had read that thread already, the problem is I can't avoid transparency as all my objects are sprites ;) One of the thing he suggests is to increase the texture size but I'm already at 1024, making the objects bigger in pixel size just means more materials which means less batching and more drawcalls. I may be asking for the impossible. If I'm not mistaken, without alpha testing, the draw order will not work or it'll hide objects behind even when they're in the transparent part of the object closer to the camera no?
I'm currently checking Jessy's videos, maybe I can optimize the alpha testing/blending, etc http://www.youtube.com/user/JessyUV#p/c/31F6A116DCCC9F61
if you check my edit on the question, you'll see some weird stuff that is pretty much beyond just optimizing the scene or texture...
Well thats interesting... I'm not sure if its an android thing (I dev on iOS). It could just be background tasks.
It's interesting in a "holy crap my project is ruined" kind of way haha background tasks that chop off your first 30fps, just great!
On iOS these numbers are way low even with the full game running