linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anup Sharma <anupnewsmail@gmail.com>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: "Peter Zijlstra" <peterz@infradead.org>,
	"Ingo Molnar" <mingo@redhat.com>,
	"  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: [RFC PATCH] perf scripts python: Add support for input args in gecko script
Date: Sun, 13 Aug 2023 03:06:27 +0530	[thread overview]
Message-ID: <ZNf7W+EIrrCSHZN0@yoga> (raw)

Refines the argument handling mechanism in the "gecko-report"
script to enable better compatibility and improved user
experience. The script now differentiates between scenarios
where arguments are provided for record and report cases
where gecko.py arguments are passed.

Signed-off-by: Anup Sharma <anupnewsmail@gmail.com>

---
Hi Arnaldo,
Thanks for providing such a detail insights here:

https://lore.kernel.org/linux-perf-users/ZMJaDGhSnhIlK3Nd@kernel.org/

I've successfully confirmed that the command "perf script gecko -a sleep 1"
is functioning as expected. However, I encountered an issue when attempting
to provide arguments such as "--user-color" and "--save-only" to the
"gecko.py" script while using the "perf script gecko" or "perf script report
gecko" commands.

In order to understand the inner workings of how these commands are executed,
I delved into the "buildin-script.c" code. From my investigation, it seems
that the arguments are taken into account for the "record" functionality,
rather than for "report."

To address this  I added this changes.

I've also documented the usage of this command in our wiki:
https://perf.wiki.kernel.org/index.php/Tutorial#Firefox_Profiler

For most cases where users do not require specific "gecko.py" arguments, the
command "perf script gecko -a sleep 0.5" is sufficient. However, if users
intend to provide particular arguments to "gecko.py," they should employ the
command "perf script report gecko --save-only=cloud_cpu.json."

I believe there might be an intelligent solution to streamline this process.
Therefore, I would greatly appreciate your insights on this matter.
---
 tools/perf/scripts/python/bin/gecko-report | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
 mode change 100644 => 100755 tools/perf/scripts/python/bin/gecko-report

diff --git a/tools/perf/scripts/python/bin/gecko-report b/tools/perf/scripts/python/bin/gecko-report
old mode 100644
new mode 100755
index 0c12cc08f3ab..1867ec8d9757
--- a/tools/perf/scripts/python/bin/gecko-report
+++ b/tools/perf/scripts/python/bin/gecko-report
@@ -1,3 +1,7 @@
 #!/bin/bash
 # description: create firefox gecko profile json format from perf.data
-perf script "$@" -s "$PERF_EXEC_PATH"/scripts/python/gecko.py
+if [ "$*" = "-i -" ]; then
+perf script -s "$PERF_EXEC_PATH"/scripts/python/gecko.py
+else
+perf script -s "$PERF_EXEC_PATH"/scripts/python/gecko.py -- "$@"
+fi
-- 
2.34.1


                 reply	other threads:[~2023-08-12 21:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=ZNf7W+EIrrCSHZN0@yoga \
    --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).