Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3035)

Unified Diff: bench/nanobench.cpp

Issue 1671573002: Create a thermal manager class and wire it in to nanobench behind a flag (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tweaks Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | gyp/bench.gyp » ('j') | tools/ThermalManager.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bench/nanobench.cpp
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp
index 31efefa4f4fb0034a632143bed2107b18bbe221b..b4944975f177e5ef778b318f7705298eeda16e49 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,8 @@ 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_string(useThermalManager, "0,1,10,1000", "enabled,threshold,sleepTimeMs,TimeoutMs for "
+ "thermalManager\n");
DEFINE_string(sourceType, "",
"Apply usual --match rules to source type: bench, gm, skp, image, etc.");
@@ -1056,6 +1059,16 @@ int nanobench_main() {
SkTArray<Config> configs;
create_configs(&configs);
+#ifdef THERMAL_MANAGER_SUPPORTED
+ int tmEnabled, tmThreshold, tmSleepTimeMs, tmTimeoutMs;
+ if (4 != sscanf(FLAGS_useThermalManager[0], "%d,%d,%d,%d",
+ &tmEnabled, &tmThreshold, &tmSleepTimeMs, &tmTimeoutMs)) {
+ SkDebugf("Can't parse %s from --useThermalManager.\n", FLAGS_useThermalManager[0]);
+ exit(1);
+ }
+ ThermalManager tm(tmThreshold, tmSleepTimeMs, tmTimeoutMs);
+#endif
+
if (FLAGS_keepAlive) {
start_keepalive();
}
@@ -1073,6 +1086,11 @@ int nanobench_main() {
bench->delayedSetup();
}
for (int i = 0; i < configs.count(); ++i) {
+#ifdef THERMAL_MANAGER_SUPPORTED
+ if (tmEnabled && !tm.coolOffIfNecessary()) {
+ SkDebugf("Could not cool off, timings will be throttled\n");
+ }
+#endif
Target* target = is_enabled(b, configs[i]);
if (!target) {
continue;
« no previous file with comments | « no previous file | gyp/bench.gyp » ('j') | tools/ThermalManager.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698