| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "Timer.h" | 8 #include "Timer.h" |
| 9 #include "Benchmark.h" | 9 #include "Benchmark.h" |
| 10 #include "LazyDecodeBitmap.h" | 10 #include "LazyDecodeBitmap.h" |
| 11 #include "PictureBenchmark.h" | 11 #include "PictureBenchmark.h" |
| 12 #include "PictureRenderer.h" | 12 #include "PictureRenderer.h" |
| 13 #include "SkCommandLineFlags.h" | 13 #include "SkCommandLineFlags.h" |
| 14 #include "SkForceLinking.h" | 14 #include "SkForceLinking.h" |
| 15 #include "SkGraphics.h" | 15 #include "SkGraphics.h" |
| 16 #include "SkStream.h" | 16 #include "SkStream.h" |
| 17 #include "SkString.h" | 17 #include "SkString.h" |
| 18 #include "SkTArray.h" | 18 #include "SkTArray.h" |
| 19 | 19 |
| 20 typedef sk_tools::PictureRenderer::BBoxHierarchyType BBoxType; | 20 typedef sk_tools::PictureRenderer::BBoxHierarchyType BBoxType; |
| 21 static const int kBBoxTypeCount = sk_tools::PictureRenderer::kLast_BBoxHierarchy
Type + 1; | 21 static const int kBBoxTypeCount = sk_tools::PictureRenderer::kLast_BBoxHierarchy
Type + 1; |
| 22 | 22 |
| 23 | 23 |
| 24 DEFINE_string2(skps, r, "", "The list of SKPs to benchmark."); | 24 DEFINE_string2(skps, r, "", "The list of SKPs to benchmark."); |
| 25 DEFINE_string(bb_types, "", "The set of bbox types to test. If empty, all are te
sted. " | 25 DEFINE_string(bb_types, "", "The set of bbox types to test. If empty, all are te
sted. " |
| 26 "Should be one or more of none, quadtree, rtree, tilegrid
."); | 26 "Should be one or more of none, rtree, tilegrid."); |
| 27 DEFINE_int32(record, 100, "Number of times to record each SKP."); | 27 DEFINE_int32(record, 100, "Number of times to record each SKP."); |
| 28 DEFINE_int32(playback, 1, "Number of times to playback each SKP."); | 28 DEFINE_int32(playback, 1, "Number of times to playback each SKP."); |
| 29 DEFINE_int32(tilesize, 256, "The size of a tile."); | 29 DEFINE_int32(tilesize, 256, "The size of a tile."); |
| 30 | 30 |
| 31 struct Measurement { | 31 struct Measurement { |
| 32 SkString fName; | 32 SkString fName; |
| 33 double fRecordAverage[kBBoxTypeCount]; | 33 double fRecordAverage[kBBoxTypeCount]; |
| 34 double fPlaybackAverage[kBBoxTypeCount]; | 34 double fPlaybackAverage[kBBoxTypeCount]; |
| 35 }; | 35 }; |
| 36 | 36 |
| 37 const char* kBBoxHierarchyTypeNames[kBBoxTypeCount] = { | 37 const char* kBBoxHierarchyTypeNames[kBBoxTypeCount] = { |
| 38 "none", // kNone_BBoxHierarchyType | 38 "none", // kNone_BBoxHierarchyType |
| 39 "quadtree", // kQuadTree_BBoxHierarchyType | |
| 40 "rtree", // kRTree_BBoxHierarchyType | 39 "rtree", // kRTree_BBoxHierarchyType |
| 41 "tilegrid", // kTileGrid_BBoxHierarchyType | 40 "tilegrid", // kTileGrid_BBoxHierarchyType |
| 42 }; | 41 }; |
| 43 | 42 |
| 44 static SkPicture* pic_from_path(const char path[]) { | 43 static SkPicture* pic_from_path(const char path[]) { |
| 45 SkFILEStream stream(path); | 44 SkFILEStream stream(path); |
| 46 if (!stream.isValid()) { | 45 if (!stream.isValid()) { |
| 47 SkDebugf("-- Can't open '%s'\n", path); | 46 SkDebugf("-- Can't open '%s'\n", path); |
| 48 return NULL; | 47 return NULL; |
| 49 } | 48 } |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 } | 194 } |
| 196 SkDebugf("\nWrote data to gnuplot-readable files: %s %s\n", pbTitle, recTitl
e); | 195 SkDebugf("\nWrote data to gnuplot-readable files: %s %s\n", pbTitle, recTitl
e); |
| 197 return 0; | 196 return 0; |
| 198 } | 197 } |
| 199 | 198 |
| 200 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) | 199 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) |
| 201 int main(int argc, char** argv) { | 200 int main(int argc, char** argv) { |
| 202 return tool_main(argc, argv); | 201 return tool_main(argc, argv); |
| 203 } | 202 } |
| 204 #endif | 203 #endif |
| OLD | NEW |