From owner-cvs-src@FreeBSD.ORG Wed Aug 24 11:15:01 2005 Return-Path: X-Original-To: cvs-src@FreeBSD.org Delivered-To: cvs-src@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id AB28F16A41F; Wed, 24 Aug 2005 11:15:01 +0000 (GMT) (envelope-from ume@mahoroba.org) Received: from ameno.mahoroba.org (gw4.mahoroba.org [218.45.22.175]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6C96C43D73; Wed, 24 Aug 2005 11:14:48 +0000 (GMT) (envelope-from ume@mahoroba.org) Received: from localhost (IDENT:ywE/LCn3W74ppxxSDOfRMG5PkOAjCBovyWY+OmHtqX+KFEoDK9S0grnD3I3Oqz0r@localhost [IPv6:::1]) (user=ume mech=CRAM-MD5 bits=0) by ameno.mahoroba.org (8.13.3/8.13.3) with ESMTP/inet6 id j7OBEgxL026915 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 24 Aug 2005 20:14:43 +0900 (JST) (envelope-from ume@mahoroba.org) Date: Wed, 24 Aug 2005 20:14:42 +0900 Message-ID: From: Hajimu UMEMOTO To: Bruno Ducrot In-Reply-To: <200508240752.j7O7qxep016309@repoman.freebsd.org> References: <200508240752.j7O7qxep016309@repoman.freebsd.org> User-Agent: xcite1.38> Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.7 (=?ISO-8859-4?Q?Sanj=F2?=) APEL/10.6 Emacs/21.3 (i386--freebsd) MULE/5.0 (SAKAKI) X-Operating-System: FreeBSD 5.4-STABLE X-PGP-Key: http://www.imasy.or.jp/~ume/publickey.asc X-PGP-Fingerprint: 1F00 0B9E 2164 70FC 6DC5 BF5F 04E9 F086 BF90 71FE Organization: Internet Mutual Aid Society, YOKOHAMA MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0 (ameno.mahoroba.org [IPv6:::1]); Wed, 24 Aug 2005 20:14:44 +0900 (JST) X-Virus-Scanned: by amavisd-new X-Virus-Status: Clean X-Spam-Status: No, score=-5.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.0.4 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on ameno.mahoroba.org Cc: cvs-src@FreeBSD.org, src-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/usr.sbin/powerd powerd.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Aug 2005 11:15:02 -0000 Hi, >>>>> On Wed, 24 Aug 2005 07:52:59 +0000 (UTC) >>>>> Bruno Ducrot said: bruno> Modified files: bruno> usr.sbin/powerd powerd.c bruno> Log: bruno> Change the default adaptive algorithm for phk's one. Thanks to phk bruno> and Kevin Oberman for this work. It feels too lazy for my laptop. One freq level for decreasing and two freq level for incresing is comfortable to me. Is there any chance to add an option for changing step for increasing or decreasing CPU freq level? Index: usr.sbin/powerd/powerd.8 diff -u usr.sbin/powerd/powerd.8.orig usr.sbin/powerd/powerd.8 --- usr.sbin/powerd/powerd.8.orig Thu Jul 21 18:35:33 2005 +++ usr.sbin/powerd/powerd.8 Wed Aug 24 20:02:59 2005 @@ -37,6 +37,7 @@ .Op Fl i percent .Op Fl n mode .Op Fl p ival +.Op Fl s step .Op Fl r percent .Op Fl v .Sh DESCRIPTION @@ -82,6 +83,10 @@ Specifies a different polling interval (in milliseconds) for AC line state and system idle levels. The default is 500 ms. +.It Fl s Ar step +Specifies the step for increasing or decreasing the CPU frequency +level. +The default is 1. .It Fl r Ar percent Specifies the CPU idle percent level where adaptive Index: usr.sbin/powerd/powerd.c diff -u -p usr.sbin/powerd/powerd.c.orig usr.sbin/powerd/powerd.c --- usr.sbin/powerd/powerd.c.orig Wed Aug 24 19:38:34 2005 +++ usr.sbin/powerd/powerd.c Wed Aug 24 20:04:48 2005 @@ -244,7 +244,7 @@ usage(void) { fprintf(stderr, -"usage: powerd [-v] [-a mode] [-b mode] [-i %%] [-n mode] [-p ival] [-r %%]\n"); +"usage: powerd [-v] [-a mode] [-b mode] [-i %%] [-n mode] [-p ival] [-r %%] [-s step]\n"); exit(1); } @@ -253,7 +253,7 @@ main(int argc, char * argv[]) { long idle, total; int curfreq, *freqs, i, *mwatts, numfreqs; - int ch, mode_ac, mode_battery, mode_none, acline, mode, vflag; + int ch, mode_ac, mode_battery, mode_none, acline, mode, vflag, step; uint64_t mjoules_used; size_t len; @@ -264,9 +264,10 @@ main(int argc, char * argv[]) poll_ival = DEFAULT_POLL_INTERVAL; mjoules_used = 0; vflag = 0; + step = 1; apm_fd = -1; - while ((ch = getopt(argc, argv, "a:b:i:n:p:r:v")) != EOF) + while ((ch = getopt(argc, argv, "a:b:i:n:p:r:s:v")) != EOF) switch (ch) { case 'a': parse_mode(optarg, &mode_ac, ch); @@ -300,6 +301,13 @@ main(int argc, char * argv[]) usage(); } break; + case 's': + step = atoi(optarg); + if (step < 1) { + warnx("%d is not a valid step", step); + usage(); + } + break; case 'v': vflag = 1; break; @@ -427,7 +435,7 @@ main(int argc, char * argv[]) } if (idle < (total * cpu_running_mark) / 100 && curfreq < freqs[0]) { - i -= 2; + i -= step * 2; if (i < 0) i = 0; if (vflag) { @@ -440,7 +448,9 @@ main(int argc, char * argv[]) freqs[i]); } else if (idle > (total * cpu_idle_mark) / 100 && curfreq > freqs[numfreqs - 1]) { - i++; + i += step; + if (i >= numfreqs) + i = numfreqs - 1; if (vflag) { printf("idle time > %d%%, decreasing clock" " speed from %d MHz to %d MHz\n", Sincerely, -- Hajimu UMEMOTO @ Internet Mutual Aid Society Yokohama, Japan ume@mahoroba.org ume@{,jp.}FreeBSD.org http://www.imasy.org/~ume/