=== modified file 'src/composite-canvas.cc'
@@ -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'
@@ -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'
@@ -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'
@@ -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;