machine.h revision 300395
1/*
2 * $FreeBSD: head/contrib/top/machine.h 300395 2016-05-22 04:17:00Z 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 */
18struct 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
41struct 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
65struct 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
81char	*format_header();
82char	*format_next_process();
83void	 toggle_pcpustats(void);
84void	 get_system_info(struct system_info *si);
85int		 machine_init(struct statics *statics, char do_unames);
86int		 proc_owner(int pid);
87
88/* non-int routines typically used by the machine dependent module */
89char	*printable();
90
91#endif /* MACHINE_H */
92