PPC: use device info for CPU statistics
RFC PATCH 5/5 PPC: use device info for CPU statistics
Signed-off-by Blue Swirl <[email protected]>
--- cpu-all.h | 3 --- monitor.c | 15 --------------- qemu-monitor.hx | 2 -- target-ppc/cpu.h | 2 ++ target-ppc/helper.c | 1 + target-ppc/translate.c | 40 ++++++++++++++++++++++++---------------- 6 files changed, 27 insertions(+), 36 deletions(-)
cpu-all.h +0 -3
@@ -752,9 +752,6 @@ CPUState *qemu_get_cpu(int cpu);void cpu_dump_state (CPUState *env,FILE *f,int (*cpu_fprintf)(FILE *f,const char *fmt, ...),int flags); -void cpu_dump_statistics (CPUState *env,FILE *f, -int (*cpu_fprintf)(FILE *f,const char *fmt, ...), -int flags); void QEMU_NORETURN cpu_abort(CPUState *env, const char *fmt, ...) __attribute__ ((__format__ (__printf__,2 ,3 )));
monitor.c +0 -15
@@ -408,17 +408,6 @@ static void do_info_history(Monitor *mon) } } -#if defined(TARGET_PPC ) -/* XXX: not implemented in other targets */ -static void do_info_cpu_stats (Monitor *mon) -{ -CPUState *env; - - env =mon_get_cpu (); -cpu_dump_statistics (env, (FILE *)mon, &monitor_fprintf,0 ); -} -#endif -static void do_quit (Monitor *mon) {exit (0 );
@@ -1827,10 +1816,6 @@ static const mon_cmd_t info_cmds[] = { "", "show the current VM name" }, { "uuid", "", do_info_uuid, "", "show the current VM UUID" }, -#if defined(TARGET_PPC) - { "cpustats", "", do_info_cpu_stats, - "", "show CPU statistics", }, -#endif #if defined(CONFIG_SLIRP) { "usernet", "", do_info_usernet, "", "show user network stack connection states", },
qemu-monitor.hx +0 -2
@@ -73,8 +73,6 @@ show the vnc server status show the current VM name @item info uuid show the current VM UUID -@item info cpustats -show CPU statistics @item info usernet show user network stack connection states @item info migrate
target-ppc/cpu.h +0 -0
@@ -827,6 +827,8 @@ static inline void cpu_clone_regs(CPUState *env,
target_ulong newsp)
}
#endif
+void register_stats_handler(const char *name, CPUState *env1); +
#include "cpu-all.h"
#include "exec-all.h"
target-ppc/helper.c +1 -0
@@ -2812,6 +2812,7 @@ CPUPPCState *cpu_ppc_init (const char *cpu_model) env->cpu_model_str = cpu_model;cpu_ppc_register_internal (env, def);cpu_ppc_reset (env); +register_stats_handler (cpu_model, env);qemu_init_vcpu (env);
target-ppc/translate.c +24 -16
@@ -28,6 +28,7 @@#include "tcg-op.h" #include "qemu-common.h" #include "host-utils.h" +#include "monitor.h" #include "helper.h" #define GEN_HELPER 1
@@ -39,7 +40,7 @@/* Include definitions for instructions classes and implementations flags */ //#define PPC_DEBUG_DISAS -//#define DO_PPC_STATISTICS +#define DO_PPC_STATISTICS #ifdef PPC_DEBUG_DISAS # define LOG_DISAS (...) qemu_log_mask(CPU_LOG_TB_IN_ASM, ## __VA_ARGS__)
@@ -8898,11 +8899,10 @@ void cpu_dump_state (CPUState *env, FILE *f,#undef RFPL } -void cpu_dump_statistics (CPUState *env,FILE *f, -int (*cpu_fprintf)(FILE *f,const char *fmt, ...), -int flags) +static void cpu_dump_statistics (Monitor *mon,void *opaque) {#if defined(DO_PPC_STATISTICS ) +CPUState *env = opaque;opc_handler_t **t1, **t2, **t3, *handler;int op1, op2, op3;
@@ -8919,32 +8919,40 @@ void cpu_dump_statistics (CPUState *env, FILE*f, handler = t3[op3];if (handler->count ==0 )continue ; -cpu_fprintf (f,"%02x %02x %02x (%02x %04d) %16s: " -"%016llx %lld\n" , - op1, op2, op3, op1, (op3 <<5 ) | op2, - handler->oname, - handler->count, handler->count); +monitor_printf (mon,"%02x %02x %02x (%02x %04d) %16s: " +"%016" PRIx64" %" PRId64"\n" , + op1, op2, op3, op1, (op3 <<5 ) | op2, + handler->oname, + handler->count, handler->count); } }else {if (handler->count ==0 )continue ; -cpu_fprintf (f,"%02x %02x (%02x %04d) %16s: " -"%016llx %lld\n" , - op1, op2, op1, op2, handler->oname, - handler->count, handler->count); +monitor_printf (mon,"%02x %02x (%02x %04d) %16s: " +"%016" PRIx64" %" PRId64"\n" , + op1, op2, op1, op2, handler->oname, + handler->count, handler->count); } } }else {if (handler->count ==0 )continue ; -cpu_fprintf (f,"%02x (%02x ) %16s: %016llx %lld\n" , - op1, op1, handler->oname, - handler->count, handler->count); +monitor_printf (mon,"%02x (%02x ) %16s: %016" PRIx64 +" %" PRId64"\n" , + op1, op1, handler->oname, + handler->count, handler->count); } } +#else +monitor_printf (mon,"CPU statistics not compiled\n" );#endif } +void register_stats_handler (const char *name,CPUState *env1) +{ +monitor_register_device_info (name, cpu_dump_statistics, env1); +} +/*****************************************************************************/ static inline void gen_intermediate_code_internal(CPUState *env, TranslationBlock *tb,
Signature · 1 line
1.6.2.4
From 432f227eb4c59170b0d71b8d91c47f8a6d2ab794 Mon Sep 17 00:00:00 2001
From: Blue Swirl <[email protected]>
Date: Sat, 29 Aug 2009 14:02:08 +0000
Subject: [PATCH] PPC: use device info for CPU statistics
Signed-off-by Blue Swirl <[email protected]>
--- cpu-all.h | 3 --- monitor.c | 15 --------------- qemu-monitor.hx | 2 -- target-ppc/cpu.h | 2 ++ target-ppc/helper.c | 1 + target-ppc/translate.c | 40 ++++++++++++++++++++++++---------------- 6 files changed, 27 insertions(+), 36 deletions(-)
cpu-all.h +0 -3
@@ -752,9 +752,6 @@ CPUState *qemu_get_cpu(int cpu);void cpu_dump_state (CPUState *env,FILE *f,int (*cpu_fprintf)(FILE *f,const char *fmt, ...),int flags); -void cpu_dump_statistics (CPUState *env,FILE *f, -int (*cpu_fprintf)(FILE *f,const char *fmt, ...), -int flags); void QEMU_NORETURN cpu_abort(CPUState *env, const char *fmt, ...) __attribute__ ((__format__ (__printf__,2 ,3 )));
monitor.c +0 -15
@@ -408,17 +408,6 @@ static void do_info_history(Monitor *mon) } } -#if defined(TARGET_PPC ) -/* XXX: not implemented in other targets */ -static void do_info_cpu_stats (Monitor *mon) -{ -CPUState *env; - - env =mon_get_cpu (); -cpu_dump_statistics (env, (FILE *)mon, &monitor_fprintf,0 ); -} -#endif -static void do_quit (Monitor *mon) {exit (0 );
@@ -1827,10 +1816,6 @@ static const mon_cmd_t info_cmds[] = { "", "show the current VM name" }, { "uuid", "", do_info_uuid, "", "show the current VM UUID" }, -#if defined(TARGET_PPC) - { "cpustats", "", do_info_cpu_stats, - "", "show CPU statistics", }, -#endif #if defined(CONFIG_SLIRP) { "usernet", "", do_info_usernet, "", "show user network stack connection states", },
qemu-monitor.hx +0 -2
@@ -73,8 +73,6 @@ show the vnc server status show the current VM name @item info uuid show the current VM UUID -@item info cpustats -show CPU statistics @item info usernet show user network stack connection states @item info migrate
target-ppc/cpu.h +2 -0
@@ -827,6 +827,8 @@ static inline void cpu_clone_regs(CPUState *env, target_ulong newsp) }#endif +void register_stats_handler (const char *name,CPUState *env1); +#include "cpu-all.h" #include "exec-all.h"
target-ppc/helper.c +1 -0
@@ -2812,6 +2812,7 @@ CPUPPCState *cpu_ppc_init (const char *cpu_model) env->cpu_model_str = cpu_model;cpu_ppc_register_internal (env, def);cpu_ppc_reset (env); +register_stats_handler (cpu_model, env);qemu_init_vcpu (env);
target-ppc/translate.c +24 -16
@@ -28,6 +28,7 @@#include "tcg-op.h" #include "qemu-common.h" #include "host-utils.h" +#include "monitor.h" #include "helper.h" #define GEN_HELPER 1
@@ -39,7 +40,7 @@/* Include definitions for instructions classes and implementations flags */ //#define PPC_DEBUG_DISAS -//#define DO_PPC_STATISTICS +#define DO_PPC_STATISTICS #ifdef PPC_DEBUG_DISAS # define LOG_DISAS (...) qemu_log_mask(CPU_LOG_TB_IN_ASM, ## __VA_ARGS__)
@@ -8898,11 +8899,10 @@ void cpu_dump_state (CPUState *env, FILE *f,#undef RFPL } -void cpu_dump_statistics (CPUState *env,FILE *f, -int (*cpu_fprintf)(FILE *f,const char *fmt, ...), -int flags) +static void cpu_dump_statistics (Monitor *mon,void *opaque) {#if defined(DO_PPC_STATISTICS ) +CPUState *env = opaque;opc_handler_t **t1, **t2, **t3, *handler;int op1, op2, op3;
@@ -8919,32 +8919,40 @@ void cpu_dump_statistics (CPUState *env, FILE*f, handler = t3[op3];if (handler->count ==0 )continue ; -cpu_fprintf (f,"%02x %02x %02x (%02x %04d) %16s: " -"%016llx %lld\n" , - op1, op2, op3, op1, (op3 <<5 ) | op2, - handler->oname, - handler->count, handler->count); +monitor_printf (mon,"%02x %02x %02x (%02x %04d) %16s: " +"%016" PRIx64" %" PRId64"\n" , + op1, op2, op3, op1, (op3 <<5 ) | op2, + handler->oname, + handler->count, handler->count); } }else {if (handler->count ==0 )continue ; -cpu_fprintf (f,"%02x %02x (%02x %04d) %16s: " -"%016llx %lld\n" , - op1, op2, op1, op2, handler->oname, - handler->count, handler->count); +monitor_printf (mon,"%02x %02x (%02x %04d) %16s: " +"%016" PRIx64" %" PRId64"\n" , + op1, op2, op1, op2, handler->oname, + handler->count, handler->count); } } }else {if (handler->count ==0 )continue ; -cpu_fprintf (f,"%02x (%02x ) %16s: %016llx %lld\n" , - op1, op1, handler->oname, - handler->count, handler->count); +monitor_printf (mon,"%02x (%02x ) %16s: %016" PRIx64 +" %" PRId64"\n" , + op1, op1, handler->oname, + handler->count, handler->count); } } +#else +monitor_printf (mon,"CPU statistics not compiled\n" );#endif } +void register_stats_handler (const char *name,CPUState *env1) +{ +monitor_register_device_info (name, cpu_dump_statistics, env1); +} +/*****************************************************************************/ static inline void gen_intermediate_code_internal(CPUState *env, TranslationBlock *tb,
Signature · 1 line
1.5.6.5