#ifndef MACHINE_H
#define MACHINE_H
#include <sys/time.h>
#include <sys/types.h>
#define NUM_AVERAGES 3
#define LOG1024 10
struct statics
{
const char * const *procstate_names;
const char * const *cpustate_names;
const char * const *memory_names;
const char * const *arc_names;
const char * const *carc_names;
const char * const *swap_names;
const char * const *order_names;
int nbatteries;
int ncpus;
};
struct system_info
{
int last_pid;
double load_avg[NUM_AVERAGES];
int p_total;
int p_pactive;
int *procstates;
int *cpustates;
int *memory;
int *arc;
int *carc;
int *swap;
struct timeval boottime;
int battery;
int ncpus;
};
struct process_select
{
bool idle;
bool self;
bool system;
bool thread;
bool thread_id;
#define TOP_MAX_UIDS 8
int uid[TOP_MAX_UIDS];
bool wcpu;
int jid;
bool jail;
bool swap;
bool kidle;
int pid;
char *command;
};
struct handle;
char *format_header(const char *uname_field);
char *format_next_process(struct handle* handle, char *(*get_userid)(int),
int flags);
void toggle_pcpustats(void);
void get_system_info(struct system_info *si);
int machine_init(struct statics *statics);
struct sort_info;
extern struct process_select ps;
void *
get_process_info(struct system_info *si, struct process_select *sel,
const struct sort_info *);
const struct sort_info *get_sort_info(const char *name);
void dump_sort_names(FILE *fp);
#endif