aboutsummaryrefslogtreecommitdiff
path: root/accel/tcg/translate-all.c
diff options
context:
space:
mode:
authorIlya Leoshkevich <iii@linux.ibm.com>2023-01-12 16:20:13 +0100
committerRichard Henderson <richard.henderson@linaro.org>2023-01-16 10:14:12 -1000
commit5584e2dbe8c9c95ceb178786fb88e5edf625e1b6 (patch)
tree6b117636e203be8e4246aa30704d784243e4deee /accel/tcg/translate-all.c
parent7c10cb38ccb86a0e56fff32bb348aa4b34e17e10 (diff)
downloadqemu-5584e2dbe8c9c95ceb178786fb88e5edf625e1b6.zip
qemu-5584e2dbe8c9c95ceb178786fb88e5edf625e1b6.tar.gz
qemu-5584e2dbe8c9c95ceb178786fb88e5edf625e1b6.tar.bz2
tcg: add perfmap and jitdump
Add ability to dump /tmp/perf-<pid>.map and jit-<pid>.dump. The first one allows the perf tool to map samples to each individual translation block. The second one adds the ability to resolve symbol names, line numbers and inspect JITed code. Example of use: perf record qemu-x86_64 -perfmap ./a.out perf report or perf record -k 1 qemu-x86_64 -jitdump ./a.out DEBUGINFOD_URLS= perf inject -j -i perf.data -o perf.data.jitted perf report -i perf.data.jitted Co-developed-by: Vanderson M. do Rosario <vandersonmr2@gmail.com> Co-developed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> Message-Id: <20230112152013.125680-4-iii@linux.ibm.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'accel/tcg/translate-all.c')
-rw-r--r--accel/tcg/translate-all.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
index 51ac1f6..979f8e1 100644
--- a/accel/tcg/translate-all.c
+++ b/accel/tcg/translate-all.c
@@ -62,6 +62,7 @@
#include "tb-hash.h"
#include "tb-context.h"
#include "internal.h"
+#include "perf.h"
/* Make sure all possible CPU event bits fit in tb->trace_vcpu_dstate */
QEMU_BUILD_BUG_ON(CPU_TRACE_DSTATE_MAX_EVENTS >
@@ -406,6 +407,12 @@ TranslationBlock *tb_gen_code(CPUState *cpu,
}
tb->tc.size = gen_code_size;
+ /*
+ * For TARGET_TB_PCREL, attribute all executions of the generated
+ * code to its first mapping.
+ */
+ perf_report_code(pc, tb, tcg_splitwx_to_rx(gen_code_buf));
+
#ifdef CONFIG_PROFILER
qatomic_set(&prof->code_time, prof->code_time + profile_getclock() - ti);
qatomic_set(&prof->code_in_len, prof->code_in_len + tb->size);