home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume26 / cputt-2.3 / part01 / cputt.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-04-05  |  2.2 KB  |  66 lines

  1. #define MAXUSERS       300 /* set this to (length of /etc/passwd * 2) */
  2. #define MAXACTIVE       50 /* max cpu-positive processes per interval */
  3. #define MAXOUT          10 /* output is limitted to this many processes */
  4. #define COMMAND_SIZE    51 /* set this to (width of your window - 29) */
  5. #define UNAMELEN         8 /* max length for username */
  6.  
  7. /*
  8.    cputt attempts to truncate unused slots at the end of the process
  9.    table.  This usually reduces its runtime size considerably.  If the
  10.    process table grows or shrinks by a significant amount, cputt will
  11.    restart itself and resize its internal data structures accordingly.
  12. */
  13.  
  14. #define GROWTH_BUF      40 /* growth buffer, use 0 to disable truncation */
  15. #define MAX_GROW        20 /* restart after proc table grows this much */
  16. #define MAX_SHRINK      10 /* restart after proc table shrinks this much */
  17.  
  18. /* Symbol table entry and value */
  19.  
  20. struct symbol
  21. {
  22.      char          *s_kname;            /* kernel symbol name */
  23.      caddr_t       *s_info;             /* kernel symbol value */
  24. };
  25.  
  26. /* Single hash table entry for mapping uid's to usernames */
  27.  
  28. struct hashtab
  29. {
  30.      short          h_uid;              /* uid of user entry */
  31.      char           h_uname[UNAMELEN];  /* corresponding name */
  32. };
  33.  
  34. /* Critical system info */
  35.  
  36. struct info
  37. {
  38.      struct proc   *i_proc0;            /* address of process table */
  39.      int            i_nproc;            /* length of process table */
  40.      int            i_sproc;            /* size of process table */
  41.      int            i_ecmx;             /* max physical memory address*/
  42.      struct hashtab i_hnames[MAXUSERS]; /* hash table for usernames */
  43. };
  44.  
  45. /* For reading process upages from kernel memory */
  46.  
  47. union userstate
  48. {
  49.      struct user     u_us;
  50.      char            u_pg[UPAGES][NBPG];
  51. };
  52.  
  53. /* Summary info for processes with positive cpu utilization */
  54.  
  55. struct sortdata
  56. {
  57.      struct proc    *proc;              /* proc structure */
  58.      long            pctcpu;            /* cpu usage */
  59.      int             pr_cmd;            /* command string index */
  60. };
  61.  
  62. extern kvm_t          *Flkvm;
  63. extern union userstate User;
  64. extern struct symbol   Symbollist[];
  65. extern struct info     Info;
  66.