skpbench: add debug prints for thermal trip points
Prints thermal trip points that have been exceeded when a
HardwareException is raised, and verbosity is set to debug. This can
help us correlate thermal trip points with throttling and detect
future throttling before it occurs.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2408893002
Review-Url: https://codereview.chromium.org/2408893002
diff --git a/tools/skpbench/_hardware.py b/tools/skpbench/_hardware.py
index f1c8c26..9c929c4 100644
--- a/tools/skpbench/_hardware.py
+++ b/tools/skpbench/_hardware.py
@@ -33,6 +33,10 @@
"""Raises a HardwareException if any hardware state is not as expected."""
pass
+ def print_debug_diagnostics(self):
+ """Prints any info that may help improve or debug hardware monitoring."""
+ pass
+
def sleep(self, sleeptime):
"""Puts the hardware into a resting state for a fixed amount of time."""
time.sleep(sleeptime)
diff --git a/tools/skpbench/_hardware_android.py b/tools/skpbench/_hardware_android.py
index a752ff5..d7990dc 100644
--- a/tools/skpbench/_hardware_android.py
+++ b/tools/skpbench/_hardware_android.py
@@ -89,5 +89,30 @@
def sanity_check(self):
Hardware.sanity_check(self)
+ def print_debug_diagnostics(self):
+ # search for and print thermal trip points that may have been exceeded.
+ self._adb.shell('''\
+ THERMALDIR=/sys/class/thermal
+ if [ -e $THERMALDIR ]; then
+ for ZONE in $(cd $THERMALDIR; echo thermal_zone*); do
+ cd $THERMALDIR/$ZONE
+ if [ -e mode ] && grep -Fxq enabled mode; then
+ TEMP=$(cat temp)
+ TRIPPOINT=
+ let i=0
+ while [ -e trip_point_${i}_temp ] &&
+ [ $TEMP -gt $(cat trip_point_${i}_temp) ]; do
+ TRIPPOINT=trip_point_${i}_temp
+ let i=i+1
+ done
+ if [ $TRIPPOINT ]; then
+ echo "$ZONE ($(cat type)): temp=$TEMP > $TRIPPOINT=$(cat $TRIPPOINT)"
+ fi
+ fi
+ done
+ fi''')
+
+ Hardware.print_debug_diagnostics(self)
+
def sleep(self, sleeptime):
Hardware.sleep(self, sleeptime)
diff --git a/tools/skpbench/skpbench.py b/tools/skpbench/skpbench.py
index 6bf3975..932d8d0 100755
--- a/tools/skpbench/skpbench.py
+++ b/tools/skpbench/skpbench.py
@@ -230,6 +230,8 @@
skpbench.best_result))
except HardwareException as exception:
+ if FLAGS.verbosity >= 5:
+ hardware.print_debug_diagnostics()
skpbench.terminate()
naptime = max(hardware.kick_in_time, exception.sleeptime)
if FLAGS.verbosity >= 1: