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

Side by Side Diff: tools/bench_playback.cpp

Issue 258703002: Revert of Add nanosecond timer. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 8 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 | « src/ports/SkTime_win.cpp ('k') | tools/bench_record.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 "SkCommandLineFlags.h" 8 #include "SkCommandLineFlags.h"
9 #include "SkForceLinking.h" 9 #include "SkForceLinking.h"
10 #include "SkGraphics.h" 10 #include "SkGraphics.h"
(...skipping 22 matching lines...) Expand all
33 src.draw(&recorder); 33 src.draw(&recorder);
34 34
35 SkRecordOptimize(&record); 35 SkRecordOptimize(&record);
36 36
37 SkAutoTDelete<SkCanvas> canvas(SkCanvas::NewRasterDirectN32(src.width(), 37 SkAutoTDelete<SkCanvas> canvas(SkCanvas::NewRasterDirectN32(src.width(),
38 src.height(), 38 src.height(),
39 scratch, 39 scratch,
40 src.width() * si zeof(SkPMColor))); 40 src.width() * si zeof(SkPMColor)));
41 canvas->clipRect(SkRect::MakeWH(SkIntToScalar(FLAGS_tile), SkIntToScalar(FLA GS_tile))); 41 canvas->clipRect(SkRect::MakeWH(SkIntToScalar(FLAGS_tile), SkIntToScalar(FLA GS_tile)));
42 42
43 const SkNSec start = SkTime::GetNSecs(); 43 const SkMSec start = SkTime::GetMSecs();
44 for (int i = 0; i < FLAGS_loops; i++) { 44 for (int i = 0; i < FLAGS_loops; i++) {
45 if (FLAGS_skr) { 45 if (FLAGS_skr) {
46 SkRecordDraw(record, canvas.get()); 46 SkRecordDraw(record, canvas.get());
47 } else { 47 } else {
48 src.draw(canvas.get()); 48 src.draw(canvas.get());
49 } 49 }
50 } 50 }
51 51
52 const SkNSec elapsed = SkTime::GetNSecs() - start; 52 const SkMSec elapsed = SkTime::GetMSecs() - start;
53 const double nsPerLoop = elapsed / (double)FLAGS_loops; 53 const double msPerLoop = elapsed / (double)FLAGS_loops;
54 printf("%u\t%s\n", SkToUInt(nsPerLoop), name); 54 printf("%6.2f\t%s\n", msPerLoop, name);
55 } 55 }
56 56
57 int tool_main(int argc, char** argv); 57 int tool_main(int argc, char** argv);
58 int tool_main(int argc, char** argv) { 58 int tool_main(int argc, char** argv) {
59 SkCommandLineFlags::Parse(argc, argv); 59 SkCommandLineFlags::Parse(argc, argv);
60 SkAutoGraphics autoGraphics; 60 SkAutoGraphics autoGraphics;
61 61
62 // We share a single scratch bitmap among benches to reduce the profile nois e from allocation. 62 // We share a single scratch bitmap among benches to reduce the profile nois e from allocation.
63 static const int kMaxArea = 209825221; // tabl_mozilla is this big. 63 static const int kMaxArea = 209825221; // tabl_mozilla is this big.
64 SkAutoTMalloc<SkPMColor> scratch(kMaxArea); 64 SkAutoTMalloc<SkPMColor> scratch(kMaxArea);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 bench(scratch.get(), *src, filename.c_str()); 96 bench(scratch.get(), *src, filename.c_str());
97 } 97 }
98 return failed ? 1 : 0; 98 return failed ? 1 : 0;
99 } 99 }
100 100
101 #if !defined SK_BUILD_FOR_IOS 101 #if !defined SK_BUILD_FOR_IOS
102 int main(int argc, char * const argv[]) { 102 int main(int argc, char * const argv[]) {
103 return tool_main(argc, (char**) argv); 103 return tool_main(argc, (char**) argv);
104 } 104 }
105 #endif 105 #endif
OLDNEW
« no previous file with comments | « src/ports/SkTime_win.cpp ('k') | tools/bench_record.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698