Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the FPS in chrome devtools

I want to retrieve the average fps of the measured performance recording.

So far I'm only able to get the duration and fps per frame by either hovering over the frame like this: enter image description here

or by selecting the frame: enter image description here

To get the average fps of all frames, I would have to sum and count them one by one by hand, which is quite inconvenient.


Firefox devtools for example displays the average fps at the top right of the panel. enter image description here

like image 621
Robbendebiene Avatar asked Jan 03 '18 14:01

Robbendebiene


People also ask

How do I show fps in Chrome?

Open the inspector (Right click+Inspect), Press Esc to show the console panel on the bottom, click the three dot menu to the left side of that, and click "Rendering". In that tab there's a "Show FPS Meter" checkbox.

What is idle in chrome performance?

The Idle Detection API notifies developers when a user is idle, indicating such things as lack of interaction with the keyboard, mouse, screen, activation of a screensaver, locking of the screen, or moving to a different screen.


1 Answers

You can use devtools-for-devtools.

  1. Switch devtools to detached window mode (click devtools settings icon, click "undock" icon). Next time you can simply press Ctrl-Shift-D to toggle the mode.
  2. Invoke devtools-for-devtools by pressing Ctrl-Shift-i

  • display FPS of all frames:

    UI.panels.timeline._flameChart._model._frameModel._frames.slice(1).map(f => +(1000 / f.duration).toFixed(1))

  • display the average FPS:

    +UI.panels.timeline._flameChart._model._frameModel._frames.slice(1).map(f => 1000 / f.duration).reduce((avg, fps, i) => (avg*i + fps) / (i+1), 0).toFixed(1)

You can save this code as snippets in devtools Snippets panel and invoke it after step 2 above.

like image 193
wOxxOm Avatar answered Sep 21 '22 13:09

wOxxOm