📄 sa.h
字号:
unsigned long pgpgout __attribute__ ((aligned (8))); unsigned long pswpin __attribute__ ((aligned (8))); unsigned long pswpout __attribute__ ((aligned (8))); /* Memory stats in kB */ unsigned long frmkb __attribute__ ((aligned (8))); unsigned long bufkb __attribute__ ((aligned (8))); unsigned long camkb __attribute__ ((aligned (8))); unsigned long tlmkb __attribute__ ((aligned (8))); unsigned long frskb __attribute__ ((aligned (8))); unsigned long tlskb __attribute__ ((aligned (8))); unsigned long caskb __attribute__ ((aligned (8))); unsigned long nr_running __attribute__ ((aligned (8))); unsigned long pgfault __attribute__ ((aligned (8))); unsigned long pgmajfault __attribute__ ((aligned (8))); /* --- INT --- */ unsigned int dk_drive __attribute__ ((aligned (8))); unsigned int dk_drive_rio __attribute__ ((packed)); unsigned int dk_drive_wio __attribute__ ((packed)); unsigned int dk_drive_rblk __attribute__ ((packed)); unsigned int dk_drive_wblk __attribute__ ((packed)); unsigned int file_used __attribute__ ((packed)); unsigned int inode_used __attribute__ ((packed)); unsigned int super_used __attribute__ ((packed)); unsigned int super_max __attribute__ ((packed)); unsigned int dquot_used __attribute__ ((packed)); unsigned int dquot_max __attribute__ ((packed)); unsigned int rtsig_queued __attribute__ ((packed)); unsigned int rtsig_max __attribute__ ((packed)); unsigned int sock_inuse __attribute__ ((packed)); unsigned int tcp_inuse __attribute__ ((packed)); unsigned int udp_inuse __attribute__ ((packed)); unsigned int raw_inuse __attribute__ ((packed)); unsigned int frag_inuse __attribute__ ((packed)); unsigned int dentry_stat __attribute__ ((packed)); unsigned int load_avg_1 __attribute__ ((packed)); unsigned int load_avg_5 __attribute__ ((packed)); unsigned int load_avg_15 __attribute__ ((packed)); unsigned int nr_threads __attribute__ ((packed)); unsigned int nfs_rpccnt __attribute__ ((packed)); unsigned int nfs_rpcretrans __attribute__ ((packed)); unsigned int nfs_readcnt __attribute__ ((packed)); unsigned int nfs_writecnt __attribute__ ((packed)); unsigned int nfs_accesscnt __attribute__ ((packed)); unsigned int nfs_getattcnt __attribute__ ((packed)); unsigned int nfsd_rpccnt __attribute__ ((packed)); unsigned int nfsd_rpcbad __attribute__ ((packed)); unsigned int nfsd_netcnt __attribute__ ((packed)); unsigned int nfsd_netudpcnt __attribute__ ((packed)); unsigned int nfsd_nettcpcnt __attribute__ ((packed)); unsigned int nfsd_rchits __attribute__ ((packed)); unsigned int nfsd_rcmisses __attribute__ ((packed)); unsigned int nfsd_readcnt __attribute__ ((packed)); unsigned int nfsd_writecnt __attribute__ ((packed)); unsigned int nfsd_accesscnt __attribute__ ((packed)); unsigned int nfsd_getattcnt __attribute__ ((packed)); /* --- CHAR --- */ /* Record type: R_STATS or R_DUMMY */ unsigned char record_type __attribute__ ((packed)); /* * Time stamp: hour, minute and second. * Used to determine TRUE time (immutable, non locale dependent time). */ unsigned char hour /* (0-23) */ __attribute__ ((packed)); unsigned char minute /* (0-59) */ __attribute__ ((packed)); unsigned char second /* (0-59) */ __attribute__ ((packed));};#define FILE_STATS_SIZE (sizeof(struct file_stats))struct stats_one_cpu { unsigned long long per_cpu_idle __attribute__ ((aligned (16))); unsigned long long per_cpu_iowait __attribute__ ((aligned (16))); unsigned long long per_cpu_user __attribute__ ((aligned (16))); unsigned long long per_cpu_nice __attribute__ ((aligned (16))); unsigned long long per_cpu_system __attribute__ ((aligned (16))); unsigned long long per_cpu_steal __attribute__ ((aligned (16))); unsigned long long pad __attribute__ ((aligned (16)));};#define STATS_ONE_CPU_SIZE (sizeof(struct stats_one_cpu))/* * Members do not need to be aligned since these stats are not written * to daily data files. */struct pid_stats { /* If pid is null, the process has been killed */ unsigned long pid __attribute__ ((aligned (8))); unsigned long minflt __attribute__ ((packed)); unsigned long majflt __attribute__ ((packed)); unsigned long utime __attribute__ ((packed)); unsigned long stime __attribute__ ((packed)); unsigned long nswap __attribute__ ((packed)); unsigned long cminflt __attribute__ ((packed)); unsigned long cmajflt __attribute__ ((packed)); unsigned long cutime __attribute__ ((packed)); unsigned long cstime __attribute__ ((packed)); unsigned long cnswap __attribute__ ((packed)); unsigned int processor __attribute__ ((packed)); unsigned char flag __attribute__ ((packed)); unsigned char pad[3] __attribute__ ((packed));};#define PID_STATS_SIZE (sizeof(struct pid_stats))struct stats_serial { unsigned int rx __attribute__ ((aligned (8))); unsigned int tx __attribute__ ((packed)); unsigned int frame __attribute__ ((packed)); unsigned int parity __attribute__ ((packed)); unsigned int brk __attribute__ ((packed)); unsigned int overrun __attribute__ ((packed)); unsigned int line __attribute__ ((packed)); unsigned char pad[4] __attribute__ ((packed));};#define STATS_SERIAL_SIZE (sizeof(struct stats_serial))/* See linux source file linux/include/linux/netdevice.h */struct stats_net_dev { unsigned long rx_packets __attribute__ ((aligned (8))); unsigned long tx_packets __attribute__ ((aligned (8))); unsigned long rx_bytes __attribute__ ((aligned (8))); unsigned long tx_bytes __attribute__ ((aligned (8))); unsigned long rx_compressed __attribute__ ((aligned (8))); unsigned long tx_compressed __attribute__ ((aligned (8))); unsigned long multicast __attribute__ ((aligned (8))); unsigned long collisions __attribute__ ((aligned (8))); unsigned long rx_errors __attribute__ ((aligned (8))); unsigned long tx_errors __attribute__ ((aligned (8))); unsigned long rx_dropped __attribute__ ((aligned (8))); unsigned long tx_dropped __attribute__ ((aligned (8))); unsigned long rx_fifo_errors __attribute__ ((aligned (8))); unsigned long tx_fifo_errors __attribute__ ((aligned (8))); unsigned long rx_frame_errors __attribute__ ((aligned (8))); unsigned long tx_carrier_errors __attribute__ ((aligned (8))); char interface[MAX_IFACE_LEN] __attribute__ ((aligned (8)));};#define STATS_NET_DEV_SIZE (sizeof(struct stats_net_dev))/* * stats_irq_cpu->irq: IRQ#-A * stats_irq_cpu->interrupt: number of IRQ#-A for proc 0 * stats_irq_cpu->irq: IRQ#-B * stats_irq_cpu->interrupt: number of IRQ#-B for proc 0 * ... * stats_irq_cpu->irq: (undef'd) * stats_irq_cpu->interrupt: number of IRQ#-A for proc 1 * stats_irq_cpu->irq: (undef'd) * stats_irq_cpu->interrupt: number of IRQ#-B for proc 1 * ... */struct stats_irq_cpu { unsigned int interrupt __attribute__ ((aligned (8))); unsigned int irq __attribute__ ((packed));};#define STATS_IRQ_CPU_SIZE (sizeof(struct stats_irq_cpu))#define STATS_ONE_IRQ_SIZE (sizeof(int) * NR_IRQS)struct disk_stats { unsigned long long rd_sect __attribute__ ((aligned (16))); unsigned long long wr_sect __attribute__ ((aligned (16))); unsigned long rd_ticks __attribute__ ((aligned (16))); unsigned long wr_ticks __attribute__ ((aligned (8))); unsigned long tot_ticks __attribute__ ((aligned (8))); unsigned long rq_ticks __attribute__ ((aligned (8))); unsigned long nr_ios __attribute__ ((aligned (8))); unsigned int major __attribute__ ((aligned (8))); unsigned int minor __attribute__ ((packed));};#define DISK_STATS_SIZE (sizeof(struct disk_stats))struct stats_sum { unsigned long count __attribute__ ((aligned (8))); unsigned long frmkb __attribute__ ((packed)); unsigned long bufkb __attribute__ ((packed)); unsigned long camkb __attribute__ ((packed)); unsigned long frskb __attribute__ ((packed)); unsigned long tlskb __attribute__ ((packed)); unsigned long caskb __attribute__ ((packed)); unsigned long dentry_stat __attribute__ ((packed)); unsigned long file_used __attribute__ ((packed)); unsigned long inode_used __attribute__ ((packed)); unsigned long super_used __attribute__ ((packed)); unsigned long dquot_used __attribute__ ((packed)); unsigned long rtsig_queued __attribute__ ((packed)); unsigned long sock_inuse __attribute__ ((packed)); unsigned long tcp_inuse __attribute__ ((packed)); unsigned long udp_inuse __attribute__ ((packed)); unsigned long raw_inuse __attribute__ ((packed)); unsigned long frag_inuse __attribute__ ((packed)); unsigned long nr_running __attribute__ ((packed)); unsigned long nr_threads __attribute__ ((packed)); unsigned long load_avg_1 __attribute__ ((packed)); unsigned long load_avg_5 __attribute__ ((packed)); unsigned long load_avg_15 __attribute__ ((packed));};#define STATS_SUM_SIZE (sizeof(struct stats_sum))struct tstamp { int tm_sec; int tm_min; int tm_hour; int use;};/* Time must have the format HH:MM:SS with HH in 24-hour format */#define DEF_TMSTART "08:00:00"#define DEF_TMEND "18:00:00"/* Using 'do ... while' makes this macro safer to use (trailing semicolon) */#define CLOSE_ALL(_fd_) do { \ close(_fd_[0]); \ close(_fd_[1]); \ } while (0)#define CLOSE(_fd_) if (_fd_ >= 0) \ close(_fd_)#define SREALLOC(S, TYPE, SIZE) do { \ TYPE *p; \ p = S; \ if ((S = (TYPE *) realloc(S, (SIZE))) == NULL) { \ perror("realloc"); \ exit(4); \ } \ if (!p) \ memset(S, 0, (SIZE)); \ } while (0)/* Functions */extern int check_disk_reg(struct file_hdr *, struct disk_stats * [], short, short, int);extern unsigned int check_iface_reg(struct file_hdr *, struct stats_net_dev * [], short, short, unsigned int);extern int datecmp(struct tm *, struct tstamp *);unsigned long long get_per_cpu_interval(struct stats_one_cpu *, struct stats_one_cpu *);extern char *get_devname(unsigned int, unsigned int, int);extern void init_bitmap(unsigned char [], unsigned char, unsigned int);extern void init_stats(struct file_stats [], unsigned int [][NR_IRQS]);extern int next_slice(unsigned long long, unsigned long long, struct file_hdr *, int, long);extern int parse_sar_opt(char * [], int, unsigned int *, unsigned int *, short *, int, unsigned char [], unsigned char []);extern int parse_sar_I_opt(char * [], int *, unsigned int *, short *, unsigned char []);extern int parse_sa_P_opt(char * [], int *, unsigned int *, short *, unsigned char []);extern int parse_sar_n_opt(char * [], int *, unsigned int *, short *);extern int parse_timestamp(char * [], int *, struct tstamp *, const char *);extern void prep_file_for_reading(int *, char *, struct file_hdr *, unsigned int *, unsigned int);extern void get_itv_value(struct file_stats *, struct file_stats *, unsigned int, unsigned long long *, unsigned long long *);extern void print_report_hdr(unsigned short, unsigned int, struct tm *, struct file_hdr *);extern int sa_fread(int, void *, int, int);extern void salloc_cpu_array(struct stats_one_cpu * [], unsigned int);extern void salloc_disk_array(struct disk_stats * [], int);extern void salloc_irqcpu_array(struct stats_irq_cpu * [], unsigned int, unsigned int);extern void salloc_net_dev_array(struct stats_net_dev * [], unsigned int);extern void salloc_serial_array(struct stats_serial * [], int);#endif /* _SA_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -