Sepero / temp-throttle

A shell script for throttling system CPU frequency based on a desired maximum temperature
Other
243 stars 64 forks source link

Current CPU temperature file detection is inaccurate #7

Closed Vdragon closed 5 years ago

Vdragon commented 10 years ago

Currently temp-throttle uses the first found file in TEMPERATURE_FILES as CPU temperature, however it is pretty inaccurate as:

Maybe we should put files that are known to be CPU temperature over generic ones(like from specific hardware monitor driver).

Sepero commented 10 years ago

Yeah, good idea. When I created it, I simply threw in a bunch of locations where the system temperature can be (possibly) accessed. Different systems seem to access temperatures in different locations. I have no idea what the criteria is for how the kernel determines what file location to use. I just assume it is a function of the hardware vendor. There may be more locations to access the temperature that I don't even know about. I don't know how to validate which ones are most likely to be CPU temperature.

Sepero commented 10 years ago

If you know how to validate which file locations are most likely to access the CPU temperature, then I'm willing to implement it. Sorry if that wasn't clear from my last post. I just need the information. haha :)

Djfe commented 8 years ago

Just found this script: amazing! thx for writing it

what I found out: for me cpu temperatures are located in /sys/class/hwmon/hwmon0/ hwmon0 is the only one that exists for me I'm using Fedora 21/22

The CPU temperatures are in temp2, temp3,temp4 and temp5 (4 cores) temp1 doesn't exist (I have no clue why)

you can find out what it is if you output name first of all (/sys/class/hwmon/hwmon0/name) it contains "coretemp" for me tempx_label outputs "Core x" for me x is a number here it's temp_2-5 and Core 0-3 for me

maybe labels allow a correct detection of the cpu temperatures but there is probably a better way it probably should also decide depending on the used OS

Sepero commented 8 years ago

Thanks for the report, Djfe. Please tell me this info about the hardware you are running:

Also what is:

Djfe commented 8 years ago

Yes it's temp2 like for @vdragon it doesn't start from 1 My notebook: http://www.toshiba.de/discontinued-products/satellite-a660-11m/

I'll post the kernel later And I'll zip the hwmon for you, so you can take a look yourself ;)

Sepero commented 8 years ago

This appears to be what I have so far :)

Sepero commented 8 years ago

Additional question- Are there ever times when the temperature switches to the file /sys/class/hwmon/hwmon0/hwmon0/temp1 or /sys/class/hwmon/hwmon0/hwmon0/temp0?

Sepero commented 8 years ago

Note: Support for /sys/class/hwmon/hwmon0/hwmon0/temp2 has been added to the "testing" branch.

Djfe commented 8 years ago

ups it's only once hwmon0 not twice /sys/class/hwmon/hwmon0/

the content: http://www.file-upload.net/download-11039390/hwmon0.zip.html (I didn't add the symlinks device and subsystem, because they contain symlinks back to hwmon0 and they are not important)

The notebook specs are correct and yes I never noticed being core 0 something else than temp2

Djfe commented 8 years ago

totally forgot: Linux bau.nb 4.1.12-101.fc21.x86_64 #1 SMP Wed Oct 28 15:18:44 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

Sepero commented 8 years ago

ups it's only once hwmon0 not twice

Ok, I corrected for this in the testing branch

Sepero commented 8 years ago

Until someone can discover a better method for discovering CPU temperatures, I think that takes care of everything for now.

findepi commented 8 years ago

Just to add. In my case /sys/class/hwmon/hwmon0/ contains a bunch of ACPI temperatures with /sys/class/hwmon/hwmon0/temp8_input being close to what I believe is CPU temperature as reported by sensors command. But, the CPU temperatures are in /sys/class/hwmon/hwmon1/temp[24]_input in my case (dual core i7). Oh,cat /sys/class/hwmon/hwmon1/name says "coretemp" while cat /sys/class/hwmon/hwmon0/name says "acpitz". Maybe this can be used to differentiate?

It seems, ability to specify custom temperature file may be handy (as in pull request #25). So may be ability to watch in many temperatures at once (like all cores.)

Sepero commented 8 years ago

My apologies for the long delay, findepi. I'm currently working on including that ability to specify a custom temperature location. You'll find it in the testing branch.

Sepero commented 5 years ago

Resolved in testing branch