Skip to content

Commit a4e7e6e

Browse files
Andi Kleenacmel
authored andcommitted
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 [.] 0x00007fd5bd02175b After: % 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 [.] 0x00007fd5bd02175b Signed-off-by: Andi Kleen <[email protected]> Acked-by: Jiri Olsa <[email protected]> Tested-by: Arnaldo Carvalho de Melo <[email protected]> LPU-Reference: [email protected] Link: https://lkml.kernel.org/n/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 702fb9b commit a4e7e6e

File tree

1 file changed

+24
-18
lines changed

1 file changed

+24
-18
lines changed

tools/perf/util/dso.c

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,28 +1141,34 @@ void dso__set_short_name(struct dso *dso, const char *name, bool name_allocated)
11411141

11421142
static void dso__set_basename(struct dso *dso)
11431143
{
1144-
/*
1145-
* basename() may modify path buffer, so we must pass
1146-
* a copy.
1147-
*/
1148-
char *base, *lname = strdup(dso->long_name);
1144+
char *base, *lname;
1145+
int tid;
11491146

1150-
if (!lname)
1151-
return;
1152-
1153-
/*
1154-
* basename() may return a pointer to internal
1155-
* storage which is reused in subsequent calls
1156-
* so copy the result.
1157-
*/
1158-
base = strdup(basename(lname));
1147+
if (sscanf(dso->long_name, "/tmp/perf-%d.map", &tid) == 1) {
1148+
if (asprintf(&base, "[JIT] tid %d", tid) < 0)
1149+
return;
1150+
} else {
1151+
/*
1152+
* basename() may modify path buffer, so we must pass
1153+
* a copy.
1154+
*/
1155+
lname = strdup(dso->long_name);
1156+
if (!lname)
1157+
return;
11591158

1160-
free(lname);
1159+
/*
1160+
* basename() may return a pointer to internal
1161+
* storage which is reused in subsequent calls
1162+
* so copy the result.
1163+
*/
1164+
base = strdup(basename(lname));
11611165

1162-
if (!base)
1163-
return;
1166+
free(lname);
11641167

1165-
dso__set_short_name(dso, base, true);
1168+
if (!base)
1169+
return;
1170+
}
1171+
dso__set_short_name(dso, base, true);
11661172
}
11671173

11681174
int dso__name_len(const struct dso *dso)

0 commit comments

Comments
 (0)