linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] perf scripts python: Add support for input args in gecko script
@ 2023-08-12 21:36 Anup Sharma
  0 siblings, 0 replies; only message in thread
From: Anup Sharma @ 2023-08-12 21:36 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Peter Zijlstra, Ingo Molnar,   Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Namhyung Kim, Ian Rogers,
	Adrian Hunter, Anup Sharma, linux-perf-users, linux-kernel

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


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

only message in thread, other threads:[~2023-08-12 21:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-12 21:36 [RFC PATCH] perf scripts python: Add support for input args in gecko script Anup Sharma

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).