Jump to content

can someone help me make sense out of chrome cpu profile?


valueerror
 Share

Recommended Posts

i've attached a screenshot of a javascript cpu profile i ran in chrome and  i would like to know more about how to use it / what those numbers say..

 

my game is pretty heavy on mobile devices and i don't exactly know what to do about it because i already changed so much to get my almost 60fps and now i'm back at 40fps on a nexus 7 2013

 

 

what does this "window.requestAnimationFrame.forceSetTimeOut._onLoop" mean?  it seems to eat all eft the cpu in some way.. 

 

does this mean the animation of the sprites eat up my cpu?

 

 

so many questions in my head.. .thx in advance!

post-6912-0-07076700-1411328829_thumb.jp

Link to comment
Share on other sites

well.. me neither..  i guess thats the problem..    could you please explain what you mean by "how i sorted the data" ? what data? what timeline?  how would i do this right to be able to figure out where in my code the bottlenecks are? 

 

could you point me to some online docs about this ?

 

is this cpu profile normal for a game like "angry birds" (i've got similar compexity)  assets flying around, physics, explosions, particles, spring and revolute constraints, a lot of sounds and at least 2-4 animations running all the time, tweens and a lot of timerevents

Link to comment
Share on other sites

The CPU consumed is non-idle CPU only. It's not the exact time the CPU spends in total, but just on the handling of all updates.

This is normal, since RAF occurs frequently.

 

When the system is nog handling the RAF, this time is 'idle' and not logged.

 

Hope this helps.

Link to comment
Share on other sites

RAF is the update loop in Phaser. It will consume the CPU, since that is where all the heavy lifting takes place. This method is called by the browser in order to instruct the system to update the screen in response to a 'screen refresh'. 

 

If you look closely in the call-tree, you can clearly see where time is spent. The time reported always includes children, so as you can see, drawImage consumes about 5% of the total time.

 

You do not really need to know about this all, but if you are interested, some more infor about this:

https://developer.mozilla.org/en-US/docs/Web/API/window.requestAnimationFrame

and

http://www.paulirish.com/2011/requestanimationframe-for-smart-animating/

Link to comment
Share on other sites

well.. me neither..  i guess thats the problem..    could you please explain what you mean by "how i sorted the data" ? what data? what timeline?  how would i do this right to be able to figure out where in my code the bottlenecks are? 

 

could you point me to some online docs about this ?

 

is this cpu profile normal for a game like "angry birds" (i've got similar compexity)  assets flying around, physics, explosions, particles, spring and revolute constraints, a lot of sounds and at least 2-4 animations running all the time, tweens and a lot of timerevents

 

https://developer.chrome.com/devtools/docs/cpu-profiling

 

You have 71% of your time in idle in that snapshot, the only other things that seems to take up time are drawImage and fillRect. Likely just the core render. It is difficult to tell because of the sort you used on the  profile data you shared a screenshot for. The timeline is tab in the chrome dev tools that talks about what the v8 engine is doing.

Link to comment
Share on other sites

oh.. the timeline seems to be what i was searching for..  still not exactly sure how to find out how i can map what i see to what i coded but i will do further reading on this on the web (thx for the links !)

 

 

 

could something like the garbage collection event be responsibe for sudden framedrops?

it seems to be responsible  for this "shark tooth" reading... (second screenshot)

 

the function call on line 37002 (fixed to camera) that looks like the heaviest thing on every RAF call seems to be because of my ingame menu that is the only thing that's fixed to camera ...  this doesn't seem right.

 

thx again :)

 

post-6912-0-98232500-1411406862_thumb.jp

post-6912-0-74350500-1411407674_thumb.jp

Link to comment
Share on other sites

thank you for your efforts - i really appreciate that you would be willing to look through my stuff for me....  but i'm actually looking for hints on how to do it on my own

(i thought i'd post the screenshots anyway - it wouldn't hurt anybody and you can tell if i'm on the right way)

 

as stated above i want to learn how to do this by myself..  i have sudden framedrops and i would like to find out more about the reason for it...

 

if RAF is the most consuming thing i'm wondering if there is a way to find the lines in my code that are responsible for it..

 

but i didn't find the time to learn more about this  - hopefully on the weekend.. maybe then i'm able to ask better questions :)   thx

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...