Skip to contentSkip to conversation

heatload 0.4 now with throttling support

DISCUSSION Malte Thoma 4 participants 9 messages Dec 18, 2002 – Dec 19, 2002 8 messages not in the archive ACPI

lore
Share & tools
lore
#0 lore raw

Hallo,

now it is possible to adjust the throttling with heatload. You have to add the following lines to '/etc/sudoers'

Cmnd_Alias THROTTLING=/usr/sbin/set_throttling
ALL ALL=NOPASSWD: THROTTLING

hope you test it and can give suggestions for improvements.

Greetings,

Malte

ftp://ftp.berlios.de/pub/heatload/heatload_0.4.0_i386.deb ftp://ftp.berlios.de/pub/heatload/heatload_0.4.0.orig.tgz

-------------------------------------------------------
This sf.net email is sponsored by:
With Great Power, Comes Great Responsibility Learn to use your power at OSDN's High Performance Computing Channel
http://hpc.devchannel.org/

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): 20021218153355.GK347-j6u/t2rXLliUoIHC/UFpr9i2O/[email protected]

#3 lore raw
Quoted 5 lines · Ducrot Bruno

After dpkg and heatload, get
Sorry can't open any of the following files:
/proc/acpi/thermal_zone/THRM/temperature
/proc/acpi/thermal/0/status

Quoted 7 lines

But

# ls /proc/acpi/thermal_zone/
THM0

Please fix by parsing the entry of /proc/acpi/thermal_zone,

can you please send me

cat /proc/acpi/thermal_zone/THM0

... it seems to me that there are a LOT of different proc/acpi-structures :-(

/proc/acpi/thermal/0/status
/proc/acpi/thermal_zone
/proc/acpi/thermal_zone/THRM/temperature

and now:
/proc/acpi/thermal_zone/THM0

hope that the ACPI-group stabilize this ;-)

Quoted 5 lines

and
do not forget that you can have more than one thermal zone.

until now heatload workes only for one CPU (i suppose the thermal_zone is coherent to the counting of CPUs?)

I won't be hard to improve it to more than one, but doing THAT for recurrent changing directory structs does not make fun.
If you can tell me more about the future (and present) of the proc/acpi-structure depending on the numers of CPU I will start implementing this feature between christmas and new years eve ;-)

Greetings,

Malte

Quoted 2 lines

-------------------------------------------------------
This SF.NET email is sponsored by: Order your Holiday Geek Presents Now! Green Lasers, Hip Geek T-Shirts, Remote Control Tanks, Caffeinated Soap, MP3 Players, XBox Games, Flying Saucers, WebCams, Smart Putty.
T H I N K G E E K . C O M http://www.thinkgeek.com/sf/

A message that is not in the archive (sent off-list or not yet received): [email protected]

#5 lore raw
Quoted 9 lines · Malte Thoma [[email protected]] wrote:

cat /proc/acpi/thermal_zone/THM0

... it seems to me that there are a LOT of different proc/acpi-structures :-(

/proc/acpi/thermal/0/status
/proc/acpi/thermal_zone
/proc/acpi/thermal_zone/THRM/temperature
/proc/acpi/thermal_zone/THM0

As with most ACPI things, the name of the thermal_zone is defined by the DSDT table, and is arbitrary. You should read everything in the directory.

Quoted 1 line

hope that the ACPI-group stabilize this ;-)

They can't do anything about it.

Quoted 2 lines

until now heatload workes only for one CPU (i suppose the thermal_zone is coherent to the counting of CPUs?)

No, there could be a passive zone, a critical zone etc.

Faye

Signature · 13 lines
Faye Pearson,
Covert Development
ClaraNET Ltd.       Tel 020 7903 3000

Convention is the ruler of all.
		-- Pindar


-------------------------------------------------------
This SF.NET email is sponsored by: Order your Holiday Geek Presents Now!
Green Lasers, Hip Geek T-Shirts, Remote Control Tanks, Caffeinated Soap,
MP3 Players,  XBox Games,  Flying Saucers,  WebCams,  Smart Putty.
T H I N K G E E K . C O M       http://www.thinkgeek.com/sf/

A message that is not in the archive (sent off-list or not yet received): [email protected]

#7 lore raw
Quoted 14 lines · Faye Pearson
Quoted 10 lines · Malte Thoma [[email protected]] wrote:

cat /proc/acpi/thermal_zone/THM0

