diff options
author | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2008-12-09 11:38:44 -0500 |
---|---|---|
committer | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2008-12-09 11:38:44 -0500 |
commit | 6ba8c2c05ae6348f9e973feaca55efc3f0fb87a8 (patch) | |
tree | 786a5ef82d00e11c548e667c940c2347e6fb322a /bin | |
parent | abb2b918c116bdc7463c1a3c67975f4cf10487d0 (diff) | |
parent | d8130c61443893e490d19da25ea5f32814c5367b (diff) |
Merge branch 'master' of ssh://cvs/cvs/proj/litmus/repo/liblitmus2008
Conflicts:
Makefile
Diffstat (limited to 'bin')
-rw-r--r-- | bin/cycles.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/bin/cycles.c b/bin/cycles.c new file mode 100644 index 0000000..a6b9308 --- /dev/null +++ b/bin/cycles.c | |||
@@ -0,0 +1,28 @@ | |||
1 | #include <stdio.h> | ||
2 | #include <stdlib.h> | ||
3 | #include <unistd.h> | ||
4 | |||
5 | #include "cycles.h" | ||
6 | |||
7 | int main(int argc, char** argv) | ||
8 | { | ||
9 | cycles_t t1, t2; | ||
10 | int secs = 1; | ||
11 | |||
12 | if (argc > 1) { | ||
13 | secs = atoi(argv[1]); | ||
14 | if (secs <= 0) | ||
15 | secs = 1; | ||
16 | } | ||
17 | while (1) { | ||
18 | t1 = get_cycles(); | ||
19 | sleep(secs); | ||
20 | t2 = get_cycles(); | ||
21 | t2 -= t1; | ||
22 | printf("%.2f/sec %.2f/msec %.2f/usec\n", | ||
23 | t2 / (double) secs, | ||
24 | t2 / (secs * 1000.0), | ||
25 | t2 / (secs * 1000000.0)); | ||
26 | } | ||
27 | return 0; | ||
28 | } | ||