[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <42ba5416982056273960f182e8a79fd998639bcd.1687375189.git.anupnewsmail@gmail.com>
Date: Thu, 22 Jun 2023 01:10:48 +0530
From: Anup Sharma <anupnewsmail@...il.com>
To: Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...nel.org>,
Namhyung Kim <namhyung@...nel.org>,
Ian Rogers <irogers@...gle.com>,
Adrian Hunter <adrian.hunter@...el.com>,
Anup Sharma <anupnewsmail@...il.com>,
linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH 3/9] scripts: python: Introduce thread sample processing in
convertPerfScriptProfile
The _addThreadSample function is responsible for adding a sample to a specific
thread. It takes the process ID (pid), thread ID (tid), thread name, timestamp
(time_stamp), and stack as parameters. It first checks if the thread exists in
the threadMap dictionary. If not, it creates a new thread using the _createtread
function and assigns it to the threadMap. Finally, it calls the 'addSample' method
of the thread, passing the thread name, stack, and timestamp.
Signed-off-by: Anup Sharma <anupnewsmail@...il.com>
---
tools/perf/scripts/python/firefox-gecko-converter.py | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/tools/perf/scripts/python/firefox-gecko-converter.py b/tools/perf/scripts/python/firefox-gecko-converter.py
index 2817d4a96269..0ff70c0349c8 100644
--- a/tools/perf/scripts/python/firefox-gecko-converter.py
+++ b/tools/perf/scripts/python/firefox-gecko-converter.py
@@ -46,3 +46,11 @@ def convertPerfScriptProfile(profile):
"addSample": addSample,
"finish": finish
}
+
+ threadMap = dict()
+ def _addThreadSample(pid, tid, threadName, time_stamp, stack):
+ thread = threadMap.get(tid)
+ if not thread:
+ thread = _createtread(threadName, pid, tid)
+ threadMap[tid] = thread
+ thread['addSample'](threadName, stack, time_stamp)
--
2.34.1
Powered by blists - more mailing lists