Hi Richard, Alex,

On 16/1/23 23:36, Richard Henderson wrote:
From: Ilya Leoshkevich <i...@linux.ibm.com>

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 <vanderson...@gmail.com>
Co-developed-by: Alex Bennée <alex.ben...@linaro.org>
Signed-off-by: Ilya Leoshkevich <i...@linux.ibm.com>
Message-Id: <20230112152013.125680-4-...@linux.ibm.com>
Signed-off-by: Richard Henderson <richard.hender...@linaro.org>
---
  docs/devel/tcg.rst        |  23 +++
  accel/tcg/perf.h          |  49 +++++
  accel/tcg/perf.c          | 375 ++++++++++++++++++++++++++++++++++++++
  accel/tcg/translate-all.c |   7 +
  linux-user/exit.c         |   2 +
  linux-user/main.c         |  15 ++
  softmmu/vl.c              |  11 ++
  tcg/tcg.c                 |   2 +
  accel/tcg/meson.build     |   1 +
  qemu-options.hx           |  20 ++
  10 files changed, 505 insertions(+)
  create mode 100644 accel/tcg/perf.h
  create mode 100644 accel/tcg/perf.c


diff --git a/tcg/tcg.c b/tcg/tcg.c
index da91779890..9b7df71e7a 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -61,6 +61,7 @@
  #include "exec/log.h"
  #include "tcg/tcg-ldst.h"
  #include "tcg-internal.h"
+#include "accel/tcg/perf.h"

Is it OK to include an header from QEMU's accel/tcg/ here?
I thought we wanted to keep tcg/ kinda independant (or maybe
this is already too late and this isn't a concern anymore).

  /* Forward declarations for functions declared in tcg-target.c.inc and
     used here. */
@@ -913,6 +914,7 @@ void tcg_prologue_init(TCGContext *s)
  #endif
prologue_size = tcg_current_code_size(s);
+    perf_report_prologue(s->code_gen_ptr, prologue_size);


Reply via email to