diff options
| author | Nate Lawson <njl@FreeBSD.org> | 2005-09-06 18:01:44 +0000 |
|---|---|---|
| committer | Nate Lawson <njl@FreeBSD.org> | 2005-09-06 18:01:44 +0000 |
| commit | d78723b7db68cf0e0f768d73b44d416448ece8d2 (patch) | |
| tree | 93cd422b5717b07a26e89b6d23eed139e357048e /usr.sbin | |
| parent | edb882636e957d37ab96a4bf23c9ff097e2b34e2 (diff) | |
Notes
Diffstat (limited to 'usr.sbin')
| -rw-r--r-- | usr.sbin/powerd/powerd.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/usr.sbin/powerd/powerd.c b/usr.sbin/powerd/powerd.c index 7c8ab4042cc9..80547d544ab5 100644 --- a/usr.sbin/powerd/powerd.c +++ b/usr.sbin/powerd/powerd.c @@ -425,27 +425,29 @@ main(int argc, char * argv[]) err(1, "read_usage_times"); /* - * If we're idle less than the active mark, jump the CPU to - * its fastest speed if we're not there yet. If we're idle - * more than the idle mark, drop down to the first setting - * that is half the current speed (exponential backoff). + * If we're idle less than the active mark, bump up two levels. + * If we're idle more than the idle mark, drop down one level. */ + for (i = 0; i < numfreqs - 1; i++) { + if (freqs[i] == curfreq) + break; + } if (idle < (total * cpu_running_mark) / 100 && curfreq < freqs[0]) { + i -= 2; + if (i < 0) + i = 0; if (vflag) { printf("idle time < %d%%, increasing clock" " speed from %d MHz to %d MHz\n", - cpu_running_mark, curfreq, freqs[0]); + cpu_running_mark, curfreq, freqs[i]); } - if (set_freq(freqs[0])) + if (set_freq(freqs[i])) err(1, "error setting CPU frequency %d", - freqs[0]); + freqs[i]); } else if (idle > (total * cpu_idle_mark) / 100 && curfreq > freqs[numfreqs - 1]) { - for (i = 0; i < numfreqs - 1; i++) { - if (freqs[i] <= curfreq / 2) - break; - } + i++; if (vflag) { printf("idle time > %d%%, decreasing clock" " speed from %d MHz to %d MHz\n", |
