]> jfr.im git - irc/quakenet/newserv.git/blob - graphing/dump.c
Add graphing and nterfacer_graphing modules, fix a header include order problem with...
[irc/quakenet/newserv.git] / graphing / dump.c
1 #include "graphing.h"
2 #include <stdio.h>
3 #include <time.h>
4
5 int dump(fsample_m *f, fsample_t start, fsample_t stop) {
6 int i, j;
7
8 for(i=start;i<stop;i++) {
9 printf("%2d ", i);
10 for(j=0;j<f->pos;j++) {
11 fsample_t t;
12 int moo = fsget_m(f, j, i, &t);
13
14 if(!moo) {
15 int moo2 = fsget_mr(f, j, i, &t);
16 printf("X%2d(%2d) ", t, moo2);
17 } else {
18 printf(" %2d(%2d) ", t, moo);
19 }
20 }
21 printf("\n");
22 }
23
24 return 0;
25 }
26
27
28 int main(int cargc, char **cargv) {
29 fsample_m *f;
30 int stop = time(NULL) / GRAPHING_RESOLUTION;
31
32 if(cargc < 2)
33 return 1;
34
35 f = fsopen_m(0, cargv[1], SAMPLES);
36 if(!f)
37 return 2;
38
39 dump(f, stop - 100, stop);
40
41 fsclose_m(f);
42
43 return 0;
44 }
45