Subject: patch for the top patch
To: None <current-users@NetBSD.ORG>
From: Christos Zoulas <christos@deshaw.com>
List: current-users
Date: 06/17/1997 18:24:22
I liked more the wait proc patch... This is to be applied after Luke's patch.

christos

*** machine.c.orig	Tue Jun 17 18:16:57 1997
--- machine.c	Tue Jun 17 18:12:02 1997
***************
*** 109,120 ****
   */
  
  static char header[] =
!   "  PID X        PRI NICE   SIZE   RES STATE   TIME   WCPU    CPU COMMAND";
  /* 0123456   -- field to fill in starts at header+6 */
  #define UNAME_START 6
  
  #define Proc_format \
! 	"%5d %-8.8s %3d %4d%7s %5s %-5s%7s %5.2f%% %5.2f%% %.14s"
  
  
  /* process state names for the "STATE" column of the display */
--- 109,120 ----
   */
  
  static char header[] =
!   "  PID X        PRI NICE  SIZE   RES STATE WAIT     TIME    CPU COMMAND";
  /* 0123456   -- field to fill in starts at header+6 */
  #define UNAME_START 6
  
  #define Proc_format \
! 	"%5d %-8.8s %3d %4d %5s %5s %-5s %-6.6s %6s %5.2f%% %.14s"
  
  
  /* process state names for the "STATE" column of the display */
***************
*** 474,479 ****
--- 474,480 ----
      long cputime;
      double pct;
      struct handle *hp;
+     char *p_wait, waddr[32];
  
      /* find and remember the next proc structure */
      hp = (struct handle *)handle;
***************
*** 506,513 ****
      /* calculate the base for cpu percentages */
      pct = pctdouble(PP(pp, p_pctcpu));
  
! #define Proc_format \
! 	"%5d %-8.8s %3d %4d%7s %5s %-5s%7s %5.2f%% %5.2f%% %.14s"
  
      /* format this entry */
      sprintf(fmt,
--- 507,522 ----
      /* calculate the base for cpu percentages */
      pct = pctdouble(PP(pp, p_pctcpu));
  
!     if (PP(pp, p_wchan))
!         if (PP(pp, p_wmesg))
! 	    p_wait = EP(pp, e_wmesg);
! 	else {
! 	    sprintf(waddr, "%x", 
! 		(unsigned long)(PP(pp, p_wchan)) & ~KERNBASE);
! 	    p_wait = waddr;
!         }
!     else
! 	p_wait = "-";
  
      /* format this entry */
      sprintf(fmt,
***************
*** 519,526 ****
  	    format_k(pagetok(PROCSIZE(pp))),
  	    format_k(pagetok(VP(pp, vm_rssize))),
  	    state_abbrev[(unsigned char) PP(pp, p_stat)],
  	    format_time(cputime),
- 	    10000.0 * weighted_cpu(pct, pp) / hz,
  	    10000.0 * pct / hz,
  	    printable(PP(pp, p_comm)));
  
--- 528,535 ----
  	    format_k(pagetok(PROCSIZE(pp))),
  	    format_k(pagetok(VP(pp, vm_rssize))),
  	    state_abbrev[(unsigned char) PP(pp, p_stat)],
+ 	    p_wait,
  	    format_time(cputime),
  	    10000.0 * pct / hz,
  	    printable(PP(pp, p_comm)));