15 int main(int argc, char ** argv)
19 int bufsiz = atoi(argv[1]);
20 int numpoints = atoi(argv[2]);
22 DataPoint * buffer = (DataPoint*)(calloc(bufsiz, sizeof(DataPoint)));
26 FILE * file = fopen("data.bin", "wb");
28 struct timeval start_time;
29 gettimeofday(&start_time, NULL);
35 for (j = 0; j < bufsiz && i < numpoints; ++j)
42 assert(fwrite(buffer, sizeof(DataPoint), j, file) == j);
47 struct timeval end_time;
48 gettimeofday(&end_time, NULL);
53 float time_elapsed = (float)(end_time.tv_sec - start_time.tv_sec) + 1e-6*(end_time.tv_usec - start_time.tv_usec);
54 printf("%f\n", time_elapsed);