gdbinit 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359
  1. # StarPU --- Runtime system for heterogeneous multicore architectures.
  2. #
  3. # Copyright (C) 2010-2013 Université de Bordeaux 1
  4. # Copyright (C) 2010, 2011, 2012 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. define starpu-print-job
  17. set language c
  18. set $job = (struct _starpu_job *)$arg0
  19. printf "StarPU Job (%p)\n", $job
  20. if ($job != NULL)
  21. printf "\ttask:\t\t\t\t<%p>\n", $job->task
  22. printf "\tsubmitted:\t\t\t<%d>\n", $job->submitted
  23. printf "\tterminated:\t\t\t<%d>\n", $job->terminated
  24. printf "\tjob_id:\t\t\t\t<%d>\n", $job->job_id
  25. if _starpu_use_fxt == 1
  26. if $job->model_name
  27. printf "\tmodel_name:\t\t\t<%s>\n", $job->model_name
  28. end
  29. end
  30. end
  31. end
  32. document starpu-print-job
  33. Prints a StarPU job
  34. end
  35. define starpu-print-task
  36. set language c
  37. set $task = (struct starpu_task *)$arg0
  38. set $job = (struct _starpu_job *)$task->starpu_private
  39. if $task->status == 0
  40. set $status="STARPU_TASK_INVALID"
  41. end
  42. if $task->status == 1
  43. set $status="STARPU_TASK_BLOCKED"
  44. end
  45. if $task->status == 2
  46. set $status="STARPU_TASK_READY"
  47. end
  48. if $task->status == 3
  49. set $status="STARPU_TASK_RUNNING"
  50. end
  51. if $task->status == 4
  52. set $status="STARPU_TASK_FINISHED"
  53. end
  54. if $task->status == 5
  55. set $status="STARPU_TASK_BLOCKED_ON_TAG"
  56. end
  57. if $task->status == 6
  58. set $status="STARPU_TASK_BLOCKED_ON_TASK"
  59. end
  60. if $task->status == 7
  61. set $status="STARPU_TASK_BLOCKED_ON_DATA"
  62. end
  63. printf "StarPU Task (%p)\n", $task
  64. printf "\tcodelet:\t\t\t<%p>\n", $task->cl
  65. printf "\tcallback:\t\t\t<%p>\n", $task->callback_func
  66. printf "\tsynchronous:\t\t\t<%d>\n", $task->synchronous
  67. printf "\texecute_on_a_specific_worker:\t<%d>\n", $task->execute_on_a_specific_worker
  68. printf "\tworkerid:\t\t\t<%d>\n", $task->workerid
  69. printf "\tdetach:\t\t\t\t<%d>\n", $task->detach
  70. printf "\tdestroy:\t\t\t<%d>\n", $task->destroy
  71. printf "\tregenerate:\t\t\t<%d>\n", $task->regenerate
  72. printf "\tstatus:\t\t\t\t<%s>\n", $status
  73. printf "\tjob:\t\t\t\t<%p>\n", $job
  74. printf "\tndeps:\t\t\t\t<%u>\n", $job->job_successors->ndeps
  75. printf "\tndeps_completed:\t\t<%u>\n", $job->job_successors->ndeps_completed
  76. printf "\tnsuccs:\t\t\t\t<%u>\n", $job->job_successors->nsuccs
  77. if $job
  78. starpu-print-job $job
  79. end
  80. end
  81. document starpu-print-task
  82. Prints a StarPU task
  83. end
  84. define starpu-tasks-on-worker
  85. set language c
  86. set $worker=config->workers[$arg0]
  87. set $task=$worker.local_tasks.head
  88. while $task != 0x0
  89. starpu-print-task $task
  90. set $task=$task->next
  91. end
  92. end
  93. define starpu-tasks-on-workers
  94. set language c
  95. set $num=0
  96. while $num<config->topology->nworkers
  97. printf "Worker %s\n", config->workers[$num].name
  98. starpu-tasks-on-worker $num
  99. set $num = $num + 1
  100. end
  101. end
  102. define starpu-workers
  103. set language c
  104. set $num=0
  105. printf "[Id] Name Arch Mask Devid Bindid Workerid Isrunning Isinitialized\n"
  106. while $num<config->topology->nworkers
  107. set $worker=&config->workers[$num]
  108. printf "[%2d] %-40s %-4d %-4d %-5d %-6d %-8d %-9d %-13d\n", $num, $worker->name, $worker->arch, $worker->worker_mask, \
  109. $worker->devid, $worker->bindid, $worker->workerid, $worker->worker_is_running, $worker->worker_is_initialized
  110. set $num = $num + 1
  111. end
  112. end
  113. document starpu-workers
  114. Prints a list of the StarPU workers
  115. end
  116. define starpu-tags
  117. printf "tags htbl %p\n", tag_htbl
  118. printf "TODO\n"
  119. end
  120. define starpu-tasks
  121. printf "%d submitted tasks\n", nsubmitted
  122. printf "%d ready tasks\n", nready
  123. printf "Tasks being run:\n"
  124. set $n = 0
  125. while $n < config.topology.nworkers
  126. set $task = config.workers[$n].current_task
  127. if ($task)
  128. printf "worker %d:\n", $n
  129. starpu-print-task $task
  130. set $j = (struct _starpu_job *) $task->starpu_private
  131. set $nsuccs = $j->job_successors.nsuccs
  132. set $i = 0
  133. while $i < $nsuccs
  134. set $cg = $j->job_successors.succ[$i]
  135. if ($cg->cg_type == 1)
  136. # STARPU_CG_APPS
  137. printf "waited for by application"
  138. end
  139. if ($cg->cg_type == 2)
  140. # STARPU_CG_TAG
  141. printf "will produce tag %x\n", $cg->succ.tag
  142. end
  143. if ($cg->cg_type == 4)
  144. # STARPU_CG_TASK
  145. printf "dep of task %p\n", $cg->succ.job
  146. starpu-print-task $cg->succ.job->task
  147. end
  148. set $i = $i + 1
  149. end
  150. end
  151. set $n = $n + 1
  152. end
  153. if (tag_htbl)
  154. printf "TODO: tags\n"
  155. end
  156. print "TODO: complete\n"
  157. end
  158. define starpu
  159. printf "Here I am...\n"
  160. end
  161. define starpu-print-mode
  162. if ($arg0 & 1)
  163. printf "R"
  164. end
  165. if ($arg0 & 2)
  166. printf "W"
  167. end
  168. if ($arg0 & 4)
  169. printf " SCRATCH"
  170. end
  171. if ($arg0 & 8)
  172. printf " REDUX"
  173. end
  174. end
  175. define starpu-print-data
  176. set language c
  177. set $data = (starpu_data_handle_t) $arg0
  178. printf "Data handle %p\n", $data
  179. printf "Home node %d\n", $data->home_node
  180. printf "RWlock refs %d\n", $data->refcnt
  181. printf "Busy count %d\n", $data->busy_count
  182. printf "Current mode "
  183. starpu-print-mode $data->current_mode
  184. printf "\n"
  185. if $data->current_mode & (4|8)
  186. set $n = 0
  187. while $n < config.topology.nworkers
  188. set $replicate = $data->per_worker[$n]
  189. printf "Worker %2d %10s:", $n, config->workers[$n]->name
  190. if $replicate->state == 0
  191. printf " OWNER"
  192. end
  193. if $replicate->state == 1
  194. printf " SHARED"
  195. end
  196. if $replicate->state == 2
  197. printf " INVALID"
  198. end
  199. if $replicate->initialized
  200. printf " initialized"
  201. end
  202. printf "\n"
  203. set $n = $n + 1
  204. end
  205. else
  206. set $n = 0
  207. while $n < descr.nnodes
  208. set $replicate = &$data->per_node[$n]
  209. printf "Node %2d (%2d):", $n, $replicate->refcnt
  210. if $replicate->state == 0
  211. printf " OWNER"
  212. end
  213. if $replicate->state == 1
  214. printf " SHARED"
  215. end
  216. if $replicate->state == 2
  217. printf " INVALID"
  218. end
  219. if $replicate->initialized
  220. printf " initialized"
  221. end
  222. printf "\n"
  223. set $n = $n + 1
  224. end
  225. end
  226. printf "Post sync tasks\n"
  227. set $tasklist = $data->post_sync_tasks
  228. while $tasklist != 0x0
  229. starpu-print-task $tasklist->task
  230. set $tasklist = $tasklist->next
  231. end
  232. printf "Requester tasks\n"
  233. set $requesterlist = $data->req_list._head
  234. while $requesterlist != 0x0
  235. printf "mode: "
  236. starpu-print-mode $requesterlist->mode
  237. printf "\n"
  238. starpu-print-job $requesterlist->j
  239. set $requesterlist = $requesterlist->_next
  240. end
  241. if ($data->nchildren)
  242. printf "%d children\n", $data->nchildren
  243. end
  244. end
  245. define starpu-print-datas
  246. set $entry = registered_handles
  247. while $entry
  248. starpu-print-data $entry->handle
  249. printf "\n"
  250. set $entry = (struct handle_entry *) $entry.hh.next
  251. end
  252. end
  253. define starpu-print-request
  254. set $r = (struct _starpu_data_request *)$arg0
  255. printf "Request %p\n", $r
  256. printf "Refcnt %d\n", $r->refcnt
  257. printf "Handle %p\n", $r->handle
  258. printf "src_replicate %p\n", $r->src_replicate
  259. printf "dst_replicate %p\n", $r->dst_replicate
  260. printf "handling_node %d\n", $r->handling_node
  261. if ($r->mode & 1)
  262. printf "R"
  263. end
  264. if ($r->mode & 2)
  265. printf "W"
  266. end
  267. if ($r->mode & 4)
  268. printf "S"
  269. end
  270. if ($r->mode & 8)
  271. printf "X"
  272. end
  273. printf "\n"
  274. printf "completed: %d\n", $r->completed
  275. printf "retval: %d\n", $r->retval
  276. printf "ndeps: %d\n", $r->ndeps
  277. printf "next_req_count: %d\n", $r->next_req_count
  278. end
  279. define starpu-print-requests
  280. set $node = 0
  281. while $node < descr.nnodes
  282. printf "Node %u:\n", $node
  283. set $request = data_requests[$node]._head
  284. while $request != 0
  285. printf " Request %p: handle %p ", $request, $request->handle
  286. starpu-print-mode $request->mode
  287. printf "\n"
  288. set $request = $request->_next
  289. end
  290. set $node = $node + 1
  291. end
  292. end
  293. define starpu-print-prequests
  294. set $node = 0
  295. while $node < descr.nnodes
  296. printf "Node %u:\n", $node
  297. set $request = data_requests_pending[$node]._head
  298. while $request != 0
  299. printf " Request %p: handle %p ", $request, $request->handle
  300. starpu-print-mode $request->mode
  301. printf "\n"
  302. set $request = $request->_next
  303. end
  304. set $node = $node + 1
  305. end
  306. end
  307. define starpu-print-frequests
  308. set $node = 0
  309. while $node < descr.nnodes
  310. printf "Node %u:\n", $node
  311. set $request = prefetch_requests[$node]._head
  312. while $request != 0
  313. printf " Request %p: handle %p ", $request, $request->handle
  314. starpu-print-mode $request->mode
  315. printf "\n"
  316. set $request = $request->_next
  317. end
  318. set $node = $node + 1
  319. end
  320. end
  321. document starpu
  322. List of StarPU-specific gdb functions:
  323. starpu-workers prints a list of the StarPU workers
  324. starpu-tasks-on-workers prints a list of the tasks currently running on workers
  325. starpu-tasks-on-worker prints a list of the tasks running on the given worker
  326. starpu-print-job prints a StarPU job
  327. starpu-print-task prints a StarPU task
  328. starpu-print-data prints a StarPU data handle
  329. starpu-print-datas prints all StarPU data handles
  330. starpu-print-request prints a StarPU data request
  331. starpu-print-requests prints all StarPU data requests
  332. starpu-print-prequests prints all pending StarPU data requests
  333. starpu-print-frequests prints all StarPU prefetch data requests
  334. starpu-tasks prints a list of the tasks flowing in StarPU
  335. starpu-tags prints a list of the tags known to StarPU
  336. end