On 15/7/25 15:18, Richard Henderson wrote:
On 7/15/25 07:06, Philippe Mathieu-Daudé wrote:
On 15/7/25 14:48, Richard Henderson wrote:
On 7/15/25 04:40, Philippe Mathieu-Daudé wrote:
Signed-off-by: Philippe Mathieu-Daudé <phi...@linaro.org>
Reviewed-by: Richard Henderson <richard.hender...@linaro.org>
---
accel/tcg/tcg-all.c | 6 ++++++
1 file changed, 6 insertions(+)
Oh, this is what causes tcg-stats to be used by user-only binaries,
is it?
Indeed, otherwise we'd have to use #ifdef'ry or stubs; and there is
no good reason to not dump TCG stats on user emulation (except indeed
this code path is currently unreachable there).
Ok, that's fine. Let's avoid the ifdefs.
This works for Linux (qemu-foo -d stats.log ...):
-- >8 --
diff --git a/linux-user/exit.c b/linux-user/exit.c
index 1ff8fe4f072..3e304422502 100644
--- a/linux-user/exit.c
+++ b/linux-user/exit.c
@@ -21,7 +21,10 @@
#include "gdbstub/syscalls.h"
#include "qemu.h"
#include "user-internals.h"
+#include "qemu/accel.h"
+#include "qemu/log.h"
#include "qemu/plugin.h"
+#include "accel/tcg/internal-common.h"
#ifdef CONFIG_GCOV
extern void __gcov_dump(void);
@@ -29,10 +32,14 @@ extern void __gcov_dump(void);
void preexit_cleanup(CPUArchState *env, int code)
{
+ g_autoptr(GString) buf = g_string_new("");
+
#ifdef CONFIG_GCOV
__gcov_dump();
#endif
gdb_exit(code);
qemu_plugin_user_exit();
perf_exit();
+ tcg_dump_stats(current_accel(), buf);
+ qemu_log("TCG stats: %s", buf->str);
}
---