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>
This commit is contained in:
parent
f1a527c5f6
commit
b8a4eb5265
|
@ -442,6 +442,12 @@ def _parse_proc_stat_log(file):
|
||||||
# skip the rest of statistics lines
|
# skip the rest of statistics lines
|
||||||
return samples
|
return samples
|
||||||
|
|
||||||
|
def _parse_reduced_log(file, sample_class):
|
||||||
|
samples = []
|
||||||
|
for time, lines in _parse_timed_blocks(file):
|
||||||
|
samples.append(sample_class(time, *[float(x) for x in lines[0].split()]))
|
||||||
|
return samples
|
||||||
|
|
||||||
def _parse_proc_disk_stat_log(file):
|
def _parse_proc_disk_stat_log(file):
|
||||||
"""
|
"""
|
||||||
Parse file for disk stats, but only look at the whole device, eg. sda,
|
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):
|
||||||
|
|
||||||
return disk_stats
|
return disk_stats
|
||||||
|
|
||||||
|
def _parse_reduced_proc_meminfo_log(file):
|
||||||
|
"""
|
||||||
|
Parse file for global memory statistics with
|
||||||
|
'MemTotal', 'MemFree', 'Buffers', 'Cached', 'SwapTotal', 'SwapFree' values
|
||||||
|
(in that order) directly stored on one line.
|
||||||
|
"""
|
||||||
|
used_values = ('MemTotal', 'MemFree', 'Buffers', 'Cached', 'SwapTotal', 'SwapFree',)
|
||||||
|
|
||||||
|
mem_stats = []
|
||||||
|
for time, lines in _parse_timed_blocks(file):
|
||||||
|
sample = MemSample(time)
|
||||||
|
for name, value in zip(used_values, lines[0].split()):
|
||||||
|
sample.add_value(name, int(value))
|
||||||
|
|
||||||
|
if sample.valid():
|
||||||
|
mem_stats.append(DrawMemSample(sample))
|
||||||
|
|
||||||
|
return mem_stats
|
||||||
|
|
||||||
def _parse_proc_meminfo_log(file):
|
def _parse_proc_meminfo_log(file):
|
||||||
"""
|
"""
|
||||||
Parse file for global memory statistics.
|
Parse file for global memory statistics.
|
||||||
|
@ -702,10 +727,16 @@ def _do_parse(writer, state, filename, file):
|
||||||
name = os.path.basename(filename)
|
name = os.path.basename(filename)
|
||||||
if name == "proc_diskstats.log":
|
if name == "proc_diskstats.log":
|
||||||
state.disk_stats = _parse_proc_disk_stat_log(file)
|
state.disk_stats = _parse_proc_disk_stat_log(file)
|
||||||
|
elif name == "reduced_proc_diskstats.log":
|
||||||
|
state.disk_stats = _parse_reduced_log(file, DiskSample)
|
||||||
elif name == "proc_stat.log":
|
elif name == "proc_stat.log":
|
||||||
state.cpu_stats = _parse_proc_stat_log(file)
|
state.cpu_stats = _parse_proc_stat_log(file)
|
||||||
|
elif name == "reduced_proc_stat.log":
|
||||||
|
state.cpu_stats = _parse_reduced_log(file, CPUSample)
|
||||||
elif name == "proc_meminfo.log":
|
elif name == "proc_meminfo.log":
|
||||||
state.mem_stats = _parse_proc_meminfo_log(file)
|
state.mem_stats = _parse_proc_meminfo_log(file)
|
||||||
|
elif name == "reduced_proc_meminfo.log":
|
||||||
|
state.mem_stats = _parse_reduced_proc_meminfo_log(file)
|
||||||
elif name == "cmdline2.log":
|
elif name == "cmdline2.log":
|
||||||
state.cmdline = _parse_cmdline_log(writer, file)
|
state.cmdline = _parse_cmdline_log(writer, file)
|
||||||
elif name == "monitor_disk.log":
|
elif name == "monitor_disk.log":
|
||||||
|
|
Loading…
Reference in New Issue