diff --git a/results/b2/parse.c b/results/parse.c similarity index 87% rename from results/b2/parse.c rename to results/parse.c index a27a92b..6476928 100644 --- a/results/b2/parse.c +++ b/results/parse.c @@ -1,3 +1,8 @@ +/** + * Compile: cc -O2 -luuid parse.c -o parse + * Usage: ./parse 7500 a.bin b.bin + */ + #include #include #include @@ -11,18 +16,24 @@ int cmpuint64t(const void* u1, const void* u2) { } int main(int argc, char *argv[]) { + if (argc < 3) { + printf("Usage: %s +\n", argv[0]); + exit(EXIT_FAILURE); + } + FILE *r, *w; uint64_t taglen; - char tag[255]; + char tag[255], filename[255]; uuid_t uuid; char uuidstr[37]; uint64_t meascount; uint64_t meas[25*60*90]; /* can contain up to ninety minutes of meas */ - uint64_t target = 25*60*5; /* five minutes of measures*/ + uint64_t target = atoi(argv[1]); /* subset of measures to consider */ - if ((w = fopen("5min.csv", "w")) == NULL) goto iofail; + sprintf(filename, "%d.csv", target); + if ((w = fopen(filename, "w")) == NULL) goto iofail; - for (int i = 1; i < argc; i++) { + for (int i = 2; i < argc; i++) { printf("selected %s\n", argv[i]); if ((r = fopen(argv[i], "r")) == NULL) goto iofail; if (fread(&taglen, sizeof(taglen), 1, r) != 1) goto iofail;