fxt-tool.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797
  1. /*
  2. * StarPU
  3. * Copyright (C) INRIA 2008-2009 (see AUTHORS file)
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU Lesser General Public License as published by
  7. * the Free Software Foundation; either version 2.1 of the License, or (at
  8. * your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. *
  14. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  15. */
  16. #include "fxt-tool.h"
  17. char *worker_name[MAXWORKERS];
  18. static char *cpus_worker_colors[MAXWORKERS] = {"/greens9/7", "/greens9/6", "/greens9/5", "/greens9/4", "/greens9/9", "/greens9/3", "/greens9/2", "/greens9/1" };
  19. static char *cuda_worker_colors[MAXWORKERS] = {"/ylorrd9/9", "/ylorrd9/6", "/ylorrd9/3", "/ylorrd9/1", "/ylorrd9/8", "/ylorrd9/7", "/ylorrd9/4", "/ylorrd9/2", "/ylorrd9/1"};
  20. static char *other_worker_colors[MAXWORKERS] = {"/greys9/9", "/greys9/8", "/greys9/7", "/greys9/6"};
  21. static char *worker_colors[MAXWORKERS];
  22. static fxt_t fut;
  23. struct fxt_ev_64 ev;
  24. unsigned first_event = 1;
  25. uint64_t start_time = 0;
  26. uint64_t end_time = 0;
  27. unsigned nworkers = 0;
  28. char *filename = NULL;
  29. unsigned per_task_colour = 0;
  30. unsigned generate_distrib = 0;
  31. unsigned no_counter = 0;
  32. unsigned no_bus = 0;
  33. LIST_TYPE(symbol_name,
  34. char *name;
  35. );
  36. symbol_name_list_t symbol_list;
  37. /*
  38. * Paje trace file tools
  39. */
  40. static char *out_paje_path = "paje.trace";
  41. static FILE *out_paje_file;
  42. static char *distrib_time_path = "distrib.data";
  43. static FILE *distrib_time;
  44. void paje_output_file_init(void)
  45. {
  46. /* create a new file */
  47. out_paje_file = fopen(out_paje_path, "w+");
  48. if (generate_distrib)
  49. distrib_time = fopen(distrib_time_path, "w+");
  50. write_paje_header(out_paje_file);
  51. fprintf(out_paje_file, " \n \
  52. 1 P 0 \"Program\" \n \
  53. 1 Mn P \"Memory Node\" \n \
  54. 1 T Mn \"Worker\" \n \
  55. 1 Sc P \"Scheduler State\" \n \
  56. 2 event T \"event type\" \n \
  57. 3 S T \"Thread State\" \n \
  58. 3 MS Mn \"Memory Node State\" \n \
  59. 4 ntask Sc \"Number of tasks\" \n \
  60. 6 I S Initializing \"0.0 .7 1.0\" \n \
  61. 6 D S Deinitializing \"0.0 .1 .7\" \n \
  62. 6 Fi S FetchingInput \"1.0 .1 1.0\" \n \
  63. 6 Po S PushingOutput \"0.1 1.0 1.0\" \n \
  64. 6 E S Executing \".0 .6 .4\" \n \
  65. 6 C S Callback \".0 .3 .8\" \n \
  66. 6 B S Blocked \".9 .1 .0\" \n \
  67. 6 P S Progressing \".4 .1 .6\" \n \
  68. 6 A MS Allocating \".4 .1 .0\" \n \
  69. 6 Ar MS AllocatingReuse \".1 .1 .8\" \n \
  70. 6 R MS Reclaiming \".0 .1 .4\" \n \
  71. 6 Co MS DriverCopy \".3 .5 .1\" \n \
  72. 6 No MS Nothing \".0 .0 .0\" \n \
  73. 5 L P Mn Mn L\n");
  74. }
  75. void paje_output_file_terminate(void)
  76. {
  77. /* close the file */
  78. fclose(out_paje_file);
  79. if (generate_distrib)
  80. fclose(distrib_time);
  81. }
  82. /*
  83. * Generic tools
  84. */
  85. void handle_new_mem_node(void)
  86. {
  87. char *memnodestr = malloc(16*sizeof(char));
  88. sprintf(memnodestr, "%ld", ev.param[0]);
  89. fprintf(out_paje_file, "7 %f %s Mn p MEMNODE%s\n", (float)((ev.time-start_time)/1000000.0), memnodestr, memnodestr);
  90. }
  91. static unsigned cuda_index = 0;
  92. static unsigned cpus_index = 0;
  93. static unsigned other_index = 0;
  94. void handle_worker_init_start(void)
  95. {
  96. /*
  97. arg0 : type of worker (cuda, core ..)
  98. arg1 : memory node
  99. arg2 : thread id
  100. */
  101. char *str = malloc(20*sizeof(char));
  102. char *color = NULL;
  103. strcpy(str, "unknown");
  104. switch (ev.param[0]) {
  105. case FUT_APPS_KEY:
  106. str = "apps";
  107. color = other_worker_colors[other_index++];
  108. break;
  109. case FUT_CORE_KEY:
  110. str = "core";
  111. color = cpus_worker_colors[cpus_index++];
  112. break;
  113. case FUT_CUDA_KEY:
  114. str = "cuda";
  115. color = cuda_worker_colors[cuda_index++];
  116. break;
  117. }
  118. // fprintf(stderr, "new %s worker (tid = %d)\n", str, ev.param[1]);
  119. char *memnodestr = malloc(16*sizeof(char));
  120. sprintf(memnodestr, "%ld", ev.param[1]);
  121. char *tidstr = malloc(16*sizeof(char));
  122. sprintf(tidstr, "%ld", ev.param[2]);
  123. fprintf(out_paje_file, "7 %f %s T MEMNODE%s %s \n", (float)((ev.time-start_time)/1000000.0), tidstr, memnodestr, tidstr);
  124. /* create a new key in the htable */
  125. uint64_t workerid = nworkers++;
  126. ENTRY item;
  127. item.key = tidstr;
  128. item.data = (void *)workerid;
  129. worker_colors[workerid] = color;
  130. ENTRY *res;
  131. res = hsearch(item, FIND);
  132. worker_name[workerid] = str;
  133. /* only register a thread once */
  134. STARPU_ASSERT(res == NULL);
  135. res = hsearch(item, ENTER);
  136. STARPU_ASSERT(res);
  137. /* start initialization */
  138. fprintf(out_paje_file, "10 %f S %ld I\n", (float)((ev.time-start_time)/1000000.0), ev.param[2]);
  139. }
  140. void handle_worker_init_end(void)
  141. {
  142. fprintf(out_paje_file, "10 %f S %ld B\n", (float)((ev.time-start_time)/1000000.0), ev.param[0]);
  143. }
  144. void handle_worker_deinit_start(void)
  145. {
  146. fprintf(out_paje_file, "10 %f S %ld D\n", (float)((ev.time-start_time)/1000000.0), ev.param[0]);
  147. }
  148. void handle_worker_deinit_end(void)
  149. {
  150. fprintf(out_paje_file, "8 %f %ld T\n", (float)((ev.time-start_time)/1000000.0), ev.param[1]);
  151. }
  152. int find_workder_id(unsigned long tid)
  153. {
  154. char tidstr[16];
  155. sprintf(tidstr, "%ld", tid);
  156. ENTRY item;
  157. item.key = tidstr;
  158. item.data = NULL;
  159. ENTRY *res;
  160. res = hsearch(item, FIND);
  161. //STARPU_ASSERT(res);
  162. if (!res)
  163. return -1;
  164. int id = (uintptr_t)(res->data);
  165. return id;
  166. }
  167. static unsigned get_colour_symbol_red(char *name)
  168. {
  169. /* choose some colour ... that's disguting yes */
  170. uint32_t hash_symbol = crc32_string(name, 0);
  171. return (unsigned)crc32_string("red", hash_symbol) % 1024;
  172. }
  173. static unsigned get_colour_symbol_green(char *name)
  174. {
  175. /* choose some colour ... that's disguting yes */
  176. uint32_t hash_symbol = crc32_string(name, 0);
  177. return (unsigned)crc32_string("green", hash_symbol) % 1024;
  178. }
  179. static unsigned get_colour_symbol_blue(char *name)
  180. {
  181. /* choose some colour ... that's disguting yes */
  182. uint32_t hash_symbol = crc32_string(name, 0);
  183. return (unsigned)crc32_string("blue", hash_symbol) % 1024;
  184. }
  185. static void create_paje_state_if_not_found(char *name)
  186. {
  187. symbol_name_itor_t itor;
  188. for (itor = symbol_name_list_begin(symbol_list);
  189. itor != symbol_name_list_end(symbol_list);
  190. itor = symbol_name_list_next(itor))
  191. {
  192. if (!strcmp(name, itor->name))
  193. {
  194. /* we found an entry */
  195. return;
  196. }
  197. }
  198. /* it's the first time ... */
  199. symbol_name_t entry = symbol_name_new();
  200. entry->name = malloc(strlen(name));
  201. strcpy(entry->name, name);
  202. symbol_name_list_push_front(symbol_list, entry);
  203. /* choose some colour ... that's disguting yes */
  204. unsigned hash_symbol_red = get_colour_symbol_red(name);
  205. unsigned hash_symbol_green = get_colour_symbol_green(name);
  206. unsigned hash_symbol_blue = get_colour_symbol_blue(name);
  207. fprintf(stderr, "name %s hash red %d green %d blue %d \n", name, hash_symbol_red, hash_symbol_green, hash_symbol_blue);
  208. uint32_t hash_sum = hash_symbol_red + hash_symbol_green + hash_symbol_blue;
  209. float red = (1.0f * hash_symbol_red) / hash_sum;
  210. float green = (1.0f * hash_symbol_green) / hash_sum;
  211. float blue = (1.0f * hash_symbol_blue) / hash_sum;
  212. /* create the Paje state */
  213. fprintf(out_paje_file, "6 %s S %s \"%f %f %f\" \n", name, red, green, blue, name);
  214. }
  215. /* TODO remove 32 */
  216. double last_codelet_start[32];
  217. uint64_t last_codelet_hash[32];
  218. char last_codelet_symbol[128][32];
  219. void handle_start_codelet_body(void)
  220. {
  221. int worker;
  222. worker = find_workder_id(ev.param[1]);
  223. if (worker < 0) return;
  224. unsigned long has_name = ev.param[2];
  225. char *name = has_name?(char *)&ev.param[3]:"unknown";
  226. snprintf(last_codelet_symbol[worker], 128, "%s", name);
  227. /* TODO */
  228. last_codelet_hash[worker] = 0;
  229. float start_codelet_time = (float)((ev.time-start_time)/1000000.0);
  230. last_codelet_start[worker] = start_codelet_time;
  231. if (per_task_colour)
  232. {
  233. create_paje_state_if_not_found(name);
  234. fprintf(out_paje_file, "101 %f S %ld E %s\n", start_codelet_time, ev.param[1], name);
  235. }
  236. else {
  237. fprintf(out_paje_file, "10 %f S %ld E\n", start_codelet_time, ev.param[1]);
  238. }
  239. end_time = STARPU_MAX(end_time, ev.time);
  240. }
  241. void handle_end_codelet_body(void)
  242. {
  243. //fprintf(stderr, "end codelet %p on tid %d\n", (void *)ev.param[0], ev.param[1]);
  244. int worker;
  245. worker = find_workder_id(ev.param[1]);
  246. if (worker < 0) return;
  247. float end_codelet_time = (float)((ev.time-start_time)/1000000.0);
  248. // printf("<- worker %d\n", worker);
  249. fprintf(out_paje_file, "10 %f S %ld B\n", end_codelet_time, ev.param[1] );
  250. float codelet_length = (end_codelet_time - last_codelet_start[worker]);
  251. if (generate_distrib)
  252. fprintf(distrib_time, "%s\t%lx\t%d\t%f\n", last_codelet_symbol[worker],
  253. worker, last_codelet_hash[worker], codelet_length);
  254. end_time = STARPU_MAX(end_time, ev.time);
  255. }
  256. void handle_user_event(void)
  257. {
  258. int worker;
  259. worker = find_workder_id(ev.param[1]);
  260. if (worker < 0) return;
  261. unsigned code;
  262. code = ev.param[2];
  263. fprintf(out_paje_file, "9 %f event %ld %d\n", (float)((ev.time-start_time)/1000000.0), ev.param[1], code);
  264. }
  265. void handle_start_callback(void)
  266. {
  267. int worker;
  268. worker = find_workder_id(ev.param[1]);
  269. if (worker < 0) return;
  270. fprintf(out_paje_file, "10 %f S %ld C\n", (float)((ev.time-start_time)/1000000.0), ev.param[1] );
  271. }
  272. void handle_end_callback(void)
  273. {
  274. int worker;
  275. worker = find_workder_id(ev.param[1]);
  276. if (worker < 0) return;
  277. fprintf(out_paje_file, "10 %f S %ld B\n", (float)((ev.time-start_time)/1000000.0), ev.param[1] );
  278. }
  279. void handle_start_fetch_input(void)
  280. {
  281. int worker;
  282. worker = find_workder_id(ev.param[1]);
  283. if (worker < 0) return;
  284. fprintf(out_paje_file, "10 %f S %ld Fi\n", (float)((ev.time-start_time)/1000000.0), ev.param[1] );
  285. end_time = STARPU_MAX(end_time, ev.time);
  286. }
  287. void handle_end_fetch_input(void)
  288. {
  289. int worker;
  290. worker = find_workder_id(ev.param[1]);
  291. if (worker < 0) return;
  292. fprintf(out_paje_file, "10 %f S %ld B\n", (float)((ev.time-start_time)/1000000.0), ev.param[1] );
  293. end_time = STARPU_MAX(end_time, ev.time);
  294. }
  295. void handle_start_push_output(void)
  296. {
  297. int worker;
  298. worker = find_workder_id(ev.param[1]);
  299. if (worker < 0) return;
  300. fprintf(out_paje_file, "10 %f S %ld Po\n", (float)((ev.time-start_time)/1000000.0), ev.param[1] );
  301. end_time = STARPU_MAX(end_time, ev.time);
  302. }
  303. void handle_end_push_output(void)
  304. {
  305. int worker;
  306. worker = find_workder_id(ev.param[1]);
  307. if (worker < 0) return;
  308. fprintf(out_paje_file, "10 %f S %ld B\n", (float)((ev.time-start_time)/1000000.0), ev.param[1] );
  309. end_time = STARPU_MAX(end_time, ev.time);
  310. }
  311. void handle_start_progress(void)
  312. {
  313. int worker;
  314. worker = find_workder_id(ev.param[1]);
  315. if (worker < 0) return;
  316. fprintf(out_paje_file, "10 %f S %ld P\n", (float)((ev.time-start_time)/1000000.0), ev.param[1] );
  317. end_time = STARPU_MAX(end_time, ev.time);
  318. }
  319. void handle_end_progress(void)
  320. {
  321. int worker;
  322. worker = find_workder_id(ev.param[1]);
  323. if (worker < 0) return;
  324. fprintf(out_paje_file, "10 %f S %ld B\n", (float)((ev.time-start_time)/1000000.0), ev.param[1] );
  325. end_time = STARPU_MAX(end_time, ev.time);
  326. }
  327. void handle_data_copy(void)
  328. {
  329. }
  330. void handle_start_driver_copy(void)
  331. {
  332. unsigned src = ev.param[0];
  333. unsigned dst = ev.param[1];
  334. unsigned size = ev.param[2];
  335. unsigned comid = ev.param[3];
  336. if (!no_bus)
  337. fprintf(out_paje_file, "10 %f MS MEMNODE%d Co\n", (float)((ev.time-start_time)/1000000.0), dst);
  338. if (!no_bus)
  339. fprintf(out_paje_file, "18 %f L p %d MEMNODE%d com_%d\n", (float)((ev.time-start_time)/1000000.0), size, src, comid);
  340. }
  341. void handle_end_driver_copy(void)
  342. {
  343. unsigned dst = ev.param[1];
  344. unsigned size = ev.param[2];
  345. unsigned comid = ev.param[3];
  346. fprintf(out_paje_file, "10 %f MS MEMNODE%d No\n", (float)((ev.time-start_time)/1000000.0), dst);
  347. fprintf(out_paje_file, "19 %f L p %d MEMNODE%d com_%d\n", (float)((ev.time-start_time)/1000000.0), size, dst, comid);
  348. }
  349. void handle_start_alloc(void)
  350. {
  351. unsigned memnode = ev.param[0];
  352. fprintf(out_paje_file, "10 %f MS MEMNODE%d A\n", (float)((ev.time-start_time)/1000000.0), memnode);
  353. }
  354. void handle_end_alloc(void)
  355. {
  356. unsigned memnode = ev.param[0];
  357. fprintf(out_paje_file, "10 %f MS MEMNODE%d No\n", (float)((ev.time-start_time)/1000000.0), memnode);
  358. }
  359. void handle_start_alloc_reuse(void)
  360. {
  361. unsigned memnode = ev.param[0];
  362. fprintf(out_paje_file, "10 %f MS MEMNODE%d Ar\n", (float)((ev.time-start_time)/1000000.0), memnode);
  363. }
  364. void handle_end_alloc_reuse(void)
  365. {
  366. unsigned memnode = ev.param[0];
  367. fprintf(out_paje_file, "10 %f MS MEMNODE%d No\n", (float)((ev.time-start_time)/1000000.0), memnode);
  368. }
  369. void handle_start_memreclaim(void)
  370. {
  371. unsigned memnode = ev.param[0];
  372. fprintf(out_paje_file, "10 %f MS MEMNODE%d R\n", (float)((ev.time-start_time)/1000000.0), memnode);
  373. }
  374. void handle_end_memreclaim(void)
  375. {
  376. unsigned memnode = ev.param[0];
  377. fprintf(out_paje_file, "10 %f MS MEMNODE%d No\n", (float)((ev.time-start_time)/1000000.0), memnode);
  378. }
  379. int curq_size = 0;
  380. void handle_job_push(void)
  381. {
  382. curq_size++;
  383. fprintf(out_paje_file, "13 %f ntask sched %f\n", (float)((ev.time-start_time)/1000000.0), (float)curq_size);
  384. }
  385. void handle_job_pop(void)
  386. {
  387. curq_size--;
  388. fprintf(out_paje_file, "13 %f ntask sched %f\n", (float)((ev.time-start_time)/1000000.0), (float)curq_size);
  389. }
  390. void handle_codelet_tag_deps(void)
  391. {
  392. uint64_t child;
  393. uint64_t father;
  394. child = ev.param[0];
  395. father = ev.param[1];
  396. add_deps(child, father);
  397. }
  398. void handle_task_done(void)
  399. {
  400. uint64_t tag_id;
  401. tag_id = ev.param[0];
  402. unsigned long has_name = ev.param[2];
  403. char *name = has_name?(char *)&ev.param[3]:"unknown";
  404. int worker;
  405. worker = find_workder_id(ev.param[1]);
  406. char *colour;
  407. char buffer[32];
  408. if (per_task_colour) {
  409. snprintf(buffer, 32, "%.4f,%.4f,%.4f",
  410. get_colour_symbol_red(name)/1024.0,
  411. get_colour_symbol_green(name)/1024.0,
  412. get_colour_symbol_blue(name)/1024.0);
  413. colour = &buffer[0];
  414. }
  415. else {
  416. colour=(worker < 0)?"0.0,0.0,0.0":worker_colors[worker];
  417. }
  418. dot_set_tag_done(tag_id, colour);
  419. }
  420. static void parse_args(int argc, char **argv)
  421. {
  422. int i;
  423. for (i = 1; i < argc; i++) {
  424. if (strcmp(argv[i], "-c") == 0) {
  425. per_task_colour = 1;
  426. }
  427. if (strcmp(argv[i], "-o") == 0) {
  428. out_paje_path = argv[++i];
  429. }
  430. if (strcmp(argv[i], "-i") == 0) {
  431. filename = argv[++i];
  432. }
  433. if (strcmp(argv[i], "-no-counter") == 0) {
  434. no_counter = 1;
  435. }
  436. if (strcmp(argv[i], "-no-bus") == 0) {
  437. no_bus = 1;
  438. }
  439. if (strcmp(argv[i], "-d") == 0) {
  440. generate_distrib = 1;
  441. }
  442. if (strcmp(argv[i], "-h") == 0) {
  443. fprintf(stderr, "Usage : %s [-c] [-no-counter] [-no-bus] [-i input_filename] [-o output_filename]\n", argv[0]);
  444. fprintf(stderr, "\t-c: use a different colour for every type of task.\n");
  445. exit(-1);
  446. }
  447. }
  448. }
  449. /*
  450. * This program should be used to parse the log generated by FxT
  451. */
  452. int main(int argc, char **argv)
  453. {
  454. int ret;
  455. int fd_in, fd_out;
  456. int use_stdout = 1;
  457. init_dag_dot();
  458. parse_args(argc, argv);
  459. fd_in = open(filename, O_RDONLY);
  460. if (fd_in < 0) {
  461. perror("open failed :");
  462. exit(-1);
  463. }
  464. fut = fxt_fdopen(fd_in);
  465. if (!fut) {
  466. perror("fxt_fdopen :");
  467. exit(-1);
  468. }
  469. fxt_blockev_t block;
  470. block = fxt_blockev_enter(fut);
  471. /* create a htable to identify each worker(tid) */
  472. hcreate(MAXWORKERS);
  473. symbol_list = symbol_name_list_new();
  474. paje_output_file_init();
  475. while(1) {
  476. ret = fxt_next_ev(block, FXT_EV_TYPE_64, (struct fxt_ev *)&ev);
  477. if (ret != FXT_EV_OK) {
  478. fprintf(stderr, "no more block ...\n");
  479. break;
  480. }
  481. __attribute__ ((unused)) int nbparam = ev.nb_params;
  482. if (first_event)
  483. {
  484. first_event = 0;
  485. start_time = ev.time;
  486. /* create the "program" container */
  487. fprintf(out_paje_file, "7 %f p P 0 program \n", (float)(start_time-start_time));
  488. /* create a variable with the number of tasks */
  489. if (!no_counter)
  490. {
  491. fprintf(out_paje_file, "7 %f sched Sc p scheduler \n", (float)(start_time-start_time));
  492. fprintf(out_paje_file, "13 %f ntask sched 0.0\n", (float)(start_time-start_time));
  493. }
  494. }
  495. switch (ev.code) {
  496. case FUT_WORKER_INIT_START:
  497. handle_worker_init_start();
  498. break;
  499. case FUT_WORKER_INIT_END:
  500. handle_worker_init_end();
  501. break;
  502. case FUT_NEW_MEM_NODE:
  503. handle_new_mem_node();
  504. break;
  505. /* detect when the workers were idling or not */
  506. case FUT_START_CODELET_BODY:
  507. handle_start_codelet_body();
  508. break;
  509. case FUT_END_CODELET_BODY:
  510. handle_end_codelet_body();
  511. break;
  512. case FUT_START_CALLBACK:
  513. handle_start_callback();
  514. break;
  515. case FUT_END_CALLBACK:
  516. handle_end_callback();
  517. break;
  518. /* monitor stack size */
  519. case FUT_JOB_PUSH:
  520. if (!no_counter)
  521. handle_job_push();
  522. break;
  523. case FUT_JOB_POP:
  524. if (!no_counter)
  525. handle_job_pop();
  526. break;
  527. /* check the memory transfer overhead */
  528. case FUT_START_FETCH_INPUT:
  529. handle_start_fetch_input();
  530. break;
  531. case FUT_END_FETCH_INPUT:
  532. handle_end_fetch_input();
  533. break;
  534. case FUT_START_PUSH_OUTPUT:
  535. handle_start_push_output();
  536. break;
  537. case FUT_END_PUSH_OUTPUT:
  538. handle_end_push_output();
  539. break;
  540. case FUT_START_PROGRESS:
  541. handle_start_progress();
  542. break;
  543. case FUT_END_PROGRESS:
  544. handle_end_progress();
  545. break;
  546. case FUT_CODELET_TAG:
  547. //handle_codelet_tag();
  548. break;
  549. case FUT_CODELET_TAG_DEPS:
  550. handle_codelet_tag_deps();
  551. break;
  552. case FUT_TASK_DONE:
  553. handle_task_done();
  554. break;
  555. case FUT_DATA_COPY:
  556. if (!no_bus)
  557. handle_data_copy();
  558. break;
  559. case FUT_START_DRIVER_COPY:
  560. if (!no_bus)
  561. handle_start_driver_copy();
  562. break;
  563. case FUT_END_DRIVER_COPY:
  564. if (!no_bus)
  565. handle_end_driver_copy();
  566. break;
  567. case FUT_WORK_STEALING:
  568. /* XXX */
  569. break;
  570. case FUT_WORKER_DEINIT_START:
  571. handle_worker_deinit_start();
  572. break;
  573. case FUT_WORKER_DEINIT_END:
  574. handle_worker_deinit_end();
  575. break;
  576. case FUT_START_ALLOC:
  577. if (!no_bus)
  578. handle_start_alloc();
  579. break;
  580. case FUT_END_ALLOC:
  581. if (!no_bus)
  582. handle_end_alloc();
  583. break;
  584. case FUT_START_ALLOC_REUSE:
  585. if (!no_bus)
  586. handle_start_alloc_reuse();
  587. break;
  588. case FUT_END_ALLOC_REUSE:
  589. if (!no_bus)
  590. handle_end_alloc_reuse();
  591. break;
  592. case FUT_START_MEMRECLAIM:
  593. handle_start_memreclaim();
  594. break;
  595. case FUT_END_MEMRECLAIM:
  596. handle_end_memreclaim();
  597. break;
  598. case FUT_USER_EVENT:
  599. handle_user_event();
  600. break;
  601. default:
  602. fprintf(stderr, "unknown event.. %x at time %llx\n", (unsigned)ev.code, (long long unsigned)ev.time);
  603. break;
  604. }
  605. }
  606. paje_output_file_terminate();
  607. terminate_dat_dot();
  608. return 0;
  609. }