linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anup Sharma <anupnewsmail@gmail.com>
To: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>,
	Ian Rogers <irogers@google.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Anup Sharma <anupnewsmail@gmail.com>,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v3 5/6] scripts: python: Implement add sample function and return finish
Date: Tue, 11 Jul 2023 04:44:22 +0530	[thread overview]
Message-ID: <8b80f803ffbed4c84c0c63b3e1dae155a66ac1f2.1689024635.git.anupnewsmail@gmail.com> (raw)
In-Reply-To: <cover.1689024635.git.anupnewsmail@gmail.com>

The addSample function appends a new entry to the 'samples' data structure.

The finish function generates a dictionary containing various profile
information such as 'tid', 'pid', 'name', 'markers', 'samples',
'frameTable', 'stackTable', 'stringTable', 'registerTime',
'unregisterTime', and 'processType'.

Signed-off-by: Anup Sharma <anupnewsmail@gmail.com>
---
 .../scripts/python/firefox-gecko-converter.py | 25 +++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/tools/perf/scripts/python/firefox-gecko-converter.py b/tools/perf/scripts/python/firefox-gecko-converter.py
index 39818a603265..6c934de1f608 100644
--- a/tools/perf/scripts/python/firefox-gecko-converter.py
+++ b/tools/perf/scripts/python/firefox-gecko-converter.py
@@ -106,11 +106,36 @@ def process_event(param_dict):
 		}
 		stringTable = []
 
+		def addSample(threadName, stackArray, time):
+			responsiveness = 0
+			samples['data'].append([stack, time, responsiveness])
+
+		def finish():
+			return {
+				"tid": tid,
+				"pid": pid,
+				"name": name,
+				"markers": markers,
+				"samples": samples,
+				"frameTable": frameTable,
+				"stackTable": stackTable,
+				"stringTable": stringTable,
+				"registerTime": 0,
+				"unregisterTime": None,
+				"processType": 'default'
+			}
+
+		return {
+			"addSample": addSample,
+			"finish": finish
+		}
+
 	def _addThreadSample(pid, tid, threadName, time_stamp, stack):
 		thread = thread_map.get(tid)
 		if not thread:
 			thread = _createThread(threadName, pid, tid)
 			thread_map[tid] = thread
+		thread['addSample'](threadName, stack, time_stamp)
 
 	# Extract relevant information from the event parameters. The event parameters
 	# are in a dictionary:
-- 
2.34.1


  parent reply	other threads:[~2023-07-10 23:14 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-10 23:08 [PATCH v3 0/6] Add support for Firefox's gecko profile format Anup Sharma
2023-07-10 23:09 ` [PATCH v3 1/6] scripts: python: Add initial script file with imports Anup Sharma
2023-07-12 16:50   ` Ian Rogers
2023-07-17 15:20     ` Anup Sharma
2023-07-10 23:10 ` [PATCH v3 2/6] scripts: python: Extact necessary information from process event Anup Sharma
2023-07-12 17:01   ` Ian Rogers
2023-07-12 17:03     ` Ian Rogers
2023-07-17 15:31       ` Anup Sharma
2023-07-10 23:13 ` [PATCH v3 3/6] scripts: python: thread sample processing to create thread with schemas Anup Sharma
2023-07-12 17:25   ` Ian Rogers
2023-07-17 15:43     ` Anup Sharma
2023-07-10 23:13 ` [PATCH v3 4/6] scripts: python: Add trace end processing and JSON output Anup Sharma
2023-07-12 17:28   ` Ian Rogers
2023-07-14  2:31     ` Namhyung Kim
2023-07-17 15:53       ` Anup Sharma
2023-07-10 23:14 ` Anup Sharma [this message]
2023-07-12 17:35   ` [PATCH v3 5/6] scripts: python: Implement add sample function and return finish Ian Rogers
2023-07-17 15:59     ` Anup Sharma
2023-07-10 23:15 ` [PATCH v3 6/6] scripts: python: implement get or create frame and stack function Anup Sharma
2023-07-12 17:44   ` Ian Rogers
2023-07-17 16:12     ` Anup Sharma
2023-07-14 21:36 ` [PATCH v3 0/6] Add support for Firefox's gecko profile format Anup Sharma

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8b80f803ffbed4c84c0c63b3e1dae155a66ac1f2.1689024635.git.anupnewsmail@gmail.com \
    --to=anupnewsmail@gmail.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).