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

Side by Side Diff: bench/nanobench.cpp

Issue 490683002: Add --options to nanobench, similar to --key but for non-identifying options. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 4 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 | no next file » | 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 "Loop until timer overhead is at most this fraction of our measurm ents."); 56 "Loop until timer overhead is at most this fraction of our measurm ents.");
57 DEFINE_double(gpuMs, 5, "Target bench time in millseconds for GPU."); 57 DEFINE_double(gpuMs, 5, "Target bench time in millseconds for GPU.");
58 DEFINE_int32(gpuFrameLag, 5, "Overestimate of maximum number of frames GPU allow s to lag."); 58 DEFINE_int32(gpuFrameLag, 5, "Overestimate of maximum number of frames GPU allow s to lag.");
59 DEFINE_bool(gpuCompressAlphaMasks, false, "Compress masks generated from falling back to " 59 DEFINE_bool(gpuCompressAlphaMasks, false, "Compress masks generated from falling back to "
60 "software path rendering."); 60 "software path rendering.");
61 61
62 DEFINE_string(outResultsFile, "", "If given, write results here as JSON."); 62 DEFINE_string(outResultsFile, "", "If given, write results here as JSON.");
63 DEFINE_int32(maxCalibrationAttempts, 3, 63 DEFINE_int32(maxCalibrationAttempts, 3,
64 "Try up to this many times to guess loops for a bench, or skip the bench."); 64 "Try up to this many times to guess loops for a bench, or skip the bench.");
65 DEFINE_int32(maxLoops, 1000000, "Never run a bench more times than this."); 65 DEFINE_int32(maxLoops, 1000000, "Never run a bench more times than this.");
66 DEFINE_string(key, "", "Space-separated key/value pairs to add to JSON."); 66 DEFINE_string(key, "",
67 "Space-separated key/value pairs to add to JSON identifying this b ench config.");
68 DEFINE_string(options, "",
69 "Space-separated option/value pairs to add to JSON, logging extra info.");
67 DEFINE_string(gitHash, "", "Git hash to add to JSON."); 70 DEFINE_string(gitHash, "", "Git hash to add to JSON.");
68 71
69 DEFINE_string(clip, "0,0,1000,1000", "Clip for SKPs."); 72 DEFINE_string(clip, "0,0,1000,1000", "Clip for SKPs.");
70 DEFINE_string(scales, "1.0", "Space-separated scales for SKPs."); 73 DEFINE_string(scales, "1.0", "Space-separated scales for SKPs.");
71 74
72 static SkString humanize(double ms) { 75 static SkString humanize(double ms) {
73 if (ms > 1e+3) return SkStringPrintf("%.3gs", ms/1e3); 76 if (ms > 1e+3) return SkStringPrintf("%.3gs", ms/1e3);
74 if (ms < 1e-3) return SkStringPrintf("%.3gns", ms*1e6); 77 if (ms < 1e-3) return SkStringPrintf("%.3gns", ms*1e6);
75 #ifdef SK_BUILD_FOR_WIN 78 #ifdef SK_BUILD_FOR_WIN
76 if (ms < 1) return SkStringPrintf("%.3gus", ms*1e3); 79 if (ms < 1) return SkStringPrintf("%.3gus", ms*1e3);
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 } 561 }
559 CallEnd<MultiResultsWriter> ender(log); 562 CallEnd<MultiResultsWriter> ender(log);
560 563
561 if (1 == FLAGS_key.count() % 2) { 564 if (1 == FLAGS_key.count() % 2) {
562 SkDebugf("ERROR: --key must be passed with an even number of arguments.\ n"); 565 SkDebugf("ERROR: --key must be passed with an even number of arguments.\ n");
563 return 1; 566 return 1;
564 } 567 }
565 for (int i = 1; i < FLAGS_key.count(); i += 2) { 568 for (int i = 1; i < FLAGS_key.count(); i += 2) {
566 log.key(FLAGS_key[i-1], FLAGS_key[i]); 569 log.key(FLAGS_key[i-1], FLAGS_key[i]);
567 } 570 }
571
568 fill_static_options(&log); 572 fill_static_options(&log);
573 if (1 == FLAGS_options.count() % 2) {
574 SkDebugf("ERROR: --options must be passed with an even number of argumen ts.\n");
575 return 1;
576 }
577 for (int i = 1; i < FLAGS_options.count(); i += 2) {
578 log.option(FLAGS_options[i-1], FLAGS_options[i]);
579 }
569 580
570 const double overhead = estimate_timer_overhead(); 581 const double overhead = estimate_timer_overhead();
571 SkDebugf("Timer overhead: %s\n", HUMANIZE(overhead)); 582 SkDebugf("Timer overhead: %s\n", HUMANIZE(overhead));
572 583
573 SkAutoTMalloc<double> samples(FLAGS_samples); 584 SkAutoTMalloc<double> samples(FLAGS_samples);
574 585
575 if (kAutoTuneLoops != FLAGS_loops) { 586 if (kAutoTuneLoops != FLAGS_loops) {
576 SkDebugf("Fixed number of loops; times would only be misleading so we wo n't print them.\n"); 587 SkDebugf("Fixed number of loops; times would only be misleading so we wo n't print them.\n");
577 } else if (FLAGS_verbose) { 588 } else if (FLAGS_verbose) {
578 // No header. 589 // No header.
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 700
690 return 0; 701 return 0;
691 } 702 }
692 703
693 #if !defined SK_BUILD_FOR_IOS 704 #if !defined SK_BUILD_FOR_IOS
694 int main(int argc, char** argv) { 705 int main(int argc, char** argv) {
695 SkCommandLineFlags::Parse(argc, argv); 706 SkCommandLineFlags::Parse(argc, argv);
696 return nanobench_main(); 707 return nanobench_main();
697 } 708 }
698 #endif 709 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698