Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 325615
Collapse All | Expand All

(-)wmhdplop-0.9.9/devnames.h (-1 / +1 lines)
Lines 9-15 typedef struct DiskList { Link Here
9
  unsigned major, minor;
9
  unsigned major, minor;
10
  int hd_id, part_id; /* part_id = 0 for disks */
10
  int hd_id, part_id; /* part_id = 0 for disks */
11
  int enable_hddtemp;
11
  int enable_hddtemp;
12
  int nr, nw, touched_r, touched_w;
12
  long nr, nw, touched_r, touched_w;
13
  struct DiskList *next;
13
  struct DiskList *next;
14
} DiskList;
14
} DiskList;
15
15
(-)wmhdplop-0.9.9/procstat.c (-9 / +9 lines)
Lines 8-14 Link Here
8
static ProcStats ps;
8
static ProcStats ps;
9
int use_proc_diskstats;
9
int use_proc_diskstats;
10
10
11
void pstat_init(struct pstat *pst, int nslice, float update_interval) {
11
void pstat_init(struct pstat *pst, long nslice, float update_interval) {
12
  pst->nslice = nslice;
12
  pst->nslice = nslice;
13
  ALLOC_VEC(pst->slices, nslice);
13
  ALLOC_VEC(pst->slices, nslice);
14
  pst->cur_slice = 0;
14
  pst->cur_slice = 0;
Lines 17-23 void pstat_init(struct pstat *pst, int n Link Here
17
}
17
}
18
18
19
float pstat_current(struct pstat *pst) {
19
float pstat_current(struct pstat *pst) {
20
  int idx = pst->cur_slice ? pst->cur_slice-1 : pst->nslice-1;
20
  long idx = pst->cur_slice ? pst->cur_slice-1 : pst->nslice-1;
21
  return pst->slices[idx]/pst->update_interval;
21
  return pst->slices[idx]/pst->update_interval;
22
}
22
}
23
23
Lines 101-113 void update_stats() { Link Here
101
            if (!Prefs.debug_disk_rd) {
101
            if (!Prefs.debug_disk_rd) {
102
              pstat_add(&ps.disk_read, nr);
102
              pstat_add(&ps.disk_read, nr);
103
            } else {
103
            } else {
104
              static int cntr = 0; cntr+=(rand()%30) == 0 ? Prefs.debug_disk_rd : 0;
104
              static long cntr = 0; cntr+=(rand()%30) == 0 ? Prefs.debug_disk_rd : 0;
105
              pstat_add(&ps.disk_read, nr + cntr);
105
              pstat_add(&ps.disk_read, nr + cntr);
106
            }
106
            }
107
            if (!Prefs.debug_disk_wr) {
107
            if (!Prefs.debug_disk_wr) {
108
              pstat_add(&ps.disk_write, nw);
108
              pstat_add(&ps.disk_write, nw);
109
            } else {
109
            } else {
110
              static int cntw = 0; cntw+=(rand()%30) == 0 ? Prefs.debug_disk_wr : 0;
110
              static long cntw = 0; cntw+=(rand()%30) == 0 ? Prefs.debug_disk_wr : 0;
111
              pstat_add(&ps.disk_write, nw + cntw);
111
              pstat_add(&ps.disk_write, nw + cntw);
112
            }
112
            }
113
            readok = 2;
113
            readok = 2;
Lines 121-127 void update_stats() { Link Here
121
              pstat_add(&ps.swap_in, nr);
121
              pstat_add(&ps.swap_in, nr);
122
              pstat_add(&ps.swap_out, nw);
122
              pstat_add(&ps.swap_out, nw);
123
            } else {
123
            } else {
124
              static int cnt = 0; cnt+=Prefs.debug_swapio;
124
              static long cnt = 0; cnt+=Prefs.debug_swapio;
125
              pstat_add(&ps.swap_in, nr + cnt);
125
              pstat_add(&ps.swap_in, nr + cnt);
126
              pstat_add(&ps.swap_out, nw + cnt);
126
              pstat_add(&ps.swap_out, nw + cnt);
127
            }
127
            }
Lines 144-153 void init_stats(float update_interval) { Link Here
144
  char s[512];
144
  char s[512];
145
  FILE *f;
145
  FILE *f;
146
146
147
  pstat_init(&ps.swap_in, (int)(0.5/update_interval)+1, update_interval);
147
  pstat_init(&ps.swap_in, (long)(0.5/update_interval)+1, update_interval);
148
  pstat_init(&ps.swap_out, (int)(0.5/update_interval)+1, update_interval);
148
  pstat_init(&ps.swap_out, (long)(0.5/update_interval)+1, update_interval);
149
  pstat_init(&ps.disk_read, (int)(0.5/update_interval)+1, update_interval);
149
  pstat_init(&ps.disk_read, (long)(0.5/update_interval)+1, update_interval);
150
  pstat_init(&ps.disk_write, (int)(0.5/update_interval)+1, update_interval);
150
  pstat_init(&ps.disk_write, (long)(0.5/update_interval)+1, update_interval);
151
  f = fopen("/proc/swaps","r");
151
  f = fopen("/proc/swaps","r");
152
  //if (!f) { perror("/proc/swaps"); exit(1); }
152
  //if (!f) { perror("/proc/swaps"); exit(1); }
153
  if (f) {
153
  if (f) {
(-)wmhdplop-0.9.9/procstat.h (-2 / +2 lines)
Lines 4-10 Link Here
4
4
5
struct pstat {
5
struct pstat {
6
  unsigned long total;
6
  unsigned long total;
7
  int nslice, cur_slice;
7
  long nslice, cur_slice;
8
  unsigned long *slices;
8
  unsigned long *slices;
9
  float update_interval;
9
  float update_interval;
10
};
10
};
Lines 15-21 typedef struct { Link Here
15
  struct pstat disk_read, disk_write;
15
  struct pstat disk_read, disk_write;
16
} ProcStats;
16
} ProcStats;
17
17
18
void pstat_init(struct pstat *pst, int nslice, float update_interval);
18
void pstat_init(struct pstat *pst, long nslice, float update_interval);
19
float pstat_current(struct pstat *pst);
19
float pstat_current(struct pstat *pst);
20
void pstat_add(struct pstat *pst, unsigned long v);
20
void pstat_add(struct pstat *pst, unsigned long v);
21
void pstat_advance(struct pstat *pst);
21
void pstat_advance(struct pstat *pst);

Return to bug 325615