| 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 26 matching lines...) Expand all Loading... |
| 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 "SkSVGDOM.h" | 43 #include "SkSVGDOM.h" |
| 44 #include "SkTaskGroup.h" | 44 #include "SkTaskGroup.h" |
| 45 #include "SkThreadUtils.h" | 45 #include "SkThreadUtils.h" |
| 46 #include "ThermalManager.h" | 46 #include "ThermalManager.h" |
| 47 #include "SkScan.h" | |
| 48 | 47 |
| 49 #include <stdlib.h> | 48 #include <stdlib.h> |
| 50 | 49 |
| 51 #ifndef SK_BUILD_FOR_WIN32 | 50 #ifndef SK_BUILD_FOR_WIN32 |
| 52 #include <unistd.h> | 51 #include <unistd.h> |
| 53 #endif | 52 #endif |
| 54 | 53 |
| 55 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK | 54 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK |
| 56 #include "nanobenchAndroid.h" | 55 #include "nanobenchAndroid.h" |
| 57 #endif | 56 #endif |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 DEFINE_bool(gpuStatsDump, false, "Dump GPU states after each benchmark to json")
; | 120 DEFINE_bool(gpuStatsDump, false, "Dump GPU states after each benchmark to json")
; |
| 122 DEFINE_bool(keepAlive, false, "Print a message every so often so that we don't t
ime out"); | 121 DEFINE_bool(keepAlive, false, "Print a message every so often so that we don't t
ime out"); |
| 123 DEFINE_string(useThermalManager, "0,1,10,1000", "enabled,threshold,sleepTimeMs,T
imeoutMs for " | 122 DEFINE_string(useThermalManager, "0,1,10,1000", "enabled,threshold,sleepTimeMs,T
imeoutMs for " |
| 124 "thermalManager\n"); | 123 "thermalManager\n"); |
| 125 | 124 |
| 126 DEFINE_string(sourceType, "", | 125 DEFINE_string(sourceType, "", |
| 127 "Apply usual --match rules to source type: bench, gm, skp, image, etc.")
; | 126 "Apply usual --match rules to source type: bench, gm, skp, image, etc.")
; |
| 128 DEFINE_string(benchType, "", | 127 DEFINE_string(benchType, "", |
| 129 "Apply usual --match rules to bench type: micro, recording, playback, sk
codec, etc."); | 128 "Apply usual --match rules to bench type: micro, recording, playback, sk
codec, etc."); |
| 130 | 129 |
| 131 DEFINE_bool(analyticAA, false, "Analytic Anati-Alias"); | |
| 132 | |
| 133 static double now_ms() { return SkTime::GetNSecs() * 1e-6; } | 130 static double now_ms() { return SkTime::GetNSecs() * 1e-6; } |
| 134 | 131 |
| 135 static SkString humanize(double ms) { | 132 static SkString humanize(double ms) { |
| 136 if (FLAGS_verbose) return SkStringPrintf("%llu", (uint64_t)(ms*1e6)); | 133 if (FLAGS_verbose) return SkStringPrintf("%llu", (uint64_t)(ms*1e6)); |
| 137 return HumanizeMs(ms); | 134 return HumanizeMs(ms); |
| 138 } | 135 } |
| 139 #define HUMANIZE(ms) humanize(ms).c_str() | 136 #define HUMANIZE(ms) humanize(ms).c_str() |
| 140 | 137 |
| 141 bool Target::init(SkImageInfo info, Benchmark* bench) { | 138 bool Target::init(SkImageInfo info, Benchmark* bench) { |
| 142 if (Benchmark::kRaster_Backend == config.backend) { | 139 if (Benchmark::kRaster_Backend == config.backend) { |
| (...skipping 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1174 SkDebugf("Can't parse %s from --useThermalManager.\n", FLAGS_useThermalM
anager[0]); | 1171 SkDebugf("Can't parse %s from --useThermalManager.\n", FLAGS_useThermalM
anager[0]); |
| 1175 exit(1); | 1172 exit(1); |
| 1176 } | 1173 } |
| 1177 ThermalManager tm(tmThreshold, tmSleepTimeMs, tmTimeoutMs); | 1174 ThermalManager tm(tmThreshold, tmSleepTimeMs, tmTimeoutMs); |
| 1178 #endif | 1175 #endif |
| 1179 | 1176 |
| 1180 if (FLAGS_keepAlive) { | 1177 if (FLAGS_keepAlive) { |
| 1181 start_keepalive(); | 1178 start_keepalive(); |
| 1182 } | 1179 } |
| 1183 | 1180 |
| 1184 if (FLAGS_analyticAA) { | |
| 1185 GlobalAAConfig::getInstance().fUseAnalyticAA = true; | |
| 1186 } | |
| 1187 | |
| 1188 int runs = 0; | 1181 int runs = 0; |
| 1189 BenchmarkStream benchStream; | 1182 BenchmarkStream benchStream; |
| 1190 while (Benchmark* b = benchStream.next()) { | 1183 while (Benchmark* b = benchStream.next()) { |
| 1191 SkAutoTDelete<Benchmark> bench(b); | 1184 SkAutoTDelete<Benchmark> bench(b); |
| 1192 if (SkCommandLineFlags::ShouldSkip(FLAGS_match, bench->getUniqueName()))
{ | 1185 if (SkCommandLineFlags::ShouldSkip(FLAGS_match, bench->getUniqueName()))
{ |
| 1193 continue; | 1186 continue; |
| 1194 } | 1187 } |
| 1195 | 1188 |
| 1196 if (!configs.empty()) { | 1189 if (!configs.empty()) { |
| 1197 log->bench(bench->getUniqueName(), bench->getSize().fX, bench->getSi
ze().fY); | 1190 log->bench(bench->getUniqueName(), bench->getSize().fX, bench->getSi
ze().fY); |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1354 | 1347 |
| 1355 return 0; | 1348 return 0; |
| 1356 } | 1349 } |
| 1357 | 1350 |
| 1358 #if !defined SK_BUILD_FOR_IOS | 1351 #if !defined SK_BUILD_FOR_IOS |
| 1359 int main(int argc, char** argv) { | 1352 int main(int argc, char** argv) { |
| 1360 SkCommandLineFlags::Parse(argc, argv); | 1353 SkCommandLineFlags::Parse(argc, argv); |
| 1361 return nanobench_main(); | 1354 return nanobench_main(); |
| 1362 } | 1355 } |
| 1363 #endif | 1356 #endif |
| OLD | NEW |