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

Side by Side Diff: bench/nanobench.cpp

Issue 393673006: Give windows boring bars and use 'us' for microseconds. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: us too 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 unified diff | Download patch
« no previous file with comments | « no previous file | tools/Stats.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include <ctype.h> 8 #include <ctype.h>
9 9
10 #include "Benchmark.h" 10 #include "Benchmark.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 DEFINE_bool(cpu, true, "Master switch for CPU-bound work."); 48 DEFINE_bool(cpu, true, "Master switch for CPU-bound work.");
49 DEFINE_bool(gpu, true, "Master switch for GPU-bound work."); 49 DEFINE_bool(gpu, true, "Master switch for GPU-bound work.");
50 50
51 DEFINE_string(outResultsFile, "", "If given, write results here as JSON."); 51 DEFINE_string(outResultsFile, "", "If given, write results here as JSON.");
52 DEFINE_bool(resetGpuContext, true, "Reset the GrContext before running each benc h."); 52 DEFINE_bool(resetGpuContext, true, "Reset the GrContext before running each benc h.");
53 53
54 54
55 static SkString humanize(double ms) { 55 static SkString humanize(double ms) {
56 if (ms > 1e+3) return SkStringPrintf("%.3gs", ms/1e3); 56 if (ms > 1e+3) return SkStringPrintf("%.3gs", ms/1e3);
57 if (ms < 1e-3) return SkStringPrintf("%.3gns", ms*1e6); 57 if (ms < 1e-3) return SkStringPrintf("%.3gns", ms*1e6);
58 #ifdef SK_BUILD_FOR_WIN
59 if (ms < 1) return SkStringPrintf("%.3gus", ms*1e3);
60 #else
58 if (ms < 1) return SkStringPrintf("%.3gµs", ms*1e3); 61 if (ms < 1) return SkStringPrintf("%.3gµs", ms*1e3);
62 #endif
59 return SkStringPrintf("%.3gms", ms); 63 return SkStringPrintf("%.3gms", ms);
60 } 64 }
61 65
62 static double time(int loops, Benchmark* bench, SkCanvas* canvas, SkGLContextHel per* gl) { 66 static double time(int loops, Benchmark* bench, SkCanvas* canvas, SkGLContextHel per* gl) {
63 WallTimer timer; 67 WallTimer timer;
64 timer.start(); 68 timer.start();
65 if (bench) { 69 if (bench) {
66 bench->draw(loops, canvas); 70 bench->draw(loops, canvas);
67 } 71 }
68 if (canvas) { 72 if (canvas) {
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 } 363 }
360 364
361 return 0; 365 return 0;
362 } 366 }
363 367
364 #if !defined SK_BUILD_FOR_IOS 368 #if !defined SK_BUILD_FOR_IOS
365 int main(int argc, char * const argv[]) { 369 int main(int argc, char * const argv[]) {
366 return tool_main(argc, (char**) argv); 370 return tool_main(argc, (char**) argv);
367 } 371 }
368 #endif 372 #endif
OLDNEW
« 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