diff mbox

[Branch,~glmark2-dev/glmark2/trunk] Rev 247: MainLoop, Android: Exclude from score calculations benchmarks that weren't set up correctly.

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

Commit Message

alexandros.frantzis@linaro.org Aug. 16, 2012, 5:54 p.m. UTC
Merge authors:
  Alexandros Frantzis (afrantzis)
Related merge proposals:
  https://code.launchpad.net/~linaro-graphics-wg/glmark2/ignore-failed-test-scores/+merge/119527
  proposed by: Alexandros Frantzis (afrantzis)
  review: Approve - Jesse Barker (jesse-barker)
------------------------------------------------------------
revno: 247 [merge]
committer: Alexandros Frantzis <alexandros.frantzis@linaro.org>
branch nick: trunk
timestamp: Thu 2012-08-16 20:53:31 +0300
message:
  MainLoop,Android: Exclude from score calculations benchmarks that weren't set up correctly.
modified:
  src/android.cpp
  src/main-loop.cpp
  src/main-loop.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/android.cpp'
--- src/android.cpp	2012-08-13 10:09:08 +0000
+++ src/android.cpp	2012-08-16 17:17:07 +0000
@@ -49,10 +49,20 @@ 
 
     virtual void log_scene_result()
     {
-        Log::info("%s FPS: %u FrameTime: %.3f ms\n",
-                  scene_->info_string().c_str(),
-                  scene_->average_fps(),
-                  1000.0 / scene_->average_fps());
+        if (scene_setup_status_ == SceneSetupStatusSuccess) {
+            Log::info("%s FPS: %u FrameTime: %.3f ms\n",
+                      scene_->info_string().c_str(),
+                      scene_->average_fps(),
+                      1000.0 / scene_->average_fps());
+        }
+        else if (scene_setup_status_ == SceneSetupStatusUnsupported) {
+            Log::info("%s Unsupported\n",
+                      scene_->info_string().c_str());
+        }
+        else {
+            Log::info("%s Set up failed\n",
+                      scene_->info_string().c_str());
+        }
     }
 };
 
@@ -66,8 +76,20 @@ 
 
     virtual void log_scene_result()
     {
-        Log::info("%s FPS: %u", scene_->info_string().c_str(),
-                                scene_->average_fps());
+        if (scene_setup_status_ == SceneSetupStatusSuccess) {
+            Log::info("%s FPS: %u FrameTime: %.3f ms\n",
+                      scene_->info_string().c_str(),
+                      scene_->average_fps(),
+                      1000.0 / scene_->average_fps());
+        }
+        else if (scene_setup_status_ == SceneSetupStatusUnsupported) {
+            Log::info("%s Unsupported\n",
+                      scene_->info_string().c_str());
+        }
+        else {
+            Log::info("%s Set up failed\n",
+                      scene_->info_string().c_str());
+        }
     }
 };
 

=== modified file 'src/main-loop.cpp'
--- src/main-loop.cpp	2012-08-13 10:09:08 +0000
+++ src/main-loop.cpp	2012-08-16 17:17:07 +0000
@@ -42,6 +42,7 @@ 
 MainLoop::reset()
 {
     scene_ = 0;
+    scene_setup_status_ = SceneSetupStatusUnknown;
     score_ = 0;
     benchmarks_run_ = 0;
     bench_iter_ = benchmarks_.begin();
@@ -83,6 +84,15 @@ 
                 canvas_.reset();
             before_scene_setup();
             scene_ = &(*bench_iter_)->setup_scene();
+            if (!scene_->running()) {
+                if (!scene_->supported(false))
+                    scene_setup_status_ = SceneSetupStatusUnsupported;
+                else
+                    scene_setup_status_ = SceneSetupStatusFailure;
+            }
+            else {
+                scene_setup_status_ = SceneSetupStatusSuccess;
+            }
             after_scene_setup();
             log_scene_info();
         }
@@ -102,12 +112,14 @@ 
      * in draw() may have changed the state.
      */
     if (!scene_->running() || should_quit) {
-        score_ += scene_->average_fps();
+        if (scene_setup_status_ == SceneSetupStatusSuccess) {
+            score_ += scene_->average_fps();
+            benchmarks_run_++;
+        }
         log_scene_result();
         (*bench_iter_)->teardown_scene();
         scene_ = 0;
         next_benchmark();
-        benchmarks_run_++;
     }
 
     return !should_quit;
@@ -134,11 +146,23 @@ 
 void
 MainLoop::log_scene_result()
 {
-    static const std::string format_fps(Log::continuation_prefix + " FPS: %u");
-    static const std::string format_ms(Log::continuation_prefix + " FrameTime: %.3f ms\n");
+    static const std::string format_fps(Log::continuation_prefix +
+                                        " FPS: %u FrameTime: %.3f ms\n");
+    static const std::string format_unsupported(Log::continuation_prefix +
+                                                " Unsupported\n");
+    static const std::string format_fail(Log::continuation_prefix +
+                                         " Set up failed\n");
 
-    Log::info(format_fps.c_str(), scene_->average_fps());
-    Log::info(format_ms.c_str(), 1000.0 / scene_->average_fps());
+    if (scene_setup_status_ == SceneSetupStatusSuccess) {
+        Log::info(format_fps.c_str(), scene_->average_fps(),
+                                      1000.0 / scene_->average_fps());
+    }
+    else if (scene_setup_status_ == SceneSetupStatusUnsupported) {
+        Log::info(format_unsupported.c_str());
+    }
+    else {
+        Log::info(format_fail.c_str());
+    }
 }
 
 void

=== modified file 'src/main-loop.h'
--- src/main-loop.h	2012-02-15 17:09:14 +0000
+++ src/main-loop.h	2012-08-16 17:03:09 +0000
@@ -84,12 +84,19 @@ 
     virtual void log_scene_result();
 
 protected:
+    enum SceneSetupStatus {
+        SceneSetupStatusUnknown,
+        SceneSetupStatusSuccess,
+        SceneSetupStatusFailure,
+        SceneSetupStatusUnsupported
+    };
     void next_benchmark();
     Canvas &canvas_;
     Scene *scene_;
     const std::vector<Benchmark *> &benchmarks_;
     unsigned int score_;
     unsigned int benchmarks_run_;
+    SceneSetupStatus scene_setup_status_;
 
     std::vector<Benchmark *>::const_iterator bench_iter_;
 };