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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 DEFINE_bool(gpuStatsDump, false, "Dump GPU states after each benchmark to json")
; | 116 DEFINE_bool(gpuStatsDump, false, "Dump GPU states after each benchmark to json")
; |
117 DEFINE_bool(keepAlive, false, "Print a message every so often so that we don't t
ime out"); | 117 DEFINE_bool(keepAlive, false, "Print a message every so often so that we don't t
ime out"); |
118 DEFINE_string(useThermalManager, "0,1,10,1000", "enabled,threshold,sleepTimeMs,T
imeoutMs for " | 118 DEFINE_string(useThermalManager, "0,1,10,1000", "enabled,threshold,sleepTimeMs,T
imeoutMs for " |
119 "thermalManager\n"); | 119 "thermalManager\n"); |
120 | 120 |
121 DEFINE_string(sourceType, "", | 121 DEFINE_string(sourceType, "", |
122 "Apply usual --match rules to source type: bench, gm, skp, image, etc.")
; | 122 "Apply usual --match rules to source type: bench, gm, skp, image, etc.")
; |
123 DEFINE_string(benchType, "", | 123 DEFINE_string(benchType, "", |
124 "Apply usual --match rules to bench type: micro, recording, playback, sk
codec, etc."); | 124 "Apply usual --match rules to bench type: micro, recording, playback, sk
codec, etc."); |
125 | 125 |
| 126 DEFINE_bool(forceSRGB, false, "Force SRGB for imageinfos"); |
| 127 |
126 static double now_ms() { return SkTime::GetNSecs() * 1e-6; } | 128 static double now_ms() { return SkTime::GetNSecs() * 1e-6; } |
127 | 129 |
128 static SkString humanize(double ms) { | 130 static SkString humanize(double ms) { |
129 if (FLAGS_verbose) return SkStringPrintf("%llu", (uint64_t)(ms*1e6)); | 131 if (FLAGS_verbose) return SkStringPrintf("%llu", (uint64_t)(ms*1e6)); |
130 return HumanizeMs(ms); | 132 return HumanizeMs(ms); |
131 } | 133 } |
132 #define HUMANIZE(ms) humanize(ms).c_str() | 134 #define HUMANIZE(ms) humanize(ms).c_str() |
133 | 135 |
134 bool Target::init(SkImageInfo info, Benchmark* bench) { | 136 bool Target::init(SkImageInfo info, Benchmark* bench) { |
135 if (Benchmark::kRaster_Backend == config.backend) { | 137 if (Benchmark::kRaster_Backend == config.backend) { |
(...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
995 sleep(kSec); | 997 sleep(kSec); |
996 #endif | 998 #endif |
997 SkDebugf("\nBenchmarks still running...\n"); | 999 SkDebugf("\nBenchmarks still running...\n"); |
998 } | 1000 } |
999 } | 1001 } |
1000 }; | 1002 }; |
1001 static SkThread* intentionallyLeaked = new SkThread(Loop::forever); | 1003 static SkThread* intentionallyLeaked = new SkThread(Loop::forever); |
1002 intentionallyLeaked->start(); | 1004 intentionallyLeaked->start(); |
1003 } | 1005 } |
1004 | 1006 |
| 1007 extern bool gDefaultProfileIsSRGB; |
| 1008 |
1005 int nanobench_main(); | 1009 int nanobench_main(); |
1006 int nanobench_main() { | 1010 int nanobench_main() { |
1007 SetupCrashHandler(); | 1011 SetupCrashHandler(); |
1008 SkAutoGraphics ag; | 1012 SkAutoGraphics ag; |
1009 SkTaskGroup::Enabler enabled(FLAGS_threads); | 1013 SkTaskGroup::Enabler enabled(FLAGS_threads); |
1010 | 1014 |
1011 #if SK_SUPPORT_GPU | 1015 #if SK_SUPPORT_GPU |
1012 GrContextOptions grContextOpts; | 1016 GrContextOptions grContextOpts; |
1013 gGrFactory.reset(new GrContextFactory(grContextOpts)); | 1017 gGrFactory.reset(new GrContextFactory(grContextOpts)); |
1014 #endif | 1018 #endif |
1015 | 1019 |
| 1020 if (FLAGS_forceSRGB) { |
| 1021 gDefaultProfileIsSRGB = true; |
| 1022 } |
| 1023 |
1016 if (FLAGS_veryVerbose) { | 1024 if (FLAGS_veryVerbose) { |
1017 FLAGS_verbose = true; | 1025 FLAGS_verbose = true; |
1018 } | 1026 } |
1019 | 1027 |
1020 if (kAutoTuneLoops != FLAGS_loops) { | 1028 if (kAutoTuneLoops != FLAGS_loops) { |
1021 FLAGS_samples = 1; | 1029 FLAGS_samples = 1; |
1022 FLAGS_gpuFrameLag = 0; | 1030 FLAGS_gpuFrameLag = 0; |
1023 } | 1031 } |
1024 | 1032 |
1025 if (!FLAGS_writePath.isEmpty()) { | 1033 if (!FLAGS_writePath.isEmpty()) { |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1259 | 1267 |
1260 return 0; | 1268 return 0; |
1261 } | 1269 } |
1262 | 1270 |
1263 #if !defined SK_BUILD_FOR_IOS | 1271 #if !defined SK_BUILD_FOR_IOS |
1264 int main(int argc, char** argv) { | 1272 int main(int argc, char** argv) { |
1265 SkCommandLineFlags::Parse(argc, argv); | 1273 SkCommandLineFlags::Parse(argc, argv); |
1266 return nanobench_main(); | 1274 return nanobench_main(); |
1267 } | 1275 } |
1268 #endif | 1276 #endif |
OLD | NEW |