From owner-freebsd-current Tue Sep 23 07:40:57 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id HAA14241 for current-outgoing; Tue, 23 Sep 1997 07:40:57 -0700 (PDT) Received: from mail.cs.tu-berlin.de (root@mail.cs.tu-berlin.de [130.149.17.13]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id HAA14234 for ; Tue, 23 Sep 1997 07:40:52 -0700 (PDT) Received: from panke.panke.de (anonymous213.ppp.cs.tu-berlin.de [130.149.17.213]) by mail.cs.tu-berlin.de (8.8.6/8.8.6) with ESMTP id QAA24154 for ; Tue, 23 Sep 1997 16:39:43 +0200 (MET DST) Received: (from wosch@localhost) by panke.panke.de (8.8.5/8.6.12) id QAA03153; Tue, 23 Sep 1997 16:37:41 +0200 (MET DST) Date: Tue, 23 Sep 1997 16:37:41 +0200 (MET DST) Message-Id: <199709231437.QAA03153@panke.panke.de> From: Wolfram Schneider To: current@freebsd.org Subject: realtime priority support for top(1) MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Sender: owner-freebsd-current@freebsd.org X-Loop: FreeBSD.org Precedence: bulk The patch print the real/idle time priority in the nice field. normal time -> nice value -20 - +20 real time 0 - 31 -> nice value -52 - -21 idle time 0 - 31 -> nice value +21 - +52 [-stable patch] Index: machine.c =================================================================== RCS file: /usr/cvs/src/usr.bin/top/machine.c,v retrieving revision 1.3.2.1 diff -u -r1.3.2.1 machine.c --- machine.c 1997/05/31 03:18:12 1.3.2.1 +++ machine.c 1997/09/23 14:36:04 @@ -38,6 +38,8 @@ #include #include #include +#include +#include /* Swap */ #include @@ -584,7 +586,17 @@ PP(pp, p_pid), (*get_userid)(EP(pp, e_pcred.p_ruid)), PP(pp, p_priority) - PZERO, - PP(pp, p_nice) - NZERO, + + /* + * normal time -> nice value -20 - +20 + * real time 0 - 31 -> nice value -52 - -21 + * idle time 0 - 31 -> nice value +21 - +52 + */ + (PP(pp, p_rtprio.type) == RTP_PRIO_NORMAL ? + PP(pp, p_nice) - NZERO : + (PP(pp, p_rtprio.type) == RTP_PRIO_REALTIME ? + (PRIO_MIN - 1 - RTP_PRIO_MAX + PP(pp, p_rtprio.prio)) : + (PRIO_MAX + 1 + PP(pp, p_rtprio.prio)))), format_k2(pagetok(PROCSIZE(pp))), format_k2(pagetok(VP(pp, vm_rssize))), status, -- Wolfram Schneider http://www.apfel.de/~wosch/