gdbinit 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. # StarPU --- Runtime system for heterogeneous multicore architectures.
  2. #
  3. # Copyright (C) 2010 Université de Bordeaux 1
  4. # Copyright (C) 2010, 2011 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_s *)$arg0
  19. printf "StarPU Job (%p)\n", $job
  20. printf "\ttask:\t\t\t\t<%p>\n", $job->task
  21. printf "\tsubmitted:\t\t\t<%d>\n", $job->submitted
  22. printf "\tterminated:\t\t\t<%d>\n", $job->terminated
  23. printf "\tjob_id:\t\t\t\t<%d>\n", $job->job_id
  24. if _starpu_use_fxt == 1 && $job->model_name
  25. printf "\tmodel_name:\t\t\t<%s>\n", $job->model_name
  26. end
  27. end
  28. document starpu-print-job
  29. Prints a StarPU job
  30. end
  31. define starpu-print-task
  32. set language c
  33. set $task = (struct starpu_task *)$arg0
  34. set $job = (struct starpu_job_s *)$task->starpu_private
  35. if $task->status == 0
  36. set $status="STARPU_TASK_INVALID"
  37. end
  38. if $task->status == 1
  39. set $status="STARPU_TASK_BLOCKED"
  40. end
  41. if $task->status == 2
  42. set $status="STARPU_TASK_READY"
  43. end
  44. if $task->status == 3
  45. set $status="STARPU_TASK_RUNNING"
  46. end
  47. if $task->status == 4
  48. set $status="STARPU_TASK_FINISHED"
  49. end
  50. if $task->status == 5
  51. set $status="STARPU_TASK_BLOCKED_ON_TAG"
  52. end
  53. if $task->status == 6
  54. set $status="STARPU_TASK_BLOCKED_ON_TASK"
  55. end
  56. if $task->status == 7
  57. set $status="STARPU_TASK_BLOCKED_ON_DATA"
  58. end
  59. printf "StarPU Task (%p)\n", $task
  60. printf "\tcodelet:\t\t\t<%p>\n", $task->cl
  61. printf "\tcallback:\t\t\t<%p>\n", $task->callback_func
  62. printf "\tsynchronous:\t\t\t<%d>\n", $task->synchronous
  63. printf "\texecute_on_a_specific_worker:\t<%d>\n", $task->execute_on_a_specific_worker
  64. printf "\tworkerid:\t\t\t<%d>\n", $task->workerid
  65. printf "\tdetach:\t\t\t\t<%d>\n", $task->detach
  66. printf "\tdestroy:\t\t\t<%d>\n", $task->destroy
  67. printf "\tregenerate:\t\t\t<%d>\n", $task->regenerate
  68. printf "\tstatus:\t\t\t\t<%s>\n", $status
  69. printf "\tjob:\t\t\t\t<%p>\n", $job
  70. printf "\tndeps:\t\t\t\t<%u>\n", $job->job_successors->ndeps
  71. printf "\tndeps_completed:\t\t<%u>\n", $job->job_successors->ndeps_completed
  72. printf "\tnsuccs:\t\t\t\t<%u>\n", $job->job_successors->nsuccs
  73. if $job
  74. starpu-print-job $job
  75. end
  76. end
  77. document starpu-print-task
  78. Prints a StarPU task
  79. end
  80. define starpu-tasks-on-worker
  81. set language c
  82. set $worker=config->workers[$arg0]
  83. set $task=$worker->local_tasks->head
  84. while $task != 0x0
  85. starpu-print-task $task
  86. set $task=$task->next
  87. end
  88. end
  89. define starpu-tasks-on-workers
  90. set language c
  91. set $num=0
  92. while $num<config->topology->nworkers
  93. printf "Worker %s\n", config->workers[$num].name
  94. starpu-tasks-on-worker $num
  95. set $num = $num + 1
  96. end
  97. end
  98. define starpu-workers
  99. set language c
  100. set $num=0
  101. printf "[Id] Name Arch Mask Devid Bindid Workerid Isrunning Isinitialized\n"
  102. while $num<config->topology->nworkers
  103. set $worker=&config->workers[$num]
  104. printf "[%2d] %-10s %-4d %-4d %-5d %-6d %-8d %-9d %-13d\n", $num, $worker->name, $worker->arch, $worker->worker_mask, \
  105. $worker->devid, $worker->bindid, $worker->workerid, $worker->worker_is_running, $worker->worker_is_initialized
  106. set $num = $num + 1
  107. end
  108. end
  109. document starpu-workers
  110. Prints a list of the StarPU workers
  111. end
  112. define starpu-tasks
  113. printf "%d submitted tasks\n", nsubmitted
  114. printf "TODO: currently running\n"
  115. end
  116. define starpu
  117. printf "Here I am...\n"
  118. end
  119. define starpu-print-mode
  120. if ($arg0 & 1)
  121. printf "R"
  122. end
  123. if ($arg0 & 2)
  124. printf "W"
  125. end
  126. if ($arg0 & 4)
  127. printf " SCRATCH"
  128. end
  129. if ($arg0 & 8)
  130. printf " REDUX"
  131. end
  132. end
  133. define starpu-print-data
  134. set language c
  135. set $data = $arg0
  136. printf "Data handle %p\n", $data
  137. printf "Home node %d\n", $data->home_node
  138. printf "Requests %d\n", $data->refcnt
  139. printf "Current mode "
  140. starpu-print-mode $data->current_mode
  141. printf "\n"
  142. if $data->current_mode & (4|8)
  143. set $n = 0
  144. while $n < config.topology.nworkers
  145. set $replicate = $data->per_worker[$n]
  146. printf "Worker %2d %10s:", $n, config->workers[$n]->name
  147. if $replicate->state == 0
  148. printf " OWNER"
  149. end
  150. if $replicate->state == 1
  151. printf " SHARED"
  152. end
  153. if $replicate->state == 2
  154. printf " INVALID"
  155. end
  156. if $replicate->initialized
  157. printf " initialized"
  158. end
  159. printf "\n"
  160. set $n = $n + 1
  161. end
  162. else
  163. set $n = 0
  164. while $n < descr.nnodes
  165. set $replicate = $data->per_node[$n]
  166. printf "Node %2d:", $n
  167. if $replicate->state == 0
  168. printf " OWNER"
  169. end
  170. if $replicate->state == 1
  171. printf " SHARED"
  172. end
  173. if $replicate->state == 2
  174. printf " INVALID"
  175. end
  176. if $replicate->initialized
  177. printf " initialized"
  178. end
  179. printf "\n"
  180. set $n = $n + 1
  181. end
  182. end
  183. printf "Post sync tasks\n"
  184. set $tasklist = $data->post_sync_tasks
  185. while $tasklist != 0x0
  186. starpu-print-task $tasklist->task
  187. set $tasklist = $tasklist->next
  188. end
  189. printf "Requester tasks\n"
  190. set $requesterlist = $data->req_list._head
  191. while $requesterlist != 0x0
  192. printf "mode: "
  193. starpu-print-mode $requesterlist->mode
  194. printf "\n"
  195. starpu-print-job $requesterlist->j
  196. set $requesterlist = $requesterlist->_next
  197. end
  198. if ($data->nchildren)
  199. printf "%d children\n", $data->nchildren
  200. end
  201. end
  202. define starpu-print-datas
  203. set $entry = registered_handles
  204. while $entry
  205. starpu-print-data $entry->handle
  206. printf "\n"
  207. set $entry = (struct handle_entry *) $entry.hh.next
  208. end
  209. end
  210. define starpu-print-request
  211. set $r = (struct starpu_data_request_s *)$arg0
  212. printf "Request %p\n", $r
  213. printf "Refcnt %d\n", $r->refcnt
  214. printf "Handle %p\n", $r->handle
  215. printf "src_replicate %p\n", $r->src_replicate
  216. printf "dst_replicate %p\n", $r->dst_replicate
  217. printf "handling_node %d\n", $r->handling_node
  218. if ($r->mode & 1)
  219. printf "R"
  220. end
  221. if ($r->mode & 2)
  222. printf "W"
  223. end
  224. if ($r->mode & 4)
  225. printf "S"
  226. end
  227. if ($r->mode & 8)
  228. printf "X"
  229. end
  230. printf "\n"
  231. printf "completed: %d\n", $r->completed
  232. printf "retval: %d\n", $r->retval
  233. printf "ndeps: %d\n", $r->ndeps
  234. printf "next_req_count: %d\n", $r->next_req_count
  235. end
  236. define starpu-print-requests
  237. set $node = 0
  238. while $node < descr.nnodes
  239. printf "Node %u:\n", $node
  240. set $request = data_requests[$node]._head
  241. while $request != 0
  242. printf " Request %p: handle %p ", $request, $request->handle
  243. starpu-print-mode $request->mode
  244. printf "\n"
  245. set $request = $request->_next
  246. end
  247. set $node = $node + 1
  248. end
  249. end
  250. define starpu_print-prequests
  251. end
  252. document starpu
  253. List of StarPU-specific gdb functions:
  254. starpu-workers prints a list of the StarPU workers
  255. starpu-tasks-on-workers prints a list of the tasks currently running on workers
  256. starpu-tasks-on-worker prints a list of the tasks running on the given worker
  257. starpu-print-job prints a StarPU job
  258. starpu-print-task prints a StarPU task
  259. starpu-print-data prints a StarPU data handle
  260. starpu-print-datas prints all StarPU data handles
  261. starpu-print-request prints a StarPU data request
  262. starpu-print-requests prints all StarPU data requests
  263. starpu-print-prequests prints all pending StarPU data requests
  264. starpu-tasks prints a list of the tasks flowing in StarPU
  265. end