diff mbox

[Branch,~glmark2-dev/glmark2/trunk] Rev 175: Scene: Calculate the average fps value on demand.

Message ID 20111209133722.17810.55530.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

alexandros.frantzis@linaro.org Dec. 9, 2011, 1:37 p.m. UTC
------------------------------------------------------------
revno: 175
committer: Alexandros Frantzis <alexandros.frantzis@linaro.org>
branch nick: trunk
timestamp: Thu 2011-12-08 15:19:41 +0200
message:
  Scene: Calculate the average fps value on demand.
modified:
  src/scene.cpp
  src/scene.h


--
lp:glmark2
https://code.launchpad.net/~glmark2-dev/glmark2/trunk

You are subscribed to branch lp:glmark2.
To unsubscribe from this branch go to https://code.launchpad.net/~glmark2-dev/glmark2/trunk/+edit-subscription
diff mbox

Patch

=== modified file 'src/scene.cpp'
--- src/scene.cpp	2011-12-08 11:09:09 +0000
+++ src/scene.cpp	2011-12-08 13:19:41 +0000
@@ -35,7 +35,7 @@ 
 
 Scene::Scene(Canvas &pCanvas, const string &name) :
     canvas_(pCanvas), name_(name),
-    startTime_(0), lastUpdateTime_(0), currentFrame_(0), averageFPS_(0),
+    startTime_(0), lastUpdateTime_(0), currentFrame_(0),
     running_(0), duration_(0)
 {
     options_["duration"] = Scene::Option("duration", "10.0",
@@ -95,10 +95,8 @@ 
 
     lastUpdateTime_ = current_time;
 
-    if (elapsed_time >= duration_) {
-        averageFPS_ = currentFrame_ / elapsed_time;
+    if (elapsed_time >= duration_)
         running_ = false;
-    }
 }
 
 void
@@ -119,7 +117,8 @@ 
 unsigned
 Scene::average_fps()
 {
-    return averageFPS_;
+    double elapsed_time = lastUpdateTime_ - startTime_;
+    return currentFrame_ / elapsed_time;
 }
 
 

=== modified file 'src/scene.h'
--- src/scene.h	2011-11-14 11:36:26 +0000
+++ src/scene.h	2011-12-08 13:19:41 +0000
@@ -210,7 +210,6 @@ 
     double startTime_;
     double lastUpdateTime_;
     unsigned currentFrame_;
-    unsigned averageFPS_;      // Average FPS of run
     bool running_;
     double duration_;      // Duration of run in seconds
 };