All of lore.kernel.org
 help / color / mirror / Atom feed
* [oe][meta-oe][PATCH] pm-graph: parse separated cpu exec line
@ 2021-05-25  5:40 LiweiSong
  0 siblings, 0 replies; only message in thread
From: LiweiSong @ 2021-05-25  5:40 UTC (permalink / raw)
  To: openembedded-devel; +Cc: liwei.song

if cpu exec line was split into different line, there will be an error
when parse it:

  File "/usr/bin/sleepgraph", line 3165, in parseTraceLog
    proclist[name] = int(val[1])
IndexError: list index out of range

check this case and append to parse the unfinished line.

Signed-off-by: Liwei Song <liwei.song@windriver.com>
---
 ...raph.py-parse-unfished-cpu-exec-line.patch | 51 +++++++++++++++++++
 .../recipes-kernel/pm-graph/pm-graph_5.5.bb   |  1 +
 2 files changed, 52 insertions(+)
 create mode 100644 meta-oe/recipes-kernel/pm-graph/pm-graph/0001-sleepgraph.py-parse-unfished-cpu-exec-line.patch

diff --git a/meta-oe/recipes-kernel/pm-graph/pm-graph/0001-sleepgraph.py-parse-unfished-cpu-exec-line.patch b/meta-oe/recipes-kernel/pm-graph/pm-graph/0001-sleepgraph.py-parse-unfished-cpu-exec-line.patch
new file mode 100644
index 000000000000..33557275fb6b
--- /dev/null
+++ b/meta-oe/recipes-kernel/pm-graph/pm-graph/0001-sleepgraph.py-parse-unfished-cpu-exec-line.patch
@@ -0,0 +1,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
+
diff --git a/meta-oe/recipes-kernel/pm-graph/pm-graph_5.5.bb b/meta-oe/recipes-kernel/pm-graph/pm-graph_5.5.bb
index 4526eeed3fe6..4d7a1b2d45d5 100644
--- a/meta-oe/recipes-kernel/pm-graph/pm-graph_5.5.bb
+++ b/meta-oe/recipes-kernel/pm-graph/pm-graph_5.5.bb
@@ -10,6 +10,7 @@ SRC_URI = "git://github.com/intel/pm-graph.git \
            file://0001-Makefile-fix-multilib-build-failure.patch \
            file://0001-sleepgraph.py-use-python3.patch \
            file://0001-sleepgraph-add-support-for-RT-kernel-ftrace-flags.patch \
+           file://0001-sleepgraph.py-parse-unfished-cpu-exec-line.patch \
 "
 S = "${WORKDIR}/git"
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-05-25  5:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-25  5:40 [oe][meta-oe][PATCH] pm-graph: parse separated cpu exec line LiweiSong

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.