diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-05-08 11:48:35 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-05-08 22:56:45 +0100 |
commit | 020911ab590624406f406237f8750b0ea8be320b (patch) | |
tree | b27790bf6a76204f0288062bad03cf0b94d8b24e /scripts/pybootchartgui/pybootchartgui/draw.py | |
parent | d13b904305289df1d3ab81f86350d7ff99d2966d (diff) | |
download | poky-020911ab590624406f406237f8750b0ea8be320b.tar.gz |
scripts/pybootchart: Port to python3
This updates the pybootchart code (used for viewing build timing profiles)
to use python3. The bulk of the changes are to use gi instead of pygtk, i.e.
port from gtk+2 to gtk+3.
The main change is to make the bootchart widget inherit gtk.Scrollable
and change the way the scrollbars are implemented to match the new method
upstream. The drawing code used cairo already so can remain unchanged,
(From OE-Core rev: 949144681ad7f536732169351cab6d0612e9c566)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/pybootchartgui/pybootchartgui/draw.py')
-rw-r--r-- | scripts/pybootchartgui/pybootchartgui/draw.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/scripts/pybootchartgui/pybootchartgui/draw.py b/scripts/pybootchartgui/pybootchartgui/draw.py index 019070a7db..99b3caacc7 100644 --- a/scripts/pybootchartgui/pybootchartgui/draw.py +++ b/scripts/pybootchartgui/pybootchartgui/draw.py | |||
@@ -19,6 +19,7 @@ import math | |||
19 | import re | 19 | import re |
20 | import random | 20 | import random |
21 | import colorsys | 21 | import colorsys |
22 | import functools | ||
22 | from operator import itemgetter | 23 | from operator import itemgetter |
23 | 24 | ||
24 | class RenderOptions: | 25 | class RenderOptions: |
@@ -449,7 +450,7 @@ def render_charts(ctx, options, clip, trace, curr_y, w, h, sec_w): | |||
449 | [(sample.time, | 450 | [(sample.time, |
450 | # Sum up used space of all volumes including the current one | 451 | # Sum up used space of all volumes including the current one |
451 | # so that the graphs appear as stacked on top of each other. | 452 | # so that the graphs appear as stacked on top of each other. |
452 | reduce(lambda x,y: x+y, | 453 | functools.reduce(lambda x,y: x+y, |
453 | [sample.records[volume] - min_used[volume] | 454 | [sample.records[volume] - min_used[volume] |
454 | for volume in volumes[0:i] | 455 | for volume in volumes[0:i] |
455 | if volume in sample.records], | 456 | if volume in sample.records], |
@@ -501,7 +502,7 @@ def render_processes_chart(ctx, options, trace, curr_y, w, h, sec_w): | |||
501 | TASK_COLOR_SYSROOT, off_x+360, curr_y + 45, leg_s) | 502 | TASK_COLOR_SYSROOT, off_x+360, curr_y + 45, leg_s) |
502 | draw_legend_box (ctx, "Package", \ | 503 | draw_legend_box (ctx, "Package", \ |
503 | TASK_COLOR_PACKAGE, off_x+480, curr_y + 45, leg_s) | 504 | TASK_COLOR_PACKAGE, off_x+480, curr_y + 45, leg_s) |
504 | draw_legend_box (ctx, "Package Write", | 505 | draw_legend_box (ctx, "Package Write", \ |
505 | TASK_COLOR_PACKAGE_WRITE, off_x+600, curr_y + 45, leg_s) | 506 | TASK_COLOR_PACKAGE_WRITE, off_x+600, curr_y + 45, leg_s) |
506 | 507 | ||
507 | ctx.set_font_size(PROC_TEXT_FONT_SIZE) | 508 | ctx.set_font_size(PROC_TEXT_FONT_SIZE) |
@@ -518,13 +519,14 @@ def render_processes_chart(ctx, options, trace, curr_y, w, h, sec_w): | |||
518 | trace.processes[val][1] - s < options.app_options.mintime: | 519 | trace.processes[val][1] - s < options.app_options.mintime: |
519 | continue | 520 | continue |
520 | task = val.split(":")[1] | 521 | task = val.split(":")[1] |
521 | #print val | 522 | #print(val) |
522 | #print trace.processes[val][1] | 523 | #print(trace.processes[val][1]) |
523 | #print s | 524 | #print(s) |
525 | |||
524 | x = chart_rect[0] + (s - offset) * sec_w | 526 | x = chart_rect[0] + (s - offset) * sec_w |
525 | w = ((trace.processes[val][1] - s) * sec_w) | 527 | w = ((trace.processes[val][1] - s) * sec_w) |
526 | 528 | ||
527 | #print "proc at %s %s %s %s" % (x, y, w, proc_h) | 529 | #print("proc at %s %s %s %s" % (x, y, w, proc_h)) |
528 | col = None | 530 | col = None |
529 | if task == "do_compile": | 531 | if task == "do_compile": |
530 | col = TASK_COLOR_COMPILE | 532 | col = TASK_COLOR_COMPILE |