GitXplorerGitXplorer
e

fps-stats

public
1 stars
0 forks
0 issues

Commits

List of commits on branch master.
Unverified
dad780795d92f5c7af6b8c9bc87a109995f929a5

0.2.6

eerykpiast committed 10 years ago
Unverified
bc7d0e693c7f390ea65a1dcde334595da38d60f6

Build dist/

eerykpiast committed 10 years ago
Unverified
4189b9540e58a47464c238239edb65cef54dc43a

remove first property from the first entry emitted from meter

eerykpiast committed 10 years ago
Unverified
a885245ead346c1564c5372d28359e79d544730e

0.2.5

eerykpiast committed 10 years ago
Unverified
cd83c83d2be1b8a2d5b4f5da40244117afc97ad0

update raf shim dependency

eerykpiast committed 10 years ago
Unverified
09acfa5892d7743633a818298e77c683204301d3

0.2.4

eerykpiast committed 10 years ago

README

The README file for this repository.

fps-stats

Modules for measuring average FPS (frames per second) value.

FpsMeter

Calculates average FPS value from last n milliseconds, for each frame.

import FpsMeter from 'fps-stats/dist/meter';

let meter = new FpsMeter(1000);
let unregister = meter.registerCallback(({ avgFps, currentTime }) => {
  console.log(avgFps); // prints average FPS in last second for each frame
});

// some time later...
unregister();
meter.dispose();

FpsAggregator

Saves average FPS value from FpsMeter if it differs significantly from previous one.

import FpsAggregator from 'fps-stats/dist/meter';

let aggregator = new FpsAggregator(2);
aggregator.start();

// some time later...
aggregator.finish();

console.log(aggregator.getTimes());
// `x` is time of saving result, relative to start
// `y` is noted average FPS value
// [
//    { x: 0, y: 60.12 },
//    { x: 483, y: 58.567 }
//    { x: 500, y: 58.01 },
//    { x: 2982, y: 59.99 },
//    { x: 3000, y: 60.1 },
//    { x: 5984, y: 58.09 },
//    { x: 6000, y: 55.32 },
//    { x: 7975, y: 53.40 },
//    { x: 8000, y: 50.97 }
//  ]

With this data you can draw very nice plot of average FPS values.

avgFps
   ^
   |
60-|----_________________________------------------------------__________
   |                                                                     ‾‾‾‾‾‾‾‾‾---
   |
   |
   |
   +---------+---------+---------+---------+---------+---------+---------+---------+---> time
 0          1000      2000      3000      4000      5000      6000      7000      8000