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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 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")
; |
120 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"); |
121 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 " |
122 "thermalManager\n"); | 123 "thermalManager\n"); |
123 | 124 |
124 DEFINE_string(sourceType, "", | 125 DEFINE_string(sourceType, "", |
125 "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.")
; |
126 DEFINE_string(benchType, "", | 127 DEFINE_string(benchType, "", |
127 "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."); |
128 | 129 |
| 130 DEFINE_bool(analyticAA, false, "Analytic Anati-Alias"); |
| 131 |
129 static double now_ms() { return SkTime::GetNSecs() * 1e-6; } | 132 static double now_ms() { return SkTime::GetNSecs() * 1e-6; } |
130 | 133 |
131 static SkString humanize(double ms) { | 134 static SkString humanize(double ms) { |
132 if (FLAGS_verbose) return SkStringPrintf("%llu", (uint64_t)(ms*1e6)); | 135 if (FLAGS_verbose) return SkStringPrintf("%llu", (uint64_t)(ms*1e6)); |
133 return HumanizeMs(ms); | 136 return HumanizeMs(ms); |
134 } | 137 } |
135 #define HUMANIZE(ms) humanize(ms).c_str() | 138 #define HUMANIZE(ms) humanize(ms).c_str() |
136 | 139 |
137 bool Target::init(SkImageInfo info, Benchmark* bench) { | 140 bool Target::init(SkImageInfo info, Benchmark* bench) { |
138 if (Benchmark::kRaster_Backend == config.backend) { | 141 if (Benchmark::kRaster_Backend == config.backend) { |
(...skipping 988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1127 SkDebugf("Can't parse %s from --useThermalManager.\n", FLAGS_useThermalM
anager[0]); | 1130 SkDebugf("Can't parse %s from --useThermalManager.\n", FLAGS_useThermalM
anager[0]); |
1128 exit(1); | 1131 exit(1); |
1129 } | 1132 } |
1130 ThermalManager tm(tmThreshold, tmSleepTimeMs, tmTimeoutMs); | 1133 ThermalManager tm(tmThreshold, tmSleepTimeMs, tmTimeoutMs); |
1131 #endif | 1134 #endif |
1132 | 1135 |
1133 if (FLAGS_keepAlive) { | 1136 if (FLAGS_keepAlive) { |
1134 start_keepalive(); | 1137 start_keepalive(); |
1135 } | 1138 } |
1136 | 1139 |
| 1140 if (FLAGS_analyticAA) { |
| 1141 GlobalAAConfig::getInstance().fUseAnalyticAA = true; |
| 1142 } |
| 1143 |
1137 int runs = 0; | 1144 int runs = 0; |
1138 BenchmarkStream benchStream; | 1145 BenchmarkStream benchStream; |
1139 while (Benchmark* b = benchStream.next()) { | 1146 while (Benchmark* b = benchStream.next()) { |
1140 SkAutoTDelete<Benchmark> bench(b); | 1147 SkAutoTDelete<Benchmark> bench(b); |
1141 if (SkCommandLineFlags::ShouldSkip(FLAGS_match, bench->getUniqueName()))
{ | 1148 if (SkCommandLineFlags::ShouldSkip(FLAGS_match, bench->getUniqueName()))
{ |
1142 continue; | 1149 continue; |
1143 } | 1150 } |
1144 | 1151 |
1145 if (!configs.empty()) { | 1152 if (!configs.empty()) { |
1146 log->bench(bench->getUniqueName(), bench->getSize().fX, bench->getSi
ze().fY); | 1153 log->bench(bench->getUniqueName(), bench->getSize().fX, bench->getSi
ze().fY); |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1303 | 1310 |
1304 return 0; | 1311 return 0; |
1305 } | 1312 } |
1306 | 1313 |
1307 #if !defined SK_BUILD_FOR_IOS | 1314 #if !defined SK_BUILD_FOR_IOS |
1308 int main(int argc, char** argv) { | 1315 int main(int argc, char** argv) { |
1309 SkCommandLineFlags::Parse(argc, argv); | 1316 SkCommandLineFlags::Parse(argc, argv); |
1310 return nanobench_main(); | 1317 return nanobench_main(); |
1311 } | 1318 } |
1312 #endif | 1319 #endif |
OLD | NEW |