]> jfr.im git - irc/quakenet/newserv.git/blob - graphing/dump.c
Seperate out build ids from version numbers.
[irc/quakenet/newserv.git] / graphing / dump.c
1 #include "graphing.h"
2 #include <stdio.h>
3 #include <time.h>
4 #include <sys/types.h>
5 #include <sys/stat.h>
6
7 int dump(fsample_m *f, fsample_t start, fsample_t stop) {
8 int i, j;
9
10 for(i=start;i<stop;i++) {
11 printf("%2d ", i);
12 for(j=0;j<f->pos;j++) {
13 fsample_t t;
14 int moo = fsget_m(f, j, i, &t);
15
16 if(!moo) {
17 int moo2 = fsget_mr(f, j, i, &t);
18 printf("X%2d(%2d) ", t, moo2);
19 } else {
20 printf(" %2d(%2d) ", t, moo);
21 }
22 }
23 printf("\n");
24 }
25
26 return 0;
27 }
28
29
30 int main(int cargc, char **cargv) {
31 fsample_m *f;
32 int stop = time(NULL) / GRAPHING_RESOLUTION;
33 struct stat sb;
34
35 if(cargc < 2) {
36 puts("insufficient args");
37 return 1;
38 }
39
40 if(stat(cargv[1], &sb) == -1) {
41 puts("file doesn't exist");
42 return 2;
43 }
44
45 f = fsopen_m(0, cargv[1], SAMPLES, NULL, NULL);
46 if(!f)
47 return 3;
48
49 dump(f, stop - 100, stop);
50
51 fsclose_m(f);
52
53 return 0;
54 }
55