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 v4 1/6] perf scripts python: Add initial script file with usage information
Date: Wed, 19 Jul 2023 04:17:44 +0530	[thread overview]
Message-ID: <a9c432016409db2fcebbaf7bdfdd2921cbcc5300.1689718662.git.anupnewsmail@gmail.com> (raw)
In-Reply-To: <cover.1689718662.git.anupnewsmail@gmail.com>

Added necessary modules, including the Perf-Trace-Util
library, and defines the required functions and variables
for using perf script python. The perf_trace_context and
Core modules for tracing and processing events has been
also imported. Also added usage information.

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

diff --git a/tools/perf/scripts/python/firefox-gecko-converter.py b/tools/perf/scripts/python/firefox-gecko-converter.py
new file mode 100644
index 000000000000..63ecaf1abee8
--- /dev/null
+++ b/tools/perf/scripts/python/firefox-gecko-converter.py
@@ -0,0 +1,31 @@
+# firefox-gecko-converter.py - Convert perf record output to Firefox's gecko profile format
+# SPDX-License-Identifier: GPL-2.0
+#
+# The script converts perf.data to Gecko Profile Format,
+# which can be read by https://profiler.firefox.com/.
+#
+# Usage:
+#
+#     perf record -a -g -F 99 sleep 60
+#     perf script firefox-gecko-converter.py > output.json
+
+import os
+import sys
+from typing import Dict
+
+# Add the Perf-Trace-Util library to the Python path
+sys.path.append(os.environ['PERF_EXEC_PATH'] + \
+	'/scripts/python/Perf-Trace-Util/lib/Perf/Trace')
+
+from perf_trace_context import *
+from Core import *
+
+# Uses perf script python interface to parse each
+# event and store the data in the thread builder.
+def process_event(param_dict: Dict) -> None:
+	pass
+
+# Trace_end runs at the end and will be used to aggregate
+# the data into the final json object and print it out to stdout.
+def trace_end() -> None:
+	pass
-- 
2.34.1


  reply	other threads:[~2023-07-18 22:48 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-18 22:45 [PATCH v4 0/6] Add support for Firefox's gecko profile format Anup Sharma
2023-07-18 22:47 ` Anup Sharma [this message]
2023-07-18 22:48 ` [PATCH v4 2/6] perf scripts python: Extact necessary information from process event Anup Sharma
2023-07-18 22:49 ` [PATCH v4 3/6] perf scripts python: Add classes and conversion functions Anup Sharma
2023-07-18 22:50 ` [PATCH v4 4/6] perf scripts python: Add trace end processing and PRODUCT and CATEGORIES information Anup Sharma
2023-07-20 15:09   ` Arnaldo Carvalho de Melo
2023-07-18 22:50 ` [PATCH v4 5/6] perf scripts python: implement internal get or create frame, stack and string function Anup Sharma
2023-07-18 22:52 ` [PATCH v4 6/6] perf scripts python: Implement add sample function and thread processing Anup Sharma
2023-07-20 15:13   ` Arnaldo Carvalho de Melo
2023-07-19 11:04 ` [PATCH v4 0/6] Add support for Firefox's gecko profile format Anup Sharma
2023-07-19 15:22   ` Ian Rogers
2023-07-19 21:21     ` Anup Sharma
2023-07-20 15:14   ` Arnaldo Carvalho de Melo
2023-07-20 15:36     ` Arnaldo Carvalho de Melo

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=a9c432016409db2fcebbaf7bdfdd2921cbcc5300.1689718662.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).