| Index: PerformanceTests/Animation/resources/framerate.js
|
| diff --git a/PerformanceTests/Animation/resources/framerate.js b/PerformanceTests/Animation/resources/framerate.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..2b3d0c03c59ee2e0ea931f9e07ecfd5e1f1f1397
|
| --- /dev/null
|
| +++ b/PerformanceTests/Animation/resources/framerate.js
|
| @@ -0,0 +1,32 @@
|
| +(function(){
|
| +
|
| +var framesPerTimerReading = 10;
|
| +var frameCount = 0;
|
| +var startTime;
|
| +var trackingFrameRate = false;
|
| +
|
| +function trackFrameRate(currTime)
|
| +{
|
| + if (++frameCount == framesPerTimerReading) {
|
| + frameCount = 0;
|
| + PerfTestRunner.measureValueAsync(1000 * framesPerTimerReading / (currTime - startTime));
|
| + startTime = currTime;
|
| + }
|
| +
|
| + if (trackingFrameRate)
|
| + requestAnimationFrame(trackFrameRate);
|
| +}
|
| +
|
| +window.startTrackingFrameRate = function() {
|
| + if (trackingFrameRate)
|
| + return;
|
| + trackingFrameRate = true;
|
| + startTime = performance.now();
|
| + trackFrameRate();
|
| +};
|
| +
|
| +window.stopTrackingFrameRate = function() {
|
| + trackingFrameRate = false;
|
| +};
|
| +
|
| +})();
|
|
|