diff options
Diffstat (limited to 'scripts/pybootchartgui/pybootchartgui/parsing.py')
-rw-r--r-- | scripts/pybootchartgui/pybootchartgui/parsing.py | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/scripts/pybootchartgui/pybootchartgui/parsing.py b/scripts/pybootchartgui/pybootchartgui/parsing.py index b42dac6b88..63a53b6b88 100644 --- a/scripts/pybootchartgui/pybootchartgui/parsing.py +++ b/scripts/pybootchartgui/pybootchartgui/parsing.py | |||
@@ -49,6 +49,9 @@ class Trace: | |||
49 | self.parent_map = None | 49 | self.parent_map = None |
50 | self.mem_stats = [] | 50 | self.mem_stats = [] |
51 | self.monitor_disk = None | 51 | self.monitor_disk = None |
52 | self.cpu_pressure = [] | ||
53 | self.io_pressure = [] | ||
54 | self.mem_pressure = [] | ||
52 | self.times = [] # Always empty, but expected by draw.py when drawing system charts. | 55 | self.times = [] # Always empty, but expected by draw.py when drawing system charts. |
53 | 56 | ||
54 | if len(paths): | 57 | if len(paths): |
@@ -128,7 +131,7 @@ class Trace: | |||
128 | def compile(self, writer): | 131 | def compile(self, writer): |
129 | 132 | ||
130 | def find_parent_id_for(pid): | 133 | def find_parent_id_for(pid): |
131 | if pid is 0: | 134 | if pid == 0: |
132 | return 0 | 135 | return 0 |
133 | ppid = self.parent_map.get(pid) | 136 | ppid = self.parent_map.get(pid) |
134 | if ppid: | 137 | if ppid: |
@@ -554,6 +557,29 @@ def _parse_monitor_disk_log(file): | |||
554 | 557 | ||
555 | return disk_stats | 558 | return disk_stats |
556 | 559 | ||
560 | def _parse_pressure_logs(file, filename): | ||
561 | """ | ||
562 | Parse file for "some" pressure with 'avg10', 'avg60' 'avg300' and delta total values | ||
563 | (in that order) directly stored on one line for both CPU and IO, based on filename. | ||
564 | """ | ||
565 | pressure_stats = [] | ||
566 | if filename == "cpu.log": | ||
567 | SamplingClass = CPUPressureSample | ||
568 | elif filename == "memory.log": | ||
569 | SamplingClass = MemPressureSample | ||
570 | else: | ||
571 | SamplingClass = IOPressureSample | ||
572 | for time, lines in _parse_timed_blocks(file): | ||
573 | for line in lines: | ||
574 | if not line: continue | ||
575 | tokens = line.split() | ||
576 | avg10 = float(tokens[0]) | ||
577 | avg60 = float(tokens[1]) | ||
578 | avg300 = float(tokens[2]) | ||
579 | delta = float(tokens[3]) | ||
580 | pressure_stats.append(SamplingClass(time, avg10, avg60, avg300, delta)) | ||
581 | |||
582 | return pressure_stats | ||
557 | 583 | ||
558 | # if we boot the kernel with: initcall_debug printk.time=1 we can | 584 | # if we boot the kernel with: initcall_debug printk.time=1 we can |
559 | # get all manner of interesting data from the dmesg output | 585 | # get all manner of interesting data from the dmesg output |
@@ -741,6 +767,13 @@ def _do_parse(writer, state, filename, file): | |||
741 | state.cmdline = _parse_cmdline_log(writer, file) | 767 | state.cmdline = _parse_cmdline_log(writer, file) |
742 | elif name == "monitor_disk.log": | 768 | elif name == "monitor_disk.log": |
743 | state.monitor_disk = _parse_monitor_disk_log(file) | 769 | state.monitor_disk = _parse_monitor_disk_log(file) |
770 | #pressure logs are in a subdirectory | ||
771 | elif name == "cpu.log": | ||
772 | state.cpu_pressure = _parse_pressure_logs(file, name) | ||
773 | elif name == "io.log": | ||
774 | state.io_pressure = _parse_pressure_logs(file, name) | ||
775 | elif name == "memory.log": | ||
776 | state.mem_pressure = _parse_pressure_logs(file, name) | ||
744 | elif not filename.endswith('.log'): | 777 | elif not filename.endswith('.log'): |
745 | _parse_bitbake_buildstats(writer, state, filename, file) | 778 | _parse_bitbake_buildstats(writer, state, filename, file) |
746 | t2 = time.process_time() | 779 | t2 = time.process_time() |