From owner-freebsd-hackers@FreeBSD.ORG Sun Aug 20 08:24:45 2006 Return-Path: X-Original-To: freebsd-hackers@FreeBSD.org Delivered-To: freebsd-hackers@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 85DC216A4DA; Sun, 20 Aug 2006 08:24:45 +0000 (UTC) (envelope-from nork@FreeBSD.org) Received: from sakura.ninth-nine.com (sakura.ninth-nine.com [219.127.74.120]) by mx1.FreeBSD.org (Postfix) with ESMTP id BAD7A43D49; Sun, 20 Aug 2006 08:24:42 +0000 (GMT) (envelope-from nork@FreeBSD.org) Received: from mail.ninth-nine.com ([IPv6:2001:3e0:4cf:1:d2:ff:fe23:1b4]) (authenticated bits=0) by sakura.ninth-nine.com (8.13.6/8.13.6/NinthNine) with ESMTP id k7K8OZic014237 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 20 Aug 2006 17:24:41 +0900 (JST) (envelope-from nork@FreeBSD.org) Date: Sun, 20 Aug 2006 17:24:35 +0900 From: Norikatsu Shigemura To: freebsd-hackers@FreeBSD.org Message-Id: <20060820172435.26c4cc2a.nork@FreeBSD.org> X-Mailer: Sylpheed version 2.2.7 (GTK+ 2.8.20; i386-portbld-freebsd7.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (sakura.ninth-nine.com [IPv6:2001:3e0:4cf:0:230:48ff:fe41:2455]); Sun, 20 Aug 2006 17:24:41 +0900 (JST) Cc: freebsd-current@FreeBSD.org Subject: [RFC] prototype of top(1)'s CPU current frequency display X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Aug 2006 08:24:45 -0000 I want to see CPU current frequency on top(1), because I want to see relation of process status (CPU usage) and cpu current frequency using powerd(8) on the fly. In recently, many CPUs for servers like Xeon support frequency changing like Speed Step Technology. I run powerd(8) on these servers. So I should know performance issue, whichever program performance or server performance. I wrote a little usability patch. But I don't think that my code is not good:-(. So please improve my code. Wellknown problem. 1. assume only 1 CPU. 2. assume dev.cpu.0.freq is always exists. 3. display position is good? --- usr.bin/top/machine.c.orig Wed May 18 22:42:51 2005 +++ usr.bin/top/machine.c Sun Aug 20 16:41:59 2006 @@ -153,10 +153,10 @@ /* these are for detailing the process states */ -int process_states[8]; +int process_states[9]; char *procstatenames[] = { "", " starting, ", " running, ", " sleeping, ", " stopped, ", - " zombie, ", " waiting, ", " lock, ", + " zombie, ", " waiting, ", " lock, ", " MHz, ", NULL }; @@ -628,6 +628,9 @@ prev_pp->ki_pctcpu += pp->ki_pctcpu; } } + + /* CPU current frequency */ + GETSYSCTL("dev.cpu.0.freq", process_states[8]); /* if requested, sort the "interesting" processes */ if (compare != NULL)