diff mbox series

[v1,2/2] tb-stats: adding TBStatistics info into perf dump

Message ID 20190815023725.2659-3-vandersonmr2@gmail.com
State New
Headers show
Series Integrating qemu to Linux Perf | expand

Commit Message

vandersonmr Aug. 15, 2019, 2:37 a.m. UTC
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 | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

Comments

Alex Bennée Aug. 15, 2019, 4:19 p.m. UTC | #1
vandersonmr <vandersonmr2@gmail.com> writes:

> 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 | 15 ++++++++++++++-
>  1 file changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/accel/tcg/perf/jitdump.c b/accel/tcg/perf/jitdump.c
> index 6f4c0911c2..b2334fd601 100644
> --- a/accel/tcg/perf/jitdump.c
> +++ b/accel/tcg/perf/jitdump.c
> @@ -8,6 +8,7 @@
>  #include <sys/syscall.h>
>  #include <elf.h>
>
> +#include "exec/tb-stats.h"
>  #include "jitdump.h"
>  #include "qemu-common.h"
>
> @@ -135,7 +136,19 @@ void start_jitdump_file(void)
>  void append_load_in_jitdump_file(TranslationBlock *tb)
>  {
>      GString *func_name = g_string_new(NULL);
> -    g_string_printf(func_name, "TB virt:0x"TARGET_FMT_lx"%c", tb->pc, '\0');
> +    if (tb->tb_stats) {
> +        TBStatistics *tbs = tb->tb_stats;
> +        g = stat_per_translation(tbs, code.num_guest_inst);
> +        ops = stat_per_translation(tbs, code.num_tcg_ops);
> +        ops_opt = stat_per_translation(tbs, code.num_tcg_ops_opt);
> +        spills = stat_per_translation(tbs, code.spills);

Where are the declarations for these functions?

--
Alex Bennée
diff mbox series

Patch

diff --git a/accel/tcg/perf/jitdump.c b/accel/tcg/perf/jitdump.c
index 6f4c0911c2..b2334fd601 100644
--- a/accel/tcg/perf/jitdump.c
+++ b/accel/tcg/perf/jitdump.c
@@ -8,6 +8,7 @@ 
 #include <sys/syscall.h>
 #include <elf.h>
 
+#include "exec/tb-stats.h"
 #include "jitdump.h"
 #include "qemu-common.h"
 
@@ -135,7 +136,19 @@  void start_jitdump_file(void)
 void append_load_in_jitdump_file(TranslationBlock *tb)
 {
     GString *func_name = g_string_new(NULL);
-    g_string_printf(func_name, "TB virt:0x"TARGET_FMT_lx"%c", tb->pc, '\0');
+    if (tb->tb_stats) {
+        TBStatistics *tbs = tb->tb_stats;
+        g = stat_per_translation(tbs, code.num_guest_inst);
+        ops = stat_per_translation(tbs, code.num_tcg_ops);
+        ops_opt = stat_per_translation(tbs, code.num_tcg_ops_opt);
+        spills = stat_per_translation(tbs, code.spills);
+
+        g_string_printf(func_name,
+                "TB virt:0x"TARGET_FMT_lx" (g:%u op:%u opt:%u spills:%d)%c",
+                tb->pc, g, ops, ops_opt, spills, '\0');
+    } else {
+        g_string_printf(func_name, "TB virt:0x"TARGET_FMT_lx"%c", tb->pc, '\0');
+    }
 
     struct jr_code_load *load_event = g_new0(struct jr_code_load, 1);
     load_event->p.id = JIT_CODE_LOAD;