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

Side by Side Diff: bench/nanobench.cpp

Issue 788243008: Sketch DM refactor. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: better failure messages, disable a few things temporarily to try to go green Created 5 years, 11 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 | 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 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 "Try up to this many times to guess loops for a bench, or skip the bench."); 70 "Try up to this many times to guess loops for a bench, or skip the bench.");
71 DEFINE_int32(maxLoops, 1000000, "Never run a bench more times than this."); 71 DEFINE_int32(maxLoops, 1000000, "Never run a bench more times than this.");
72 DEFINE_string(clip, "0,0,1000,1000", "Clip for SKPs."); 72 DEFINE_string(clip, "0,0,1000,1000", "Clip for SKPs.");
73 DEFINE_string(scales, "1.0", "Space-separated scales for SKPs."); 73 DEFINE_string(scales, "1.0", "Space-separated scales for SKPs.");
74 DEFINE_bool(bbh, true, "Build a BBH for SKPs?"); 74 DEFINE_bool(bbh, true, "Build a BBH for SKPs?");
75 DEFINE_bool(mpd, true, "Use MultiPictureDraw for the SKPs?"); 75 DEFINE_bool(mpd, true, "Use MultiPictureDraw for the SKPs?");
76 DEFINE_int32(flushEvery, 10, "Flush --outResultsFile every Nth run."); 76 DEFINE_int32(flushEvery, 10, "Flush --outResultsFile every Nth run.");
77 77
78 static SkString humanize(double ms) { 78 static SkString humanize(double ms) {
79 if (FLAGS_verbose) return SkStringPrintf("%llu", (uint64_t)(ms*1e6)); 79 if (FLAGS_verbose) return SkStringPrintf("%llu", (uint64_t)(ms*1e6));
80 if (ms > 1e+3) return SkStringPrintf("%.3gs", ms/1e3); 80 return HumanizeMs(ms);
81 if (ms < 1e-3) return SkStringPrintf("%.3gns", ms*1e6);
82 #ifdef SK_BUILD_FOR_WIN
83 if (ms < 1) return SkStringPrintf("%.3gus", ms*1e3);
84 #else
85 if (ms < 1) return SkStringPrintf("%.3gµs", ms*1e3);
86 #endif
87 return SkStringPrintf("%.3gms", ms);
88 } 81 }
89 #define HUMANIZE(ms) humanize(ms).c_str() 82 #define HUMANIZE(ms) humanize(ms).c_str()
90 83
91 static double time(int loops, Benchmark* bench, SkCanvas* canvas, SkGLContext* g l) { 84 static double time(int loops, Benchmark* bench, SkCanvas* canvas, SkGLContext* g l) {
92 if (canvas) { 85 if (canvas) {
93 canvas->clear(SK_ColorWHITE); 86 canvas->clear(SK_ColorWHITE);
94 } 87 }
95 WallTimer timer; 88 WallTimer timer;
96 timer.start(); 89 timer.start();
97 if (bench) { 90 if (bench) {
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 } 534 }
542 535
543 while (fCurrentUseMPD < fUseMPDs.count()) { 536 while (fCurrentUseMPD < fUseMPDs.count()) {
544 if (FLAGS_bbh) { 537 if (FLAGS_bbh) {
545 // The SKP we read off disk doesn't have a BBH. Re-reco rd so it grows one. 538 // The SKP we read off disk doesn't have a BBH. Re-reco rd so it grows one.
546 SkRTreeFactory factory; 539 SkRTreeFactory factory;
547 SkPictureRecorder recorder; 540 SkPictureRecorder recorder;
548 static const int kFlags = SkPictureRecorder::kComputeSav eLayerInfo_RecordFlag; 541 static const int kFlags = SkPictureRecorder::kComputeSav eLayerInfo_RecordFlag;
549 pic->playback(recorder.beginRecording(pic->cullRect().wi dth(), 542 pic->playback(recorder.beginRecording(pic->cullRect().wi dth(),
550 pic->cullRect().he ight(), 543 pic->cullRect().he ight(),
551 &factory, 544 &factory,
552 fUseMPDs[fCurrentU seMPD] ? kFlags : 0)); 545 fUseMPDs[fCurrentU seMPD] ? kFlags : 0));
553 pic.reset(recorder.endRecording()); 546 pic.reset(recorder.endRecording());
554 } 547 }
555 SkString name = SkOSPath::Basename(path.c_str()); 548 SkString name = SkOSPath::Basename(path.c_str());
556 fSourceType = "skp"; 549 fSourceType = "skp";
557 fBenchType = "playback"; 550 fBenchType = "playback";
558 return SkNEW_ARGS(SKPBench, 551 return SkNEW_ARGS(SKPBench,
559 (name.c_str(), pic.get(), fClip, 552 (name.c_str(), pic.get(), fClip,
560 fScales[fCurrentScale], fUseMPDs[fCurrentUseMPD++]) ); 553 fScales[fCurrentScale], fUseMPDs[fCurrentUseMPD++]) );
561 } 554 }
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
796 789
797 return 0; 790 return 0;
798 } 791 }
799 792
800 #if !defined SK_BUILD_FOR_IOS 793 #if !defined SK_BUILD_FOR_IOS
801 int main(int argc, char** argv) { 794 int main(int argc, char** argv) {
802 SkCommandLineFlags::Parse(argc, argv); 795 SkCommandLineFlags::Parse(argc, argv);
803 return nanobench_main(); 796 return nanobench_main();
804 } 797 }
805 #endif 798 #endif
OLDNEW
« no previous file with comments | « no previous file | dm/DM.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698