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)));
24 struct timeval start_time;
25 gettimeofday(&start_time, NULL);
27 FILE * file = fopen("data.bin", "wb");
33 for (j = 0; j < bufsiz && i < numpoints; ++j)
40 assert(fwrite(buffer, sizeof(DataPoint), j, file) == j);
48 struct timeval end_time;
49 gettimeofday(&end_time, NULL);
52 float time_elapsed = (float)(end_time.tv_sec - start_time.tv_sec) + 1e-6*(end_time.tv_usec - start_time.tv_usec);
53 printf("%f\n", time_elapsed);