OpenMPI 0.1.1

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

timer_aix.h
1 /*
2 * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
3 * University Research and Technology
4 * Corporation. All rights reserved.
5 * Copyright (c) 2004-2006 The University of Tennessee and The University
6 * of Tennessee Research Foundation. All rights
7 * reserved.
8 * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
9 * University of Stuttgart. All rights reserved.
10 * Copyright (c) 2004-2005 The Regents of the University of California.
11 * All rights reserved.
12 * $COPYRIGHT$
13 *
14 * Additional copyrights may follow
15 *
16 * $HEADER$
17 */
18
19 #ifndef OPAL_MCA_TIMER_AIX_TIMER_AIX_H
20 #define OPAL_MCA_TIMER_AIX_TIMER_AIX_H
21
22 #include <sys/time.h>
23
24 BEGIN_C_DECLS
25
26 typedef uint64_t opal_timer_t;
27
28 extern opal_timer_t opal_timer_aix_freq_mhz;
29 extern opal_timer_t opal_timer_aix_freq;
30
31 static inline opal_timer_t
32 opal_timer_base_get_usec()
33 {
34 timebasestruct_t t;
35 uint64_t retval;
36
37 read_real_time(&t, TIMEBASE_SZ);
38 time_base_to_time(&t, TIMEBASE_SZ);
39 retval = (t.tb_high * 1000000) + t.tb_low / 1000;
40
41 return retval;
42 }
43
44 static inline opal_timer_t
45 opal_timer_base_get_cycles()
46 {
47 #ifdef HAVE_PM_CYCLES
48 return opal_timer_base_get_usec() * opal_timer_aix_freq_mhz;
49 #else
50 return 0;
51 #endif
52 }
53
54 static inline opal_timer_t
55 opal_timer_base_get_freq()
56 {
57 return opal_timer_aix_freq;;
58 }
59
60
61 #ifdef HAVE_PM_CYCLES
62 #define OPAL_TIMER_CYCLE_NATIVE 0
63 #define OPAL_TIMER_CYCLE_SUPPORTED 1
64 #else
65 #define OPAL_TIMER_CYCLE_NATIVE 0
66 #define OPAL_TIMER_CYCLE_SUPPORTED 0
67 #endif
68 #define OPAL_TIMER_USEC_NATIVE 1
69 #define OPAL_TIMER_USEC_SUPPORTED 1
70
71 END_C_DECLS
72
73 #endif