Re: [PATCH] perf trace: get rid of the hard-coded paths in thereport scripts

From: Tom Zanussi
Date: Sat Aug 14 2010 - 00:38:22 EST


Hi Stephane,

On Fri, 2010-08-13 at 10:30 +0200, Stephane Eranian wrote:
> Tom,
>
> Here is version that works for me. Besides the stat() to access() change, I fixed
> the pathname you were building, it was missing the language name. The way I solved
> that is by leveraging the scripting_ops->name field, but for that I had to make sure
> it would match the subdir name, i.e., all lower-case. I also add an error message
> when the script is not found, so users understand what went wrong without turning
> on any sort of debugging.
>

Hmm, I'm not sure why the previous version didn't work for you, since
that version changed all the scripts to the form:

python/sctop.py

which applied to the format string there, "%s/scripts/%s"

gives

..../scripts/python/sctop.py

so it should have worked.

With your version, I get:

root@tropicana:~# perf trace sctop
script python/sctop.py not found

because the script names still have the form python/sctop.py but are
applied to the new format string "%s/scripts/%s/%s" which gives:

..../scripts/python/python/sctop.py

After removing the python/ prefix from all the scripts, everything works
fine:

root@tropicana:~# perf trace sctop
good output...

root@tropicana:~# perf record -c 1 -e raw_syscalls:sys_enter -a -- sleep
1
[ perf record: Woken up 0 times to write data ]
[ perf record: Captured and wrote 22.546 MB perf.data (~985061
samples) ]
root@tropicana:~# perf trace -g python
generated Python script: perf-trace.py
root@tropicana:~# perf trace -s perf-trace.py > out
good output...

Anyway, for all the reasons you stated and the fact that it gets rid of
everything but the bare script name, I think your version is a nice
improvement - I'll repost it along with the small script changes
mentioned shortly.

Tom


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/