]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - usr.bin/top/machine.h
top(1): assume that we're building on FreeBSD
[FreeBSD/FreeBSD.git] / usr.bin / top / machine.h
1 /*
2  * $FreeBSD$
3  */
4
5 /*
6  *  This file defines the interface between top and the machine-dependent
7  *  module.  It is NOT machine dependent and should not need to be changed
8  *  for any specific machine.
9  */
10 #ifndef MACHINE_H
11 #define MACHINE_H
12
13 #include "top.h"
14
15 /*
16  * the statics struct is filled in by machine_init
17  */
18 struct statics
19 {
20     char **procstate_names;
21     char **cpustate_names;
22     char **memory_names;
23     char **arc_names;
24     char **carc_names;
25     char **swap_names;
26     char **order_names;
27     int ncpus;
28 };
29
30 /*
31  * the system_info struct is filled in by a machine dependent routine.
32  */
33
34 #ifdef p_active     /* uw7 define macro p_active */
35 #define P_ACTIVE p_pactive
36 #else
37 #define P_ACTIVE p_active
38 #endif
39
40 struct system_info
41 {
42     int    last_pid;
43     double load_avg[NUM_AVERAGES];
44     int    p_total;
45     int    P_ACTIVE;     /* number of procs considered "active" */
46     int    *procstates;
47     int    *cpustates;
48     int    *memory;
49     int    *arc;
50     int    *carc;
51     int    *swap;
52     struct timeval boottime;
53     int    ncpus;
54 };
55
56 /* cpu_states is an array of percentages * 10.  For example, 
57    the (integer) value 105 is 10.5% (or .105).
58  */
59
60 /*
61  * the process_select struct tells get_process_info what processes we
62  * are interested in seeing
63  */
64
65 struct process_select
66 {
67     int idle;           /* show idle processes */
68     int self;           /* show self */
69     int system;         /* show system processes */
70     int thread;         /* show threads */
71 #define TOP_MAX_UIDS 8
72     int uid[TOP_MAX_UIDS];      /* only these uids (unless uid[0] == -1) */
73     int wcpu;           /* show weighted cpu */
74     int jid;            /* only this jid (unless jid == -1) */
75     int jail;           /* show jail ID */
76     int swap;           /* show swap usage */
77     int kidle;          /* show per-CPU idle threads */
78     char *command;      /* only this command (unless == NULL) */
79 };
80
81 /* routines defined by the machine dependent module */
82
83 char    *format_header(char *uname_field);
84 char    *format_next_process(caddr_t handle, char *(*get_userid)(int),
85             int flags);
86 void     toggle_pcpustats(void);
87 void     get_system_info(struct system_info *si);
88 int      machine_init(struct statics *statics, char do_unames);
89 int      proc_owner(int pid);
90
91 /* non-int routines typically used by the machine dependent module */
92 char    *printable(char *string);
93
94 #endif /* MACHINE_H */