diff options
author | Peter Kjellerstedt <peter.kjellerstedt@axis.com> | 2013-11-15 18:09:03 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-11-18 12:44:56 +0000 |
commit | b0281b3a190dec6502b4abc6a5b14ae46243f913 (patch) | |
tree | ffdb558622493bae5fe307affb6921e64ac83a52 /scripts/pybootchartgui | |
parent | 8c26891e1dc59ad9efd876794b9eac79e393845b (diff) | |
download | poky-b0281b3a190dec6502b4abc6a5b14ae46243f913.tar.gz |
pybootchartgui: Add option --minutes to show time in minutes
(From OE-Core rev: b93eefd039a956b7d1d184592dd4342eb43f9341)
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/pybootchartgui')
-rw-r--r-- | scripts/pybootchartgui/pybootchartgui/draw.py | 11 | ||||
-rw-r--r-- | scripts/pybootchartgui/pybootchartgui/main.py.in | 2 |
2 files changed, 9 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 | ||
190 | def draw_sec_labels(ctx, rect, sec_w, nsecs): | 190 | def 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 |
diff --git a/scripts/pybootchartgui/pybootchartgui/main.py.in b/scripts/pybootchartgui/pybootchartgui/main.py.in index 1d70271f72..cc9c40b178 100644 --- a/scripts/pybootchartgui/pybootchartgui/main.py.in +++ b/scripts/pybootchartgui/pybootchartgui/main.py.in | |||
@@ -40,6 +40,8 @@ def _mk_options_parser(): | |||
40 | help="split the output chart into <NUM> charts, only works with \"-o PATH\"") | 40 | help="split the output chart into <NUM> charts, only works with \"-o PATH\"") |
41 | parser.add_option("-m", "--mintime", dest="mintime", type=int, default=8, | 41 | parser.add_option("-m", "--mintime", dest="mintime", type=int, default=8, |
42 | help="only tasks longer than this time will be displayed") | 42 | help="only tasks longer than this time will be displayed") |
43 | parser.add_option("-M", "--minutes", action="store_true", dest="as_minutes", default=False, | ||
44 | help="display time in minutes instead of seconds") | ||
43 | # parser.add_option("-n", "--no-prune", action="store_false", dest="prune", default=True, | 45 | # parser.add_option("-n", "--no-prune", action="store_false", dest="prune", default=True, |
44 | # help="do not prune the process tree") | 46 | # help="do not prune the process tree") |
45 | parser.add_option("-q", "--quiet", action="store_true", dest="quiet", default=False, | 47 | parser.add_option("-q", "--quiet", action="store_true", dest="quiet", default=False, |