[RFC] prototype of top(1)'s CPU current frequency display

From: Norikatsu Shigemura <nork_at_FreeBSD.org>
Date: Sun, 20 Aug 2006 17:24:35 +0900
	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
_at__at_ -153,10 +153,10 _at__at_
 
 /* 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
 };
 
_at__at_ -628,6 +628,9 _at__at_
 			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)
Received on Sun Aug 20 2006 - 06:24:45 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:59 UTC