perf trace: get rid of the hard-coded paths in the report scripts
PATCH 1/1 perf trace: get rid of the hard-coded paths in the report scripts
The perf trace report shell scripts hard-code the exec path of the scripts into their command-lines, which doesn't work if perf has been installed somewhere else.
Instead, perf trace should create the paths at run-time. This patch does that and removes the hard-coded paths from all the report scripts.
Reported-by Stephane Eranian <[email protected]>
Signed-off-by Tom Zanussi <[email protected]>
--- tools/perf/builtin-trace.c | 11 +++++++++-- tools/perf/scripts/perl/bin/failed-syscalls-report | 2 +- tools/perf/scripts/perl/bin/rw-by-file-report | 2 +- tools/perf/scripts/perl/bin/rw-by-pid-report | 2 +- tools/perf/scripts/perl/bin/rwtop-report | 2 +- tools/perf/scripts/perl/bin/wakeup-latency-report | 2 +- tools/perf/scripts/perl/bin/workqueue-stats-report | 2 +- .../python/bin/failed-syscalls-by-pid-report | 2 +- tools/perf/scripts/python/bin/sctop-report | 2 +- .../python/bin/syscall-counts-by-pid-report | 2 +- .../perf/scripts/python/bin/syscall-counts-report | 3 ++- 11 files changed, 20 insertions(+), 12 deletions(-)
tools/perf/builtin-trace.c +9 -2
@@ -702,10 +702,17 @@ int cmd_trace(int argc, const char **argv, const char *prefix __used) }if (script_name) { - err = scripting_ops->start_script (script_name, argc, argv); +char script_exec_path[MAXPATHLEN ]; + +snprintf (script_exec_path,MAXPATHLEN ,"%s/scripts/%s" , +perf_exec_path (), script_name); + + err = scripting_ops->start_script (script_exec_path, + argc, argv);if (err) goto out; -pr_debug ("perf trace started with script %s\n\n" , script_name); +pr_debug ("perf trace started with script %s\n\n" , + script_exec_path); } err =__cmd_trace (session);
tools/perf/scripts/perl/bin/failed-syscalls-report +1 -1
@@ -7,4 +7,4 @@ if [ $# -gt 0 ] ; then shift fi fi -perf trace $@ -s ~/libexec/perf-core/scripts/perl/failed-syscalls.pl $comm +perf trace $@ -s perl/failed-syscalls.pl $comm
tools/perf/scripts/perl/bin/rw-by-file-report +1 -1
@@ -7,7 +7,7 @@ if [ $# -lt 1 ] ; then fi comm=$1 shift -perf trace $@ -s ~/libexec/perf-core/scripts/perl/rw-by-file.pl $comm +perf trace $@ -s perl/rw-by-file.pl $comm
tools/perf/scripts/perl/bin/rw-by-pid-report +1 -1
@@ -1,6 +1,6 @@ #!/bin/bash # description: system-wide r/w activity -perf trace $@ -s ~/libexec/perf-core/scripts/perl/rw-by-pid.pl +perf trace $@ -s perl/rw-by-pid.pl
tools/perf/scripts/perl/bin/rwtop-report +1 -1
@@ -17,7 +17,7 @@ if [ "$n_args" -gt 0 ] ; then interval=$1 shift fi -perf trace $@ -s ~/libexec/perf-core/scripts/perl/rwtop.pl $interval +perf trace $@ -s perl/rwtop.pl $interval
tools/perf/scripts/perl/bin/wakeup-latency-report +1 -1
@@ -1,6 +1,6 @@ #!/bin/bash # description: system-wide min/max/avg wakeup latency -perf trace $@ -s ~/libexec/perf-core/scripts/perl/wakeup-latency.pl +perf trace $@ -s perl/wakeup-latency.pl
tools/perf/scripts/perl/bin/workqueue-stats-report +1 -1
@@ -1,6 +1,6 @@ #!/bin/bash # description: workqueue stats (ins/exe/create/destroy) -perf trace $@ -s ~/libexec/perf-core/scripts/perl/workqueue-stats.pl +perf trace $@ -s perl/workqueue-stats.pl
tools/perf/scripts/python/bin/failed-syscalls-by-pid-report +1 -1
@@ -7,4 +7,4 @@ if [ $# -gt 0 ] ; then shift fi fi -perf trace $@ -s ~/libexec/perf-core/scripts/python/failed-syscalls-by-pid.py $comm +perf trace $@ -s python/failed-syscalls-by-pid.py $comm
tools/perf/scripts/python/bin/sctop-report +1 -1
@@ -21,4 +21,4 @@ elif [ "$n_args" -gt 0 ] ; then interval=$1 shift fi -perf trace $@ -s ~/libexec/perf-core/scripts/python/sctop.py $comm $interval +perf trace $@ -s python/sctop.py $comm $interval
tools/perf/scripts/python/bin/syscall-counts-by-pid-report +1 -1
@@ -7,4 +7,4 @@ if [ $# -gt 0 ] ; then shift fi fi -perf trace $@ -s ~/libexec/perf-core/scripts/python/syscall-counts-by-pid.py $comm +perf trace $@ -s python/syscall-counts-by-pid.py $comm
tools/perf/scripts/python/bin/syscall-counts-report +2 -1
@@ -1,3 +1,4 @@ + #!/bin/bash # description: system-wide syscall counts # args: [comm]
@@ -7,4 +8,4 @@ if [ $# -gt 0 ] ; then shift fi fi -perf trace $@ -s ~/libexec/perf-core/scripts/python/syscall-counts.py $comm +perf trace $@ -s python/syscall-counts.py $comm
Signature · 1 line
1.6.4.GIT