diff options
author | sjg <sjg@FreeBSD.org> | 2013-09-05 20:18:59 +0000 |
---|---|---|
committer | sjg <sjg@FreeBSD.org> | 2013-09-05 20:18:59 +0000 |
commit | 62bb1062226d3ce6a2350808256a25508978352d (patch) | |
tree | 22b131dceb13c3df96da594fbaadb693504797c7 /usr.sbin/powerd | |
parent | 72ab90509b3a51ab361bf710338f2ef44a4e360d (diff) | |
parent | 04932445481c2cb89ff69a83b961bdef3d64757e (diff) | |
download | FreeBSD-src-62bb1062226d3ce6a2350808256a25508978352d.zip FreeBSD-src-62bb1062226d3ce6a2350808256a25508978352d.tar.gz |
Merge from head
Diffstat (limited to 'usr.sbin/powerd')
-rw-r--r-- | usr.sbin/powerd/powerd.8 | 50 | ||||
-rw-r--r-- | usr.sbin/powerd/powerd.c | 16 |
2 files changed, 41 insertions, 25 deletions
diff --git a/usr.sbin/powerd/powerd.8 b/usr.sbin/powerd/powerd.8 index 0991bce..853282c 100644 --- a/usr.sbin/powerd/powerd.8 +++ b/usr.sbin/powerd/powerd.8 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 21, 2009 +.Dd July 4, 2013 .Dt POWERD 8 .Os .Sh NAME @@ -47,27 +47,43 @@ The .Nm utility monitors the system state and sets various power control options accordingly. -It offers four modes (maximum, minimum, adaptive and hiadaptive) that can be -individually selected while on AC power or batteries. -The modes maximum, minimum, adaptive and hiadaptive may be abbreviated -max, min, adp, hadp. -.Pp -Maximum mode chooses the highest performance values. -Minimum mode selects the lowest performance values to get the most power -savings. -Adaptive mode attempts to strike a balance by degrading performance when -the system appears idle and increasing it when the system is busy. +It offers power-saving modes that can be +individually selected for operation on AC power or batteries. +.Bl -tag -width ".Ar hiadaptive" +.It Ar maximum +Choose the highest performance values. +May be abbreviated as +.Ar max . +.It Ar minimum +Choose the lowest performance values to get the most power savings. +May be abbreviated as +.Ar min . +.It Ar adaptive +Attempt to strike a balance by degrading performance when the system +appears idle and increasing it when the system is busy. It offers a good balance between a small performance loss for greatly increased power savings. -Hiadaptive mode is like adaptive mode, but tuned for systems where -performance and interactivity are more important than power consumption. -It increases frequency faster, reduces the frequency less aggressively and +May be abbreviated as +.Ar adp . +.It Ar hiadaptive +Like +.Ar adaptive +mode, but tuned for systems where performance and interactivity are +more important than power consumption. +It increases frequency faster, reduces frequency less aggressively, and will maintain full frequency for longer. -The default mode is adaptive for battery power and hiadaptive for the rest. +May be abbreviated as +.Ar hadp . +.El +.Pp +The default mode is +.Ar adaptive +for battery power and +.Ar hiadaptive +for the rest. .Pp -The .Nm -utility recognizes the following runtime options: +recognizes these runtime options: .Bl -tag -width ".Fl r Ar percent" .It Fl a Ar mode Selects the diff --git a/usr.sbin/powerd/powerd.c b/usr.sbin/powerd/powerd.c index 254c237..2c6eac2 100644 --- a/usr.sbin/powerd/powerd.c +++ b/usr.sbin/powerd/powerd.c @@ -154,7 +154,7 @@ read_usage_times(int *load) error = sysctl(cp_times_mib, 2, cp_times, &cp_times_len, NULL, 0); if (error) return (error); - + if (load) { *load = 0; for (cpu = 0; cpu < ncpus; cpu++) { @@ -165,7 +165,7 @@ read_usage_times(int *load) } if (total == 0) continue; - *load += 100 - (cp_times[cpu * CPUSTATES + CP_IDLE] - + *load += 100 - (cp_times[cpu * CPUSTATES + CP_IDLE] - cp_times_old[cpu * CPUSTATES + CP_IDLE]) * 100 / total; } } @@ -236,7 +236,7 @@ get_freq(void) { size_t len; int curfreq; - + len = sizeof(curfreq); if (sysctl(freq_mib, 4, &curfreq, &len, NULL, 0) != 0) { if (vflag) @@ -262,7 +262,7 @@ static int get_freq_id(int freq, int *freqs, int numfreqs) { int i = 1; - + while (i < numfreqs) { if (freqs[i] < freq) break; @@ -717,7 +717,7 @@ main(int argc, char * argv[]) idle = 0; if (set_freq(freq) != 0) { warn("error setting CPU freq %d", - freq); + freq); continue; } } @@ -730,7 +730,7 @@ main(int argc, char * argv[]) warn("read_usage_times() failed"); continue; } - + if (mode == MODE_ADAPTIVE) { if (load > cpu_running_mark) { if (load > 95 || load > cpu_running_mark * 2) @@ -741,7 +741,7 @@ main(int argc, char * argv[]) freq = freqs[0]; } else if (load < cpu_idle_mark && curfreq * load < freqs[get_freq_id( - freq * 7 / 8, freqs, numfreqs)] * + freq * 7 / 8, freqs, numfreqs)] * cpu_running_mark) { freq = freq * 7 / 8; if (freq < freqs[numfreqs - 1]) @@ -757,7 +757,7 @@ main(int argc, char * argv[]) freq = freqs[0] * 2; } else if (load < cpu_idle_mark / 2 && curfreq * load < freqs[get_freq_id( - freq * 31 / 32, freqs, numfreqs)] * + freq * 31 / 32, freqs, numfreqs)] * cpu_running_mark / 2) { freq = freq * 31 / 32; if (freq < freqs[numfreqs - 1]) |