diff options
author | Björn Brandenburg <bbb@mpi-sws.org> | 2016-03-23 19:39:51 -0400 |
---|---|---|
committer | Björn Brandenburg <bbb@mpi-sws.org> | 2016-03-23 19:39:51 -0400 |
commit | 462be64e1eecf61ba0c63e75e1cb535ceb8767c9 (patch) | |
tree | f3487a86903d1fc7943652adbe03836b62a3484a /sched_trace/draw.py | |
parent | f6958ce2f589f2e07c1c3bca3697412370af2903 (diff) |
st-draw: add markers for job suspensions and job wake-ups
Diffstat (limited to 'sched_trace/draw.py')
-rw-r--r-- | sched_trace/draw.py | 67 |
1 files changed, 66 insertions, 1 deletions
diff --git a/sched_trace/draw.py b/sched_trace/draw.py index a2cba30..8c32cc1 100644 --- a/sched_trace/draw.py +++ b/sched_trace/draw.py | |||
@@ -137,6 +137,10 @@ def render(opts, trace): | |||
137 | 137 | ||
138 | # c.scale(xscale, yscale) | 138 | # c.scale(xscale, yscale) |
139 | 139 | ||
140 | if opts.verbose: | ||
141 | print '[II] Dawing grid...', | ||
142 | sys.stdout.flush() | ||
143 | |||
140 | # draw minor tick lines | 144 | # draw minor tick lines |
141 | if opts.minor_ticks: | 145 | if opts.minor_ticks: |
142 | c.set_source_rgb(*MINOR_TICK_COLOR) | 146 | c.set_source_rgb(*MINOR_TICK_COLOR) |
@@ -169,6 +173,11 @@ def render(opts, trace): | |||
169 | center_text(c, x, y, "%dms" % ((time - opts.start) / 1E6)) | 173 | center_text(c, x, y, "%dms" % ((time - opts.start) / 1E6)) |
170 | time += opts.major_ticks * 1E6 | 174 | time += opts.major_ticks * 1E6 |
171 | 175 | ||
176 | if opts.verbose: | ||
177 | print 'done.' | ||
178 | print '[II] Dawing CPU allocations...', | ||
179 | sys.stdout.flush() | ||
180 | |||
172 | 181 | ||
173 | # raw allocations | 182 | # raw allocations |
174 | box_height = ALLOC_HEIGHT * YRES * yscale | 183 | box_height = ALLOC_HEIGHT * YRES * yscale |
@@ -176,7 +185,7 @@ def render(opts, trace): | |||
176 | for (to, away) in trace.scheduling_intervals_in_range(opts.start, opts.end): | 185 | for (to, away) in trace.scheduling_intervals_in_range(opts.start, opts.end): |
177 | delta = (event_time(away) - event_time(to)) * xscale | 186 | delta = (event_time(away) - event_time(to)) * xscale |
178 | pid = event_pid(to) | 187 | pid = event_pid(to) |
179 | y = ypos(task_idx[pid] + ALLOC_HEIGHT) | 188 | y = ypos(task_idx[pid] + (1 - ALLOC_HEIGHT)) |
180 | x = xpos(event_time(to)) | 189 | x = xpos(event_time(to)) |
181 | c.new_path() | 190 | c.new_path() |
182 | c.rectangle(x, y, delta, box_height) | 191 | c.rectangle(x, y, delta, box_height) |
@@ -198,6 +207,11 @@ def render(opts, trace): | |||
198 | c.line_to(x, y) | 207 | c.line_to(x, y) |
199 | c.stroke() | 208 | c.stroke() |
200 | 209 | ||
210 | if opts.verbose: | ||
211 | print 'done.' | ||
212 | print '[II] Dawing releases and deadlines...', | ||
213 | sys.stdout.flush() | ||
214 | |||
201 | # draw releases and deadlines | 215 | # draw releases and deadlines |
202 | c.set_source_rgb(*JOB_EVENT_COLOR) | 216 | c.set_source_rgb(*JOB_EVENT_COLOR) |
203 | c.set_line_width(ARROW_LINE_WIDTH) | 217 | c.set_line_width(ARROW_LINE_WIDTH) |
@@ -227,6 +241,11 @@ def render(opts, trace): | |||
227 | c.rel_line_to(arrow_width, -arrow_width) | 241 | c.rel_line_to(arrow_width, -arrow_width) |
228 | c.stroke() | 242 | c.stroke() |
229 | 243 | ||
244 | if opts.verbose: | ||
245 | print 'done.' | ||
246 | print '[II] Dawing job completions...', | ||
247 | sys.stdout.flush() | ||
248 | |||
230 | # draw job completions | 249 | # draw job completions |
231 | for rec in trace.events_in_range_of_type(opts.start, opts.end, 'ST_COMPLETION'): | 250 | for rec in trace.events_in_range_of_type(opts.start, opts.end, 'ST_COMPLETION'): |
232 | pid = event_pid(rec) | 251 | pid = event_pid(rec) |
@@ -239,6 +258,52 @@ def render(opts, trace): | |||
239 | c.rel_line_to(2 * arrow_width, 0) | 258 | c.rel_line_to(2 * arrow_width, 0) |
240 | c.stroke() | 259 | c.stroke() |
241 | 260 | ||
261 | if opts.verbose: | ||
262 | print 'done.' | ||
263 | print '[II] Dawing job suspensions...', | ||
264 | sys.stdout.flush() | ||
265 | |||
266 | # draw job suspensions | ||
267 | c.set_line_width(1) | ||
268 | for rec in trace.events_in_range_of_type(opts.start, opts.end, 'ST_BLOCK'): | ||
269 | pid = event_pid(rec) | ||
270 | y = ypos(task_idx[pid] + (1 - ALLOC_HEIGHT) + 0.5 * ALLOC_HEIGHT) | ||
271 | y1 = ypos(task_idx[pid] + (1 - ALLOC_HEIGHT) + 0.4 * ALLOC_HEIGHT) | ||
272 | y2 = ypos(task_idx[pid] + (1 - ALLOC_HEIGHT) + 0.6 * ALLOC_HEIGHT) | ||
273 | x = xpos(event_time(rec)) | ||
274 | c.new_path() | ||
275 | c.move_to(x, y1) | ||
276 | c.line_to(x, y2) | ||
277 | c.line_to(x - arrow_width, y) | ||
278 | c.line_to(x, y1) | ||
279 | c.close_path() | ||
280 | c.stroke() | ||
281 | |||
282 | |||
283 | if opts.verbose: | ||
284 | print 'done.' | ||
285 | print '[II] Dawing job wake-ups...', | ||
286 | sys.stdout.flush() | ||
287 | |||
288 | # draw job suspensions | ||
289 | c.set_line_width(1) | ||
290 | for rec in trace.events_in_range_of_type(opts.start, opts.end, 'ST_RESUME'): | ||
291 | pid = event_pid(rec) | ||
292 | y = ypos(task_idx[pid] + (1 - ALLOC_HEIGHT) + 0.5 * ALLOC_HEIGHT) | ||
293 | y1 = ypos(task_idx[pid] + (1 - ALLOC_HEIGHT) + 0.4 * ALLOC_HEIGHT) | ||
294 | y2 = ypos(task_idx[pid] + (1 - ALLOC_HEIGHT) + 0.6 * ALLOC_HEIGHT) | ||
295 | x = xpos(event_time(rec)) | ||
296 | c.new_path() | ||
297 | c.move_to(x, y1) | ||
298 | c.line_to(x, y2) | ||
299 | c.line_to(x + arrow_width, y) | ||
300 | c.line_to(x, y1) | ||
301 | c.close_path() | ||
302 | c.stroke() | ||
303 | |||
304 | if opts.verbose: | ||
305 | print 'done.' | ||
306 | |||
242 | 307 | ||
243 | # draw task labels | 308 | # draw task labels |
244 | c.set_font_size(TASK_LABEL_FONT_SIZE) | 309 | c.set_font_size(TASK_LABEL_FONT_SIZE) |