Page 1 of 4

CPUtemp - A CPU Temperature Monitor

Posted: Wed 07 Jul 2010, 16:24
by rcrsn51
Update: V1.9 recognizes CPU scaling governors like PowerSave in addition to OnDemand. This will give you more information in recent Puppies.

One of my machines won't run traytemp, so I decided to make my own. I noticed that System > Hardinfo > Sensors has two readings - the CPU core temperature and the thermal zone temperature. There is a considerable difference between the two and no consistency among machines as to which is correct.

This applet shows both readings plus the CPU frequency scaling status and the current CPU frequency.

1. Install the PET below.

2. You should see a "flame" icon in the system tray. It is launched from your /root/Startup folder. Click it.

3. If you have an AMD or Intel processor, CPUtemp should display the temperature information. If not, click on Help and follow the instructions for detecting other temperature modules.

4. To change the CPU scaling method, run the CPU Frequency Scaling Tool. Look for it in Menu > Utility or Menu > System.

Posted: Fri 01 Oct 2010, 08:58
by Karl Godt
1: This .pet introduced me to `sensors` and sensors-detect .

Hardinfo now shows temp ! This is very very good !

2: I also was introduced to modules I never stumbled upon : it87 , acpi* , hwmon , k8temp , processor and much more. Even without k8temp on my K7 board i got temp.

3. /usr/bin/CPUtemp I had to modify a little, because even with loaded acpi* via BootManager and BOOT_IMAGE=/dpup004/vmlinuz pdev=sdc3 psubdir=dpup004 acpi=force from /proc/cmdline
I still have no /proc/acpi -directory

Code: Select all

if [ -d /proc/acpi/ ]; then
                              THRMFILE=`find /proc/acpi/thermal_zone -name "temperature"`
without such prove the screen frooze clicking the sun and even killing kill -9

7858 root 0:00 tr -s
7859 root 0:00 sed s/temperature/THRM Temp/

didn't help .... I had to kill X ! and startx again !

Now the clicking the sun doesn't show any tempers but it doesn't freeze anymore.
I also if'ed

Code: Select all

if [ -f /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor ]; then
if [ -f /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq ]; then 
so the end looks like this for now:

Code: Select all

 xmessage -file /tmp/CPUtemp.txt -timeout 10 -buttons Okay:0,Help:1
  [ $? -eq 1 ] && exec xmessage -file /usr/bin/CPUtemp.hlp
 
				fi
	
		fi 

else 
echo line 43 $?,$FREQ,$THRMFILE
exit

fi
var-log-messages:
ACPI Error: A valid RSDP was not found (20091214/tbxfroot-219)
ACPI WAKEUP ==> [0000011000 - 0000015000]
Kernel command line: BOOT_IMAGE=/dpup004/vmlinuz pdev=sdc3 psubdir=dpup004 acpi=force
ACPI: Interpreter disabled.
pnp: PnP ACPI: disabled

Posted: Fri 01 Oct 2010, 17:38
by Karl Godt
now the code is that :

Code: Select all

#!/bin/sh

#modprobe k8temp
#modprobe coretemp

sensors -A  | tr -s " " > /tmp/CPUtemp.txt

   if [ -d /proc/acpi/ ]; then
                              THRMFILE=`find /proc/acpi/thermal_zone -name "temperature"`
 
                              cat $THRMFILE | tr -s " " | sed s/"temperature"/"THRM Temp"/ >> /tmp/CPUtemp.txt
 
                              echo >> /tmp/CPUtemp.txt

		if [ -f /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor ]; then
                                                                   cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor | grep -q ondemand
  
  
			if [ $? -eq 0 ]; then
  
			echo "OnDemand CPU Scaling: on" >> /tmp/CPUtemp.txt
			else
			echo "OnDemand CPU Scaling: off" >> /tmp/CPUtemp.txt 
			fi
 
				if [ -f /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq ]; then 
                                                                   FREQ=`cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq`
 
					if [ -n "$FREQ" ]; then
						echo -n "Current CPU Freq: " >> /tmp/CPUtemp.txt
   
						echo ${FREQ%???} MHz >> /tmp/CPUtemp.txt
					fi

  xmessage -file /tmp/CPUtemp.txt -timeout 10 -buttons Okay:0,Help:1
  [ $? -eq 1 ] && exec xmessage -file /usr/bin/CPUtemp.hlp
 
				fi
	
		fi 

else 
# echo line 43 $?,$FREQ,$THRMFILE

 xmessage -file /tmp/CPUtemp.txt -timeout 107 -buttons Okay:0,Help:1
  [ $? -eq 1 ] && exec xmessage -file /usr/bin/CPUtemp.hlp


fi

Posted: Fri 01 Oct 2010, 18:25
by rcrsn51
Thanks for this. I see the problem with missing files and have uploaded a patched version.

Posted: Mon 10 Jan 2011, 16:45
by rcrsn51
CPUtemp v1.1 is posted above. If you have previously installed v1.0, you MUST remove it from the PPM before installing the new version.

Posted: Fri 21 Jan 2011, 13:36
by Bert
Just discovered this pet. Worked perfectly...after I changed from openbox to jwm :oops: The included guide was a great help.

