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

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

Issue 2115012: Added texture update test. (Closed) Base URL: ssh://git@chromiumos-git//autotest.git
Patch Set: C++ enum 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/all_tests.h ('k') | client/deps/glbench/src/main.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
deleted file mode 100644
index 3ea0a2974b9c26adc4ff8469abc4036c37a527e6..0000000000000000000000000000000000000000
--- a/client/deps/glbench/src/bench.cc
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "main.h"
-#include "testbase.h"
-
-uint64_t TimeTest(glbench::TestBase* test, int iter) {
- SwapBuffers();
- glFinish();
- uint64_t time1 = GetUTime();
- test->TestFunc(iter);
- glFinish();
- uint64_t time2 = GetUTime();
- return time2 - time1;
-}
-
-// Benchmark some draw commands, by running it many times.
-// 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(glbench::TestBase* test, float *slope, int64_t *bias) {
- // Do one iteration in case the driver needs to set up states.
- if (TimeTest(test, 1) > MAX_ITERATION_DURATION_MS)
- return false;
- int64_t count = 0;
- int64_t sum_x = 0;
- int64_t sum_y = 0;
- int64_t sum_xy = 0;
- int64_t sum_x2 = 0;
- uint64_t last_time = 0;
- bool do_count = false;
- uint64_t iter;
- for (iter = 8; iter < 1<<30; iter *= 2) {
- uint64_t time = TimeTest(test, iter);
- if (last_time > 0 && (time > last_time * 1.8))
- do_count = true;
- last_time = time;
- if (do_count) {
- ++count;
- sum_x += iter;
- sum_y += time;
- sum_xy += iter * time;
- sum_x2 += iter * iter;
- }
- if ((time >= 500000 && count > 4))
- break;
- }
- if (count < 2) {
- *slope = 0.f;
- *bias = 0;
- }
- *slope = static_cast<float>(sum_x * sum_y - count * sum_xy) /
- (sum_x * sum_x - count * sum_x2);
- *bias = (sum_x * sum_xy - sum_x2 * sum_y) / (sum_x * sum_x - count * sum_x2);
- return true;
-}
« no previous file with comments | « client/deps/glbench/src/all_tests.h ('k') | client/deps/glbench/src/main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698