[TUTO] Quick-Monitoring CPU Temperature and frequency from ADB
I'm one of those persons that tests stuff all day long, from kernels, to custom made kernels, overclocking, benchmarks, roms and that stuff so I felt in the need of something that could provide me with CPU Temp and current CPU Frequency because I was testing governors and cpu throttling.
No, you don't need ROOT, you can do this on a 100% stock tablet.
What you need
USB Debugging enabled on your tablet.
ADB in your computer (if you don't have/know about this, you should find a manual :P)
How to do it
1) Connect your tablet to the computer (you can do this over usb or you can use adb wireless apps)
2) Open up a command shell (Windows users: CMD, Linux/Mac users: Terminal)
3) Type adb shell (Make sure you are in the folder where your adb program is located, if you have setup System Variables you can skip that)
4) Your terminal/cmd should say something like this now: shell@deb / shell@flo, the line of text your will have to copy paste is this one:
while :; do sleep 2; echo -n "TEMP: ";cat /sys/devices/virtual/thermal/thermal_zone0/temp;echo -n "FREQ: "; cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq; done
5) This will auto-run every 2 seconds until you stop it, temperature is in Celsius and Frequency is in Hz (384000 Hz represents 384 Mhz), the sensor we are reading gives an average CPU temperature based on the actual load and expected load, this is natively done by the tablet. If you want to read a more accurate sensor you can change the thermal_zone0 for thermal_zone7, the difference should not be much but on stock kernels that sensor sometimes doesn't report any temperature and you will see an error. If you are using @franciscofranco
) you can read sensor 7 always, and it's recommended.
If you find this little trick useful, enjoy it, just thought that someone could use it.
P.D.: You can run this as well on a Terminal from Android.
ADVANCED: If you know a bit about what I did in that command, you can tune it as you like to do whatever you want, here is a breakdown of what this command does.
while :; (this is what keeps the infinite loop going)
do (the trigger to start running commands)
sleep 2;(basic sleep command works as a timer, this is in seconds)
echo -n "TEMP"; (We write a text line to identify the 2 values, with -n operator we do it in the same line as the next order
cat /sys/devices/virtual/thermal/thermal_zone0/temp; (we output the temperature value from the following file with a cat
echo -n "FREQ"; (We write a text line to identify the 2 values, using -n again gives us another line of text
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq;(we output the current cpu speed value from the following file with a cat
done (this is how we tell the while loop that we are done with commands and that it should run again)
You can give this script some other uses, like creating a log file with sensor readings to measure per example, battery drain, or signal strength.
Phone: Google Nexus 4 16GB
ROM: ParanoidAndroid 3.99-RC2
Kernel: Franco Nightlies
Tablet: Google Nexus 7 2013 LTE 32GB
ROM: Stock 4.3 JLS36I
Kernel: Franco Nightlies