[webkit-dev] Collecting FPS Data from CSS Animations in WebKit

Simon Fraser simon.fraser at apple.com
Sat Apr 16 14:47:47 PDT 2011


On Apr 16, 2011, at 11:08 AM, Kevin Hendry wrote:

> I've been looking at how to collect FPS data from a webpage rendered in WebKit where the animations are due to CSS transitions.  I don't see anything there that can do this today.  Is that true?  I saw a presentation by some folks at Nokia where QtWebKit had some hooks to do this, but I don't see anything in the source tree about it.  
> 
> Does anyone on this list have some information that can help me?  My current thoughts are to hook in to the Console.profile() and Console.stopProfiling() calls to get the duration and add some custom changes to the platform code in order to track the number of paints over the duration.  I'm just surprised that this isn't possible already and wondering if I'm just missing something.  
> 
> Any help would be greatly appreciated.

There are two ways that we run animations with CSS transitions and animations.

In one, the "software" path, AnimationController fires timers to drive the animations, on a 25ms threshold. You could get a rough idea of framerate when running these kinds of animation by seeing how fast a JS timer will fire, which indicates how fast the runloop is running.

The other kind, supported in Safari on Mac, is a "hardware-accelerated" animation, which runs on another thread, and is composited without WebKit's direct involvement. These basically run at screen refresh rate. We only run these kinds of animations for transitions/animations of -webkit-transform, and sometimes opacity. There's no way you can measure framerate for these from JS.

There's a proposed API called requestAnimationFrame that is being implemented that will make this easier to measure for software animations. See <https://bugs.webkit.org/show_bug.cgi?id=51218>.

Simon

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20110416/64c73dbf/attachment.html>


More information about the webkit-dev mailing list