qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: vandersonmr <vandersonmr2@gmail.com>
To: qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	vandersonmr <vandersonmr2@gmail.com>,
	Richard Henderson <rth@twiddle.net>
Subject: [Qemu-devel] [PATCH v2 2/2] tb-stats: adding TBStatistics info into perf dump
Date: Fri, 30 Aug 2019 09:19:03 -0300	[thread overview]
Message-ID: <20190830121903.17585-3-vandersonmr2@gmail.com> (raw)
In-Reply-To: <20190830121903.17585-1-vandersonmr2@gmail.com>

Adding TBStatistics information to linux perf TB's symbol names.

This commit depends on the following PATCH:
[PATCH v5 00/10] Measure Tiny Code Generation Quality

Signed-off-by: Vanderson M. do Rosario <vandersonmr2@gmail.com>
---
 accel/tcg/perf/jitdump.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/accel/tcg/perf/jitdump.c b/accel/tcg/perf/jitdump.c
index 6fb464039d..6a7ca4cf06 100644
--- a/accel/tcg/perf/jitdump.c
+++ b/accel/tcg/perf/jitdump.c
@@ -21,6 +21,7 @@
 #include "disas/disas.h"
 #include "jitdump.h"
 #include "qemu-common.h"
+#include "exec/tb-stats.h"
 
 struct jitheader {
     uint32_t magic;     /* characters "jItD" */
@@ -149,7 +150,20 @@ void start_jitdump_file(void)
 
 void append_load_in_jitdump_file(TranslationBlock *tb)
 {
-    gchar *func_name = g_strdup_printf("TB virt:0x"TARGET_FMT_lx, tb->pc);
+    gchar *func_name;
+    if (tb->tb_stats) {
+        TBStatistics *tbs = tb->tb_stats;
+        unsigned g = stat_per_translation(tbs, code.num_guest_inst);
+        unsigned ops = stat_per_translation(tbs, code.num_tcg_ops);
+        unsigned ops_opt = stat_per_translation(tbs, code.num_tcg_ops_opt);
+        unsigned spills = stat_per_translation(tbs, code.spills);
+
+        func_name = g_strdup_printf(func_name,
+                "TB virt:0x"TARGET_FMT_lx" (g:%u op:%u opt:%u spills:%d)",
+                tb->pc, g, ops, ops_opt, spills);
+    } else {
+        func_name = g_strdup_printf("TB virt:0x"TARGET_FMT_lx, tb->pc);
+    }
 
     struct jr_code_load load_event;
     load_event.p.id = JIT_CODE_LOAD;
-- 
2.22.0



  parent reply	other threads:[~2019-08-30 14:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-30 12:19 [Qemu-devel] [PATCH v2 0/2] Integrating qemu to Linux Perf vandersonmr
2019-08-30 12:19 ` [Qemu-devel] [PATCH v2 1/2] accel/tcg: adding integration with linux perf vandersonmr
2019-09-02 10:07   ` Stefan Hajnoczi
2019-10-02 18:55     ` Alex Bennée
2019-08-30 12:19 ` vandersonmr [this message]
2019-09-02  9:41 ` [Qemu-devel] [PATCH v2 0/2] Integrating qemu to Linux Perf Stefan Hajnoczi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190830121903.17585-3-vandersonmr2@gmail.com \
    --to=vandersonmr2@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).