📄 statinfo.h
字号:
#ifndef _STATINFO_H_#define _STATINFO_H_#include <sys/types.h>#include <sys/utsname.h>#define MAX_CPUS 8#define MAX_PROCS 256struct time_format { int day; int hour; int minute; int second;};/* all processes's information, like ps */struct _proc_stat { char user[15]; /* process's owner */ char state; /* process state */ pid_t pid; /* process PID */ pid_t ppid; /* process's parent's PID */ char cpu_percent[8]; /* cpu utilization */ char mem_percent[8]; /* memory utilization */ int page_fault; /* number of page faults */ int last_cpu; /* last CPU this process is running on */ int vsize; /* virtual memory size in KBytes */ int rss; /* resident set size in KBytes */ char usr_time[16]; /* user time in seconds */ char sys_time[16]; /* system time in seconds */ char command[32]; /* the filename of executable */ char cwd[128]; /* current working directory */ char exe[128]; /* actual pathname of the executed command */ struct time_format time_lasting; /* how long has this process lasting */};typedef struct _proc_stat proc_stat_t;struct _proc_list { int num_of_procs; proc_stat_t procs[MAX_PROCS];};typedef struct _proc_list proc_list_t;/* load information for one host */struct _system_load_info { int num_of_cpu; /* number of CPUs */ char loadavg[3][8]; /* load averages, loadavg[3] is no use. */ char dummy0[8]; char cpu_freq[MAX_CPUS][16]; /* cpu frequencies */ char cpu_util[MAX_CPUS][16]; /* cpu utiliazations */ int total_mem; /* total memory capacity */ int free_mem; /* free memory capacity */ struct utsname sysinfo; /* os, machine ... */ char dummy1[10]; /* to align */};typedef struct _system_load_info system_load_info;/* request for load information */struct load_request { int type; /* load type */};/* reply to load request */struct load_reply { int result;};#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -