7 #define GET_SEC(a, b) ((b - a) / (double)CLOCKS_PER_SEC)
9 static int cmp_dbl(
const void* a,
const void* b)
21 int main(
int argc,
char** argv)
29 x[
i] = (rand() % 256);
31 sum = 0.0; start = clock();
37 printf(
"IO time=%.3f sum=%.1f\n",
GET_SEC(start, clock()), sum);
39 sum = 0.0; start = clock(); q = 0;
48 printf(
"IO time=%.3f sum=%.1f %d\n",
GET_SEC(start, clock()), sum, q);
50 qsort(x, SIZE,
sizeof(*x),
cmp_dbl);
52 sum = 0.0; start = clock(); q = 0;
61 printf(
"IO time=%.3f sum=%.1f %d\n",
GET_SEC(start, clock()), sum, q);
static int cmp_dbl(const void *a, const void *b)
int main(int argc, char **argv)