summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Ohly <patrick.ohly@intel.com>2016-11-30 10:50:11 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-12-07 10:38:00 +0000
commitb8a4eb52654edef6bf926d9a9b840a6c02b1c0fb (patch)
treed53e20c33944118f4522f12194865c3fd9d82a4d
parentf1a527c5f6f0add2c7f209ffb69650733f692e81 (diff)
downloadpoky-b8a4eb52654edef6bf926d9a9b840a6c02b1c0fb.tar.gz
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>
-rw-r--r--scripts/pybootchartgui/pybootchartgui/parsing.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/scripts/pybootchartgui/pybootchartgui/parsing.py b/scripts/pybootchartgui/pybootchartgui/parsing.py
index 1c8d8efed7..bcfb2da569 100644
--- a/scripts/pybootchartgui/pybootchartgui/parsing.py
+++ b/scripts/pybootchartgui/pybootchartgui/parsing.py
@@ -442,6 +442,12 @@ def _parse_proc_stat_log(file):
442 # skip the rest of statistics lines 442 # skip the rest of statistics lines
443 return samples 443 return samples
444 444
445def _parse_reduced_log(file, sample_class):
446 samples = []
447 for time, lines in _parse_timed_blocks(file):
448 samples.append(sample_class(time, *[float(x) for x in lines[0].split()]))
449 return samples
450
445def _parse_proc_disk_stat_log(file): 451def _parse_proc_disk_stat_log(file):
446 """ 452 """
447 Parse file for disk stats, but only look at the whole device, eg. sda, 453 Parse file for disk stats, but only look at the whole device, eg. sda,
@@ -483,6 +489,25 @@ def _parse_proc_disk_stat_log(file):
483 489
484 return disk_stats 490 return disk_stats
485 491
492def _parse_reduced_proc_meminfo_log(file):
493 """
494 Parse file for global memory statistics with
495 'MemTotal', 'MemFree', 'Buffers', 'Cached', 'SwapTotal', 'SwapFree' values
496 (in that order) directly stored on one line.
497 """
498 used_values = ('MemTotal', 'MemFree', 'Buffers', 'Cached', 'SwapTotal', 'SwapFree',)
499
500 mem_stats = []
501 for time, lines in _parse_timed_blocks(file):
502 sample = MemSample(time)
503 for name, value in zip(used_values, lines[0].split()):
504 sample.add_value(name, int(value))
505
506 if sample.valid():
507 mem_stats.append(DrawMemSample(sample))
508
509 return mem_stats
510
486def _parse_proc_meminfo_log(file): 511def _parse_proc_meminfo_log(file):
487 """ 512 """
488 Parse file for global memory statistics. 513 Parse file for global memory statistics.
@@ -702,10 +727,16 @@ def _do_parse(writer, state, filename, file):
702 name = os.path.basename(filename) 727 name = os.path.basename(filename)
703 if name == "proc_diskstats.log": 728 if name == "proc_diskstats.log":
704 state.disk_stats = _parse_proc_disk_stat_log(file) 729 state.disk_stats = _parse_proc_disk_stat_log(file)
730 elif name == "reduced_proc_diskstats.log":
731 state.disk_stats = _parse_reduced_log(file, DiskSample)
705 elif name == "proc_stat.log": 732 elif name == "proc_stat.log":
706 state.cpu_stats = _parse_proc_stat_log(file) 733 state.cpu_stats = _parse_proc_stat_log(file)
734 elif name == "reduced_proc_stat.log":
735 state.cpu_stats = _parse_reduced_log(file, CPUSample)
707 elif name == "proc_meminfo.log": 736 elif name == "proc_meminfo.log":
708 state.mem_stats = _parse_proc_meminfo_log(file) 737 state.mem_stats = _parse_proc_meminfo_log(file)
738 elif name == "reduced_proc_meminfo.log":
739 state.mem_stats = _parse_reduced_proc_meminfo_log(file)
709 elif name == "cmdline2.log": 740 elif name == "cmdline2.log":
710 state.cmdline = _parse_cmdline_log(writer, file) 741 state.cmdline = _parse_cmdline_log(writer, file)
711 elif name == "monitor_disk.log": 742 elif name == "monitor_disk.log":