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

Side by Side Diff: bench/nanobench.cpp

Issue 853883004: Revert of Sketch DM refactor. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 return HumanizeMs(ms); 80 if (ms > 1e+3) return SkStringPrintf("%.3gs", ms/1e3);
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);
81 } 88 }
82 #define HUMANIZE(ms) humanize(ms).c_str() 89 #define HUMANIZE(ms) humanize(ms).c_str()
83 90
84 static double time(int loops, Benchmark* bench, SkCanvas* canvas, SkGLContext* g l) { 91 static double time(int loops, Benchmark* bench, SkCanvas* canvas, SkGLContext* g l) {
85 if (canvas) { 92 if (canvas) {
86 canvas->clear(SK_ColorWHITE); 93 canvas->clear(SK_ColorWHITE);
87 } 94 }
88 WallTimer timer; 95 WallTimer timer;
89 timer.start(); 96 timer.start();
90 if (bench) { 97 if (bench) {
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 } 541 }
535 542
536 while (fCurrentUseMPD < fUseMPDs.count()) { 543 while (fCurrentUseMPD < fUseMPDs.count()) {
537 if (FLAGS_bbh) { 544 if (FLAGS_bbh) {
538 // The SKP we read off disk doesn't have a BBH. Re-reco rd so it grows one. 545 // The SKP we read off disk doesn't have a BBH. Re-reco rd so it grows one.
539 SkRTreeFactory factory; 546 SkRTreeFactory factory;
540 SkPictureRecorder recorder; 547 SkPictureRecorder recorder;
541 static const int kFlags = SkPictureRecorder::kComputeSav eLayerInfo_RecordFlag; 548 static const int kFlags = SkPictureRecorder::kComputeSav eLayerInfo_RecordFlag;
542 pic->playback(recorder.beginRecording(pic->cullRect().wi dth(), 549 pic->playback(recorder.beginRecording(pic->cullRect().wi dth(),
543 pic->cullRect().he ight(), 550 pic->cullRect().he ight(),
544 &factory, 551 &factory,
545 fUseMPDs[fCurrentU seMPD] ? kFlags : 0)); 552 fUseMPDs[fCurrentU seMPD] ? kFlags : 0));
546 pic.reset(recorder.endRecording()); 553 pic.reset(recorder.endRecording());
547 } 554 }
548 SkString name = SkOSPath::Basename(path.c_str()); 555 SkString name = SkOSPath::Basename(path.c_str());
549 fSourceType = "skp"; 556 fSourceType = "skp";
550 fBenchType = "playback"; 557 fBenchType = "playback";
551 return SkNEW_ARGS(SKPBench, 558 return SkNEW_ARGS(SKPBench,
552 (name.c_str(), pic.get(), fClip, 559 (name.c_str(), pic.get(), fClip,
553 fScales[fCurrentScale], fUseMPDs[fCurrentUseMPD++]) ); 560 fScales[fCurrentScale], fUseMPDs[fCurrentUseMPD++]) );
554 } 561 }
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
789 796
790 return 0; 797 return 0;
791 } 798 }
792 799
793 #if !defined SK_BUILD_FOR_IOS 800 #if !defined SK_BUILD_FOR_IOS
794 int main(int argc, char** argv) { 801 int main(int argc, char** argv) {
795 SkCommandLineFlags::Parse(argc, argv); 802 SkCommandLineFlags::Parse(argc, argv);
796 return nanobench_main(); 803 return nanobench_main();
797 } 804 }
798 #endif 805 #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