| OLD | NEW |
| 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 "nanobench.h" | 10 #include "nanobench.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 #include "SkGraphics.h" | 36 #include "SkGraphics.h" |
| 37 #include "SkLeanWindows.h" | 37 #include "SkLeanWindows.h" |
| 38 #include "SkOSFile.h" | 38 #include "SkOSFile.h" |
| 39 #include "SkPictureRecorder.h" | 39 #include "SkPictureRecorder.h" |
| 40 #include "SkPictureUtils.h" | 40 #include "SkPictureUtils.h" |
| 41 #include "SkString.h" | 41 #include "SkString.h" |
| 42 #include "SkSurface.h" | 42 #include "SkSurface.h" |
| 43 #include "SkTaskGroup.h" | 43 #include "SkTaskGroup.h" |
| 44 #include "SkThreadUtils.h" | 44 #include "SkThreadUtils.h" |
| 45 #include "ThermalManager.h" | 45 #include "ThermalManager.h" |
| 46 #include "SkScan.h" |
| 46 | 47 |
| 47 #include <stdlib.h> | 48 #include <stdlib.h> |
| 48 | 49 |
| 49 #ifndef SK_BUILD_FOR_WIN32 | 50 #ifndef SK_BUILD_FOR_WIN32 |
| 50 #include <unistd.h> | 51 #include <unistd.h> |
| 51 #endif | 52 #endif |
| 52 | 53 |
| 53 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK | 54 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK |
| 54 #include "nanobenchAndroid.h" | 55 #include "nanobenchAndroid.h" |
| 55 #endif | 56 #endif |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 DEFINE_bool(gpuStatsDump, false, "Dump GPU states after each benchmark to json")
; | 119 DEFINE_bool(gpuStatsDump, false, "Dump GPU states after each benchmark to json")
; |
| 119 DEFINE_bool(keepAlive, false, "Print a message every so often so that we don't t
ime out"); | 120 DEFINE_bool(keepAlive, false, "Print a message every so often so that we don't t
ime out"); |
| 120 DEFINE_string(useThermalManager, "0,1,10,1000", "enabled,threshold,sleepTimeMs,T
imeoutMs for " | 121 DEFINE_string(useThermalManager, "0,1,10,1000", "enabled,threshold,sleepTimeMs,T
imeoutMs for " |
| 121 "thermalManager\n"); | 122 "thermalManager\n"); |
| 122 | 123 |
| 123 DEFINE_string(sourceType, "", | 124 DEFINE_string(sourceType, "", |
| 124 "Apply usual --match rules to source type: bench, gm, skp, image, etc.")
; | 125 "Apply usual --match rules to source type: bench, gm, skp, image, etc.")
; |
| 125 DEFINE_string(benchType, "", | 126 DEFINE_string(benchType, "", |
| 126 "Apply usual --match rules to bench type: micro, recording, playback, sk
codec, etc."); | 127 "Apply usual --match rules to bench type: micro, recording, playback, sk
codec, etc."); |
| 127 | 128 |
| 129 DEFINE_bool(analyticAA, false, "Analytic Anati-Alias"); |
| 130 |
| 128 static double now_ms() { return SkTime::GetNSecs() * 1e-6; } | 131 static double now_ms() { return SkTime::GetNSecs() * 1e-6; } |
| 129 | 132 |
| 130 static SkString humanize(double ms) { | 133 static SkString humanize(double ms) { |
| 131 if (FLAGS_verbose) return SkStringPrintf("%llu", (uint64_t)(ms*1e6)); | 134 if (FLAGS_verbose) return SkStringPrintf("%llu", (uint64_t)(ms*1e6)); |
| 132 return HumanizeMs(ms); | 135 return HumanizeMs(ms); |
| 133 } | 136 } |
| 134 #define HUMANIZE(ms) humanize(ms).c_str() | 137 #define HUMANIZE(ms) humanize(ms).c_str() |
| 135 | 138 |
| 136 bool Target::init(SkImageInfo info, Benchmark* bench) { | 139 bool Target::init(SkImageInfo info, Benchmark* bench) { |
| 137 if (Benchmark::kRaster_Backend == config.backend) { | 140 if (Benchmark::kRaster_Backend == config.backend) { |
| (...skipping 988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1126 SkDebugf("Can't parse %s from --useThermalManager.\n", FLAGS_useThermalM
anager[0]); | 1129 SkDebugf("Can't parse %s from --useThermalManager.\n", FLAGS_useThermalM
anager[0]); |
| 1127 exit(1); | 1130 exit(1); |
| 1128 } | 1131 } |
| 1129 ThermalManager tm(tmThreshold, tmSleepTimeMs, tmTimeoutMs); | 1132 ThermalManager tm(tmThreshold, tmSleepTimeMs, tmTimeoutMs); |
| 1130 #endif | 1133 #endif |
| 1131 | 1134 |
| 1132 if (FLAGS_keepAlive) { | 1135 if (FLAGS_keepAlive) { |
| 1133 start_keepalive(); | 1136 start_keepalive(); |
| 1134 } | 1137 } |
| 1135 | 1138 |
| 1139 if (FLAGS_analyticAA) { |
| 1140 GlobalAAConfig::getInstance().fUseAnalyticAA = true; |
| 1141 } |
| 1142 |
| 1136 int runs = 0; | 1143 int runs = 0; |
| 1137 BenchmarkStream benchStream; | 1144 BenchmarkStream benchStream; |
| 1138 while (Benchmark* b = benchStream.next()) { | 1145 while (Benchmark* b = benchStream.next()) { |
| 1139 SkAutoTDelete<Benchmark> bench(b); | 1146 SkAutoTDelete<Benchmark> bench(b); |
| 1140 if (SkCommandLineFlags::ShouldSkip(FLAGS_match, bench->getUniqueName()))
{ | 1147 if (SkCommandLineFlags::ShouldSkip(FLAGS_match, bench->getUniqueName()))
{ |
| 1141 continue; | 1148 continue; |
| 1142 } | 1149 } |
| 1143 | 1150 |
| 1144 if (!configs.empty()) { | 1151 if (!configs.empty()) { |
| 1145 log->bench(bench->getUniqueName(), bench->getSize().fX, bench->getSi
ze().fY); | 1152 log->bench(bench->getUniqueName(), bench->getSize().fX, bench->getSi
ze().fY); |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1302 | 1309 |
| 1303 return 0; | 1310 return 0; |
| 1304 } | 1311 } |
| 1305 | 1312 |
| 1306 #if !defined SK_BUILD_FOR_IOS | 1313 #if !defined SK_BUILD_FOR_IOS |
| 1307 int main(int argc, char** argv) { | 1314 int main(int argc, char** argv) { |
| 1308 SkCommandLineFlags::Parse(argc, argv); | 1315 SkCommandLineFlags::Parse(argc, argv); |
| 1309 return nanobench_main(); | 1316 return nanobench_main(); |
| 1310 } | 1317 } |
| 1311 #endif | 1318 #endif |
| OLD | NEW |