fxt.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2009-2013 Université de Bordeaux 1
  4. * Copyright (C) 2010, 2011, 2012, 2013 Centre National de la Recherche Scientifique
  5. *
  6. * StarPU is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU Lesser General Public License as published by
  8. * the Free Software Foundation; either version 2.1 of the License, or (at
  9. * your option) any later version.
  10. *
  11. * StarPU is distributed in the hope that it will be useful, but
  12. * WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  14. *
  15. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  16. */
  17. #ifndef __FXT_H__
  18. #define __FXT_H__
  19. #ifndef _GNU_SOURCE
  20. #define _GNU_SOURCE /* ou _BSD_SOURCE ou _SVID_SOURCE */
  21. #endif
  22. #include <unistd.h>
  23. #include <string.h>
  24. #include <sys/types.h>
  25. #include <stdlib.h>
  26. #include <common/config.h>
  27. #include <common/utils.h>
  28. #include <starpu.h>
  29. /* some key to identify the worker kind */
  30. #define _STARPU_FUT_APPS_KEY 0x100
  31. #define _STARPU_FUT_CPU_KEY 0x101
  32. #define _STARPU_FUT_CUDA_KEY 0x102
  33. #define _STARPU_FUT_OPENCL_KEY 0x103
  34. #define _STARPU_FUT_MIC_KEY 0x104
  35. #define _STARPU_FUT_SCC_KEY 0x105
  36. #define _STARPU_FUT_WORKER_INIT_START 0x5100
  37. #define _STARPU_FUT_WORKER_INIT_END 0x5101
  38. #define _STARPU_FUT_START_CODELET_BODY 0x5102
  39. #define _STARPU_FUT_END_CODELET_BODY 0x5103
  40. #define _STARPU_FUT_JOB_PUSH 0x5104
  41. #define _STARPU_FUT_JOB_POP 0x5105
  42. #define _STARPU_FUT_UPDATE_TASK_CNT 0x5106
  43. #define _STARPU_FUT_START_FETCH_INPUT 0x5107
  44. #define _STARPU_FUT_END_FETCH_INPUT 0x5108
  45. #define _STARPU_FUT_START_PUSH_OUTPUT 0x5109
  46. #define _STARPU_FUT_END_PUSH_OUTPUT 0x5110
  47. #define _STARPU_FUT_TAG 0x5111
  48. #define _STARPU_FUT_TAG_DEPS 0x5112
  49. #define _STARPU_FUT_TASK_DEPS 0x5113
  50. #define _STARPU_FUT_DATA_COPY 0x5114
  51. #define _STARPU_FUT_WORK_STEALING 0x5115
  52. #define _STARPU_FUT_WORKER_DEINIT_START 0x5116
  53. #define _STARPU_FUT_WORKER_DEINIT_END 0x5117
  54. #define _STARPU_FUT_WORKER_SLEEP_START 0x5118
  55. #define _STARPU_FUT_WORKER_SLEEP_END 0x5119
  56. #define _STARPU_FUT_USER_DEFINED_START 0x5120
  57. #define _STARPU_FUT_USER_DEFINED_END 0x5121
  58. #define _STARPU_FUT_NEW_MEM_NODE 0x5122
  59. #define _STARPU_FUT_START_CALLBACK 0x5123
  60. #define _STARPU_FUT_END_CALLBACK 0x5124
  61. #define _STARPU_FUT_TASK_DONE 0x5125
  62. #define _STARPU_FUT_TAG_DONE 0x5126
  63. #define _STARPU_FUT_START_ALLOC 0x5127
  64. #define _STARPU_FUT_END_ALLOC 0x5128
  65. #define _STARPU_FUT_START_ALLOC_REUSE 0x5129
  66. #define _STARPU_FUT_END_ALLOC_REUSE 0x5130
  67. #define _STARPU_FUT_START_MEMRECLAIM 0x5131
  68. #define _STARPU_FUT_END_MEMRECLAIM 0x5132
  69. #define _STARPU_FUT_START_DRIVER_COPY 0x5133
  70. #define _STARPU_FUT_END_DRIVER_COPY 0x5134
  71. #define _STARPU_FUT_START_DRIVER_COPY_ASYNC 0x5135
  72. #define _STARPU_FUT_END_DRIVER_COPY_ASYNC 0x5136
  73. #define _STARPU_FUT_START_PROGRESS 0x5137
  74. #define _STARPU_FUT_END_PROGRESS 0x5138
  75. #define _STARPU_FUT_USER_EVENT 0x5139
  76. #define _STARPU_FUT_SET_PROFILING 0x513a
  77. #define _STARPU_FUT_TASK_WAIT_FOR_ALL 0x513b
  78. #define _STARPU_FUT_LOCKING_MUTEX 0x5140
  79. #define _STARPU_FUT_MUTEX_LOCKED 0x5141
  80. #define _STARPU_FUT_UNLOCKING_MUTEX 0x5142
  81. #define _STARPU_FUT_MUTEX_UNLOCKED 0x5143
  82. #define _STARPU_FUT_TRYLOCK_MUTEX 0x5144
  83. #define _STARPU_FUT_RDLOCKING_RWLOCK 0x5145
  84. #define _STARPU_FUT_RWLOCK_RDLOCKED 0x5146
  85. #define _STARPU_FUT_WRLOCKING_RWLOCK 0x5147
  86. #define _STARPU_FUT_RWLOCK_WRLOCKED 0x5148
  87. #define _STARPU_FUT_UNLOCKING_RWLOCK 0x5149
  88. #define _STARPU_FUT_RWLOCK_UNLOCKED 0x514a
  89. #define _STARPU_FUT_LOCKING_SPINLOCK 0x514b
  90. #define _STARPU_FUT_SPINLOCK_LOCKED 0x514c
  91. #define _STARPU_FUT_UNLOCKING_SPINLOCK 0x514d
  92. #define _STARPU_FUT_SPINLOCK_UNLOCKED 0x514e
  93. #define _STARPU_FUT_TRYLOCK_SPINLOCK 0x514f
  94. #define _STARPU_FUT_COND_WAIT_BEGIN 0x5150
  95. #define _STARPU_FUT_COND_WAIT_END 0x5151
  96. #define _STARPU_FUT_MEMORY_FULL 0x5152
  97. #ifdef STARPU_USE_FXT
  98. #include <fxt/fxt.h>
  99. #include <fxt/fut.h>
  100. /* Some versions of FxT do not include the declaration of the function */
  101. #ifdef HAVE_ENABLE_FUT_FLUSH
  102. #if !HAVE_DECL_ENABLE_FUT_FLUSH
  103. void enable_fut_flush();
  104. #endif
  105. #endif
  106. #ifdef HAVE_FUT_SET_FILENAME
  107. #if !HAVE_DECL_FUT_SET_FILENAME
  108. void fut_set_filename(char *filename);
  109. #endif
  110. #endif
  111. long _starpu_gettid(void);
  112. /* Initialize the FxT library. */
  113. void _starpu_init_fxt_profiling(unsigned trace_buffer_size);
  114. /* Stop the FxT library, and generate the trace file. */
  115. void _starpu_stop_fxt_profiling(void);
  116. /* Associate the current processing unit to the identifier of the LWP that runs
  117. * the worker. */
  118. void _starpu_fxt_register_thread(unsigned);
  119. /* Sometimes we need something a little more specific than the wrappers from
  120. * FxT: these macro permit to put add an event with 3 (or 4) numbers followed
  121. * by a string. */
  122. #define _STARPU_FUT_DO_PROBE2STR(CODE, P1, P2, str) \
  123. do { \
  124. if(fut_active) { \
  125. /* No more than FXT_MAX_PARAMS args are allowed */ \
  126. /* we add a \0 just in case ... */ \
  127. size_t len = STARPU_MIN(strlen(str)+1, (FXT_MAX_PARAMS - 2)*sizeof(unsigned long));\
  128. unsigned nbargs_str = (len + sizeof(unsigned long) - 1)/(sizeof(unsigned long));\
  129. unsigned nbargs = 2 + nbargs_str; \
  130. size_t total_len = FUT_SIZE(nbargs); \
  131. unsigned long *futargs = \
  132. fut_getstampedbuffer(FUT_CODE(CODE, nbargs), total_len);\
  133. *(futargs++) = (unsigned long)(P1); \
  134. *(futargs++) = (unsigned long)(P2); \
  135. snprintf((char *)futargs, len, "%s", str); \
  136. ((char *)futargs)[len - 1] = '\0'; \
  137. } \
  138. } while (0);
  139. #define _STARPU_FUT_DO_PROBE3STR(CODE, P1, P2, P3, str) \
  140. do { \
  141. if(fut_active) { \
  142. /* No more than FXT_MAX_PARAMS args are allowed */ \
  143. /* we add a \0 just in case ... */ \
  144. size_t len = STARPU_MIN(strlen(str)+1, (FXT_MAX_PARAMS - 3)*sizeof(unsigned long));\
  145. unsigned nbargs_str = (len + sizeof(unsigned long) - 1)/(sizeof(unsigned long));\
  146. unsigned nbargs = 3 + nbargs_str; \
  147. size_t total_len = FUT_SIZE(nbargs); \
  148. unsigned long *futargs = \
  149. fut_getstampedbuffer(FUT_CODE(CODE, nbargs), total_len);\
  150. *(futargs++) = (unsigned long)(P1); \
  151. *(futargs++) = (unsigned long)(P2); \
  152. *(futargs++) = (unsigned long)(P3); \
  153. snprintf((char *)futargs, len, "%s", str); \
  154. ((char *)futargs)[len - 1] = '\0'; \
  155. } \
  156. } while (0);
  157. #define _STARPU_FUT_DO_PROBE4STR(CODE, P1, P2, P3, P4, str) \
  158. do { \
  159. if(fut_active) { \
  160. /* No more than FXT_MAX_PARAMS args are allowed */ \
  161. /* we add a \0 just in case ... */ \
  162. size_t len = STARPU_MIN(strlen(str)+1, (FXT_MAX_PARAMS - 4)*sizeof(unsigned long));\
  163. unsigned nbargs_str = (len + sizeof(unsigned long) - 1)/(sizeof(unsigned long));\
  164. unsigned nbargs = 4 + nbargs_str; \
  165. size_t total_len = FUT_SIZE(nbargs); \
  166. unsigned long *futargs = \
  167. fut_getstampedbuffer(FUT_CODE(CODE, nbargs), total_len);\
  168. *(futargs++) = (unsigned long)(P1); \
  169. *(futargs++) = (unsigned long)(P2); \
  170. *(futargs++) = (unsigned long)(P3); \
  171. *(futargs++) = (unsigned long)(P4); \
  172. snprintf((char *)futargs, len, "%s", str); \
  173. ((char *)futargs)[len - 1] = '\0'; \
  174. } \
  175. } while (0);
  176. #define _STARPU_FUT_DO_PROBE5STR(CODE, P1, P2, P3, P4, P5, str) \
  177. do { \
  178. if(fut_active) { \
  179. /* No more than FXT_MAX_PARAMS args are allowed */ \
  180. /* we add a \0 just in case ... */ \
  181. size_t len = STARPU_MIN(strlen(str)+1, (FXT_MAX_PARAMS - 5)*sizeof(unsigned long));\
  182. unsigned nbargs_str = (len + sizeof(unsigned long) - 1)/(sizeof(unsigned long));\
  183. unsigned nbargs = 5 + nbargs_str; \
  184. size_t total_len = FUT_SIZE(nbargs); \
  185. unsigned long *futargs = \
  186. fut_getstampedbuffer(FUT_CODE(CODE, nbargs), total_len);\
  187. *(futargs++) = (unsigned long)(P1); \
  188. *(futargs++) = (unsigned long)(P2); \
  189. *(futargs++) = (unsigned long)(P3); \
  190. *(futargs++) = (unsigned long)(P4); \
  191. *(futargs++) = (unsigned long)(P5); \
  192. snprintf((char *)futargs, len, "%s", str); \
  193. ((char *)futargs)[len - 1] = '\0'; \
  194. } \
  195. } while (0);
  196. /* workerkind = _STARPU_FUT_CPU_KEY for instance */
  197. #define _STARPU_TRACE_NEW_MEM_NODE(nodeid) \
  198. FUT_DO_PROBE2(_STARPU_FUT_NEW_MEM_NODE, nodeid, _starpu_gettid());
  199. #define _STARPU_TRACE_WORKER_INIT_START(workerkind, workerid, devid, memnode) \
  200. FUT_DO_PROBE5(_STARPU_FUT_WORKER_INIT_START, workerkind, workerid, devid, memnode, _starpu_gettid());
  201. #define _STARPU_TRACE_WORKER_INIT_END \
  202. FUT_DO_PROBE1(_STARPU_FUT_WORKER_INIT_END, _starpu_gettid());
  203. #define _STARPU_TRACE_START_CODELET_BODY(job) \
  204. do { \
  205. const char *model_name = _starpu_job_get_model_name((job)); \
  206. if (model_name) \
  207. { \
  208. /* we include the symbol name */ \
  209. _STARPU_FUT_DO_PROBE4STR(_STARPU_FUT_START_CODELET_BODY, (job), ((job)->task)->sched_ctx, _starpu_gettid(), 1, model_name); \
  210. } \
  211. else { \
  212. FUT_DO_PROBE4(_STARPU_FUT_START_CODELET_BODY, (job), ((job)->task)->sched_ctx, _starpu_gettid(), 0); \
  213. } \
  214. } while(0);
  215. #define _STARPU_TRACE_END_CODELET_BODY(job, nimpl, archtype) \
  216. do { \
  217. const size_t job_size = _starpu_job_get_data_size((job)->task->cl?(job)->task->cl->model:NULL, archtype, nimpl, (job)); \
  218. const uint32_t job_hash = _starpu_compute_buffers_footprint((job)->task->cl?(job)->task->cl->model:NULL, archtype, nimpl, (job));\
  219. FUT_DO_PROBE5(_STARPU_FUT_END_CODELET_BODY, (job), (job_size), (job_hash), (archtype), _starpu_gettid()); \
  220. } while(0);
  221. #define _STARPU_TRACE_START_CALLBACK(job) \
  222. FUT_DO_PROBE2(_STARPU_FUT_START_CALLBACK, job, _starpu_gettid());
  223. #define _STARPU_TRACE_END_CALLBACK(job) \
  224. FUT_DO_PROBE2(_STARPU_FUT_END_CALLBACK, job, _starpu_gettid());
  225. #define _STARPU_TRACE_JOB_PUSH(task, prio) \
  226. FUT_DO_PROBE3(_STARPU_FUT_JOB_PUSH, task, prio, _starpu_gettid());
  227. #define _STARPU_TRACE_JOB_POP(task, prio) \
  228. FUT_DO_PROBE3(_STARPU_FUT_JOB_POP, task, prio, _starpu_gettid());
  229. #define _STARPU_TRACE_UPDATE_TASK_CNT(counter) \
  230. FUT_DO_PROBE2(_STARPU_FUT_UPDATE_TASK_CNT, counter, _starpu_gettid())
  231. #define _STARPU_TRACE_START_FETCH_INPUT(job) \
  232. FUT_DO_PROBE2(_STARPU_FUT_START_FETCH_INPUT, job, _starpu_gettid());
  233. #define _STARPU_TRACE_END_FETCH_INPUT(job) \
  234. FUT_DO_PROBE2(_STARPU_FUT_END_FETCH_INPUT, job, _starpu_gettid());
  235. #define _STARPU_TRACE_START_PUSH_OUTPUT(job) \
  236. FUT_DO_PROBE2(_STARPU_FUT_START_PUSH_OUTPUT, job, _starpu_gettid());
  237. #define _STARPU_TRACE_END_PUSH_OUTPUT(job) \
  238. FUT_DO_PROBE2(_STARPU_FUT_END_PUSH_OUTPUT, job, _starpu_gettid());
  239. #define _STARPU_TRACE_TAG(tag, job) \
  240. FUT_DO_PROBE2(_STARPU_FUT_TAG, tag, (job)->job_id)
  241. #define _STARPU_TRACE_TAG_DEPS(tag_child, tag_father) \
  242. FUT_DO_PROBE2(_STARPU_FUT_TAG_DEPS, tag_child, tag_father)
  243. #define _STARPU_TRACE_TASK_DEPS(job_prev, job_succ) \
  244. FUT_DO_PROBE2(_STARPU_FUT_TASK_DEPS, (job_prev)->job_id, (job_succ)->job_id)
  245. #define _STARPU_TRACE_GHOST_TASK_DEPS(ghost_prev_id, job_succ_id) \
  246. FUT_DO_PROBE2(_STARPU_FUT_TASK_DEPS, (ghost_prev_id), (job_succ_id))
  247. #define _STARPU_TRACE_TASK_DONE(job) \
  248. do { \
  249. unsigned exclude_from_dag = (job)->exclude_from_dag; \
  250. const char *model_name = _starpu_job_get_model_name((job)); \
  251. if (model_name) \
  252. { \
  253. _STARPU_FUT_DO_PROBE4STR(_STARPU_FUT_TASK_DONE, (job)->job_id, _starpu_gettid(), (long unsigned)exclude_from_dag, 1, model_name);\
  254. } \
  255. else { \
  256. FUT_DO_PROBE4(_STARPU_FUT_TASK_DONE, (job)->job_id, _starpu_gettid(), (long unsigned)exclude_from_dag, 0);\
  257. } \
  258. } while(0);
  259. #define _STARPU_TRACE_TAG_DONE(tag) \
  260. do { \
  261. struct _starpu_job *job = (tag)->job; \
  262. const char *model_name = _starpu_job_get_model_name((job)); \
  263. if (model_name) \
  264. { \
  265. _STARPU_FUT_DO_PROBE3STR(_STARPU_FUT_TAG_DONE, (tag)->id, _starpu_gettid(), 1, model_name); \
  266. } \
  267. else { \
  268. FUT_DO_PROBE3(_STARPU_FUT_TAG_DONE, (tag)->id, _starpu_gettid(), 0);\
  269. } \
  270. } while(0);
  271. #define _STARPU_TRACE_DATA_COPY(src_node, dst_node, size) \
  272. FUT_DO_PROBE3(_STARPU_FUT_DATA_COPY, src_node, dst_node, size)
  273. #define _STARPU_TRACE_START_DRIVER_COPY(src_node, dst_node, size, com_id) \
  274. FUT_DO_PROBE4(_STARPU_FUT_START_DRIVER_COPY, src_node, dst_node, size, com_id)
  275. #define _STARPU_TRACE_END_DRIVER_COPY(src_node, dst_node, size, com_id) \
  276. FUT_DO_PROBE4(_STARPU_FUT_END_DRIVER_COPY, src_node, dst_node, size, com_id)
  277. #define _STARPU_TRACE_START_DRIVER_COPY_ASYNC(src_node, dst_node) \
  278. FUT_DO_PROBE2(_STARPU_FUT_START_DRIVER_COPY_ASYNC, src_node, dst_node)
  279. #define _STARPU_TRACE_END_DRIVER_COPY_ASYNC(src_node, dst_node) \
  280. FUT_DO_PROBE2(_STARPU_FUT_END_DRIVER_COPY_ASYNC, src_node, dst_node)
  281. #define _STARPU_TRACE_WORK_STEALING(empty_q, victim_q) \
  282. FUT_DO_PROBE2(_STARPU_FUT_WORK_STEALING, empty_q, victim_q)
  283. #define _STARPU_TRACE_WORKER_DEINIT_START \
  284. FUT_DO_PROBE1(_STARPU_FUT_WORKER_DEINIT_START, _starpu_gettid());
  285. #define _STARPU_TRACE_WORKER_DEINIT_END(workerkind) \
  286. FUT_DO_PROBE2(_STARPU_FUT_WORKER_DEINIT_END, workerkind, _starpu_gettid());
  287. #define _STARPU_TRACE_WORKER_SLEEP_START \
  288. FUT_DO_PROBE1(_STARPU_FUT_WORKER_SLEEP_START, _starpu_gettid());
  289. #define _STARPU_TRACE_WORKER_SLEEP_END \
  290. FUT_DO_PROBE1(_STARPU_FUT_WORKER_SLEEP_END, _starpu_gettid());
  291. #define _STARPU_TRACE_USER_DEFINED_START \
  292. FUT_DO_PROBE1(_STARPU_FUT_USER_DEFINED_START, _starpu_gettid());
  293. #define _STARPU_TRACE_USER_DEFINED_END \
  294. FUT_DO_PROBE1(_STARPU_FUT_USER_DEFINED_END, _starpu_gettid());
  295. #define _STARPU_TRACE_START_ALLOC(memnode) \
  296. FUT_DO_PROBE2(_STARPU_FUT_START_ALLOC, memnode, _starpu_gettid());
  297. #define _STARPU_TRACE_END_ALLOC(memnode) \
  298. FUT_DO_PROBE2(_STARPU_FUT_END_ALLOC, memnode, _starpu_gettid());
  299. #define _STARPU_TRACE_START_ALLOC_REUSE(memnode) \
  300. FUT_DO_PROBE2(_STARPU_FUT_START_ALLOC_REUSE, memnode, _starpu_gettid());
  301. #define _STARPU_TRACE_END_ALLOC_REUSE(memnode) \
  302. FUT_DO_PROBE2(_STARPU_FUT_END_ALLOC_REUSE, memnode, _starpu_gettid());
  303. #define _STARPU_TRACE_START_MEMRECLAIM(memnode,is_prefetch) \
  304. FUT_DO_PROBE3(_STARPU_FUT_START_MEMRECLAIM, memnode, is_prefetch, _starpu_gettid());
  305. #define _STARPU_TRACE_END_MEMRECLAIM(memnode, is_prefetch) \
  306. FUT_DO_PROBE3(_STARPU_FUT_END_MEMRECLAIM, memnode, is_prefetch, _starpu_gettid());
  307. /* We skip these events becasue they are called so often that they cause FxT to
  308. * fail and make the overall trace unreadable anyway. */
  309. #define _STARPU_TRACE_START_PROGRESS(memnode) \
  310. do {} while (0);
  311. // FUT_DO_PROBE2(_STARPU_FUT_START_PROGRESS, memnode, _starpu_gettid());
  312. #define _STARPU_TRACE_END_PROGRESS(memnode) \
  313. do {} while (0);
  314. //FUT_DO_PROBE2(_STARPU_FUT_END_PROGRESS, memnode, _starpu_gettid());
  315. #define _STARPU_TRACE_USER_EVENT(code) \
  316. FUT_DO_PROBE2(_STARPU_FUT_USER_EVENT, code, _starpu_gettid());
  317. #define _STARPU_TRACE_SET_PROFILING(status) \
  318. FUT_DO_PROBE2(_STARPU_FUT_SET_PROFILING, status, _starpu_gettid());
  319. #define _STARPU_TRACE_TASK_WAIT_FOR_ALL \
  320. FUT_DO_PROBE0(_STARPU_FUT_TASK_WAIT_FOR_ALL)
  321. #ifdef STARPU_FXT_LOCK_TRACES
  322. #define _STARPU_TRACE_LOCKING_MUTEX(file,line) \
  323. _STARPU_FUT_DO_PROBE2STR(_STARPU_FUT_LOCKING_MUTEX,line,_starpu_gettid(),file);
  324. #define _STARPU_TRACE_MUTEX_LOCKED(file,line) \
  325. _STARPU_FUT_DO_PROBE2STR(_STARPU_FUT_MUTEX_LOCKED,line,_starpu_gettid(),file);
  326. #define _STARPU_TRACE_UNLOCKING_MUTEX(file,line) \
  327. _STARPU_FUT_DO_PROBE2STR(_STARPU_FUT_UNLOCKING_MUTEX,line,_starpu_gettid(),file);
  328. #define _STARPU_TRACE_MUTEX_UNLOCKED(file,line) \
  329. _STARPU_FUT_DO_PROBE2STR(_STARPU_FUT_MUTEX_UNLOCKED,line,_starpu_gettid(),file);
  330. #define _STARPU_TRACE_TRYLOCK_MUTEX(file,line) \
  331. _STARPU_FUT_DO_PROBE2STR(_STARPU_FUT_TRYLOCK_MUTEX,line,_starpu_gettid(),file);
  332. #define _STARPU_TRACE_RDLOCKING_RWLOCK(file,line) \
  333. _STARPU_FUT_DO_PROBE2STR(_STARPU_FUT_RDLOCKING_RWLOCK,line,_starpu_gettid(),file);
  334. #define _STARPU_TRACE_RWLOCK_RDLOCKED(file,line) \
  335. _STARPU_FUT_DO_PROBE2STR(_STARPU_FUT_RWLOCK_RDLOCKED,line,_starpu_gettid(),file);
  336. #define _STARPU_TRACE_WRLOCKING_RWLOCK(file,line) \
  337. _STARPU_FUT_DO_PROBE2STR(_STARPU_FUT_WRLOCKING_RWLOCK,line,_starpu_gettid(),file);
  338. #define _STARPU_TRACE_RWLOCK_WRLOCKED(file,line) \
  339. _STARPU_FUT_DO_PROBE2STR(_STARPU_FUT_RWLOCK_WRLOCKED,line,_starpu_gettid(),file);
  340. #define _STARPU_TRACE_UNLOCKING_RWLOCK(file,line) \
  341. _STARPU_FUT_DO_PROBE2STR(_STARPU_FUT_UNLOCKING_RWLOCK,line,_starpu_gettid(),file);
  342. #define _STARPU_TRACE_RWLOCK_UNLOCKED(file,line) \
  343. _STARPU_FUT_DO_PROBE2STR(_STARPU_FUT_RWLOCK_UNLOCKED,line,_starpu_gettid(),file);
  344. #define _STARPU_TRACE_LOCKING_SPINLOCK(file,line) \
  345. _STARPU_FUT_DO_PROBE2STR(_STARPU_FUT_LOCKING_SPINLOCK,line,_starpu_gettid(),file);
  346. #define _STARPU_TRACE_SPINLOCK_LOCKED(file,line) \
  347. _STARPU_FUT_DO_PROBE2STR(_STARPU_FUT_SPINLOCK_LOCKED,line,_starpu_gettid(),file);
  348. #define _STARPU_TRACE_UNLOCKING_SPINLOCK(file,line) \
  349. _STARPU_FUT_DO_PROBE2STR(_STARPU_FUT_UNLOCKING_SPINLOCK,line,_starpu_gettid(),file);
  350. #define _STARPU_TRACE_SPINLOCK_UNLOCKED(file,line) \
  351. _STARPU_FUT_DO_PROBE2STR(_STARPU_FUT_SPINLOCK_UNLOCKED,line,_starpu_gettid(),file);
  352. #define _STARPU_TRACE_TRYLOCK_SPINLOCK(file,line) \
  353. _STARPU_FUT_DO_PROBE2STR(_STARPU_FUT_TRYLOCK_SPINLOCK,line,_starpu_gettid(),file);
  354. #define _STARPU_TRACE_COND_WAIT_BEGIN(file,line) \
  355. _STARPU_FUT_DO_PROBE2STR(_STARPU_FUT_COND_WAIT_BEGIN,line,_starpu_gettid(),file);
  356. #define _STARPU_TRACE_COND_WAIT_END(file,line) \
  357. _STARPU_FUT_DO_PROBE2STR(_STARPU_FUT_COND_WAIT_END,line,_starpu_gettid(),file);
  358. #else // !STARPU_FXT_LOCK_TRACES
  359. #define _STARPU_TRACE_LOCKING_MUTEX(file,line) do {} while(0)
  360. #define _STARPU_TRACE_MUTEX_LOCKED(file,line) do {} while(0)
  361. #define _STARPU_TRACE_UNLOCKING_MUTEX(file,line) do {} while(0)
  362. #define _STARPU_TRACE_MUTEX_UNLOCKED(file,line) do {} while(0)
  363. #define _STARPU_TRACE_TRYLOCK_MUTEX(file,line) do {} while(0)
  364. #define _STARPU_TRACE_RDLOCKING_RWLOCK(file,line) do {} while(0)
  365. #define _STARPU_TRACE_RWLOCK_RDLOCKED(file,line) do {} while(0)
  366. #define _STARPU_TRACE_WRLOCKING_RWLOCK(file,line) do {} while(0)
  367. #define _STARPU_TRACE_RWLOCK_WRLOCKED(file,line) do {} while(0)
  368. #define _STARPU_TRACE_UNLOCKING_RWLOCK(file,line) do {} while(0)
  369. #define _STARPU_TRACE_RWLOCK_UNLOCKED(file,line) do {} while(0)
  370. #define _STARPU_TRACE_LOCKING_SPINLOCK(file,line) do {} while(0)
  371. #define _STARPU_TRACE_SPINLOCK_LOCKED(file,line) do {} while(0)
  372. #define _STARPU_TRACE_UNLOCKING_SPINLOCK(file,line) do {} while(0)
  373. #define _STARPU_TRACE_SPINLOCK_UNLOCKED(file,line) do {} while(0)
  374. #define _STARPU_TRACE_TRYLOCK_SPINLOCK(file,line) do {} while(0)
  375. #define _STARPU_TRACE_COND_WAIT_BEGIN(file,line) do {} while(0)
  376. #define _STARPU_TRACE_COND_WAIT_END(file,line) do {} while(0)
  377. #endif // STARPU_FXT_LOCK_TRACES
  378. #define _STARPU_TRACE_MEMORY_FULL(size) \
  379. FUT_DO_PROBE2(_STARPU_FUT_MEMORY_FULL,size,_starpu_gettid());
  380. #else // !STARPU_USE_FXT
  381. /* Dummy macros in case FxT is disabled */
  382. #define _STARPU_TRACE_NEW_MEM_NODE(nodeid) do {} while(0)
  383. #define _STARPU_TRACE_WORKER_INIT_START(a,b,c) do {} while(0)
  384. #define _STARPU_TRACE_WORKER_INIT_END do {} while(0)
  385. #define _STARPU_TRACE_START_CODELET_BODY(job) do {} while(0)
  386. #define _STARPU_TRACE_END_CODELET_BODY(job, nimpl, a) do {} while(0)
  387. #define _STARPU_TRACE_START_CALLBACK(job) do {} while(0)
  388. #define _STARPU_TRACE_END_CALLBACK(job) do {} while(0)
  389. #define _STARPU_TRACE_JOB_PUSH(task, prio) do {} while(0)
  390. #define _STARPU_TRACE_JOB_POP(task, prio) do {} while(0)
  391. #define _STARPU_TRACE_UPDATE_TASK_CNT(counter) do {} while(0)
  392. #define _STARPU_TRACE_START_FETCH_INPUT(job) do {} while(0)
  393. #define _STARPU_TRACE_END_FETCH_INPUT(job) do {} while(0)
  394. #define _STARPU_TRACE_START_PUSH_OUTPUT(job) do {} while(0)
  395. #define _STARPU_TRACE_END_PUSH_OUTPUT(job) do {} while(0)
  396. #define _STARPU_TRACE_TAG(tag, job) do {} while(0)
  397. #define _STARPU_TRACE_TAG_DEPS(a, b) do {} while(0)
  398. #define _STARPU_TRACE_TASK_DEPS(a, b) do {} while(0)
  399. #define _STARPU_TRACE_GHOST_TASK_DEPS(a, b) do {} while(0)
  400. #define _STARPU_TRACE_TASK_DONE(a) do {} while(0)
  401. #define _STARPU_TRACE_TAG_DONE(a) do {} while(0)
  402. #define _STARPU_TRACE_DATA_COPY(a, b, c) do {} while(0)
  403. #define _STARPU_TRACE_START_DRIVER_COPY(a,b,c,d) do {} while(0)
  404. #define _STARPU_TRACE_END_DRIVER_COPY(a,b,c,d) do {} while(0)
  405. #define _STARPU_TRACE_START_DRIVER_COPY_ASYNC(a,b) do {} while(0)
  406. #define _STARPU_TRACE_END_DRIVER_COPY_ASYNC(a,b) do {} while(0)
  407. #define _STARPU_TRACE_WORK_STEALING(a, b) do {} while(0)
  408. #define _STARPU_TRACE_WORKER_DEINIT_START do {} while(0)
  409. #define _STARPU_TRACE_WORKER_DEINIT_END(a) do {} while(0)
  410. #define _STARPU_TRACE_WORKER_SLEEP_START do {} while(0)
  411. #define _STARPU_TRACE_WORKER_SLEEP_END do {} while(0)
  412. #define _STARPU_TRACE_USER_DEFINED_START do {} while(0)
  413. #define _STARPU_TRACE_USER_DEFINED_END do {} while(0)
  414. #define _STARPU_TRACE_START_ALLOC(memnode) do {} while(0)
  415. #define _STARPU_TRACE_END_ALLOC(memnode) do {} while(0)
  416. #define _STARPU_TRACE_START_ALLOC_REUSE(a) do {} while(0)
  417. #define _STARPU_TRACE_END_ALLOC_REUSE(a) do {} while(0)
  418. #define _STARPU_TRACE_START_MEMRECLAIM(memnode,is_prefetch) do {} while(0)
  419. #define _STARPU_TRACE_END_MEMRECLAIM(memnode,is_prefetch) do {} while(0)
  420. #define _STARPU_TRACE_START_PROGRESS(memnode) do {} while(0)
  421. #define _STARPU_TRACE_END_PROGRESS(memnode) do {} while(0)
  422. #define _STARPU_TRACE_USER_EVENT(code) do {} while(0)
  423. #define _STARPU_TRACE_SET_PROFILING(status) do {} while(0)
  424. #define _STARPU_TRACE_TASK_WAIT_FOR_ALL do {} while(0)
  425. #define _STARPU_TRACE_LOCKING_MUTEX(file,line) do {} while(0)
  426. #define _STARPU_TRACE_MUTEX_LOCKED(file,line) do {} while(0)
  427. #define _STARPU_TRACE_UNLOCKING_MUTEX(file,line) do {} while(0)
  428. #define _STARPU_TRACE_MUTEX_UNLOCKED(file,line) do {} while(0)
  429. #define _STARPU_TRACE_TRYLOCK_MUTEX(file,line) do {} while(0)
  430. #define _STARPU_TRACE_RDLOCKING_RWLOCK(file,line) do {} while(0)
  431. #define _STARPU_TRACE_RWLOCK_RDLOCKED(file,line) do {} while(0)
  432. #define _STARPU_TRACE_WRLOCKING_RWLOCK(file,line) do {} while(0)
  433. #define _STARPU_TRACE_RWLOCK_WRLOCKED(file,line) do {} while(0)
  434. #define _STARPU_TRACE_UNLOCKING_RWLOCK(file,line) do {} while(0)
  435. #define _STARPU_TRACE_RWLOCK_UNLOCKED(file,line) do {} while(0)
  436. #define _STARPU_TRACE_LOCKING_SPINLOCK(file,line) do {} while(0)
  437. #define _STARPU_TRACE_SPINLOCK_LOCKED(file,line) do {} while(0)
  438. #define _STARPU_TRACE_UNLOCKING_SPINLOCK(file,line) do {} while(0)
  439. #define _STARPU_TRACE_SPINLOCK_UNLOCKED(file,line) do {} while(0)
  440. #define _STARPU_TRACE_TRYLOCK_SPINLOCK(file,line) do {} while(0)
  441. #define _STARPU_TRACE_COND_WAIT_BEGIN(file,line) do {} while(0)
  442. #define _STARPU_TRACE_COND_WAIT_END(file,line) do {} while(0)
  443. #define _STARPU_TRACE_MEMORY_FULL(size) do {} while(0)
  444. #endif // STARPU_USE_FXT
  445. #endif // __FXT_H__