Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1801)

Unified Diff: client/deps/glbench/src/bench.cc

Issue 2123013: Split tests into individual files. Got rid of globals by converting them to classes. (Closed) Base URL: ssh://git@chromiumos-git//autotest.git
Patch Set: addressed comments Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « client/deps/glbench/src/attributefetchtest.cc ('k') | client/deps/glbench/src/cleartest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/deps/glbench/src/bench.cc
diff --git a/client/deps/glbench/src/bench.cc b/client/deps/glbench/src/bench.cc
index 3c5f216b508b7beb704ad4d773fd00beef6c8201..3ea0a2974b9c26adc4ff8469abc4036c37a527e6 100644
--- a/client/deps/glbench/src/bench.cc
+++ b/client/deps/glbench/src/bench.cc
@@ -3,12 +3,13 @@
// found in the LICENSE file.
#include "main.h"
+#include "testbase.h"
-uint64_t TimeBench(BenchFunc func, int iter) {
+uint64_t TimeTest(glbench::TestBase* test, int iter) {
SwapBuffers();
glFinish();
uint64_t time1 = GetUTime();
- func(iter);
+ test->TestFunc(iter);
glFinish();
uint64_t time2 = GetUTime();
return time2 - time1;
@@ -18,9 +19,9 @@ uint64_t TimeBench(BenchFunc func, int iter) {
// We want to measure the marginal cost, so we try more and more iterations
// until we get a somewhat linear response (to eliminate constant cost), and we
// do a linear regression on a few samples.
-bool Bench(BenchFunc func, float *slope, int64_t *bias) {
+bool Bench(glbench::TestBase* test, float *slope, int64_t *bias) {
// Do one iteration in case the driver needs to set up states.
- if (TimeBench(func, 1) > MAX_ITERATION_DURATION_MS)
+ if (TimeTest(test, 1) > MAX_ITERATION_DURATION_MS)
return false;
int64_t count = 0;
int64_t sum_x = 0;
@@ -31,7 +32,7 @@ bool Bench(BenchFunc func, float *slope, int64_t *bias) {
bool do_count = false;
uint64_t iter;
for (iter = 8; iter < 1<<30; iter *= 2) {
- uint64_t time = TimeBench(func, iter);
+ uint64_t time = TimeTest(test, iter);
if (last_time > 0 && (time > last_time * 1.8))
do_count = true;
last_time = time;
« no previous file with comments | « client/deps/glbench/src/attributefetchtest.cc ('k') | client/deps/glbench/src/cleartest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698