From patchwork Fri Dec 9 13:37:22 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: alexandros.frantzis@linaro.org X-Patchwork-Id: 5560 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 041F123E0C for ; Fri, 9 Dec 2011 13:37:26 +0000 (UTC) Received: from mail-bw0-f52.google.com (mail-bw0-f52.google.com [209.85.214.52]) by fiordland.canonical.com (Postfix) with ESMTP id E6D78A18088 for ; Fri, 9 Dec 2011 13:37:25 +0000 (UTC) Received: by mail-bw0-f52.google.com with SMTP id 17so4007389bke.11 for ; Fri, 09 Dec 2011 05:37:25 -0800 (PST) Received: by 10.204.157.12 with SMTP id z12mr940190bkw.18.1323437845742; Fri, 09 Dec 2011 05:37:25 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.205.129.2 with SMTP id hg2cs114094bkc; Fri, 9 Dec 2011 05:37:25 -0800 (PST) Received: by 10.152.104.103 with SMTP id gd7mr4863022lab.34.1323437843426; Fri, 09 Dec 2011 05:37:23 -0800 (PST) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id je10si4930790lab.11.2011.12.09.05.37.23 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 09 Dec 2011 05:37:23 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) client-ip=91.189.90.7; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) smtp.mail=bounces@canonical.com Received: from ackee.canonical.com ([91.189.89.26]) by indium.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1RZ0de-0008IC-Pl for ; Fri, 09 Dec 2011 13:37:22 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id BA033E03C8 for ; Fri, 9 Dec 2011 13:37:22 +0000 (UTC) MIME-Version: 1.0 X-Launchpad-Project: glmark2 X-Launchpad-Branch: ~glmark2-dev/glmark2/trunk X-Launchpad-Message-Rationale: Subscriber X-Launchpad-Branch-Revision-Number: 175 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~glmark2-dev/glmark2/trunk] Rev 175: Scene: Calculate the average fps value on demand. Message-Id: <20111209133722.17810.55530.launchpad@ackee.canonical.com> Date: Fri, 09 Dec 2011 13:37:22 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="14450"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: e5df57b2b3061d9215565215ff032a380c6ee53a ------------------------------------------------------------ revno: 175 committer: Alexandros Frantzis 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 === 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 };