124139Sjoerg/* 289758Sdwmalone * $FreeBSD: stable/11/contrib/top/machine.h 322509 2017-08-14 15:08:49Z gahr $ 389758Sdwmalone */ 489758Sdwmalone 589758Sdwmalone/* 624139Sjoerg * This file defines the interface between top and the machine-dependent 724139Sjoerg * module. It is NOT machine dependent and should not need to be changed 824139Sjoerg * for any specific machine. 924139Sjoerg */ 10300395Sngie#ifndef MACHINE_H 11300395Sngie#define MACHINE_H 1224139Sjoerg 13300395Sngie#include "top.h" 14300395Sngie 1524139Sjoerg/* 1624139Sjoerg * the statics struct is filled in by machine_init 1724139Sjoerg */ 1824139Sjoergstruct statics 1924139Sjoerg{ 2024139Sjoerg char **procstate_names; 2124139Sjoerg char **cpustate_names; 2224139Sjoerg char **memory_names; 23237656Sjhb char **arc_names; 24318449Sallanjude char **carc_names; 2524142Sjoerg char **swap_names; 2624139Sjoerg#ifdef ORDER 2724139Sjoerg char **order_names; 2824139Sjoerg#endif 29175420Speter int ncpus; 3024139Sjoerg}; 3124139Sjoerg 3224139Sjoerg/* 3324139Sjoerg * the system_info struct is filled in by a machine dependent routine. 3424139Sjoerg */ 3524139Sjoerg 3689758Sdwmalone#ifdef p_active /* uw7 define macro p_active */ 3789758Sdwmalone#define P_ACTIVE p_pactive 3889758Sdwmalone#else 3989758Sdwmalone#define P_ACTIVE p_active 4089758Sdwmalone#endif 4189758Sdwmalone 4224139Sjoergstruct system_info 4324139Sjoerg{ 4424139Sjoerg int last_pid; 4524139Sjoerg double load_avg[NUM_AVERAGES]; 4624139Sjoerg int p_total; 4789758Sdwmalone int P_ACTIVE; /* number of procs considered "active" */ 4824139Sjoerg int *procstates; 4924139Sjoerg int *cpustates; 5024139Sjoerg int *memory; 51237656Sjhb int *arc; 52318449Sallanjude int *carc; 5324142Sjoerg int *swap; 5442447Sobrien struct timeval boottime; 55175420Speter int ncpus; 5624139Sjoerg}; 5724139Sjoerg 5824139Sjoerg/* cpu_states is an array of percentages * 10. For example, 5924139Sjoerg the (integer) value 105 is 10.5% (or .105). 6024139Sjoerg */ 6124139Sjoerg 6224139Sjoerg/* 6324139Sjoerg * the process_select struct tells get_process_info what processes we 6424139Sjoerg * are interested in seeing 6524139Sjoerg */ 6624139Sjoerg 6724139Sjoergstruct process_select 6824139Sjoerg{ 6924139Sjoerg int idle; /* show idle processes */ 7038090Sdes int self; /* show self */ 7124139Sjoerg int system; /* show system processes */ 72117709Sjulian int thread; /* show threads */ 73322509Sgahr#define TOP_MAX_UIDS 8 74322509Sgahr int uid[TOP_MAX_UIDS]; /* only these uids (unless uid[0] == -1) */ 75146342Skeramida int wcpu; /* show weighted cpu */ 76265249Sbdrewery int jid; /* only this jid (unless jid == -1) */ 77169257Srafan int jail; /* show jail ID */ 78307757Sdes int swap; /* show swap usage */ 79222530Sjhb int kidle; /* show per-CPU idle threads */ 8024139Sjoerg char *command; /* only this command (unless == NULL) */ 8124139Sjoerg}; 8224139Sjoerg 8324139Sjoerg/* routines defined by the machine dependent module */ 8424139Sjoerg 85300395Sngiechar *format_header(); 86300395Sngiechar *format_next_process(); 87300395Sngievoid toggle_pcpustats(void); 88300395Sngievoid get_system_info(struct system_info *si); 89307757Sdesint machine_init(struct statics *statics, char do_unames); 90307757Sdesint proc_owner(int pid); 9124139Sjoerg 9224139Sjoerg/* non-int routines typically used by the machine dependent module */ 93300395Sngiechar *printable(); 94300395Sngie 95300395Sngie#endif /* MACHINE_H */ 96