This source file includes following definitions.
- main
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 #include "ompi_config.h"
20
21 #include <unistd.h>
22
23 #include "opal/runtime/opal.h"
24 #include "opal/mca/timer/base/base.h"
25
26 int
27 main(int argc, char *argv[])
28 {
29 opal_timer_t start, end, diff;
30
31 opal_init(&argc, &argv);
32
33 printf("--> frequency: %llu\n", (unsigned long long) opal_timer_base_get_freq());
34
35 #if OPAL_TIMER_CYCLE_SUPPORTED
36 printf("--> cycle count\n");
37 start = opal_timer_base_get_cycles();
38 start = opal_timer_base_get_cycles();
39 sleep(1);
40 end = opal_timer_base_get_cycles();
41 diff = end - start;
42 printf(" Slept approximately %llu cycles, or %llu us\n",
43 (unsigned long long) diff,
44 (unsigned long long) ((diff * 1000000) / opal_timer_base_get_freq()));
45 #else
46 printf("--> cycle count not supported\n");
47 #endif
48
49 #if OPAL_TIMER_USEC_SUPPORTED
50 printf("--> usecs\n");
51 start = opal_timer_base_get_usec();
52 sleep(1);
53 end = opal_timer_base_get_usec();
54 diff = end - start;
55 printf(" Slept approximately %llu us\n", (unsigned long long) diff);
56 #else
57 printf("--> usec timer not supported\n");
58 #endif
59
60 opal_finalize();
61
62 return 0;
63 }