diff mbox series

[v2] This makes it easier to figure out whether a particular instruction was actually translated.

Message ID FITkUaiC5DeyCU3e1T6EisgkkQ8Fnrwf2WZTBGE@cp4-web-031.plabs.ch
State New
Headers show
Series [v2] This makes it easier to figure out whether a particular instruction was actually translated. | expand

Commit Message

Nathan Ringo May 7, 2021, 10:48 p.m. UTC
Signed-off-by: Nathan Ringo <nathan@remexre.xyz>
---
 accel/tcg/trace-events    | 2 +-
 accel/tcg/translate-all.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Richard Henderson May 7, 2021, 11:24 p.m. UTC | #1
On 5/7/21 3:48 PM, Nathan Ringo wrote:
> -    trace_translate_block(tb, tb->pc, tb->tc.ptr);
> +    trace_translate_block(tb, tb->pc, (int)tb->icount, tb->tc.ptr);

What target are you looking at, because for the variable-length isa's, 
instruction count may not really help.  Perhaps tb->size instead?


r~
Nathan Ringo May 9, 2021, 1:57 a.m. UTC | #2
I'm mostly looking at AArch64, so they're the same there :) I'm using
this to collect code coverage information, so I have the disassembly,
and it's slightly easier to report it that way; if you think it'd be
more useful on other architectures to report the byte range instead,
it'd be an easy change to my scripts.

Also, noticed I accidentally deleted the first line of the commit
message when I updated the patch... I can fix that if you want me to
switch the size metric.
Alex Bennée May 9, 2021, 6:15 p.m. UTC | #3
Nathan Ringo <nathan@remexre.xyz> writes:

> I'm mostly looking at AArch64, so they're the same there :) I'm using
> this to collect code coverage information, so I have the disassembly,
> and it's slightly easier to report it that way;

Have you considered collecting this information with TCG plugins? That
way you can instrument what was actually instrumented directly.

> if you think it'd be
> more useful on other architectures to report the byte range instead,
> it'd be an easy change to my scripts.
>
> Also, noticed I accidentally deleted the first line of the commit
> message when I updated the patch... I can fix that if you want me to
> switch the size metric.
diff mbox series

Patch

diff --git a/accel/tcg/trace-events b/accel/tcg/trace-events
index 6eefb37f5d..c227e56248 100644
--- a/accel/tcg/trace-events
+++ b/accel/tcg/trace-events
@@ -7,4 +7,4 @@  exec_tb_nocache(void *tb, uintptr_t pc) "tb:%p pc=0x%"PRIxPTR
 exec_tb_exit(void *last_tb, unsigned int flags) "tb:%p flags=0x%x"
 
 # translate-all.c
-translate_block(void *tb, uintptr_t pc, const void *tb_code) "tb:%p, pc:0x%"PRIxPTR", tb_code:%p"
+translate_block(void *tb, uintptr_t pc, int num_insns, const void *tb_code) "tb:%p, pc:0x%"PRIxPTR", num_insns:%d, tb_code:%p"
diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
index b12d0898d0..2c70eec777 100644
--- a/accel/tcg/translate-all.c
+++ b/accel/tcg/translate-all.c
@@ -1916,7 +1916,7 @@  TranslationBlock *tb_gen_code(CPUState *cpu,
     tcg_ctx->cpu = NULL;
     max_insns = tb->icount;
 
-    trace_translate_block(tb, tb->pc, tb->tc.ptr);
+    trace_translate_block(tb, tb->pc, (int)tb->icount, tb->tc.ptr);
 
     /* generate machine code */
     tb->jmp_reset_offset[0] = TB_JMP_RESET_OFFSET_INVALID;