Commit Graph

36 Commits

Author SHA1 Message Date
Patrick Ohly b8a4eb5265 pybootchartgui: support reading reduced /proc logs
Pre-processing /proc data during the build considerably reduces the
amount of data written to disk: 176KB instead of 4.7MB for a 20
minuted build. Parsing also becomes faster.

buildstats.bbclass only writes the reduced logs now, but support for
the full /proc files is kept around as reference.

(From OE-Core rev: b5e47df9af1ebbb477074587fdeae17eb2f55582)

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-07 10:38:00 +00:00
Patrick Ohly 820c042b36 pybootchartgui: simplify drawing of memory usage
The internal representation after parsing now matches exactly
what the drawing code needs, thus speeding up drawing a bit.
However, the main motivation is to store exactly that required
information in a more compact file.

(From OE-Core rev: ca06e67a0bb5820b38fda4c8dfee20764c1e59ae)

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-07 10:37:59 +00:00
Patrick Ohly 6b5037bf2c pybootchartgui: render disk space usage
This adds a new, separate chart showing the amount of disk space used
over time for each volume monitored during the build. The hight of the
graph entries represents the delta between current usage and minimal
usage during the build.

That's more useful than showing just the current usage, because then a
graph showing changes in the order of MBs in a volume that is several
GB large would be just flat.

The legend shows the maximum of those deltas, i.e. maximum amount of
space needed for the build. Minor caveat: sampling of disk space usage
starts a bit later than the initial task, so the displayed value may
be slightly lower than the actual amount of space needed because
sampling does not record the actual initial state.

(From OE-Core rev: 263d189d066b578debf08b2bd07494a69b70f70d)

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-07 10:37:59 +00:00
Patrick Ohly 0cd48fcef4 pybootchartgui/parsing.py: fix error handling in meminfo parser
When matching fails, m.group(0) is invalid and can't be used in the
error message.

(From OE-Core rev: ddfea21e06a2e6b1a1e766969f8c134a6de7388a)

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-07 10:37:59 +00:00
Patrick Ohly 1416bb3244 pybootchartgui/draw.py: skip empty CPU and disk usage charts
The only real change is the addition of two if checks that skips the
corresponding drawing code when there is no data.

(From OE-Core rev: 1658fd5e9ca1ba793cae604c2a395d54e3ec9056)

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-07 10:37:59 +00:00
Patrick Ohly 521887ea61 pybootchartgui: show system utilization
This enables rendering of the original bootchart charts for CPU, disk
and memory usage. It depends on the /proc samples recorded by the
updated buildstats.bbclass. Currently, empty charts CPU and disk usage
charts are drawn if that data is not present; the memory chart already
gets skipped when there's no data, which will also have to be added
for the other two.

(From OE-Core rev: 233d3e50b361feea07803a9c0f2a691e687c6cd5)

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-07 10:37:59 +00:00
Patrick Ohly a2c2092195 pybootchartgui/draw.py: fix drawing of samples not starting at zero
The code did not handle x scaling correctly when drawing starts at
some time larger than zero, i.e. it worked for normal bootchart data,
but not for the system statistics recorded by buildstats.bbclass.

(From OE-Core rev: 166f8f9aaa1f01fc6d6a5451f8f06b815c51ffae)

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-07 10:37:59 +00:00
Patrick Ohly 7b8ffa18fd pybootchartgui/draw.py: allow moving process chart up and down
Substracting curr_y when determining the hight of the process chart is
wrong because the height is independent of the position where the
chart is about to be drawn. It happens to work at the moment because
curr_y is always 10 when render_processes_chart() gets called. But it
leads to a negative height when other charts are drawn above it, and
then the grid gets drawn on top of those other charts.

Substracting some constant is relevant because otherwise the box is
slightly larger than the process bars. Not sure exactly where that
comes from (text height?); leg_s seems a suitable constant and happens
to be 10, so everything still gets rendered exactly as before.

