1 /* 2 * $FreeBSD: stable/10/contrib/top/machine.h 301836 2016-06-12 05:57:42Z ngie $ 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 **swap_names; 25 #ifdef ORDER 26 char **order_names; 27 #endif 28 int ncpus; 29 }; 30 31 /* 32 * the system_info struct is filled in by a machine dependent routine. 33 */ 34 35 #ifdef p_active /* uw7 define macro p_active */ 36 #define P_ACTIVE p_pactive 37 #else 38 #define P_ACTIVE p_active 39 #endif 40 41 struct system_info 42 { 43 int last_pid; 44 double load_avg[NUM_AVERAGES]; 45 int p_total; 46 int P_ACTIVE; /* number of procs considered "active" */ 47 int *procstates; 48 int *cpustates; 49 int *memory; 50 int *arc; 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 int uid; /* only this uid (unless uid == -1) */ 72 int wcpu; /* show weighted cpu */ 73 int jid; /* only this jid (unless jid == -1) */ 74 int jail; /* show jail ID */ 75 int kidle; /* show per-CPU idle threads */ 76 char *command; /* only this command (unless == NULL) */ 77 }; 78 79 /* routines defined by the machine dependent module */ 80 81 char *format_header(); 82 char *format_next_process(); 83 void toggle_pcpustats(void); 84 void get_system_info(struct system_info *si); 85 int machine_init(struct statics *statics, char do_unames); 86 int proc_owner(int pid); 87 88 /* non-int routines typically used by the machine dependent module */ 89 char *printable(); 90 91 #endif /* MACHINE_H */ 92