From owner-freebsd-current@FreeBSD.ORG Wed Dec 7 03:53:45 2005 Return-Path: X-Original-To: current@freebsd.org 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 375C316A41F; Wed, 7 Dec 2005 03:53:45 +0000 (GMT) (envelope-from nate@root.org) Received: from www.cryptography.com (li-22.members.linode.com [64.5.53.22]) by mx1.FreeBSD.org (Postfix) with ESMTP id 23EE343D58; Wed, 7 Dec 2005 03:53:43 +0000 (GMT) (envelope-from nate@root.org) Received: from [172.16.0.224] (fi01-84CBdd.tokyo.flets.isao.net [211.132.203.221]) by www.cryptography.com (8.12.8/8.12.8) with ESMTP id jB73rYdu007045 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 6 Dec 2005 19:53:35 -0800 Message-ID: <43965CB2.5000707@root.org> Date: Wed, 07 Dec 2005 12:53:22 +0900 From: Nate Lawson User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 To: =?ISO-8859-1?Q?Dag-Erling_Sm=F8rgrav?= References: <43938F61.1050202@terranova.net> <4393F60E.2040106@shapeshifter.se> <86mzjflc97.fsf@xps.des.no> <439495B1.5060305@shapeshifter.se> <861x0qmuen.fsf@xps.des.no> <43956ADF.4050504@shapeshifter.se> <86slt6lb9s.fsf@xps.des.no> <4395A265.8080006@root.org> <86d5k9eric.fsf@xps.des.no> <868xuxer6f.fsf@xps.des.no> In-Reply-To: <868xuxer6f.fsf@xps.des.no> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Cc: njl@freebsd.org, Fredrik Lindberg , Travis Mikalson , current@freebsd.org Subject: Re: powerd X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 07 Dec 2005 03:53:45 -0000 Dag-Erling Smørgrav wrote: > des@des.no (Dag-Erling Smørgrav) writes: > >>powerd is a mess, BTW. I've tried to fix the most blatant mistakes >>(poor understanding of signal handling), but it basically needs a >>rewrite. Thanks for the patch. I'll review it later today and try to commit it. > The signal handling code can probably be removed entirely. Its only > purpose is to catch SIGINT / SIGTERM so powerd can print some stats > before exiting, but said stats are meaningless because: > > a) they assume that the main loop runs once every poll_interval, when > in fact the time between two successive iterations can range from > microseconds (interrupted usleep() / select()) to hours or even > days (suspended laptop). > > b) even assuming that a) does not apply and that ACPI provides > accurate values, it still only reports power consumed by the CPU, > not by peripherals or the LCD backlight. Both a) and b) are not applicable. The goal of those stats is to assist with profiling various algorithms. You can compare the total power consumed over the same interval and workload for different algorithms to decide which is best. Since the stats are only printed in verbose mode (and it doesn't daemonize in that mode), testers should know that suspending/resuming would cause the number to be inaccurate, it's only an estimate, and that it only pertains to CPU power. I'll make sure the signal handling is cleaned up when I commit it. -- Nate