perf scripts python: Add support for input args in gecko script
RFC PATCH 1/1 perf scripts python: Add support for input args in gecko script
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.
---
Hi Arnaldo,
Thanks for providing such a detail insights here:
https://lore.kernel.org/linux-perf-users/[email protected]/
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
tools/perf/scripts/python/bin/gecko-report +5 -1
@@ -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
Signature · 1 line
2.34.1