OpenMPI  0.1.1
timer_catamount.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-2005 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_CATAMOUNT_TIMER_CATAMOUNT_H
20 #define OPAL_MCA_TIMER_CATAMOUNT_TIMER_CATAMOUNT_H
21 
22 #include "opal_config.h"
23 #include <opal/sys/timer.h>
24 
25 OPAL_DECLSPEC extern opal_timer_t opal_timer_catamount_freq;
26 
27 static inline opal_timer_t
28 opal_timer_base_get_cycles(void)
29 {
30 #if OPAL_HAVE_SYS_TIMER_GET_CYCLES
31  return opal_sys_timer_get_cycles();
32 #else
33  return 0;
34 #endif
35 }
36 
37 
38 static inline opal_timer_t
39 opal_timer_base_get_usec(void)
40 {
41 #if OPAL_HAVE_SYS_TIMER_GET_CYCLES
42  /* freq is in Hz, so this gives usec */
43  return opal_sys_timer_get_cycles() * 1000000 / opal_timer_catamount_freq;
44 #else
45  return 0;
46 #endif
47 }
48 
49 
50 static inline opal_timer_t
51 opal_timer_base_get_freq(void)
52 {
53  return opal_timer_catamount_freq;
54 }
55 
56 
57 #define OPAL_TIMER_CYCLE_NATIVE OPAL_HAVE_SYS_TIMER_GET_CYCLES
58 #define OPAL_TIMER_CYCLE_SUPPORTED OPAL_HAVE_SYS_TIMER_GET_CYCLES
59 #define OPAL_TIMER_USEC_NATIVE 0
60 #define OPAL_TIMER_USEC_SUPPORTED OPAL_HAVE_SYS_TIMER_GET_CYCLES
61 
62 #endif
Cycle counter reading instructions.