OpenMPI 0.1.1

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

- File List
- Globals

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