HPCToolkit
ibm-xlomp-wrappers.c
Go to the documentation of this file.
1 #include <pthread.h>
2 #include <stdio.h>
3 
4 #ifdef HPCTOOLKIT_DEBUG
5 #include <messages/messages.h>
6 #else
7 #define TMSG(...)
8 #endif
9 
10 #include <hpcrun/constructors.h>
11 
12 
13 /************************************************************
14  * external declarations
15  ***********************************************************/
16 
17 extern void idle_metric_blame_shift_idle(void);
18 extern void idle_metric_blame_shift_work(void);
19 extern void idle_metric_register_blame_source(void);
20 
21 #define IDLE() idle_metric_blame_shift_idle()
22 #define WORKING() idle_metric_blame_shift_work()
23 
24 
25 
26 /************************************************************
27  * forward declarations
28  ***********************************************************/
29 
31 int __real_pthread_cond_wait(pthread_cond_t *c, pthread_mutex_t *m);
32 int __real__xlsmpSyncWorkShareItemL2(long x, long y, long z, long other);
33 int __real__xlsmpSyncRegionItemL2Fence(long x, long y, long z);
34 int __real__xlsmpBarrier_TPO(long x, long y);
35 int __real__xlsmpWSDoSetup_TPO(long a1, long a2, long a3, long a4,
36  long a5, long a6, long a7, long a8);
37 
38 // _xlsmp_DynamicChunkCall
39 int __real__xlsmp_DynamicChunkCall(long a1, long a2, long a3, long a4,
40  long a5);
41 
42 
43 
44 /************************************************************
45  * private operations
46  ***********************************************************/
47 
49 {
51 }
52 
53 
54 
55 /************************************************************
56  * interface operations
57  ***********************************************************/
58 
59 int
60 __wrap__xlsmpBarrier_TPO(long x, long y)
61 {
62  int ret;
63  TMSG(IDLE, "enter barrier");
64  IDLE();
65  ret = __real__xlsmpBarrier_TPO(x, y);
66  WORKING();
67  TMSG(IDLE, "exit barrier");
68  return ret;
69 }
70 
71 
72 int
73 __wrap__xlsmpWSDoSetup_TPO(long a1, long a2, long a3, long a4,
74  long a5, long a6, long a7, long a8)
75 {
76  int ret;
77  TMSG(IDLE, "enter dosetup");
78  IDLE();
79  ret = __real__xlsmpWSDoSetup_TPO(a1, a2, a3, a4,
80  a5, a6, a7, a8);
81  WORKING();
82  TMSG(IDLE, "exit dosetup");
83  return ret;
84 }
85 
86 
87 int
88 __wrap__xlsmp_DynamicChunkCall(long a1, long a2, long a3, long a4,
89  long a5)
90 {
91  int ret;
92 #ifdef BLAME_DYN_CHUNK
93  TMSG(IDLE, "enter chunk");
94  WORKING();
95 #endif
96  ret = __real__xlsmp_DynamicChunkCall(a1, a2, a3, a4,
97  a5);
98 #ifdef BLAME_DYN_CHUNK
99  IDLE();
100  TMSG(IDLE, "exit chunk");
101 #endif
102  return ret;
103 }
104 
105 
106 int
107 __wrap__xlsmpSyncWorkShareItemL2(long x, long y, long z, long other)
108 {
109  int ret;
110  TMSG(IDLE, "enter sync");
111  IDLE();
112  ret = __real__xlsmpSyncWorkShareItemL2(x,y,z,other);
113  WORKING();
114  TMSG(IDLE, "exit sync");
115  return ret;
116 }
117 
118 
119 int
120 __wrap__xlsmpSyncRegionItemL2Fence(long x, long y, long z)
121 {
122  int ret;
123  TMSG(IDLE, "enter fence");
124  IDLE();
126  WORKING();
127  TMSG(IDLE, "exit fence");
128  return ret;
129 }
130 
131 
132 int
133 __wrap_pthread_cond_wait(pthread_cond_t *c, pthread_mutex_t *m)
134 {
135  int ret;
136  TMSG(IDLE, "enter cond");
137  IDLE();
138  ret = __real_pthread_cond_wait(c, m);
139  WORKING();
140  TMSG(IDLE, "exit cond");
141  return ret;
142 }
143 
144 
145 int
147 {
148  int ret;
149  TMSG(IDLE, "enter yield");
150  IDLE();
151  ret = __real_pthread_yield();
152  WORKING();
153  TMSG(IDLE, "exit yield");
154  return ret;
155 }
int __real_pthread_cond_wait(pthread_cond_t *c, pthread_mutex_t *m)
int __wrap_pthread_yield()
int __real__xlsmp_DynamicChunkCall(long a1, long a2, long a3, long a4, long a5)
int __real__xlsmpWSDoSetup_TPO(long a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8)
void idle_metric_register_blame_source(void)
Definition: idle.c:289
int __wrap_pthread_cond_wait(pthread_cond_t *c, pthread_mutex_t *m)
int __wrap__xlsmpSyncRegionItemL2Fence(long x, long y, long z)
int __wrap__xlsmp_DynamicChunkCall(long a1, long a2, long a3, long a4, long a5)
int __real__xlsmpBarrier_TPO(long x, long y)
#define HPCRUN_CONSTRUCTOR(x)
Definition: constructors.h:5
void idle_metric_blame_shift_work(void)
Definition: idle.c:320
int __wrap__xlsmpSyncWorkShareItemL2(long x, long y, long z, long other)
int __real_pthread_yield()
int __real__xlsmpSyncWorkShareItemL2(long x, long y, long z, long other)
void idle_metric_blame_shift_idle(void)
Definition: idle.c:296
int __real__xlsmpSyncRegionItemL2Fence(long x, long y, long z)
HPCRUN_CONSTRUCTOR() init_xlomp_plugin(void)
int __wrap__xlsmpWSDoSetup_TPO(long a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8)
int __wrap__xlsmpBarrier_TPO(long x, long y)
#define TMSG(...)
#define IDLE()
#define WORKING()