]>
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> |
28f540f4 | 6 | |
84724245 RM |
7 | volatile int gotit = 0; |
8 | ||
de149cdb | 9 | static void |
84724245 RM |
10 | alarm_handler (int signal) |
11 | { | |
12 | gotit = 1; | |
13 | } | |
14 | ||
15 | ||
16 | int | |
17 | main (int argc, char ** argv) | |
28f540f4 | 18 | { |
84724245 | 19 | clock_t start, stop; |
28f540f4 | 20 | |
227d9931 | 21 | if (signal(SIGALRM, alarm_handler) == SIG_ERR) |
9eb2730e UD |
22 | { |
23 | perror ("signal"); | |
24 | exit (1); | |
25 | } | |
84724245 RM |
26 | alarm(1); |
27 | start = clock (); | |
28 | while (!gotit); | |
29 | stop = clock (); | |
28f540f4 | 30 | |
84724245 RM |
31 | printf ("%ld clock ticks per second (start=%ld,stop=%ld)\n", |
32 | stop - start, start, stop); | |
f3acd084 | 33 | printf ("CLOCKS_PER_SEC=%ld, sysconf(_SC_CLK_TCK)=%ld\n", |
84724245 | 34 | CLOCKS_PER_SEC, sysconf(_SC_CLK_TCK)); |
28f540f4 RM |
35 | return 0; |
36 | } |