summaryrefslogtreecommitdiffstats
path: root/scripts/pybootchartgui/pybootchartgui/draw.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/pybootchartgui/pybootchartgui/draw.py')
-rw-r--r--scripts/pybootchartgui/pybootchartgui/draw.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/scripts/pybootchartgui/pybootchartgui/draw.py b/scripts/pybootchartgui/pybootchartgui/draw.py
index 2a261600a5..299cced741 100644
--- a/scripts/pybootchartgui/pybootchartgui/draw.py
+++ b/scripts/pybootchartgui/pybootchartgui/draw.py
@@ -187,12 +187,15 @@ def draw_label_in_box(ctx, color, label, x, y, w, maxx):
187 label_x = x - label_w - 5 187 label_x = x - label_w - 5
188 draw_text(ctx, label, color, label_x, y) 188 draw_text(ctx, label, color, label_x, y)
189 189
190def draw_sec_labels(ctx, rect, sec_w, nsecs): 190def draw_sec_labels(ctx, options, rect, sec_w, nsecs):
191 ctx.set_font_size(AXIS_FONT_SIZE) 191 ctx.set_font_size(AXIS_FONT_SIZE)
192 prev_x = 0 192 prev_x = 0
193 for i in range(0, rect[2] + 1, sec_w): 193 for i in range(0, rect[2] + 1, sec_w):
194 if ((i / sec_w) % nsecs == 0) : 194 if ((i / sec_w) % nsecs == 0) :
195 label = "%ds" % (i / sec_w) 195 if options.app_options.as_minutes :
196 label = "%.1f" % (i / sec_w / 60.0)
197 else :
198 label = "%d" % (i / sec_w)
196 label_w = ctx.text_extents(label)[2] 199 label_w = ctx.text_extents(label)[2]
197 x = rect[0] + i - label_w/2 200 x = rect[0] + i - label_w/2
198 if x >= prev_x: 201 if x >= prev_x:
@@ -426,7 +429,7 @@ def render_processes_chart(ctx, options, trace, curr_y, w, h, sec_w):
426 ctx.set_font_size(PROC_TEXT_FONT_SIZE) 429 ctx.set_font_size(PROC_TEXT_FONT_SIZE)
427 430
428 draw_box_ticks(ctx, chart_rect, sec_w) 431 draw_box_ticks(ctx, chart_rect, sec_w)
429 draw_sec_labels(ctx, chart_rect, sec_w, 30) 432 draw_sec_labels(ctx, options, chart_rect, sec_w, 30)
430 433
431 y = curr_y+header_h 434 y = curr_y+header_h
432 435
@@ -555,7 +558,7 @@ def draw_process_bar_chart(ctx, clip, options, proc_tree, times, curr_y, w, h, s
555 nsec = 1 558 nsec = 1
556 else: 559 else:
557 nsec = 5 560 nsec = 5
558 draw_sec_labels (ctx, chart_rect, sec_w, nsec) 561 draw_sec_labels (ctx, options, chart_rect, sec_w, nsec)
559 draw_annotations (ctx, proc_tree, times, chart_rect) 562 draw_annotations (ctx, proc_tree, times, chart_rect)
560 563
561 y = curr_y + 60 564 y = curr_y + 60