Subject: Re: Crusoe LongRun Support
To: Wojciech Puchar <wojtek@wojtek.3miasto.net>
From: Curt Sampson <cjs@cynic.net>
List: tech-kern
Date: 08/21/2001 22:03:47
On Tue, 21 Aug 2001, Wojciech Puchar wrote:

> > You can query the system to find out what the current settings are, and
> > also change the current settings to optimize for best CPU throughput or
> > best power savings.
>
> IMHO simple user level tool can do it.

So I typed in your program:

    int main()
    {
	while(1) {
	    int cpuload = check_average_cpu_usage();
	    sleep(5);
	    if(cpuload < 0.9)
		lower_cpu_clock();
	    if(cpuload > 0.95)
		higher_cpu_clock();}
	}
    }


but I can't seem to get it to compile. I get this when I try:

angelic $ cc -o longrun longrun.c
/tmp/cc3d7LUL.o: In function `main':
/tmp/cc3d7LUL.o(.text+0xd): undefined reference to `check_average_cpu_usage'
/tmp/cc3d7LUL.o(.text+0x40): undefined reference to `lower_cpu_clock'
/tmp/cc3d7LUL.o(.text+0x63): undefined reference to `higher_cpu_clock'
collect2: ld returned 1 exit status

I can't find these functions you reference in a any library on NetBSD.

Also, perhaps because I am not a very skilled C programmer, I don't
understand the coding tricks you're using here. I notice, for example,
that you compare cpuload with 0.9 and 0.95. Yet, cpuload is an int,
and so the closest it would ever get would be 0 or 1. How does this work?

cjs
-- 
Curt Sampson  <cjs@cynic.net>   +81 3 5778 0123   http://www.netbsd.org
    Don't you know, in this new Dark Age, we're all light.  --XTC