profiling.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2010-2020 Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
  4. * Copyright (C) 2020 Federal University of Rio Grande do Sul (UFRGS)
  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. #include <starpu.h>
  18. #include <starpu_profiling.h>
  19. #include <profiling/profiling.h>
  20. #include <core/workers.h>
  21. #include <common/config.h>
  22. #include <common/utils.h>
  23. #include <common/timing.h>
  24. #include <common/fxt.h>
  25. #include <errno.h>
  26. #ifdef STARPU_PAPI
  27. #include <papi.h>
  28. #endif
  29. /* TODO: move to worker structure */
  30. static struct starpu_profiling_worker_info worker_info[STARPU_NMAXWORKERS];
  31. /* TODO: rather use rwlock */
  32. static starpu_pthread_mutex_t worker_info_mutex[STARPU_NMAXWORKERS];
  33. /* In case the worker is still sleeping when the user request profiling info,
  34. * we need to account for the time elasped while sleeping. */
  35. static unsigned worker_registered_sleeping_start[STARPU_NMAXWORKERS];
  36. static struct timespec sleeping_start_date[STARPU_NMAXWORKERS];
  37. static unsigned worker_registered_executing_start[STARPU_NMAXWORKERS];
  38. static struct timespec executing_start_date[STARPU_NMAXWORKERS];
  39. #ifdef STARPU_PAPI
  40. static starpu_pthread_mutex_t papi_mutex = STARPU_PTHREAD_MUTEX_INITIALIZER;
  41. static int papi_events[PAPI_MAX_HWCTRS];
  42. static int papi_nevents = 0;
  43. static int warned_component_unavailable = 0;
  44. #endif
  45. /* Store the busid of the different (src, dst) pairs. busid_matrix[src][dst]
  46. * contains the busid of (src, dst) or -1 if the bus was not registered. */
  47. struct node_pair
  48. {
  49. int src;
  50. int dst;
  51. struct starpu_profiling_bus_info *bus_info;
  52. };
  53. static int busid_matrix[STARPU_MAXNODES][STARPU_MAXNODES];
  54. static struct starpu_profiling_bus_info bus_profiling_info[STARPU_MAXNODES][STARPU_MAXNODES];
  55. static struct node_pair busid_to_node_pair[STARPU_MAXNODES*STARPU_MAXNODES];
  56. static char bus_direct[STARPU_MAXNODES*STARPU_MAXNODES];
  57. static int bus_ngpus[STARPU_MAXNODES*STARPU_MAXNODES];
  58. static unsigned busid_cnt = 0;
  59. static void _starpu_bus_reset_profiling_info(struct starpu_profiling_bus_info *bus_info);
  60. /* Clear all the profiling info related to the worker. */
  61. static void _starpu_worker_reset_profiling_info_with_lock(int workerid);
  62. /*
  63. * Global control of profiling
  64. */
  65. /* Disabled by default, unless simulating */
  66. int _starpu_profiling =
  67. #ifdef STARPU_SIMGRID
  68. 1
  69. #else
  70. 0
  71. #endif
  72. ;
  73. void starpu_profiling_init()
  74. {
  75. _starpu_profiling_init();
  76. }
  77. static void _starpu_profiling_reset_counters()
  78. {
  79. int worker;
  80. for (worker = 0; worker < STARPU_NMAXWORKERS; worker++)
  81. {
  82. _starpu_worker_reset_profiling_info_with_lock(worker);
  83. }
  84. int busid;
  85. int bus_cnt = starpu_bus_get_count();
  86. for (busid = 0; busid < bus_cnt; busid++)
  87. {
  88. struct starpu_profiling_bus_info *bus_info;
  89. bus_info = busid_to_node_pair[busid].bus_info;
  90. _starpu_bus_reset_profiling_info(bus_info);
  91. }
  92. }
  93. int starpu_profiling_status_set(int status)
  94. {
  95. int worker;
  96. for (worker = 0; worker < STARPU_NMAXWORKERS; worker++)
  97. {
  98. STARPU_PTHREAD_MUTEX_LOCK(&worker_info_mutex[worker]);
  99. }
  100. ANNOTATE_HAPPENS_AFTER(&_starpu_profiling);
  101. int prev_value = _starpu_profiling;
  102. _starpu_profiling = status;
  103. ANNOTATE_HAPPENS_BEFORE(&_starpu_profiling);
  104. _STARPU_TRACE_SET_PROFILING(status);
  105. /* If we enable profiling, we reset the counters. */
  106. if (status == STARPU_PROFILING_ENABLE)
  107. {
  108. _starpu_profiling_reset_counters();
  109. }
  110. for (worker = 0; worker < STARPU_NMAXWORKERS; worker++)
  111. {
  112. STARPU_PTHREAD_MUTEX_UNLOCK(&worker_info_mutex[worker]);
  113. }
  114. return prev_value;
  115. }
  116. void _starpu_profiling_init(void)
  117. {
  118. int worker;
  119. for (worker = 0; worker < STARPU_NMAXWORKERS; worker++)
  120. {
  121. STARPU_PTHREAD_MUTEX_INIT(&worker_info_mutex[worker], NULL);
  122. }
  123. #ifdef STARPU_PAPI
  124. STARPU_PTHREAD_MUTEX_LOCK(&papi_mutex);
  125. int retval = PAPI_library_init(PAPI_VER_CURRENT);
  126. if (retval != PAPI_VER_CURRENT)
  127. {
  128. _STARPU_MSG("Failed init PAPI, error: %s.\n", PAPI_strerror(retval));
  129. }
  130. retval = PAPI_thread_init(pthread_self);
  131. if (retval != PAPI_OK)
  132. {
  133. _STARPU_MSG("Failed init PAPI thread, error: %s.\n", PAPI_strerror(retval));
  134. }
  135. char *conf_papi_events;
  136. char *papi_event_name;
  137. conf_papi_events = starpu_getenv("STARPU_PROF_PAPI_EVENTS");
  138. papi_nevents = 0;
  139. if (conf_papi_events != NULL)
  140. {
  141. while ((papi_event_name = strtok_r(conf_papi_events, " ,", &conf_papi_events)))
  142. {
  143. if (papi_nevents == PAPI_MAX_HWCTRS)
  144. {
  145. _STARPU_MSG("Too many requested papi counters, ignoring %s\n", papi_event_name);
  146. continue;
  147. }
  148. _STARPU_DEBUG("Loading PAPI Event: %s\n", papi_event_name);
  149. retval = PAPI_event_name_to_code ((char*)papi_event_name, &papi_events[papi_nevents]);
  150. if (retval != PAPI_OK)
  151. _STARPU_MSG("Failed to codify papi event [%s], error: %s.\n", papi_event_name, PAPI_strerror(retval));
  152. else
  153. papi_nevents++;
  154. }
  155. }
  156. STARPU_PTHREAD_MUTEX_UNLOCK(&papi_mutex);
  157. #endif
  158. }
  159. #ifdef STARPU_PAPI
  160. void _starpu_profiling_papi_task_start_counters(struct starpu_task *task)
  161. {
  162. if (!starpu_profiling_status_get())
  163. return;
  164. struct starpu_profiling_task_info *profiling_info;
  165. profiling_info = task->profiling_info;
  166. if (profiling_info && papi_nevents)
  167. {
  168. int i;
  169. profiling_info->papi_event_set = PAPI_NULL;
  170. STARPU_PTHREAD_MUTEX_LOCK(&papi_mutex);
  171. PAPI_create_eventset(&profiling_info->papi_event_set);
  172. for(i=0; i<papi_nevents; i++)
  173. {
  174. int ret = PAPI_add_event(profiling_info->papi_event_set, papi_events[i]);
  175. #ifdef PAPI_ECMP_DISABLED
  176. if (ret == PAPI_ECMP_DISABLED && !warned_component_unavailable)
  177. {
  178. _STARPU_MSG("Error while registering Papi event: Component containing event is disabled. Try running `papi_component_avail` to get more information.\n");
  179. warned_component_unavailable = 1;
  180. }
  181. #endif
  182. profiling_info->papi_values[i]=0;
  183. }
  184. PAPI_reset(profiling_info->papi_event_set);
  185. PAPI_start(profiling_info->papi_event_set);
  186. STARPU_PTHREAD_MUTEX_UNLOCK(&papi_mutex);
  187. }
  188. }
  189. void _starpu_profiling_papi_task_stop_counters(struct starpu_task *task)
  190. {
  191. if (!starpu_profiling_status_get())
  192. return;
  193. struct starpu_profiling_task_info *profiling_info;
  194. profiling_info = task->profiling_info;
  195. if (profiling_info && papi_nevents)
  196. {
  197. int i;
  198. STARPU_PTHREAD_MUTEX_LOCK(&papi_mutex);
  199. PAPI_stop(profiling_info->papi_event_set, profiling_info->papi_values);
  200. for(i=0; i<papi_nevents; i++)
  201. {
  202. _STARPU_TRACE_PAPI_TASK_EVENT(papi_events[i], task, profiling_info->papi_values[i]);
  203. }
  204. PAPI_cleanup_eventset(profiling_info->papi_event_set);
  205. PAPI_destroy_eventset(&profiling_info->papi_event_set);
  206. STARPU_PTHREAD_MUTEX_UNLOCK(&papi_mutex);
  207. }
  208. }
  209. #endif
  210. void _starpu_profiling_start(void)
  211. {
  212. const char *env;
  213. if ((env = starpu_getenv("STARPU_PROFILING")) && atoi(env))
  214. {
  215. starpu_profiling_status_set(STARPU_PROFILING_ENABLE);
  216. }
  217. }
  218. void _starpu_profiling_terminate(void)
  219. {
  220. int worker;
  221. for (worker = 0; worker < STARPU_NMAXWORKERS; worker++)
  222. {
  223. STARPU_PTHREAD_MUTEX_DESTROY(&worker_info_mutex[worker]);
  224. }
  225. #ifdef STARPU_PAPI
  226. /* free the resources used by PAPI */
  227. STARPU_PTHREAD_MUTEX_LOCK(&papi_mutex);
  228. PAPI_shutdown();
  229. STARPU_PTHREAD_MUTEX_UNLOCK(&papi_mutex);
  230. #endif
  231. }
  232. /*
  233. * Task profiling
  234. */
  235. struct starpu_profiling_task_info *_starpu_allocate_profiling_info_if_needed(struct starpu_task *task)
  236. {
  237. struct starpu_profiling_task_info *info = NULL;
  238. /* If we are benchmarking, we need room for the energy */
  239. if (starpu_profiling_status_get() || (task->cl && task->cl->energy_model && (task->cl->energy_model->benchmarking || _starpu_get_calibrate_flag())))
  240. {
  241. _STARPU_CALLOC(info, 1, sizeof(struct starpu_profiling_task_info));
  242. }
  243. return info;
  244. }
  245. /*
  246. * Worker profiling
  247. */
  248. static void _starpu_worker_reset_profiling_info_with_lock(int workerid)
  249. {
  250. _starpu_clock_gettime(&worker_info[workerid].start_time);
  251. /* This is computed in a lazy fashion when the application queries
  252. * profiling info. */
  253. starpu_timespec_clear(&worker_info[workerid].total_time);
  254. starpu_timespec_clear(&worker_info[workerid].executing_time);
  255. starpu_timespec_clear(&worker_info[workerid].sleeping_time);
  256. worker_info[workerid].executed_tasks = 0;
  257. worker_info[workerid].used_cycles = 0;
  258. worker_info[workerid].stall_cycles = 0;
  259. worker_info[workerid].energy_consumed = 0;
  260. worker_info[workerid].flops = 0;
  261. /* We detect if the worker is already sleeping or doing some
  262. * computation */
  263. enum _starpu_worker_status status = _starpu_worker_get_status(workerid);
  264. if (status == STATUS_SLEEPING || status == STATUS_SLEEPING_SCHEDULING)
  265. {
  266. worker_registered_sleeping_start[workerid] = 1;
  267. _starpu_clock_gettime(&sleeping_start_date[workerid]);
  268. }
  269. else
  270. {
  271. worker_registered_sleeping_start[workerid] = 0;
  272. }
  273. if (status == STATUS_EXECUTING)
  274. {
  275. worker_registered_executing_start[workerid] = 1;
  276. _starpu_clock_gettime(&executing_start_date[workerid]);
  277. }
  278. else
  279. {
  280. worker_registered_executing_start[workerid] = 0;
  281. }
  282. }
  283. void _starpu_worker_restart_sleeping(int workerid)
  284. {
  285. if (starpu_profiling_status_get())
  286. {
  287. struct timespec sleep_start_time;
  288. _starpu_clock_gettime(&sleep_start_time);
  289. STARPU_PTHREAD_MUTEX_LOCK(&worker_info_mutex[workerid]);
  290. if (worker_registered_sleeping_start[workerid] == 0)
  291. {
  292. worker_registered_sleeping_start[workerid] = 1;
  293. memcpy(&sleeping_start_date[workerid], &sleep_start_time, sizeof(struct timespec));
  294. }
  295. STARPU_PTHREAD_MUTEX_UNLOCK(&worker_info_mutex[workerid]);
  296. }
  297. }
  298. void _starpu_worker_stop_sleeping(int workerid)
  299. {
  300. if (starpu_profiling_status_get())
  301. {
  302. struct timespec *sleeping_start, sleep_end_time;
  303. _starpu_clock_gettime(&sleep_end_time);
  304. STARPU_PTHREAD_MUTEX_LOCK(&worker_info_mutex[workerid]);
  305. if (worker_registered_sleeping_start[workerid] == 1)
  306. {
  307. sleeping_start = &sleeping_start_date[workerid];
  308. /* Perhaps that profiling was enabled while the worker was
  309. * already blocked, so we don't measure (end - start), but
  310. * (end - max(start,worker_start)) where worker_start is the
  311. * date of the previous profiling info reset on the worker */
  312. struct timespec *worker_start = &worker_info[workerid].start_time;
  313. if (starpu_timespec_cmp(sleeping_start, worker_start, <))
  314. {
  315. /* sleeping_start < worker_start */
  316. sleeping_start = worker_start;
  317. }
  318. struct timespec sleeping_time;
  319. starpu_timespec_sub(&sleep_end_time, sleeping_start, &sleeping_time);
  320. starpu_timespec_accumulate(&worker_info[workerid].sleeping_time, &sleeping_time);
  321. worker_registered_sleeping_start[workerid] = 0;
  322. }
  323. STARPU_PTHREAD_MUTEX_UNLOCK(&worker_info_mutex[workerid]);
  324. }
  325. }
  326. void _starpu_worker_register_executing_start_date(int workerid, struct timespec *executing_start)
  327. {
  328. if (starpu_profiling_status_get())
  329. {
  330. STARPU_PTHREAD_MUTEX_LOCK(&worker_info_mutex[workerid]);
  331. worker_registered_executing_start[workerid] = 1;
  332. memcpy(&executing_start_date[workerid], executing_start, sizeof(struct timespec));
  333. STARPU_PTHREAD_MUTEX_UNLOCK(&worker_info_mutex[workerid]);
  334. }
  335. }
  336. void _starpu_worker_register_executing_end(int workerid)
  337. {
  338. if (starpu_profiling_status_get())
  339. {
  340. STARPU_PTHREAD_MUTEX_LOCK(&worker_info_mutex[workerid]);
  341. worker_registered_executing_start[workerid] = 0;
  342. STARPU_PTHREAD_MUTEX_UNLOCK(&worker_info_mutex[workerid]);
  343. }
  344. }
  345. void _starpu_worker_update_profiling_info_executing(int workerid, struct timespec *executing_time, int executed_tasks, uint64_t used_cycles, uint64_t stall_cycles, double energy_consumed, double flops)
  346. {
  347. if (starpu_profiling_status_get())
  348. {
  349. STARPU_PTHREAD_MUTEX_LOCK(&worker_info_mutex[workerid]);
  350. if (executing_time)
  351. starpu_timespec_accumulate(&worker_info[workerid].executing_time, executing_time);
  352. worker_info[workerid].used_cycles += used_cycles;
  353. worker_info[workerid].stall_cycles += stall_cycles;
  354. worker_info[workerid].energy_consumed += energy_consumed;
  355. worker_info[workerid].executed_tasks += executed_tasks;
  356. worker_info[workerid].flops += flops;
  357. STARPU_PTHREAD_MUTEX_UNLOCK(&worker_info_mutex[workerid]);
  358. }
  359. else /* Not thread safe, shouldn't be too much a problem */
  360. worker_info[workerid].executed_tasks += executed_tasks;
  361. }
  362. int starpu_profiling_worker_get_info(int workerid, struct starpu_profiling_worker_info *info)
  363. {
  364. if (!starpu_profiling_status_get())
  365. {
  366. /* Not thread safe, shouldn't be too much a problem */
  367. info->executed_tasks = worker_info[workerid].executed_tasks;
  368. }
  369. STARPU_PTHREAD_MUTEX_LOCK(&_starpu_get_worker_struct(workerid)->sched_mutex);
  370. STARPU_PTHREAD_MUTEX_LOCK(&worker_info_mutex[workerid]);
  371. if (info)
  372. {
  373. /* The total time is computed in a lazy fashion */
  374. struct timespec now;
  375. _starpu_clock_gettime(&now);
  376. /* In case some worker is currently sleeping, we take into
  377. * account the time spent since it registered. */
  378. if (worker_registered_sleeping_start[workerid])
  379. {
  380. struct timespec sleeping_time;
  381. starpu_timespec_sub(&now, &sleeping_start_date[workerid], &sleeping_time);
  382. starpu_timespec_accumulate(&worker_info[workerid].sleeping_time, &sleeping_time);
  383. }
  384. if (worker_registered_executing_start[workerid])
  385. {
  386. struct timespec executing_time;
  387. starpu_timespec_sub(&now, &executing_start_date[workerid], &executing_time);
  388. starpu_timespec_accumulate(&worker_info[workerid].executing_time, &executing_time);
  389. }
  390. /* total_time = now - start_time */
  391. starpu_timespec_sub(&now, &worker_info[workerid].start_time,
  392. &worker_info[workerid].total_time);
  393. memcpy(info, &worker_info[workerid], sizeof(struct starpu_profiling_worker_info));
  394. }
  395. _starpu_worker_reset_profiling_info_with_lock(workerid);
  396. STARPU_PTHREAD_MUTEX_UNLOCK(&worker_info_mutex[workerid]);
  397. STARPU_PTHREAD_MUTEX_UNLOCK(&_starpu_get_worker_struct(workerid)->sched_mutex);
  398. return 0;
  399. }
  400. /* When did the task reach the scheduler ? */
  401. void _starpu_profiling_set_task_push_start_time(struct starpu_task *task)
  402. {
  403. if (!starpu_profiling_status_get())
  404. return;
  405. struct starpu_profiling_task_info *profiling_info;
  406. profiling_info = task->profiling_info;
  407. if (profiling_info)
  408. _starpu_clock_gettime(&profiling_info->push_start_time);
  409. }
  410. void _starpu_profiling_set_task_push_end_time(struct starpu_task *task)
  411. {
  412. if (!starpu_profiling_status_get())
  413. return;
  414. struct starpu_profiling_task_info *profiling_info;
  415. profiling_info = task->profiling_info;
  416. if (profiling_info)
  417. _starpu_clock_gettime(&profiling_info->push_end_time);
  418. }
  419. /*
  420. * Bus profiling
  421. */
  422. void _starpu_initialize_busid_matrix(void)
  423. {
  424. int i, j;
  425. for (j = 0; j < STARPU_MAXNODES; j++)
  426. for (i = 0; i < STARPU_MAXNODES; i++)
  427. busid_matrix[i][j] = -1;
  428. busid_cnt = 0;
  429. }
  430. static void _starpu_bus_reset_profiling_info(struct starpu_profiling_bus_info *bus_info)
  431. {
  432. _starpu_clock_gettime(&bus_info->start_time);
  433. bus_info->transferred_bytes = 0;
  434. bus_info->transfer_count = 0;
  435. }
  436. int _starpu_register_bus(int src_node, int dst_node)
  437. {
  438. if (starpu_bus_get_id(src_node, dst_node) != -1)
  439. return -EBUSY;
  440. int busid = STARPU_ATOMIC_ADD(&busid_cnt, 1) - 1;
  441. busid_matrix[src_node][dst_node] = busid;
  442. busid_to_node_pair[busid].src = src_node;
  443. busid_to_node_pair[busid].dst = dst_node;
  444. busid_to_node_pair[busid].bus_info = &bus_profiling_info[src_node][dst_node];
  445. _starpu_bus_reset_profiling_info(&bus_profiling_info[src_node][dst_node]);
  446. return busid;
  447. }
  448. int starpu_bus_get_count(void)
  449. {
  450. return busid_cnt;
  451. }
  452. int starpu_bus_get_id(int src, int dst)
  453. {
  454. return busid_matrix[src][dst];
  455. }
  456. int starpu_bus_get_src(int busid)
  457. {
  458. return busid_to_node_pair[busid].src;
  459. }
  460. int starpu_bus_get_dst(int busid)
  461. {
  462. return busid_to_node_pair[busid].dst;
  463. }
  464. void starpu_bus_set_direct(int busid, int direct)
  465. {
  466. bus_direct[busid] = direct;
  467. }
  468. int starpu_bus_get_direct(int busid)
  469. {
  470. return bus_direct[busid];
  471. }
  472. void starpu_bus_set_ngpus(int busid, int ngpus)
  473. {
  474. bus_ngpus[busid] = ngpus;
  475. }
  476. int starpu_bus_get_ngpus(int busid)
  477. {
  478. struct _starpu_machine_topology *topology = &_starpu_get_machine_config()->topology;
  479. int ngpus = bus_ngpus[busid];
  480. if (!ngpus)
  481. /* Unknown number of GPUs, assume it's shared by all GPUs */
  482. ngpus = topology->ndevices[STARPU_CUDA_WORKER]+topology->ndevices[STARPU_OPENCL_WORKER];
  483. return ngpus;
  484. }
  485. int starpu_bus_get_profiling_info(int busid, struct starpu_profiling_bus_info *bus_info)
  486. {
  487. int src_node = starpu_bus_get_src(busid);
  488. int dst_node = starpu_bus_get_dst(busid);
  489. /* XXX protect all this method with a mutex */
  490. if (bus_info)
  491. {
  492. struct timespec now;
  493. _starpu_clock_gettime(&now);
  494. /* total_time = now - start_time */
  495. starpu_timespec_sub(&now, &bus_profiling_info[src_node][dst_node].start_time,
  496. &bus_profiling_info[src_node][dst_node].total_time);
  497. memcpy(bus_info, &bus_profiling_info[src_node][dst_node], sizeof(struct starpu_profiling_bus_info));
  498. }
  499. _starpu_bus_reset_profiling_info(&bus_profiling_info[src_node][dst_node]);
  500. return 0;
  501. }
  502. void _starpu_bus_update_profiling_info(int src_node, int dst_node, size_t size)
  503. {
  504. bus_profiling_info[src_node][dst_node].transferred_bytes += size;
  505. bus_profiling_info[src_node][dst_node].transfer_count++;
  506. // fprintf(stderr, "PROFILE %d -> %d : %d (cnt %d)\n", src_node, dst_node, size, bus_profiling_info[src_node][dst_node].transfer_count);
  507. }
  508. #undef starpu_profiling_status_get
  509. int starpu_profiling_status_get(void)
  510. {
  511. int ret;
  512. ANNOTATE_HAPPENS_AFTER(&_starpu_profiling);
  513. ret = _starpu_profiling;
  514. ANNOTATE_HAPPENS_BEFORE(&_starpu_profiling);
  515. return ret;
  516. }