#define lsize sizeof(unsigned long)
-long usec_diff(const struct timeval *a, const struct timeval *b)
+long long usec_diff(const struct timeval *a, const struct timeval *b)
{
- long usec_a, usec_b;
+ long long usec_a, usec_b;
usec_a = a->tv_sec * 1000000 + a->tv_usec;
usec_b = b->tv_sec * 1000000 + b->tv_usec;
return usec_b - usec_a;
unsigned long *buf, i, tmp = 0;
struct timeval start, end;
+ printf("Benchmark sequential access bandwidth "
+ "and random access latency\n\n");
+
if (argc > 1)
iterations = atoi(argv[1]);
else
iterations = 24;
if (argc > 2)
- count = atoi(argv[2]);
+ count = atoi(argv[2]) * 1024;
else
- count = 1024;
+ count = 1024 * 64;
latcount = count / 10;
printf("Doing %d runs with buffer size goin up to %dk\n",
iterations, 1 << (iterations - 10));
printf("Running each round %d times\n", count);
- printf("Size of unsigned long is %lu bits\n\n", lsize * 8);
+ printf("Size of unsigned long is %d bits\n\n", (int)lsize * 8);
switch (lsize) {
case 4:
for (i = 0; i < size; i++)
buf[i] = i;
- printf("%8luk |", size * lsize / 1024);
+ printf("%8dk |", (int)(size * lsize / 1024));
/* Read bandwidth*/
printf("\n");
+ count /= 2;
+ count = count ? count : 1;
+ latcount = count / 10;
+ latcount = latcount ? latcount : 1;
+
free(buf);
}
return 0;