OpenMPI 0.1.1

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

- File List
- Globals

vt_user_region.h
1 /**
2 * VampirTrace
3 * http://www.tu-dresden.de/zih/vampirtrace
4 *
5 * Copyright (c) 2005-2012, ZIH, TU Dresden, Federal Republic of Germany
6 *
7 * Copyright (c) 1998-2005, Forschungszentrum Juelich, Juelich Supercomputing
8 * Centre, Federal Republic of Germany
9 *
10 * See the file COPYING in the package base directory for details
11 **/
12
13 #ifndef _VT_USER_H
14 # error "vt_user_region.h should only be included from vt_user.h"
15 #endif /* _VT_USER_H */
16
17 #ifndef _VT_USER_REGION_H
18 #define _VT_USER_REGION_H
19
20 __VT_EXTERN_DECL void VT_User_start__(const char* name, const char* file,
21 int lno);
22 __VT_EXTERN_DECL void VT_User_end__(const char* name);
23 __VT_EXTERN_DECL unsigned int VT_User_def__(const char* name, const char* file,
24 int lno);
25 __VT_EXTERN_DECL void VT_User_start_id__(unsigned int rid);
26 __VT_EXTERN_DECL void VT_User_end_id__(unsigned int rid);
27
28 #ifdef __cplusplus
29 char vt_tracer_spec__(unsigned int);
30 int vt_tracer_spec__(const char*);
31
32 template<int> struct VT_Tracer {
33 VT_Tracer(const char* r, const char* f, int l) __VT_NOINST_ATTR;
34 ~VT_Tracer() __VT_NOINST_ATTR;
35 const char* n;
36 };
37 template<> inline VT_Tracer<sizeof(int)>::VT_Tracer(const char* r, const char* f,
38 int l) : n(r) { VT_User_start__(n, f, l); }
39 template<> inline VT_Tracer<sizeof(int)>::~VT_Tracer() { VT_User_end__(n); }
40
41 template<> struct VT_Tracer<1> {
42 VT_Tracer(unsigned int r, const char*, int) __VT_NOINST_ATTR;
43 ~VT_Tracer() __VT_NOINST_ATTR;
44 unsigned int i;
45 };
46 inline VT_Tracer<1>::VT_Tracer(unsigned int r, const char*, int)
47 : i(r) { VT_User_start_id__(i); }
48 inline VT_Tracer<1>::~VT_Tracer() { VT_User_end_id__(i); }
49 #endif /* __cplusplus */
50
51 #if (defined(VTRACE)) && !(defined(VTRACE_NO_REGION))
52
53 # define VT_USER_START(n) VT_User_start__((n), __FILE__, __LINE__)
54 # define VT_USER_END(n) VT_User_end__((n))
55 # define VT_USER_DEF(n) VT_User_def__((n), 0, 0)
56 # define VT_USER_START_ID(i) VT_User_start_id__((i))
57 # define VT_USER_END_ID(i) VT_User_end_id__((i))
58 # ifdef __cplusplus
59 # define VT_TRACER(r) VT_Tracer<sizeof(vt_tracer_spec__(r))> \
60 vt_tracer__((r), __FILE__, __LINE__);
61 # endif /* __cplusplus */
62
63 #else /* VTRACE && !VTRACE_NO_REGION */
64
65 # define VT_USER_START(n)
66 # define VT_USER_END(n)
67 # define VT_USER_DEF(n) 0
68 # define VT_USER_START_ID(i)
69 # define VT_USER_END_ID(i)
70 # define VT_TRACER(r)
71
72 #endif /* VTRACE && !VTRACE_NO_REGION */
73
74 #endif /* _VT_USER_H */