#include <stdio.h>
#include <stdlib.h>
#include <time.h>
Go to the source code of this file.
|
#define | SIZE 100000000 |
|
#define | GET_SEC(a, b) ((b - a) / (double)CLOCKS_PER_SEC) |
|
|
static int | cmp_dbl (const void *a, const void *b) |
|
int | main (int argc, char **argv) |
|
#define GET_SEC |
( |
|
a, |
|
|
|
b |
|
) |
| ((b - a) / (double)CLOCKS_PER_SEC) |
static int cmp_dbl |
( |
const void * |
a, |
|
|
const void * |
b |
|
) |
| |
|
static |
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 21 of file ex4_cond.c.
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)