aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--BUILD.gn1
-rw-r--r--bench/nanobench.cpp18
-rw-r--r--infra/bots/recipes/perf.expected/Perf-Android-Clang-NVIDIA_Shield-GPU-TegraX1-arm64-Debug-All-Android_Vulkan.json2
-rw-r--r--infra/bots/recipes/perf.expected/Perf-Android-Clang-Nexus5-GPU-Adreno330-arm-Debug-All-Android.json2
-rw-r--r--infra/bots/recipes/perf.expected/Perf-Android-Clang-Nexus7-GPU-Tegra3-arm-Release-All-Android.json2
-rw-r--r--infra/bots/recipes/perf.expected/Perf-Android-Clang-NexusPlayer-GPU-PowerVR-x86-Release-All-Android.json2
-rw-r--r--infra/bots/recipes/perf.expected/Perf-Android-Clang-NexusPlayer-GPU-PowerVR-x86-Release-All-Android_Vulkan.json2
-rw-r--r--infra/bots/recipes/perf.expected/Perf-Android-Clang-PixelC-GPU-TegraX1-arm64-Release-All-Android_Skpbench.json2
-rw-r--r--infra/bots/recipes/perf.py3
-rw-r--r--tools/ThermalManager.cpp113
-rw-r--r--tools/ThermalManager.h61
11 files changed, 6 insertions, 202 deletions
diff --git a/BUILD.gn b/BUILD.gn
index a194ac8c53..cffa2c2716 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -1203,7 +1203,6 @@ if (skia_enable_tools) {
"tools/Resources.cpp",
"tools/SkRandomScalerContext.cpp",
"tools/SkTestScalerContext.cpp",
- "tools/ThermalManager.cpp",
"tools/UrlDataManager.cpp",
"tools/debugger/SkDebugCanvas.cpp",
"tools/debugger/SkDrawCommand.cpp",
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp
index d475e164e5..76d5371869 100644
--- a/bench/nanobench.cpp
+++ b/bench/nanobench.cpp
@@ -47,7 +47,6 @@
#include "SkTaskGroup.h"
#include "SkTraceEvent.h"
#include "Stats.h"
-#include "ThermalManager.h"
#include "ios_utils.h"
#include <stdlib.h>
@@ -128,8 +127,6 @@ DEFINE_int32(flushEvery, 10, "Flush --outResultsFile every Nth run.");
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_bool(csv, false, "Print status in CSV format");
DEFINE_string(sourceType, "",
"Apply usual --match rules to source type: bench, gm, skp, image, etc.");
@@ -1221,16 +1218,6 @@ int main(int argc, char** argv) {
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();
}
@@ -1261,11 +1248,6 @@ int main(int argc, char** argv) {
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;
diff --git a/infra/bots/recipes/perf.expected/Perf-Android-Clang-NVIDIA_Shield-GPU-TegraX1-arm64-Debug-All-Android_Vulkan.json b/infra/bots/recipes/perf.expected/Perf-Android-Clang-NVIDIA_Shield-GPU-TegraX1-arm64-Debug-All-Android_Vulkan.json
index 4bbe4bdd32..14cbde30ce 100644
--- a/infra/bots/recipes/perf.expected/Perf-Android-Clang-NVIDIA_Shield-GPU-TegraX1-arm64-Debug-All-Android_Vulkan.json
+++ b/infra/bots/recipes/perf.expected/Perf-Android-Clang-NVIDIA_Shield-GPU-TegraX1-arm64-Debug-All-Android_Vulkan.json
@@ -561,7 +561,7 @@
"--json-output",
"/path/to/tmp/json",
"copy",
- "set -x; /data/local/tmp/nanobench -i /sdcard/revenge_of_the_skiabot/resources --skps /sdcard/revenge_of_the_skiabot/skps --images /sdcard/revenge_of_the_skiabot/images/nanobench --svgs /sdcard/revenge_of_the_skiabot/svgs --pre_log --images --gpuStatsDump true --useThermalManager 1,1,10,1000 --scales 1.0 1.1 --nocpu --config vk --match ~blurroundrect ~patch_grid ~desk_carsvg ~inc0.gif ~inc1.gif ~incInterlaced.gif ~inc0.jpg ~incGray.jpg ~inc0.wbmp ~inc1.wbmp ~inc0.webp ~inc1.webp ~inc0.ico ~inc1.ico ~inc0.png ~inc1.png ~inc2.png ~inc12.png ~inc13.png ~inc14.png ~inc0.webp ~inc1.webp; echo $? >/data/local/tmp/rc",
+ "set -x; /data/local/tmp/nanobench -i /sdcard/revenge_of_the_skiabot/resources --skps /sdcard/revenge_of_the_skiabot/skps --images /sdcard/revenge_of_the_skiabot/images/nanobench --svgs /sdcard/revenge_of_the_skiabot/svgs --pre_log --images --gpuStatsDump true --scales 1.0 1.1 --nocpu --config vk --match ~blurroundrect ~patch_grid ~desk_carsvg ~inc0.gif ~inc1.gif ~incInterlaced.gif ~inc0.jpg ~incGray.jpg ~inc0.wbmp ~inc1.wbmp ~inc0.webp ~inc1.webp ~inc0.ico ~inc1.ico ~inc0.png ~inc1.png ~inc2.png ~inc12.png ~inc13.png ~inc14.png ~inc0.webp ~inc1.webp; echo $? >/data/local/tmp/rc",
"[START_DIR]/tmp/nanobench.sh"
],
"env": {
diff --git a/infra/bots/recipes/perf.expected/Perf-Android-Clang-Nexus5-GPU-Adreno330-arm-Debug-All-Android.json b/infra/bots/recipes/perf.expected/Perf-Android-Clang-Nexus5-GPU-Adreno330-arm-Debug-All-Android.json
index 95d87c45c3..5edf7e5af9 100644
--- a/infra/bots/recipes/perf.expected/Perf-Android-Clang-Nexus5-GPU-Adreno330-arm-Debug-All-Android.json
+++ b/infra/bots/recipes/perf.expected/Perf-Android-Clang-Nexus5-GPU-Adreno330-arm-Debug-All-Android.json
@@ -644,7 +644,7 @@
"--json-output",
"/path/to/tmp/json",
"copy",
- "set -x; /data/local/tmp/nanobench -i /sdcard/revenge_of_the_skiabot/resources --skps /sdcard/revenge_of_the_skiabot/skps --images /sdcard/revenge_of_the_skiabot/images/nanobench --svgs /sdcard/revenge_of_the_skiabot/svgs --pre_log --images --gpuStatsDump true --useThermalManager 1,1,10,1000 --scales 1.0 1.1 --nocpu --config gles glessrgb glesmsaa4 --match ~blurroundrect ~patch_grid ~desk_carsvg ~keymobi_shop_mobileweb_ebay_com.skp ~inc0.gif ~inc1.gif ~incInterlaced.gif ~inc0.jpg ~incGray.jpg ~inc0.wbmp ~inc1.wbmp ~inc0.webp ~inc1.webp ~inc0.ico ~inc1.ico ~inc0.png ~inc1.png ~inc2.png ~inc12.png ~inc13.png ~inc14.png ~inc0.webp ~inc1.webp; echo $? >/data/local/tmp/rc",
+ "set -x; /data/local/tmp/nanobench -i /sdcard/revenge_of_the_skiabot/resources --skps /sdcard/revenge_of_the_skiabot/skps --images /sdcard/revenge_of_the_skiabot/images/nanobench --svgs /sdcard/revenge_of_the_skiabot/svgs --pre_log --images --gpuStatsDump true --scales 1.0 1.1 --nocpu --config gles glessrgb glesmsaa4 --match ~blurroundrect ~patch_grid ~desk_carsvg ~keymobi_shop_mobileweb_ebay_com.skp ~inc0.gif ~inc1.gif ~incInterlaced.gif ~inc0.jpg ~incGray.jpg ~inc0.wbmp ~inc1.wbmp ~inc0.webp ~inc1.webp ~inc0.ico ~inc1.ico ~inc0.png ~inc1.png ~inc2.png ~inc12.png ~inc13.png ~inc14.png ~inc0.webp ~inc1.webp; echo $? >/data/local/tmp/rc",
"[START_DIR]/tmp/nanobench.sh"
],
"env": {
diff --git a/infra/bots/recipes/perf.expected/Perf-Android-Clang-Nexus7-GPU-Tegra3-arm-Release-All-Android.json b/infra/bots/recipes/perf.expected/Perf-Android-Clang-Nexus7-GPU-Tegra3-arm-Release-All-Android.json
index a4497e098c..459150467a 100644
--- a/infra/bots/recipes/perf.expected/Perf-Android-Clang-Nexus7-GPU-Tegra3-arm-Release-All-Android.json
+++ b/infra/bots/recipes/perf.expected/Perf-Android-Clang-Nexus7-GPU-Tegra3-arm-Release-All-Android.json
@@ -680,7 +680,7 @@
"--json-output",
"/path/to/tmp/json",
"copy",
- "set -x; /data/local/tmp/nanobench -i /sdcard/revenge_of_the_skiabot/resources --skps /sdcard/revenge_of_the_skiabot/skps --images /sdcard/revenge_of_the_skiabot/images/nanobench --svgs /sdcard/revenge_of_the_skiabot/svgs --pre_log --images --gpuStatsDump true --useThermalManager 1,1,10,1000 --scales 1.0 1.1 --nocpu --config gles --match ~blurroundrect ~patch_grid ~desk_carsvg ~inc0.gif ~inc1.gif ~incInterlaced.gif ~inc0.jpg ~incGray.jpg ~inc0.wbmp ~inc1.wbmp ~inc0.webp ~inc1.webp ~inc0.ico ~inc1.ico ~inc0.png ~inc1.png ~inc2.png ~inc12.png ~inc13.png ~inc14.png ~inc0.webp ~inc1.webp --outResultsFile /sdcard/revenge_of_the_skiabot/perf/nanobench_abc123_1337000001.json --properties gitHash abc123 swarming_bot_id skia-bot-123 swarming_task_id 123456 --key arch arm compiler Clang cpu_or_gpu GPU cpu_or_gpu_value Tegra3 extra_config Android model Nexus7 os Android; echo $? >/data/local/tmp/rc",
+ "set -x; /data/local/tmp/nanobench -i /sdcard/revenge_of_the_skiabot/resources --skps /sdcard/revenge_of_the_skiabot/skps --images /sdcard/revenge_of_the_skiabot/images/nanobench --svgs /sdcard/revenge_of_the_skiabot/svgs --pre_log --images --gpuStatsDump true --scales 1.0 1.1 --nocpu --config gles --match ~blurroundrect ~patch_grid ~desk_carsvg ~inc0.gif ~inc1.gif ~incInterlaced.gif ~inc0.jpg ~incGray.jpg ~inc0.wbmp ~inc1.wbmp ~inc0.webp ~inc1.webp ~inc0.ico ~inc1.ico ~inc0.png ~inc1.png ~inc2.png ~inc12.png ~inc13.png ~inc14.png ~inc0.webp ~inc1.webp --outResultsFile /sdcard/revenge_of_the_skiabot/perf/nanobench_abc123_1337000001.json --properties gitHash abc123 swarming_bot_id skia-bot-123 swarming_task_id 123456 --key arch arm compiler Clang cpu_or_gpu GPU cpu_or_gpu_value Tegra3 extra_config Android model Nexus7 os Android; echo $? >/data/local/tmp/rc",
"[START_DIR]/tmp/nanobench.sh"
],
"env": {
diff --git a/infra/bots/recipes/perf.expected/Perf-Android-Clang-NexusPlayer-GPU-PowerVR-x86-Release-All-Android.json b/infra/bots/recipes/perf.expected/Perf-Android-Clang-NexusPlayer-GPU-PowerVR-x86-Release-All-Android.json
index 56dc7cfa39..3327afe002 100644
--- a/infra/bots/recipes/perf.expected/Perf-Android-Clang-NexusPlayer-GPU-PowerVR-x86-Release-All-Android.json
+++ b/infra/bots/recipes/perf.expected/Perf-Android-Clang-NexusPlayer-GPU-PowerVR-x86-Release-All-Android.json
@@ -680,7 +680,7 @@
"--json-output",
"/path/to/tmp/json",
"copy",
- "set -x; /data/local/tmp/nanobench -i /sdcard/revenge_of_the_skiabot/resources --skps /sdcard/revenge_of_the_skiabot/skps --images /sdcard/revenge_of_the_skiabot/images/nanobench --svgs /sdcard/revenge_of_the_skiabot/svgs --pre_log --images --gpuStatsDump true --useThermalManager 1,1,10,1000 --scales 1.0 1.1 --nocpu --config gles --match ~blurroundrect ~patch_grid ~desk_carsvg ~inc0.gif ~inc1.gif ~incInterlaced.gif ~inc0.jpg ~incGray.jpg ~inc0.wbmp ~inc1.wbmp ~inc0.webp ~inc1.webp ~inc0.ico ~inc1.ico ~inc0.png ~inc1.png ~inc2.png ~inc12.png ~inc13.png ~inc14.png ~inc0.webp ~inc1.webp --outResultsFile /sdcard/revenge_of_the_skiabot/perf/nanobench_abc123_1337000001.json --properties gitHash abc123 swarming_bot_id skia-bot-123 swarming_task_id 123456 --key arch x86 compiler Clang cpu_or_gpu GPU cpu_or_gpu_value PowerVR extra_config Android model NexusPlayer os Android; echo $? >/data/local/tmp/rc",
+ "set -x; /data/local/tmp/nanobench -i /sdcard/revenge_of_the_skiabot/resources --skps /sdcard/revenge_of_the_skiabot/skps --images /sdcard/revenge_of_the_skiabot/images/nanobench --svgs /sdcard/revenge_of_the_skiabot/svgs --pre_log --images --gpuStatsDump true --scales 1.0 1.1 --nocpu --config gles --match ~blurroundrect ~patch_grid ~desk_carsvg ~inc0.gif ~inc1.gif ~incInterlaced.gif ~inc0.jpg ~incGray.jpg ~inc0.wbmp ~inc1.wbmp ~inc0.webp ~inc1.webp ~inc0.ico ~inc1.ico ~inc0.png ~inc1.png ~inc2.png ~inc12.png ~inc13.png ~inc14.png ~inc0.webp ~inc1.webp --outResultsFile /sdcard/revenge_of_the_skiabot/perf/nanobench_abc123_1337000001.json --properties gitHash abc123 swarming_bot_id skia-bot-123 swarming_task_id 123456 --key arch x86 compiler Clang cpu_or_gpu GPU cpu_or_gpu_value PowerVR extra_config Android model NexusPlayer os Android; echo $? >/data/local/tmp/rc",
"[START_DIR]/tmp/nanobench.sh"
],
"env": {
diff --git a/infra/bots/recipes/perf.expected/Perf-Android-Clang-NexusPlayer-GPU-PowerVR-x86-Release-All-Android_Vulkan.json b/infra/bots/recipes/perf.expected/Perf-Android-Clang-NexusPlayer-GPU-PowerVR-x86-Release-All-Android_Vulkan.json
index 0ed8677b66..c8bb82a5cf 100644
--- a/infra/bots/recipes/perf.expected/Perf-Android-Clang-NexusPlayer-GPU-PowerVR-x86-Release-All-Android_Vulkan.json
+++ b/infra/bots/recipes/perf.expected/Perf-Android-Clang-NexusPlayer-GPU-PowerVR-x86-Release-All-Android_Vulkan.json
@@ -680,7 +680,7 @@
"--json-output",
"/path/to/tmp/json",
"copy",
- "set -x; /data/local/tmp/nanobench -i /sdcard/revenge_of_the_skiabot/resources --skps /sdcard/revenge_of_the_skiabot/skps --images /sdcard/revenge_of_the_skiabot/images/nanobench --svgs /sdcard/revenge_of_the_skiabot/svgs --pre_log --images --gpuStatsDump true --useThermalManager 1,1,10,1000 --scales 1.0 1.1 --nocpu --config vk --match ~blurroundrect ~patch_grid ~desk_carsvg ~blendmode_ ~inc0.gif ~inc1.gif ~incInterlaced.gif ~inc0.jpg ~incGray.jpg ~inc0.wbmp ~inc1.wbmp ~inc0.webp ~inc1.webp ~inc0.ico ~inc1.ico ~inc0.png ~inc1.png ~inc2.png ~inc12.png ~inc13.png ~inc14.png ~inc0.webp ~inc1.webp --outResultsFile /sdcard/revenge_of_the_skiabot/perf/nanobench_abc123_1337000001.json --properties gitHash abc123 swarming_bot_id skia-bot-123 swarming_task_id 123456 --key arch x86 compiler Clang cpu_or_gpu GPU cpu_or_gpu_value PowerVR extra_config Android_Vulkan model NexusPlayer os Android; echo $? >/data/local/tmp/rc",
+ "set -x; /data/local/tmp/nanobench -i /sdcard/revenge_of_the_skiabot/resources --skps /sdcard/revenge_of_the_skiabot/skps --images /sdcard/revenge_of_the_skiabot/images/nanobench --svgs /sdcard/revenge_of_the_skiabot/svgs --pre_log --images --gpuStatsDump true --scales 1.0 1.1 --nocpu --config vk --match ~blurroundrect ~patch_grid ~desk_carsvg ~blendmode_ ~inc0.gif ~inc1.gif ~incInterlaced.gif ~inc0.jpg ~incGray.jpg ~inc0.wbmp ~inc1.wbmp ~inc0.webp ~inc1.webp ~inc0.ico ~inc1.ico ~inc0.png ~inc1.png ~inc2.png ~inc12.png ~inc13.png ~inc14.png ~inc0.webp ~inc1.webp --outResultsFile /sdcard/revenge_of_the_skiabot/perf/nanobench_abc123_1337000001.json --properties gitHash abc123 swarming_bot_id skia-bot-123 swarming_task_id 123456 --key arch x86 compiler Clang cpu_or_gpu GPU cpu_or_gpu_value PowerVR extra_config Android_Vulkan model NexusPlayer os Android; echo $? >/data/local/tmp/rc",
"[START_DIR]/tmp/nanobench.sh"
],
"env": {
diff --git a/infra/bots/recipes/perf.expected/Perf-Android-Clang-PixelC-GPU-TegraX1-arm64-Release-All-Android_Skpbench.json b/infra/bots/recipes/perf.expected/Perf-Android-Clang-PixelC-GPU-TegraX1-arm64-Release-All-Android_Skpbench.json
index fd2ab5ff59..6a106b53df 100644
--- a/infra/bots/recipes/perf.expected/Perf-Android-Clang-PixelC-GPU-TegraX1-arm64-Release-All-Android_Skpbench.json
+++ b/infra/bots/recipes/perf.expected/Perf-Android-Clang-PixelC-GPU-TegraX1-arm64-Release-All-Android_Skpbench.json
@@ -680,7 +680,7 @@
"--json-output",
"/path/to/tmp/json",
"copy",
- "set -x; /data/local/tmp/nanobench -i /sdcard/revenge_of_the_skiabot/resources --skps /sdcard/revenge_of_the_skiabot/skps --images /sdcard/revenge_of_the_skiabot/images/nanobench --svgs /sdcard/revenge_of_the_skiabot/svgs --pre_log --images --gpuStatsDump true --useThermalManager 1,1,10,1000 --scales 1.0 1.1 --nocpu --config gles glessrgb glesmsaa4 glesnvpr4 glesnvprdit4 glesinst glesinst4 --gpuThreads 0 --match ~blurroundrect ~patch_grid ~desk_carsvg ~inc0.gif ~inc1.gif ~incInterlaced.gif ~inc0.jpg ~incGray.jpg ~inc0.wbmp ~inc1.wbmp ~inc0.webp ~inc1.webp ~inc0.ico ~inc1.ico ~inc0.png ~inc1.png ~inc2.png ~inc12.png ~inc13.png ~inc14.png ~inc0.webp ~inc1.webp --outResultsFile /sdcard/revenge_of_the_skiabot/perf/nanobench_abc123_1337000001.json --properties gitHash abc123 swarming_bot_id skia-bot-123 swarming_task_id 123456 --key arch arm64 compiler Clang cpu_or_gpu GPU cpu_or_gpu_value TegraX1 extra_config Android_Skpbench model PixelC os Android; echo $? >/data/local/tmp/rc",
+ "set -x; /data/local/tmp/nanobench -i /sdcard/revenge_of_the_skiabot/resources --skps /sdcard/revenge_of_the_skiabot/skps --images /sdcard/revenge_of_the_skiabot/images/nanobench --svgs /sdcard/revenge_of_the_skiabot/svgs --pre_log --images --gpuStatsDump true --scales 1.0 1.1 --nocpu --config gles glessrgb glesmsaa4 glesnvpr4 glesnvprdit4 glesinst glesinst4 --gpuThreads 0 --match ~blurroundrect ~patch_grid ~desk_carsvg ~inc0.gif ~inc1.gif ~incInterlaced.gif ~inc0.jpg ~incGray.jpg ~inc0.wbmp ~inc1.wbmp ~inc0.webp ~inc1.webp ~inc0.ico ~inc1.ico ~inc0.png ~inc1.png ~inc2.png ~inc12.png ~inc13.png ~inc14.png ~inc0.webp ~inc1.webp --outResultsFile /sdcard/revenge_of_the_skiabot/perf/nanobench_abc123_1337000001.json --properties gitHash abc123 swarming_bot_id skia-bot-123 swarming_task_id 123456 --key arch arm64 compiler Clang cpu_or_gpu GPU cpu_or_gpu_value TegraX1 extra_config Android_Skpbench model PixelC os Android; echo $? >/data/local/tmp/rc",
"[START_DIR]/tmp/nanobench.sh"
],
"env": {
diff --git a/infra/bots/recipes/perf.py b/infra/bots/recipes/perf.py
index cb535abce6..bf03533e81 100644
--- a/infra/bots/recipes/perf.py
+++ b/infra/bots/recipes/perf.py
@@ -34,9 +34,6 @@ def nanobench_flags(api, bot):
args.append('--images')
args.extend(['--gpuStatsDump', 'true'])
- if 'Android' in bot and 'GPU' in bot and 'Nexus5x' not in bot:
- args.extend(['--useThermalManager', '1,1,10,1000'])
-
args.extend(['--scales', '1.0', '1.1'])
if 'iOS' in bot:
diff --git a/tools/ThermalManager.cpp b/tools/ThermalManager.cpp
deleted file mode 100644
index e0c7c44c69..0000000000
--- a/tools/ThermalManager.cpp
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright 2016 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "ThermalManager.h"
-
-#include "SkOSFile.h"
-
-#include <stdio.h>
-
-#ifndef SK_BUILD_FOR_WIN32
- #include <unistd.h>
-#endif
-
-#ifdef THERMAL_MANAGER_SUPPORTED
-
-/*
- * ThermalManager is completely dependent on sysfs to monitor thermal temperatures. In sysfs
- * thermal management is controlled by a number of thermal zones. They are laid out as follows:
- * /sys/class/thermal/thermal_zoneN where N is the number of the thermal zone starting at 0.
- *
- * Inside each thermal_zone folder is a file called 'temp,' which has the current temperature
- * reading from the sensor in that zone, as well as 0 or more files called 'trip_point_N_temp.'
- *
- * When the reading in temp is greater than one of the numbers in the trip_point files, then the
- * kernel will take some kind of action. This is all documented online.
- *
- * In any case, the goal of this class is to sleep right before a trip point is about to be
- * triggered, thus naturally cooling the system and preventing thermal throttling.
- */
-
-ThermalManager::ThermalManager(int32_t threshold, uint32_t sleepIntervalMs, uint32_t timeoutMs)
- : fSleepIntervalMs(sleepIntervalMs)
- , fTimeoutMs(timeoutMs) {
- static const char* kThermalZonePath = "/sys/class/thermal/";
- SkOSFile::Iter it(kThermalZonePath);
- SkString path;
- while (it.next(&path, true)) {
- if (!path.contains("thermal_zone")) {
- continue;
- }
-
- SkString fullPath(kThermalZonePath);
- fullPath.append(path);
- SkOSFile::Iter thermalZoneIt(fullPath.c_str());
-
- SkString filename;
- while (thermalZoneIt.next(&filename)) {
- if (!(filename.contains("trip_point") && filename.contains("temp"))) {
- continue;
- }
-
- fTripPoints.push_back(TripPoint(fullPath, filename, threshold));
- }
- }
-}
-
-bool ThermalManager::coolOffIfNecessary() {
- uint32_t i = 0, totalTimeSleptMs = 0;
- while (i < (uint32_t)fTripPoints.count() && totalTimeSleptMs < fTimeoutMs) {
- if (fTripPoints[i].willTrip()) {
- sleep(fSleepIntervalMs);
- totalTimeSleptMs += fSleepIntervalMs;
- } else {
- i++;
- }
- }
-
- return totalTimeSleptMs < fTimeoutMs;
-}
-
-int32_t ThermalManager::OpenFileAndReadInt32(const char* path) {
- FILE* tempFile = fopen(path, "r");
- SkASSERT(tempFile);
- int32_t value;
- int ret = fscanf(tempFile, "%d", &value);
- if (!ret) {
- SkDebugf("Could not read temperature\n");
- SkASSERT(false);
- }
-
- fclose(tempFile);
- return value;
-}
-
-ThermalManager::TripPoint::TripPoint(SkString thermalZoneRoot, SkString pointName,
- int32_t threshold)
- : fThermalZoneRoot(thermalZoneRoot)
- , fPointName(pointName) {
- SkString fullPath(thermalZoneRoot);
- fullPath.appendf("/%s", pointName.c_str());
- fPoint = OpenFileAndReadInt32(fullPath.c_str());
- fBase = GetTemp(fThermalZoneRoot);
- fThreshold = threshold;
- fDisabled = fBase + fThreshold >= fPoint; // We disable any trip point which start off
- // triggered
-}
-
-bool ThermalManager::TripPoint::willTrip() {
- int32_t currentTemp = GetTemp(fThermalZoneRoot);
- bool wouldTrip = !fDisabled && currentTemp + fThreshold >= fPoint;
-
- if (wouldTrip) {
- SkDebugf("%s/%s would trip {%d,%d,%d,%d}\n", fThermalZoneRoot.c_str(),
- fPointName.c_str(), fBase, currentTemp, fPoint, fThreshold);
- }
- return wouldTrip;
-}
-
-#endif
diff --git a/tools/ThermalManager.h b/tools/ThermalManager.h
deleted file mode 100644
index 747cf52691..0000000000
--- a/tools/ThermalManager.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright 2016 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef ThermalManager_DEFINED
-#define ThermalManager_DEFINED
-
-#include "../private/SkTArray.h"
-#include "SkString.h"
-
-#if defined(SK_BUILD_FOR_ANDROID) || defined(SK_BUILD_FOR_UNIX)
-# define THERMAL_MANAGER_SUPPORTED
-#endif
-
-#ifdef THERMAL_MANAGER_SUPPORTED
-
-/*
- * This simple class monitors the thermal part of sysfs to ensure we don't trigger thermal events
- */
-
-class ThermalManager {
-public:
- ThermalManager(int32_t threshold, uint32_t sleepIntervalMs, uint32_t timeoutMs);
-
- bool coolOffIfNecessary();
-
-private:
- static int32_t OpenFileAndReadInt32(const char* path);
-
- // current temperature can be read from /thermalZonePath/temp
- static int32_t GetTemp(SkString thermalZonePath) {
- SkString temperatureFilePath(thermalZonePath);
- temperatureFilePath.appendf("/temp");
- return OpenFileAndReadInt32(temperatureFilePath.c_str());
- }
-
- struct TripPoint {
- TripPoint(SkString thermalZoneRoot, SkString pointName, int32_t threshold);
-
- bool willTrip();
-
- SkString fThermalZoneRoot;
- SkString fPointName;
- int32_t fBase;
- int32_t fPoint;
- int32_t fThreshold;
-
- // Certain trip points seem to start tripped. For example, I have seen trip points of 0 or
- // negative numbers.
- bool fDisabled;
- };
-
- SkTArray<TripPoint> fTripPoints;
- uint32_t fSleepIntervalMs;
- uint32_t fTimeoutMs;
-};
-#endif
-#endif