Clicking the little sun reveals a healthy 33°C core temperature.

For the first time on this box, Hardinfo is displaying temperatures!

Thank you rcrsn51!

Posted: Fri 21 Jan 2011, 13:49
by rcrsn51
Glad you like it. If you don't want to use JWM, you can run CPUtemp from the command line with

Code: Select all

CPUtemp
Or you can drag a shortcut to /usr/local/bin/CPUtemp onto your desktop.

Posted: Fri 21 Jan 2011, 14:21
by Bert
rcrsn51 wrote:Glad you like it. If you don't want to use JWM, you can run CPUtemp from the command line with

Code: Select all

CPUtemp
Or you can drag a shortcut to /usr/local/bin/CPUtemp onto your desktop.
You mean like this? :lol:
Thanks again!

Posted: Fri 21 Jan 2011, 16:21
by rcrsn51
So Mr. Shakespeare might have said, "Shall I compare thy CPU to a Summer's day?" :wink:

Posted: Thu 27 Jan 2011, 02:43
by rcrsn51
Mick and I are pleased to announce the release of CPUtemp v1.2. This version has a simplified installation procedure and a nicer looking user interface. It should work with other window managers in addition to JWM.

See the first post.

Posted: Sun 30 Jan 2011, 11:45
by rcrsn51
CPUtemp v1.3 is posted above. This release is now a gtkdialog app, so it removes the dependency on gxmessage. Also, it resolves some problems with displaying temperatures in non-English languages.

Thank you to Béèm for being my regular tester.

Posted: Mon 31 Jan 2011, 15:46
by rcrsn51
For those of you who prefer your temperature readings in Fahrenheit, here are the modifications to CPUtemp.

1. Open the file /usr/local/bin/CPUtemp in a text editor.

2. Go to Line 8 and add an "f" as follows

Code: Select all

/usr/local/bin/sensors -Af -c /etc/sensors3.conf | tr -s " " > /tmp/CPUtemp.txt
3. Go to Line 13 and insert a new line AFTER it.

Code: Select all

TEMP=${TEMP%???}
let TEMP=TEMP*9/5+32
4. On the next line, change the "C" to an "F".

Code: Select all

echo "THRM Temp: " $TEMP F >> /tmp/CPUtemp.txt

Posted: Thu 19 May 2011, 12:20
by lithpr
Works great on Lucid Puppy 5.2.5! Thank you very much!

Posted: Thu 19 May 2011, 15:09
by nooby
Oh I should have found this one a year ago. So much frustration.

Now I know the CPU temp. it is not 26 which I was very skeptical to. it is 48 Celsius. That is more likely to be the true temp than 26 C.

So thanks indeed for providing this pet. I tested it on Snow5 and on Ice-010

Posted: Thu 25 Aug 2011, 20:21
by playdayz
Oh wait a minute, in a terminal i did 'modprobe w83627ehf' and now I have more info than I wanted ;-)

Hi rcrsn51, I run sensors-detect

Code: Select all

Found `Winbond W83627EHF/EF/EHG/EG Super IO Sensors'        Success!
    (address 0x290, driver `w83627ehf')
That is the only Success.

Then I get CPUTemp in the systray. But all I get is

Code: Select all

CPUTemp
ONDemand CPU Scaling On
Current CPU Frequency 150MHz
lsmod shows that k10temp is running and is used by hwmon.

Hardinfo gives no Sensors at all, blank.

I changed the module on line 5 to k10temp.

No big deal, but does anything jump out at you? Thanks.

Posted: Thu 25 Aug 2011, 20:49
by rcrsn51
This is the reality of temperature detection. Sometimes, both methods (libsensors and thermal zone) will detect a temperature, but only one will make sense. Sometimes, only one method will give a value. In your case, neither works.

However, some processors appear to keep their thermal zone info in different locations, so another temperature tool may find it.
Oh wait a minute, in a terminal i did 'modprobe w83627ehf' and now I have more info than I wanted
Was the temperature included?

Posted: Thu 25 Aug 2011, 21:12
by 8-bit
I downloaded and modified the CPUtemp file as per your instructions to show the temperature in fahrenheit.

But the display window has some unknown character symbols shown.

See attached example.
How to fix it?

Posted: Thu 25 Aug 2011, 21:28
by rcrsn51
That's the degree symbol. But I thought that we had the program fixed so it never showed it. Do you have the latest version from above?

Posted: Thu 25 Aug 2011, 21:56
by 8-bit
I downloaded CPUtemp-1.3.pet and ran it from its own directory.
Both the original and the modified one showed the unknown character symbol.
I think the message in the terminal may help in determining what is happening.

The old 1.1 version did not display the unknown character.

Posted: Thu 25 Aug 2011, 22:03
by rcrsn51
What Puppy are you using? None of my machines show that symbol anymore.
I downloaded CPUtemp-1.3.pet and ran it from its own directory.
Version 1.3 runs the script /usr/local/bin/CPUtemp. It calls /usr/local/bin/sensors. Is that where you are? Or do you have an older version still installed? Type

Code: Select all

which sensors