Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Sep 1997 16:37:41 +0200 (MET DST)
From:      Wolfram Schneider <wosch@cs.tu-berlin.de>
To:        current@freebsd.org
Subject:   realtime priority support for top(1)
Message-ID:  <199709231437.QAA03153@panke.panke.de>

next in thread | raw e-mail | index | archive | help

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 <sys/proc.h>
 #include <sys/user.h>
 #include <sys/vmmeter.h>
+#include <sys/resource.h>
+#include <sys/rtprio.h>
 
 /* Swap */
 #include <stdlib.h>
@@ -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   <wosch@apfel.de>   http://www.apfel.de/~wosch/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199709231437.QAA03153>