gdbinit 9.7 KB

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