From owner-freebsd-smp Fri Oct 4 22:25:52 1996 Return-Path: owner-smp Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id WAA26405 for smp-outgoing; Fri, 4 Oct 1996 22:25:52 -0700 (PDT) Received: from spinner.DIALix.COM (root@spinner.DIALix.COM [192.203.228.67]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id WAA26397 for ; Fri, 4 Oct 1996 22:25:43 -0700 (PDT) Received: from spinner.DIALix.COM (peter@localhost.DIALix.oz.au [127.0.0.1]) by spinner.DIALix.COM (8.8.0/8.8.0) with ESMTP id NAA00432 for ; Sat, 5 Oct 1996 13:25:33 +0800 (WST) Message-Id: <199610050525.NAA00432@spinner.DIALix.COM> To: smp@freebsd.org Subject: top patches for smp.. Date: Sat, 05 Oct 1996 13:25:32 +0800 From: Peter Wemm Sender: owner-smp@freebsd.org X-Loop: FreeBSD.org Precedence: bulk If anybody's interested, these patches will show some extra info when top is running. I can't remember if I've send this already.. Hope not. :-) With this, instead of "RUN", you will see either "CPU0/1" or "RUN/1". In this case, "CPU0/1" means that the process is currently on cpu 0, and the "1" is meaningless.. It's set at the same time I just realised. :-] The idea was that you could see the current and "last" cpu, so you had a chance of seeing procs bouncing from one cpu to another, maybe later.. "RUN/1" means it is runnable, waiting in the run queue and last ran on cpu#1. If 'ps' is showing "31Dec69" or "1Jan70", your libkvm is out of sync. I don't know what has changed that caused this BTW. I changed the /sys symlink so I could compile libkvm and top/ps/etc. Index: files/m_freebsd2.c =================================================================== RCS file: /home/ncvs/ports/sysutils/top/files/m_freebsd2.c,v retrieving revision 1.8 diff -u -r1.8 m_freebsd2.c --- m_freebsd2.c 1996/09/28 09:55:32 1.8 +++ m_freebsd2.c 1996/10/04 18:12:34 @@ -523,6 +523,7 @@ register long cputime; register double pct; struct handle *hp; + char runbuf[16]; /* find and remember the next proc structure */ hp = (struct handle *)handle; @@ -555,6 +556,25 @@ /* calculate the base for cpu percentages */ pct = pctdouble(PP(pp, p_pctcpu)); + /* generate "STATE" field */ + switch (PP(pp, p_stat)) { + case SRUN: + if (PP(pp, p_oncpu) >= 0) + sprintf(runbuf, "CPU#%d/%d", PP(pp, p_oncpu), PP(pp, p_lastcpu)) + else + sprintf(runbuf, "RUN/%d", PP(pp, p_lastcpu)); + break; + case SSLEEP: + if (PP(pp, p_wmesg) != NULL) { + sprintf(runbuf, "%.6s", EP(pp, e_wmesg)); + break; + } + /* fall through */ + default: + sprintf(runbuf, "%s", state_abbrev[(unsigned char) PP(pp, p_stat)]); + break; + } + /* format this entry */ sprintf(fmt, Proc_format, @@ -564,9 +584,7 @@ PP(pp, p_nice) - NZERO, format_k(pagetok(PROCSIZE(pp))), format_k(pagetok(VP(pp, vm_rssize))), - ( (PP(pp, p_stat) == SSLEEP) && (PP(pp, p_wmesg) != NULL) ) ? - EP(pp, e_wmesg) : - state_abbrev[(unsigned char) PP(pp, p_stat)], + runbuf, format_time(cputime), 10000.0 * weighted_cpu(pct, pp) / hz, 10000.0 * pct / hz, Cheers, -Peter