aboutsummaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-kernel/pm-graph/pm-graph/0001-sleepgraph.py-parse-unfished-cpu-exec-line.patch
blob: 33557275fb6b6f2ce9321d1bf7ee6ac829ab560f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
From 9bbc991a927722439cad38c892fc9f57207089d3 Mon Sep 17 00:00:00 2001
From: Liwei Song <liwei.song@windriver.com>
Date: Mon, 24 May 2021 08:27:28 +0000
Subject: [PATCH] sleepgraph.py: parse unfished cpu exec line

exist the below case in ftrace file:
sleepgraph-6508    [003] .... 18197.824037: tracing_mark_write: ps - xxx..., lock_torture_wr-94 169,lock_torture_wr-95 143,lock_tort
sleepgraph-6508    [003] .... 18197.824043: tracing_mark_write: ure_wr-96 189,lock_torture_wr-97 174,lock_torture_wr-98 160,lock_torture_st-99 1

lock_torture_wr-96 was split to different line due to limited buffer
size(1k) set in kernel, check this case and re-parse the unfinished
line.

Upstream-Status: [Submitted: https://github.com/intel/pm-graph/pull/20]

Signed-off-by: Liwei Song <liwei.song@windriver.com>
---
 sleepgraph.py | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/sleepgraph.py b/sleepgraph.py
index e340d5b3f03b..38b4439db8eb 100755
--- a/sleepgraph.py
+++ b/sleepgraph.py
@@ -3365,8 +3365,21 @@ def parseTraceLog(live=False):
 					val = ps.split()
 					if not val:
 						continue
-					name = val[0].replace('--', '-')
-					proclist[name] = int(val[1])
+					if not len(val) < 2:
+						name = val[0].replace('--', '-')
+						proclist[name] = int(val[1])
+					else:
+						proclist = dict()
+						nextline = next(tf)
+						mcont = re.match(tp.ftrace_line_fmt, nextline)
+						n = m.group('ps') + mcont.group('msg').split(': ')[1]
+						for pscont in n.split(','):
+							val = pscont.split()
+							if not val:
+								continue
+							if not len(val) < 2:
+								name = val[0].replace('--', '-')
+								proclist[name] = int(val[1])
 				data.pstl[t.time] = proclist
 				continue
 		# find the end of resume
-- 
2.29.2