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

Unified Diff: bench/nanobench.cpp

Issue 394363003: Use __rdtsc on Windows. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 5 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 | « no previous file | tools/Stats.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bench/nanobench.cpp
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp
index 445370741665cca3dd64c0c8cd6b41b266fe95b5..a9862c6ef01008a59e2c029bdd81e2ca977bc226 100644
--- a/bench/nanobench.cpp
+++ b/bench/nanobench.cpp
@@ -50,8 +50,6 @@ DEFINE_bool(gpu, true, "Master switch for GPU-bound work.");
DEFINE_string(outResultsFile, "", "If given, write results here as JSON.");
DEFINE_bool(resetGpuContext, true, "Reset the GrContext before running each bench.");
-DEFINE_int32(maxCalibrationAttempts, 3,
- "Try up to this many times to guess loops for a bench, or skip the bench.");
static SkString humanize(double ms) {
@@ -95,13 +93,8 @@ static double estimate_timer_overhead() {
static int cpu_bench(const double overhead, Benchmark* bench, SkCanvas* canvas, double* samples) {
// First figure out approximately how many loops of bench it takes to make overhead negligible.
double bench_plus_overhead;
- int round = 0;
do {
bench_plus_overhead = time(1, bench, canvas, NULL);
- if (++round == FLAGS_maxCalibrationAttempts) {
- // At some point we have to just give up.
- return 0;
- }
} while (bench_plus_overhead < overhead);
// Later we'll just start and stop the timer once but loop N times.
@@ -288,6 +281,8 @@ int tool_main(int argc, char** argv) {
fill_static_options(&log);
const double overhead = estimate_timer_overhead();
+ SkDebugf("Timer overhead: %s\n", humanize(overhead).c_str());
+
SkAutoTMalloc<double> samples(FLAGS_samples);
if (FLAGS_runOnce) {
« no previous file with comments | « no previous file | tools/Stats.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698