]>
Commit | Line | Data |
---|---|---|
84724245 | 1 | #include <signal.h> |
28f540f4 | 2 | #include <stdio.h> |
3e1f480e | 3 | #include <stdlib.h> |
28f540f4 | 4 | #include <time.h> |
84724245 | 5 | #include <unistd.h> |
ceaa9889 | 6 | #include <stdint.h> |
28f540f4 | 7 | |
84724245 RM |
8 | volatile int gotit = 0; |
9 | ||
de149cdb | 10 | static void |
84724245 RM |
11 | alarm_handler (int signal) |
12 | { | |
13 | gotit = 1; | |
14 | } | |
15 | ||
16 | ||
17 | int | |
18 | main (int argc, char ** argv) | |
28f540f4 | 19 | { |
84724245 | 20 | clock_t start, stop; |
28f540f4 | 21 | |
227d9931 | 22 | if (signal(SIGALRM, alarm_handler) == SIG_ERR) |
9eb2730e UD |
23 | { |
24 | perror ("signal"); | |
25 | exit (1); | |
26 | } | |
84724245 RM |
27 | alarm(1); |
28 | start = clock (); | |
29 | while (!gotit); | |
30 | stop = clock (); | |
28f540f4 | 31 | |
fe342f50 L |
32 | printf ("%jd clock ticks per second (start=%jd,stop=%jd)\n", |
33 | (intmax_t) (stop - start), (intmax_t) start, (intmax_t) stop); | |
57ada0e7 L |
34 | printf ("CLOCKS_PER_SEC=%jd, sysconf(_SC_CLK_TCK)=%ld\n", |
35 | (intmax_t) CLOCKS_PER_SEC, sysconf(_SC_CLK_TCK)); | |
28f540f4 RM |
36 | return 0; |
37 | } |