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

Side by Side Diff: bench/benchmain.cpp

Issue 303913002: In Android framework, make tools depend on jsoncpp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Do as Thoreau would do. Created 6 years, 6 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 | « bench/TimerData.cpp ('k') | dm/DM.cpp » ('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 2011 Google Inc. 2 * Copyright 2011 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 "BenchTimer.h" 8 #include "BenchTimer.h"
9 #include "ResultsWriter.h" 9 #include "ResultsWriter.h"
10 #include "SkBenchLogger.h" 10 #include "SkBenchLogger.h"
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 "Run configs given. By default, runs the configs marked \"runByDe fault\" in gConfigs."); 260 "Run configs given. By default, runs the configs marked \"runByDe fault\" in gConfigs.");
261 DEFINE_string(logFile, "", "Also write stdout here."); 261 DEFINE_string(logFile, "", "Also write stdout here.");
262 DEFINE_int32(minMs, 20, "Shortest time we'll allow a benchmark to run."); 262 DEFINE_int32(minMs, 20, "Shortest time we'll allow a benchmark to run.");
263 DEFINE_int32(maxMs, 4000, "Longest time we'll allow a benchmark to run."); 263 DEFINE_int32(maxMs, 4000, "Longest time we'll allow a benchmark to run.");
264 DEFINE_bool(runOnce, kIsDebug, "Run each bench exactly once and don't report tim ings."); 264 DEFINE_bool(runOnce, kIsDebug, "Run each bench exactly once and don't report tim ings.");
265 DEFINE_double(error, 0.01, 265 DEFINE_double(error, 0.01,
266 "Ratio of subsequent bench measurements must drop within 1±error t o converge."); 266 "Ratio of subsequent bench measurements must drop within 1±error t o converge.");
267 DEFINE_string(timeFormat, "%9.2f", "Format to print results, in milliseconds per 1000 loops."); 267 DEFINE_string(timeFormat, "%9.2f", "Format to print results, in milliseconds per 1000 loops.");
268 DEFINE_bool2(verbose, v, false, "Print more."); 268 DEFINE_bool2(verbose, v, false, "Print more.");
269 DEFINE_string2(resourcePath, i, "resources", "directory for test resources."); 269 DEFINE_string2(resourcePath, i, "resources", "directory for test resources.");
270 #ifdef SK_BUILD_JSON_WRITER
271 DEFINE_string(outResultsFile, "", "If given, the results will be written to the file in JSON format."); 270 DEFINE_string(outResultsFile, "", "If given, the results will be written to the file in JSON format.");
272 #endif
273 DEFINE_bool(dryRun, false, "Don't actually run the tests, just print what would have been done."); 271 DEFINE_bool(dryRun, false, "Don't actually run the tests, just print what would have been done.");
274 272
275 // Has this bench converged? First arguments are milliseconds / loop iteration, 273 // Has this bench converged? First arguments are milliseconds / loop iteration,
276 // last is overall runtime in milliseconds. 274 // last is overall runtime in milliseconds.
277 static bool HasConverged(double prevPerLoop, double currPerLoop, double currRaw) { 275 static bool HasConverged(double prevPerLoop, double currPerLoop, double currRaw) {
278 if (currRaw < FLAGS_minMs) { 276 if (currRaw < FLAGS_minMs) {
279 return false; 277 return false;
280 } 278 }
281 const double low = 1 - FLAGS_error, high = 1 + FLAGS_error; 279 const double low = 1 - FLAGS_error, high = 1 + FLAGS_error;
282 const double ratio = currPerLoop / prevPerLoop; 280 const double ratio = currPerLoop / prevPerLoop;
(...skipping 13 matching lines...) Expand all
296 // First, parse some flags. 294 // First, parse some flags.
297 SkBenchLogger logger; 295 SkBenchLogger logger;
298 if (FLAGS_logFile.count()) { 296 if (FLAGS_logFile.count()) {
299 logger.SetLogFile(FLAGS_logFile[0]); 297 logger.SetLogFile(FLAGS_logFile[0]);
300 } 298 }
301 299
302 LoggerResultsWriter logWriter(logger, FLAGS_timeFormat[0]); 300 LoggerResultsWriter logWriter(logger, FLAGS_timeFormat[0]);
303 MultiResultsWriter writer; 301 MultiResultsWriter writer;
304 writer.add(&logWriter); 302 writer.add(&logWriter);
305 303
306 #ifdef SK_BUILD_JSON_WRITER
307 SkAutoTDelete<JSONResultsWriter> jsonWriter; 304 SkAutoTDelete<JSONResultsWriter> jsonWriter;
308 if (FLAGS_outResultsFile.count()) { 305 if (FLAGS_outResultsFile.count()) {
309 jsonWriter.reset(SkNEW(JSONResultsWriter(FLAGS_outResultsFile[0]))); 306 jsonWriter.reset(SkNEW(JSONResultsWriter(FLAGS_outResultsFile[0])));
310 writer.add(jsonWriter.get()); 307 writer.add(jsonWriter.get());
311 } 308 }
312 #endif
313 309
314 // Instantiate after all the writers have been added to writer so that we 310 // Instantiate after all the writers have been added to writer so that we
315 // call close() before their destructors are called on the way out. 311 // call close() before their destructors are called on the way out.
316 CallEnd<MultiResultsWriter> ender(writer); 312 CallEnd<MultiResultsWriter> ender(writer);
317 313
318 const uint8_t alpha = FLAGS_forceBlend ? 0x80 : 0xFF; 314 const uint8_t alpha = FLAGS_forceBlend ? 0x80 : 0xFF;
319 SkTriState::State dither = SkTriState::kDefault; 315 SkTriState::State dither = SkTriState::kDefault;
320 for (size_t i = 0; i < 3; i++) { 316 for (size_t i = 0; i < 3; i++) {
321 if (strcmp(SkTriState::Name[i], FLAGS_forceDither[0]) == 0) { 317 if (strcmp(SkTriState::Name[i], FLAGS_forceDither[0]) == 0) {
322 dither = static_cast<SkTriState::State>(i); 318 dither = static_cast<SkTriState::State>(i);
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 gContextFactory.destroyContexts(); 692 gContextFactory.destroyContexts();
697 #endif 693 #endif
698 return 0; 694 return 0;
699 } 695 }
700 696
701 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) 697 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL)
702 int main(int argc, char * const argv[]) { 698 int main(int argc, char * const argv[]) {
703 return tool_main(argc, (char**) argv); 699 return tool_main(argc, (char**) argv);
704 } 700 }
705 #endif 701 #endif
OLDNEW
« no previous file with comments | « bench/TimerData.cpp ('k') | dm/DM.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698