File: procstat.h

package info (click to toggle)
wmhdplop 0.9.5-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,028 kB
  • ctags: 333
  • sloc: sh: 8,290; ansic: 2,380; makefile: 71
file content (35 lines) | stat: -rw-r--r-- 865 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef PROCSTAT_H
#define PROCSTAT_H
#include "util.h"

struct pstat {
  unsigned long total;
  int nslice, cur_slice;
  unsigned long *slices;
  float update_interval;
};

typedef struct {
  /* counted in sectors */
  struct pstat swap_in, swap_out;
  struct pstat disk_read, disk_write;
} ProcStats;

void pstat_init(struct pstat *pst, int nslice, float update_interval);
float pstat_current(struct pstat *pst);
void pstat_add(struct pstat *pst, unsigned long v);
void pstat_advance(struct pstat *pst);
float pstat_meanval(struct pstat *pst);

/* given in MB/s */
float get_read_throughput();
float get_write_throughput();
float get_swapin_throughput();
float get_swapout_throughput();
float get_read_mean_throughput();
float get_write_mean_throughput();

void update_stats();
void init_stats(float update_interval);
void scan_all_hd(int add_partitions);
#endif