Index: bench/nanobench.cpp |
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp |
index c2bcb4950ac6b6ac6f5896412deb3cb8ccf44fee..2fafb27d2c7c143f0dc31b9b364a9ac1b0db00a4 100644 |
--- a/bench/nanobench.cpp |
+++ b/bench/nanobench.cpp |
@@ -38,6 +38,7 @@ |
#include "SkSurface.h" |
#include "SkTaskGroup.h" |
#include "SkThreadUtils.h" |
+#include "ThermalManager.h" |
#include <stdlib.h> |
@@ -111,6 +112,7 @@ DEFINE_bool(resetGpuContext, true, "Reset the GrContext before running each test |
DEFINE_bool(gpuStats, false, "Print GPU stats after each gpu benchmark?"); |
DEFINE_bool(gpuStatsDump, false, "Dump GPU states after each benchmark to json"); |
DEFINE_bool(keepAlive, false, "Print a message every so often so that we don't time out"); |
+DEFINE_bool(useThermalManager, false, "Uses a thermal manager to prevent overheating\n"); |
static double now_ms() { return SkTime::GetNSecs() * 1e-6; } |
@@ -1050,6 +1052,10 @@ int nanobench_main() { |
SkTArray<Config> configs; |
create_configs(&configs); |
+#if USE_THERMAL_MANAGER |
+ ThermalManager tm; |
+#endif |
+ |
if (FLAGS_keepAlive) { |
start_keepalive(); |
} |
@@ -1067,6 +1073,11 @@ int nanobench_main() { |
bench->delayedSetup(); |
} |
for (int i = 0; i < configs.count(); ++i) { |
+#if USE_THERMAL_MANAGER |
+ if (FLAGS_useThermalManager && !tm.coolOffIfNecessary()) { |
+ SkDebugf("Could not cool off, timings will be throttled\n"); |
+ } |
+#endif |
Target* target = is_enabled(b, configs[i]); |
if (!target) { |
continue; |