... it seems to me that there are a LOT of different proc/acpi-structures :-(

/proc/acpi/thermal/0/status
/proc/acpi/thermal_zone
/proc/acpi/thermal_zone/THRM/temperature
/proc/acpi/thermal_zone/THM0

Quoted 5 lines

As with most ACPI things, the name of the thermal_zone is defined by the DSDT table, and is arbitrary. You should read everything in the directory.

In which directory, in /proc/acpi or in ../thermal_zone ?

Quoted 7 lines
Quoted 3 lines

hope that the ACPI-group stabilize this ;-)

They can't do anything about it.

Thank you for this importent and disillusioned information :-(

Quoted 7 lines
Quoted 3 lines

until now heatload workes only for one CPU (i suppose the thermal_zone is coherent to the counting of CPUs?)

No, there could be a passive zone, a critical zone etc.

Wonderfull task: something to develope for machines I cannot test it for :-( coming along that my skills are not guru-like :-(

So what can you advise me?

parsing /proc/acpi and looking for

processor ->throttling
thermal* -> ????
battery -> state or status
ac_adapter -> state or status

excpecially in the thermal zone it looks as if ther is no regularity :-( Do you have some more hints ?

Greetings,

Malte

Quoted 2 lines

-------------------------------------------------------
This SF.NET email is sponsored by: Order your Holiday Geek Presents Now! Green Lasers, Hip Geek T-Shirts, Remote Control Tanks, Caffeinated Soap, MP3 Players, XBox Games, Flying Saucers, WebCams, Smart Putty.
T H I N K G E E K . C O M http://www.thinkgeek.com/sf/

A message that is not in the archive (sent off-list or not yet received): [email protected]

#9 lore raw
Quoted 1 line · Malte Thoma [[email protected]] wrote:

In which directory, in /proc/acpi or in ../thermal_zone ?

Well, everything under /proc/acpi is well-known (so far at least) ac_adapter/
thermal_zone/
battery/
processor/
etc.

In each of those directories there may be one or more other directories
- one for each node eg.

ACAD, AC0 for AC
BAT0, BAT1, BAT2, BATR for batteries
TZ0, THRM for thermal zones.
CPU0, PROC, for processor

The only thing you can do is opendir("/proc/acpi/thermalzone"), then readdir for each item - ignore . and .. of course.

Quoted 2 lines

Wonderfull task: something to develope for machines I cannot test it for :-( coming along that my skills are not guru-like :-(

If you don't hardcode the directories under ac_adapter,thermal_zone etc. then you should be ok.

Quoted 1 line

processor ->throttling

processor/*/throttling
processor/*/performance

My processor (for example) doesn't support throttling, just performance.

Quoted 1 line

thermal* -> ????

thermal_zone/*/temperature I guess :)

Quoted 1 line

battery -> state or status

Is it status or info which holds the most useful information?

Quoted 1 line

ac_adapter -> state or status

Present: yes or no is about all that's useful there I think.

Faye

Signature · 13 lines
Faye Pearson,
Covert Development
ClaraNET Ltd.       Tel 020 7903 3000

I have the simplest tastes.  I am always satisfied with the best.
		-- Oscar Wilde


-------------------------------------------------------
This SF.NET email is sponsored by: Order your Holiday Geek Presents Now!
Green Lasers, Hip Geek T-Shirts, Remote Control Tanks, Caffeinated Soap,
MP3 Players,  XBox Games,  Flying Saucers,  WebCams,  Smart Putty.
T H I N K G E E K . C O M       http://www.thinkgeek.com/sf/

A message that is not in the archive (sent off-list or not yet received): [email protected]

#11 lore raw
Quoted 13 lines · Faye Pearson
Quoted 1 line · Malte Thoma [[email protected]] wrote:

In which directory, in /proc/acpi or in ../thermal_zone ?

Well, everything under /proc/acpi is well-known (so far at least) ac_adapter/
thermal_zone/
battery/
processor/
etc.

In each of those directories there may be one or more other directories
- one for each node eg.

Quoted 7 lines

ACAD, AC0 for AC
BAT0, BAT1, BAT2, BATR for batteries
TZ0, THRM for thermal zones.
CPU0, PROC, for processor

The only thing you can do is opendir("/proc/acpi/thermalzone"), then readdir for each item - ignore . and .. of course.

No. scandir(). You can alphasort.

Signature · 10 lines
Ducrot Bruno

--  Which is worse:  ignorance or apathy?
--  Don't know.  Don't care.


-------------------------------------------------------
This SF.NET email is sponsored by: Geek Gift Procrastinating?
Get the perfect geek gift now!  Before the Holidays pass you by.
T H I N K G E E K . C O M      http://www.thinkgeek.com/sf/

A message that is not in the archive (sent off-list or not yet received): 20021219132303.GH4257-j6u/t2rXLliUoIHC/UFpr9i2O/[email protected]

#13 lore raw
Quoted 4 lines · Ducrot Bruno [[email protected]] wrote:
Quoted 2 lines

The only thing you can do is opendir("/proc/acpi/thermalzone"), then readdir for each item - ignore . and .. of course.

No. scandir(). You can alphasort.

Picky :) What I was trying to say is that you've got no choice but to scan/read directories, you can't hardcode.

Scandir is cute, but perhaps unnecessary in a procfs where the nodes are created in-order anyway?

Faye

Signature · 12 lines
Faye Pearson,
Covert Development
ClaraNET Ltd.       Tel 020 7903 3000

When it comes to broken marriages most husbands will split the blame --
half his wife's fault, and half her mother's.


-------------------------------------------------------
This SF.NET email is sponsored by: Geek Gift Procrastinating?
Get the perfect geek gift now!  Before the Holidays pass you by.
T H I N K G E E K . C O M      http://www.thinkgeek.com/sf/

A message that is not in the archive (sent off-list or not yet received): [email protected]

#15 lore raw
Quoted 11 lines · Faye Pearson
Quoted 4 lines · Ducrot Bruno [[email protected]] wrote:
Quoted 2 lines

The only thing you can do is opendir("/proc/acpi/thermalzone"), then readdir for each item - ignore . and .. of course.

No. scandir(). You can alphasort.

Picky :) What I was trying to say is that you've got no choice but to scan/read directories, you can't hardcode.

Scandir is cute, but perhaps unnecessary in a procfs where the nodes are created in-order anyway?

Nope. I really need to scandir() especially for the batteries case, because the opendir() gave me BAT2 then BAT1 at least for me.

Cheers,

Signature · 10 lines
Ducrot Bruno

--  Which is worse:  ignorance or apathy?
--  Don't know.  Don't care.


-------------------------------------------------------
This SF.NET email is sponsored by: Geek Gift Procrastinating?
Get the perfect geek gift now!  Before the Holidays pass you by.
T H I N K G E E K . C O M      http://www.thinkgeek.com/sf/
#16 lore raw
In reply to a message not in the archive
Quoted 9 lines · Malte Thoma
Quoted 5 lines · Ducrot Bruno

After dpkg and heatload, get
Sorry can't open any of the following files:
/proc/acpi/thermal_zone/THRM/temperature
/proc/acpi/thermal/0/status

Quoted 7 lines
Quoted 7 lines

But

# ls /proc/acpi/thermal_zone/
THM0

Please fix by parsing the entry of /proc/acpi/thermal_zone,

It is exactly the same as for your /proc/acpi/thermal_zone/THRM/temperature

You can not know in advance what will be the name of /proc/acpi/thermal_zone/THRM

The 'name' THRM is actually given by the BIOS (by the DSDT, in fact).

the only 'clean' way to go is to get the entry(ies) of

/proc/acpi/thermal_zone/

Doing something like (not tested):

char *get_the_name_of_that_damned_temp_file(void)

{
	int		n;
	int		i;
	struct dirent **temp;
	char	       *name;

	static char temperature[4096];		/* OK.. we can do certainly better here via malloc.. */


	n = scandir("/proc/acpi/thermal_zone", &temp, 0, alphasort);

	if (n < 0) {
		return NULL;
	}

	for (i = 0; i < n; i++) {
		/* skip .* */
		if ((temp[i]->d_name)[0] == '.')
			continue;

		name = temp[i]->d_name;
		sprintf(temperature, "/proc/acpi/thermal_zone/%s/temperature", name);
		free(temp);
		return temperature;
	}
	free(temp);
	return NULL;
}

It should return the first 'temperature' file for all newer release of ACPI. For 'older', it is OK for /proc/acpi/thermal/0/temperature

Then, that file contain:

ducrot@novae:~$ cat /proc/acpi/thermal_zone/THM0/temperature 
temperature:             45 C

(I must admit also that I don't know for /proc/acpi/thermal/0/temperature, 'older' way).

Cheers,

Signature · 10 lines
Ducrot Bruno

--  Which is worse:  ignorance or apathy?
--  Don't know.  Don't care.


-------------------------------------------------------
This SF.NET email is sponsored by: Geek Gift Procrastinating?
Get the perfect geek gift now!  Before the Holidays pass you by.
T H I N K G E E K . C O M      http://www.thinkgeek.com/sf/