aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/RDGE/src/core/script/util/fpsTracker.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/helper-classes/RDGE/src/core/script/util/fpsTracker.js')
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/util/fpsTracker.js51
1 files changed, 0 insertions, 51 deletions
diff --git a/js/helper-classes/RDGE/src/core/script/util/fpsTracker.js b/js/helper-classes/RDGE/src/core/script/util/fpsTracker.js
deleted file mode 100755
index 0b6cdd84..00000000
--- a/js/helper-classes/RDGE/src/core/script/util/fpsTracker.js
+++ /dev/null
@@ -1,51 +0,0 @@
1/* <copyright>
2This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
4(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5</copyright> */
6
7fpsTracker = function (id) {
8 this.id = id;
9 this.fpsRaw = new stat(id + "_fps", "raw", 0, null, false);
10 this.fpsAvg = new stat(id + "_fps", "avg", 0, null, false);
11 this.fpsMin = new stat(id + "_fps", "min", 0, null, false);
12 this.fpsMax = new stat(id + "_fps", "max", 0, null, false);
13 this.samples = [];
14 this.maxSamples = 10;
15 this.timeStampMS = 0.0;
16 this.reportInterval = 500;
17
18 this.close = function() {
19 stat.pages[id + "_fps"] = null;
20 }
21
22 this.sample = function() {
23 var currMS = new Date().getTime();
24 this.samples.push(currMS - this.timeStampMS);
25 if (this.samples.length > this.maxSamples) {
26 this.samples.shift();
27 }
28 this.timeStampMS = currMS;
29 var accum = 0.0;
30 var fmin = -1e10;
31 var fmax = 1e10;
32 var i = this.samples.length - 1;
33 while (i >= 0) {
34 accum += this.samples[i];
35 fmin = Math.max(fmin, this.samples[i]);
36 fmax = Math.min(fmax, this.samples[i]);
37 i--;
38 }
39 var denom = this.samples.length > 0 ? accum / this.samples.length : 0;
40 var avgFPS = denom > 0 ? 1000 / denom : 0;
41 var minFPS = fmin > 0 ? 1000 / fmin : 0;
42 var maxFPS = fmax > 0 ? 1000 / fmax : 0;
43 var lastSample = this.samples[this.samples.length - 1];
44 var rawFPS = (lastSample > 0) ? 1000 / lastSample : 0;
45
46 this.fpsRaw.value = rawFPS.toFixed(2);
47 this.fpsAvg.value = avgFPS.toFixed(2);
48 this.fpsMin.value = minFPS.toFixed(2);
49 this.fpsMax.value = maxFPS.toFixed(2);
50 }
51} \ No newline at end of file