perf report: Indicate JITed code better in report
tip-bot for Andi Kleen
merge botCommit-ID: a4e7e6efabc57e85e0737c2eaa391525c0ae36f3 Gitweb: https://git.kernel.org/tip/a4e7e6efabc57e85e0737c2eaa391525c0ae36f3 Author: Andi Kleen <[email protected]> AuthorDate: Thu, 14 Mar 2019 15:49:59 -0700 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Tue, 19 Mar 2019 16:52:03 -0300
perf report: Indicate JITed code better in report
Print [TID] tid %d instead of the crypted /tmp/perf-%d.map default.
% cat >loop.java
public class loop {
public static void main(String[] args)
{
for (;;);
} }
^D
% javac loop.java
% perf record java loop
^C
Before:
% perf report --stdio
...
56.09% java perf-34724.map [.] 0x00007fd5bd021896
19.12% java perf-34724.map [.] 0x00007fd5bd021887
9.79% java perf-34724.map [.] 0x00007fd5bd021783
8.97% java perf-34724.map [.] 0x00007fd5bd02175bAfter:
% perf report --stdio
...
56.09% java [JIT] tid 34724 [.] 0x00007fd5bd021896
19.12% java [JIT] tid 34724 [.] 0x00007fd5bd021887
9.79% java [JIT] tid 34724 [.] 0x00007fd5bd021783
8.97% java [JIT] tid 34724 [.] 0x00007fd5bd02175bSigned-off-by Andi Kleen <[email protected]>
Acked-by Jiri Olsa <[email protected]>
LPU-Reference: [email protected]
Signed-off-by Arnaldo Carvalho de Melo <[email protected]>
--- tools/perf/util/dso.c | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-)
tools/perf/util/dso.c +24 -18
@@ -1141,28 +1141,34 @@ void dso__set_short_name(struct dso *dso, const char *name, bool name_allocated)static void dso__set_basename (struct dso *dso) { -/* -* basename() may modify path buffer, so we must pass -* a copy. -*/ -char *base, *lname =strdup (dso->long_name); +char *base, *lname; +int tid; -if (!lname) -return ; - -/* -* basename() may return a pointer to internal -* storage which is reused in subsequent calls -* so copy the result. -*/ - base =strdup (basename (lname)); +if (sscanf (dso->long_name,"/tmp/perf-%d.map" , &tid) ==1 ) { +if (asprintf (&base,"[JIT] tid %d" , tid) <0 ) +return ; + }else { +/* +* basename() may modify path buffer, so we must pass +* a copy. +*/ + lname =strdup (dso->long_name); +if (!lname) +return ; -free (lname); +/* +* basename() may return a pointer to internal +* storage which is reused in subsequent calls +* so copy the result. +*/ + base =strdup (basename (lname)); -if (!base) -return ; +free (lname); -dso__set_short_name (dso, base, true); +if (!base) +return ; + } +dso__set_short_name (dso, base, true); }int dso__name_len (const struct dso *dso)