diff mbox

[Branch,~glcompbench-dev/glcompbench/trunk] Rev 32: Replace --num-iters command line option with the 'iterations' and 'duration' test options.

Message ID 20110623142315.3922.42482.launchpad@loganberry.canonical.com
State Accepted
Headers show

Commit Message

alexandros.frantzis@linaro.org June 23, 2011, 2:23 p.m. UTC
------------------------------------------------------------
revno: 32
committer: Alexandros Frantzis <alexandros.frantzis@linaro.org>
branch nick: trunk
timestamp: Thu 2011-06-23 16:13:26 +0300
message:
  Replace --num-iters command line option with the 'iterations' and 'duration' test options.
modified:
  src/composite-canvas.cc
  src/composite-canvas.h
  src/options.cc
  src/options.h


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

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

Patch

=== modified file 'src/composite-canvas.cc'
--- src/composite-canvas.cc	2011-06-23 08:54:28 +0000
+++ src/composite-canvas.cc	2011-06-23 13:13:26 +0000
@@ -25,6 +25,7 @@ 
 #include <stdint.h>
 #include <inttypes.h>
 #include <sys/time.h>
+#include <sstream>
 
 #include <X11/Xlib.h>
 #include <X11/Xutil.h>
@@ -454,7 +455,7 @@ 
     // Each iteration is 3 seconds of compositing by the current test object.
     // When we complete an iteration, reset the count and tell the caller.
 
-    if (stats.total >= 3000.0) {
+    if (stats.total >= current_test_duration_) {
         Log::info("FPS: %"PRIu64"\n", stats.nsamples / 3);
 
         for (Profiler::Point p = 0; p < profiler.get_num_points(); p += 2) {
@@ -466,7 +467,7 @@ 
 
         profiler.reset();
         ++iterations_;
-        if (iterations_ < Options::num_iterations) {
+        if (iterations_ < current_test_iterations_) {
             return;
         }
         iterations_ = 0;
@@ -474,6 +475,28 @@ 
     }
 }
 
+void
+CompositeCanvas::load_current_test_options()
+{
+    std::map<std::string, CompositeTest::Option>::const_iterator iter;
+
+    current_test_duration_ = 0.0;
+    current_test_iterations_ = 0;
+
+    iter = current_test_->options().find("duration");
+    if (iter != current_test_->options().end()) {
+        std::stringstream ss(iter->second.value);
+        ss >> current_test_duration_;
+        current_test_duration_ *= 1000.0;
+    }
+
+    iter = current_test_->options().find("iterations");
+    if (iter != current_test_->options().end()) {
+        std::stringstream ss(iter->second.value);
+        ss >> current_test_iterations_;
+    }
+}
+
 static void
 next_benchmark(std::list<Benchmark*>& benchmarks,
                std::list<Benchmark*>::iterator &benchIt)
@@ -572,6 +595,7 @@ 
     {
         Benchmark *benchmark = *benchIt;
         current_test_ = &benchmark->setup_test();
+        load_current_test_options();
         reshape(width_, height_);
         Log::info("Running test: '%s' %susing vertex buffer objects\n", 
                   current_test_->name().c_str(),

=== modified file 'src/composite-canvas.h'
--- src/composite-canvas.h	2011-06-22 11:36:50 +0000
+++ src/composite-canvas.h	2011-06-23 13:13:26 +0000
@@ -84,9 +84,12 @@ 
     void benchmark_update(bool& iteration_complete);
     void update_all_textures();
     void sample_point(int i);
+    void load_current_test_options();
     unsigned int iterations_;
     unsigned int width_;
     unsigned int height_;
+    double current_test_duration_;
+    unsigned int current_test_iterations_;
 
     Profiler::PointPair profiler_cycle_pair_;
     Profiler::PointPair profiler_xevent_pair_;

=== modified file 'src/options.cc'
--- src/options.cc	2011-06-23 11:26:39 +0000
+++ src/options.cc	2011-06-23 13:13:26 +0000
@@ -30,7 +30,6 @@ 
 #include "options.h"
 
 int Options::size = 512;
-unsigned int Options::num_iterations = 5;
 std::list<Window> Options::window_ids;
 bool Options::run_forever = false;
 bool Options::use_accel_tfp = true;
@@ -142,8 +141,6 @@ 
             Options::force_tex_update = true;
         else if (!strcmp(optname, "run-forever"))
             Options::run_forever = true;
-        else if (!strcmp(optname, "num-iters"))
-            Options::num_iterations = strtol(optarg, NULL, 10);
         else if (!strcmp(optname, "list-tests"))
             Options::list_tests = true;
         else if (!strcmp(optname, "manual-redirect"))

=== modified file 'src/options.h'
--- src/options.h	2011-06-23 09:49:07 +0000
+++ src/options.h	2011-06-23 13:13:26 +0000
@@ -34,7 +34,6 @@ 
 
     static std::list<Window> window_ids;
     static int size;
-    static unsigned int num_iterations;
     static bool run_forever;
     static bool use_accel_tfp;
     static std::list<std::string> benchmarks;