(From OE-Core rev: b6bb690728c329ae448f89a1b68298c6dd8a573a)

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-07 10:37:59 +00:00
Richard Purdie df963f54f1 scripts/pybootchart: Fix print statement
This was broken with the python3 fixes.

(From OE-Core rev: 0eadd008d08f9a6bb17a1f641b4735d0d2012580)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-06-03 14:38:01 +01:00
Ed Bartosh b05bf8c6bd scripts: python3: get rid of __future__ imports
Removed print_function and with_statement imports from __future__
as they're supported by python 3 by default.

(From OE-Core rev: 77ae2daad5d775d710b953cf0c623ce74cb2c274)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-06-03 13:13:29 +01:00
Martin Hundebøll c0dafd3101 scripts: use '/usr/bin/env' in shebangs with python
To support yocto on systems with python3 as default version, scripts
should use /usr/bin/env python in the shebang, as this allows the use of
a fake env to mimic python2 as default version.

This patch simply replaces occurrences of #!/usr/bin/python with
 #!/usr/bin/env python and was done with this oneliner:

     git grep -lE '^#!/usr/bin/python' | xargs \
         sed -i 's|/usr/bin/python|/usr/bin/env python|'

(From OE-Core rev: 6d3de22a19657a413e01d7bb5fd74d16c00dc696)

Signed-off-by: Martin Hundebøll <martin@hundeboll.net>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-11-12 15:38:29 +00:00
Peter Kjellerstedt 7b171ed393 pybootchartgui: Add option -T to allways use the full time
When --full-time (or -T) is used, the graph allways shows the full
time regardless of which processes are currently shown. This is
especially useful in combinationm with the -s flag when outputting to
multiple files.

(From OE-Core rev: c6e88199ddf2c4ae243d42afc403d28ab56f00f0)

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-01-23 10:17:36 +00:00
Peter Kjellerstedt 57c93e3507 pybootchartgui: Adopt the width of the index in split output files
Add minimum width zero-padding to the index used in split output files
with -s and -o. I.e., if -s 200 is used, then the index will be
zero-padded to three digits width.

