sudo nano temp.sh
Paste this and save:
#!/bin/bash
cpuTemp0=$(cat /sys/class/thermal/thermal_zone0/temp)
cpuTemp1=$(($cpuTemp0/1000))
cpuTemp2=$(($cpuTemp0/100))
cpuTempM=$(($cpuTemp2 % $cpuTemp1))
cpuFreq=`cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq | sed 's/.\{3\}$//'`Mhz
echo CPU temp"="$cpuTemp1"."$cpuTempM"'C"
echo GPU $(/opt/vc/bin/vcgencmd measure_temp)
echo CPU frequency=$cpuFreq
cpuTemp0=$(cat /sys/class/thermal/thermal_zone0/temp)
cpuTemp1=$(($cpuTemp0/1000))
cpuTemp2=$(($cpuTemp0/100))
cpuTempM=$(($cpuTemp2 % $cpuTemp1))
cpuFreq=`cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq | sed 's/.\{3\}$//'`Mhz
echo CPU temp"="$cpuTemp1"."$cpuTempM"'C"
echo GPU $(/opt/vc/bin/vcgencmd measure_temp)
echo CPU frequency=$cpuFreq
Set permission and run it:
sudo chmod +x temp.sh;./temp.sh
3 comments:
#!/bin/bash
counter=1
#capture user input
echo "Enter the number of seconds to run CPU/GPU temp script:"
read counter
#execute in secongs user input
while [ $counter -gt 0 ];
do
cpuTemp0=$(cat /sys/class/thermal/thermal_zone0/temp)
cpuTemp1=$(($cpuTemp0/1000))
cpuTemp2=$(($cpuTemp0/100))
cpuTempM=$(($cpuTemp2 % $cpuTemp1))
cpuFreq=`cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq | sed 's/.\{3\}$//'`
dat="$(date)"
echo "${dat}" CPU temp"="$cpuTemp1"."$cpuTempM"'C" GPU $(/opt/vc/bin/vcgencmd measure_temp) CPU frequency=$cpuFreq
echo $cpuTemp1"."$cpuTempM","$(/opt/vc/bin/vcgencmd measure_temp)","$cpuFreq",""${dat}">> temprlog.csv
sleep 1
let counter-=1
done
-----------------------
just alittle benchmarking app i wrote to get a time frame and log file for the temp, cpu/gpu and frequency for benchmarking and over clocking records :) enjoy
output looks like the below
******************
35.7,temp=35.8'C,700,Fri Apr 25 15:16:49 EDT 2014
35.7,temp=35.8'C,700,Fri Apr 25 15:16:50 EDT 2014
35.7,temp=35.8'C,700,Fri Apr 25 15:16:51 EDT 2014
35.2,temp=35.8'C,700,Fri Apr 25 15:16:52 EDT 2014
35.7,temp=35.8'C,700,Fri Apr 25 15:16:53 EDT 2014
35.7,temp=35.8'C,700,Fri Apr 25 15:16:55 EDT 2014
*********
hope this helps anyone looking for something such as this :)
I really loved reading your writing. Finally winter is knocking the door. It's really enjoyable. Father promised me to buy me gadgets and instrument to measure wind speed for my research work. It will be the biggest gift for me of this Christmas.
Post a Comment