summaryrefslogtreecommitdiffstats
path: root/scripts/pybootchartgui
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/pybootchartgui')
-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":