(From OE-Core rev: 45565b24651ab502ae49dc49261dc3ad5634191f)

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-01-23 10:17:33 +00:00
Peter Kjellerstedt 9d492a46fa pybootchartgui: Simplify adding processes to the trace
(From OE-Core rev: 5fa869007b5ba762bf5679197cf98b1d14a34a22)

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-01-23 10:17:33 +00:00
Peter Kjellerstedt ea27845a67 pybootchartgui: Correct the legend
(From OE-Core rev: 1ca2e1a2ae3dc4d1e62a9daf25df588ec27a195a)

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-01-23 10:17:33 +00:00
Peter Kjellerstedt 34a5d1e9cd pybootchartgui: Make the -s option work again
[YOCTO #5588]

(From OE-Core rev: 8245ceab3acd02618f24665ff5dc203c1e5cce1d)

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-01-23 10:17:32 +00:00
Peter Kjellerstedt b0281b3a19 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>
2013-11-18 12:44:56 +00:00
Peter Kjellerstedt 8c26891e1d pybootchartgui: Add a color for the package_write_* tasks
(From OE-Core rev: 2cec29b47a1de5da712cf4e2c6e25daf45d9f265)

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-11-18 12:44:56 +00:00
Peter Kjellerstedt 85fca34bd9 pybootchartgui: Reorder the legend to match the task execution order
(From OE-Core rev: a12cf87471de40ce432d0176eabfb111de5310c6)

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-11-18 12:44:56 +00:00
Peter Kjellerstedt d5f88f0f3b pybootchartgui: Make bars without a specified color white
Previously they were transparent.

(From OE-Core rev: 4ebdd8672cc5589a3e2f8d1b75cde7fae9fd6c99)

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-11-18 12:44:56 +00:00
Peter Kjellerstedt 46c45853f0 pybootchartgui: Make "Show more" show all processes
While "Show more" is enabled, all processes are shown, regardless of
--mintime.

This also has the added benefit of making the first shown bar start at
its correct offset from the start time, rather than always starting at
0.

(From OE-Core rev: 5f1b8730f90099c0f73a6b08599990ee71e831b5)

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-11-18 12:44:56 +00:00
Peter Kjellerstedt 65d43843b6 pybootchartgui: Draw a lot less ticks
With this, one second ticks are only enabled if the width of a second is
five pixels or more. It is also possible to distinguish 1, 5 and 30
second ticks.

(From OE-Core rev: bd0bde6d04fd6cd9f8e7773d68da127144afa7de)

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-11-18 12:44:07 +00:00
Peter Kjellerstedt 80cce56e82 pybootchartgui: Disable options that do not make sense
(From OE-Core rev: e1cde0c8b65a56657a5a5669890dad442223fef4)

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-11-18 12:44:07 +00:00
Peter Kjellerstedt 730e350f04 pybootchartgui: No need to do a double list comprehension over files
(From OE-Core rev: bd00a768d88c22eabee90407684f1fb84139acfb)

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-11-18 12:44:07 +00:00
Peter Kjellerstedt c10abc74d8 pybootchartgui: Avoid having overlapping process bars
(From OE-Core rev: 901afb35da814661ed20b2895f1d4055bf73fae2)

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-11-18 12:44:07 +00:00
Peter Kjellerstedt 94caf6f6e5 pybootchartgui: Use correct header height
(From OE-Core rev: f7d1f49aa46a46ecb881386f0399aa7da288d805)

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-11-18 12:44:06 +00:00
Peter Kjellerstedt 2020eb2e5f pybootchartgui: Correct the X offset for the chart
This will make the first bar actually start within the graph. It will
also move the graph to the right so the names of the first tasks are
more likely to be visible.

(From OE-Core rev: 388daa9a8ce7f2216fb55ce65cab1d4060f6c41d)

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-11-18 12:44:06 +00:00
Peter Kjellerstedt 1a539bb131 pybootchartgui: Set the initial state of "Show more" correctly
(From OE-Core rev: 55fa7f768bb7618f2daaf43f147609c76e077b8b)

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-11-18 12:44:06 +00:00
Peter Kjellerstedt cacd502cd3 pybootchartgui: Make the horizontal scaling stay within bounds
(From OE-Core rev: 50c2c3435915ef1ecbde395c71c5c9581c83fb2e)

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-11-18 12:44:06 +00:00
Peter Kjellerstedt d0e513d437 pybootchartgui: Import pybootchartgui 0.14.5
This update the pybootchartgui code to the latest release from its new
location at "https://github.com/mmeeks/bootchart". This only imports
the relevant parts, and not all of bootchart2.

(From OE-Core rev: 6f1568e54a7808b2ab568618fc5bb244249579f1)

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-11-18 12:44:06 +00:00
Richard Purdie 077291583c scripts/pybootchart: Allow minimum task length to be configured from the commandline
Rather than hardcode the value of "8", allow the minimum task length to be
configured from the commandline using the -m option. "-m 0" means all
tasks will be graphed.

(From OE-Core rev: 30001153d3ce7dadf8f1ec79e634a638a9994518)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-11-20 15:31:48 +00:00
Richard Purdie 295f1608b0 scripts/pybootchart: Fix missing entries bug
If two entries have the same start time, the data store used will cause
all but one of the entries to be lost. This patch enhances the data
storage structure to avoid this problem and allow more than one
event to start at the same time.

(From OE-Core rev: 220b071fd8d1cc6bdbca58f75489e3c9b34921ca)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-11-20 15:31:48 +00:00
Robert Yang 1b112fa9cf pybootchartgui: Fix the filename and add a default format
* Fix teh output filename to make it easy to use
* Add a default output format (svg)
* Fix the usage message
* Fix the version to v1.0.0

Currently, the help messages are:

$ ./pybootchartgui.py --help
Usage: pybootchartgui.py [options] /path/to/tmp/buildstats/<recipe-machine>/<BUILDNAME>/

Options:
  --version             show program's version number and exit
  -h, --help            show this help message and exit
  -i, --interactive     start in active mode
  -f FORMAT, --format=FORMAT
                        image format: svg, pdf, png, [default: svg]
  -o PATH, --output=PATH
                        output path (file or directory) where charts are
                        stored
  -s NUM, --split=NUM   split the output chart into <NUM> charts, only works
                        with "-o PATH"
  -n, --no-prune        do not prune the process tree
  -q, --quiet           suppress informational messages
  --very-quiet          suppress all messages except errors
  --verbose             print all messages

[YOCTO #2403]

(From OE-Core rev: 138c2c31e41e3f1803b7efbedf78326d71821468)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-06-15 15:12:43 +01:00
Robert Yang 0ad3f75432 pybootchartgui: split the output chart into multiple ones
Split the output chart into multiple ones to make it more readable, it
only works with "-o path", which means that it doesn't work if the user
doesn't want to save the chart to the disk. For example:

$ ./pybootchartgui.py /path/to/tmp/buildstats/core-image-sato-qemux86/201205301810/ -f svg -s 5 -o /tmp/
bootchart written to /tmp/bootchart_1.svg
bootchart written to /tmp/bootchart_2.svg
bootchart written to /tmp/bootchart_3.svg
bootchart written to /tmp/bootchart_4.svg
bootchart written to /tmp/bootchart_5.svg

[YOCTO #2403]

(From OE-Core rev: 04a34899e1c15a70babd97a3a59ccb9f8af05bad)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-06-15 15:12:42 +01:00
Robert Yang bc5b86f025 pybootchartgui: make the build profiling in pictures
The original patch is from Richard, I rebased it to the up-to-date
upstream code, here are the original messages from him:

We have just merged Beth's initial buildstats logging work. I was
sitting wondering how to actually evaluate the numbers as I wanted to
know "where are we spending the time?".

It occurred to me that I wanted a graph very similar to that generated
by bootchart. I looked around and found pyboootchartgui and then hacked
it around a bit and coerced it to start producing charts like:

http://tim.rpsys.net/bootchart.png

which is the initial "pseudo-native" part of the build. This was simple
enough to test with.

I then tried graphing a poky-image-sato. To get a graph I could actually
read, I stripped out any task taking less than 8 seconds and scaled the
x axis from 25 units per second to one unit per second. The result was:

http://tim.rpsys.net/bootchart2.png
(warning this is a 2.7MB png)

I also added in a little bit of colour coding for the second chart.
Interestingly it looks like there is more yellow than green meaning
configure is a bigger drain on the build time not that its
unexpected :/.

I quite enjoyed playing with this and on a serious note, the gradient of
the task graph makes me a little suspicious of whether the overhead of
launching tasks in bitbake itself is having some effect on build time.
Certainly on the first graph there are some interesting latencies
showing up.

Anyhow, I think this is the first time bitbake's task execution has been
visualised and there are some interesting things we can learn from it.
I'm hoping this is a start of a much more detailed understanding of the
build process with respect to performance.

[YOCTO #2403]

(From OE-Core rev: 6ea0c02d0db08f6b4570769c6811ecdb051646ad)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-06-15 15:12:42 +01:00
Robert Yang 3d78bc19c5 pybootchartgui: add the original code
This is from:
http://pybootchartgui.googlecode.com/files/pybootchartgui-r124.tar.gz

Will modify it to make the build profiling in pictures.

Remove the examples since they would not work any more, and they cost
much disk space.

[YOCTO #2403]

(From OE-Core rev: 1f0791109e1aed715f02945834d6d7fdb9a411b4)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-06-15 15:12:42 +01:00