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>
50 lines
1.1 KiB
C
50 lines
1.1 KiB
C
/*
|
|
* Linux perf perf-<pid>.map and jit-<pid>.dump integration.
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
|
*/
|
|
|
|
#ifndef ACCEL_TCG_PERF_H
|
|
#define ACCEL_TCG_PERF_H
|
|
|
|
#if defined(CONFIG_TCG) && defined(CONFIG_LINUX)
|
|
/* Start writing perf-<pid>.map. */
|
|
void perf_enable_perfmap(void);
|
|
|
|
/* Start writing jit-<pid>.dump. */
|
|
void perf_enable_jitdump(void);
|
|
|
|
/* Add information about TCG prologue to profiler maps. */
|
|
void perf_report_prologue(const void *start, size_t size);
|
|
|
|
/* Add information about JITted guest code to profiler maps. */
|
|
void perf_report_code(uint64_t guest_pc, TranslationBlock *tb,
|
|
const void *start);
|
|
|
|
/* Stop writing perf-<pid>.map and/or jit-<pid>.dump. */
|
|
void perf_exit(void);
|
|
#else
|
|
static inline void perf_enable_perfmap(void)
|
|
{
|
|
}
|
|
|
|
static inline void perf_enable_jitdump(void)
|
|
{
|
|
}
|
|
|
|
static inline void perf_report_prologue(const void *start, size_t size)
|
|
{
|
|
}
|
|
|
|
static inline void perf_report_code(uint64_t guest_pc, TranslationBlock *tb,
|
|
const void *start)
|
|
{
|
|
}
|
|
|
|
static inline void perf_exit(void)
|
|
{
|
|
}
|
|
#endif
|
|
|
|
#endif
|