From owner-freebsd-current@FreeBSD.ORG Mon Apr 18 12:35:31 2005 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1D7F916A4CE for ; Mon, 18 Apr 2005 12:35:31 +0000 (GMT) Received: from sigma.informatik.hu-berlin.de (sigma.informatik.hu-berlin.de [141.20.20.51]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3785243D1F for ; Mon, 18 Apr 2005 12:35:30 +0000 (GMT) (envelope-from sebastian.ssmoller@gmx.net) Received: from hadriel.linnet (wll192-81.wlan.hu-berlin.de [141.20.192.81]) (authenticated bits=0) (8.12.10/8.12.9/INF-2.0-MA-SOLARIS-2.8) with ESMTP id j3ICZTGR011666 for ; Mon, 18 Apr 2005 14:35:29 +0200 (MEST) Date: Mon, 18 Apr 2005 14:35:23 +0200 From: sebastian ssmoller To: freebsd-current@freebsd.org Message-Id: <20050418143523.3d935084.sebastian.ssmoller@gmx.net> In-Reply-To: <2428.1113827273@critter.freebsd.dk> References: <2304.1113826754@critter.freebsd.dk> <2428.1113827273@critter.freebsd.dk> X-Mailer: Sylpheed version 1.0.4 (GTK+ 1.2.10; i386-portbld-freebsd6.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: powerd(8) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Apr 2005 12:35:31 -0000 wow - that was fast ;-) thx - i'll give it a try today and i'll let u know how it works thx regards, seb On Mon, 18 Apr 2005 14:27:53 +0200 "Poul-Henning Kamp" wrote: > > Here's a patch which implements "phk" mode: > > > Index: powerd.c > =================================================================== > RCS file: /home/ncvs/src/usr.sbin/powerd/powerd.c,v > retrieving revision 1.4 > diff -u -r1.4 powerd.c > --- powerd.c 27 Feb 2005 01:58:49 -0000 1.4 > +++ powerd.c 18 Apr 2005 12:26:03 -0000 > @@ -50,6 +50,7 @@ > enum modes_t { > MODE_MIN, > MODE_ADAPTIVE, > + MODE_PHK, > MODE_MAX, > }; > > @@ -220,6 +221,8 @@ > *mode = MODE_MAX; > else if (strcmp(arg, "adaptive") == 0) > *mode = MODE_ADAPTIVE; > + else if (strcmp(arg, "phk") == 0) > + *mode = MODE_PHK; > else > errx(1, "bad option: -%c %s", (char)ch, optarg); > } > @@ -377,6 +380,37 @@ > if (read_usage_times(&idle, &total)) > err(1, "read_usage_times"); > > + if (mode == MODE_PHK) { > + 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[i]); > + } > + if (set_freq(freqs[i])) > + err(1, "error setting CPU frequency %d", freqs[i]); > + } else if (idle > (total * cpu_idle_mark) / 100 && > + curfreq > freqs[numfreqs - 1]) { > + i++; > + if (vflag) { > + printf("idle time > %d%%, decreasing clock" > + " speed from %d MHz to %d MHz\n", > + cpu_idle_mark, curfreq, freqs[i]); > + } > + if (set_freq(freqs[i])) > + err(1, "error setting CPU frequency %d", freqs[i]); > + } > + continue; > + } > + > /* > * 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 > > -- > Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 > phk@FreeBSD.ORG | TCP/IP since RFC 956 > FreeBSD committer | BSD since 4.3-tahoe > Never attribute to malice what can adequately be explained by > incompetence. _______________________________________________ > freebsd-current@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-current > To unsubscribe, send any mail to > "freebsd-current-unsubscribe@freebsd.org" >