diff options
author | Adrian Hunter <adrian.hunter@intel.com> | 2021-05-24 08:57:18 +0200 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2021-05-25 14:51:44 +0200 |
commit | 6ea4b5dbe0c40bbafacdb78405a3bcbe88593ba1 (patch) | |
tree | ff2052c3e03928ec0df41c1ba2873a85a5f8683c /tools/perf/util/trace-event.h | |
parent | perf arm-spe: Remove redundant checking for "full_auxtrace" (diff) | |
download | linux-6ea4b5dbe0c40bbafacdb78405a3bcbe88593ba1.tar.xz linux-6ea4b5dbe0c40bbafacdb78405a3bcbe88593ba1.zip |
perf script: Find script file relative to exec path
Allow perf script to find a script in the exec path.
Example:
Before:
$ perf record -a -e intel_pt/branch=0/ sleep 0.1
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.954 MB perf.data ]
$ perf script intel-pt-events.py 2>&1 | head -3
Error: Couldn't find script `intel-pt-events.py'
See perf script -l for available scripts.
$ perf script -s intel-pt-events.py 2>&1 | head -3
Can't open python script "intel-pt-events.py": No such file or directory
$ perf script ~/libexec/perf-core/scripts/python/intel-pt-events.py 2>&1 | head -3
Error: Couldn't find script `/home/ahunter/libexec/perf-core/scripts/python/intel-pt-events.py'
See perf script -l for available scripts.
$
After:
$ perf script intel-pt-events.py 2>&1 | head -3
Intel PT Power Events and PTWRITE
perf 8123/8123 [000] 551.230753986 cbr: 42 freq: 4219 MHz (156%) 0 [unknown] ([unknown])
perf 8123/8123 [001] 551.230808216 cbr: 42 freq: 4219 MHz (156%) 0 [unknown] ([unknown])
$ perf script -s intel-pt-events.py 2>&1 | head -3
Intel PT Power Events and PTWRITE
perf 8123/8123 [000] 551.230753986 cbr: 42 freq: 4219 MHz (156%) 0 [unknown] ([unknown])
perf 8123/8123 [001] 551.230808216 cbr: 42 freq: 4219 MHz (156%) 0 [unknown] ([unknown])
$ perf script ~/libexec/perf-core/scripts/python/intel-pt-events.py 2>&1 | head -3
Intel PT Power Events and PTWRITE
perf 8123/8123 [000] 551.230753986 cbr: 42 freq: 4219 MHz (156%) 0 [unknown] ([unknown])
perf 8123/8123 [001] 551.230808216 cbr: 42 freq: 4219 MHz (156%) 0 [unknown] ([unknown])
$
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Link: http://lore.kernel.org/lkml/20210524065718.11421-1-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/trace-event.h')
-rw-r--r-- | tools/perf/util/trace-event.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/tools/perf/util/trace-event.h b/tools/perf/util/trace-event.h index 72fdf2a3577c..39fb39ed6612 100644 --- a/tools/perf/util/trace-event.h +++ b/tools/perf/util/trace-event.h @@ -71,6 +71,7 @@ struct perf_stat_config; struct scripting_ops { const char *name; + const char *dirname; /* For script path .../scripts/<dirname>/... */ int (*start_script) (const char *script, int argc, const char **argv); int (*flush_script) (void); int (*stop_script) (void); |