-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathemancipate_bplus.c
43 lines (35 loc) · 1.12 KB
/
emancipate_bplus.c
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
36
37
38
39
40
41
42
43
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <sys/types.h>
int main(int argc, char **argv)
{
// time the program
struct timeval sysTimeStart, sysTimeEnd;
gettimeofday(&sysTimeStart, NULL);
char filename[1024];
int i, j;
unsigned long tot;
remove("bplus_roots.dat");
const char* const FILE_PREFIX[] = { "user", "state", "city", "message", "timestamp", "datestamp" };
for (j = 0; j < 6; j++)
{
i=0;
sprintf(filename, "bplus/%s_node_%08d.dat", FILE_PREFIX[j], i);
while (remove(filename) == 0)
{
i++;
sprintf(filename, "bplus/%s_node_%08d.dat", FILE_PREFIX[j], i);
}
printf("Removed %d %s b+ nodes\n", i, FILE_PREFIX[j]);
tot += i;
}
printf("Total: removed %lu b+ nodes\n", tot);
// end timing the program
gettimeofday(&sysTimeEnd, NULL);
float totalTime = (sysTimeEnd.tv_sec - sysTimeStart.tv_sec)
+ (sysTimeEnd.tv_usec - sysTimeStart.tv_usec) / 1000000.0f;
printf("Process time %f seconds\n", totalTime);
return 0;
}