qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] tcg: add separate monitor command to dump opcode counters
@ 2014-11-02 20:28 Max Filippov
  2014-11-04 15:02 ` Richard Henderson
  2014-11-04 15:27 ` Alex Bennée
  0 siblings, 2 replies; 3+ messages in thread
From: Max Filippov @ 2014-11-02 20:28 UTC (permalink / raw)
  To: qemu-devel; +Cc: Max Filippov, Richard Henderson

Currently 'info jit' outputs half of the information to monitor and the
rest to qemu log. Dumping opcode counts to monitor as a part of 'info
jit' command doesn't sound useful. Add new monitor command 'info
opcount' that only dumps opcode counters.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
 include/exec/cpu-all.h |  1 +
 monitor.c              | 12 ++++++++++++
 tcg/tcg.c              | 12 ++++++++----
 tcg/tcg.h              |  1 +
 translate-all.c        |  5 +++++
 5 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h
index c085804..f02f96f 100644
--- a/include/exec/cpu-all.h
+++ b/include/exec/cpu-all.h
@@ -335,6 +335,7 @@ extern RAMList ram_list;
 #define TLB_MMIO        (1 << 5)
 
 void dump_exec_info(FILE *f, fprintf_function cpu_fprintf);
+void dump_opcount_info(FILE *f, fprintf_function cpu_fprintf);
 ram_addr_t last_ram_offset(void);
 void qemu_mutex_lock_ramlist(void);
 void qemu_mutex_unlock_ramlist(void);
diff --git a/monitor.c b/monitor.c
index 2d14f39..946f8fd 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1043,6 +1043,11 @@ static void do_info_jit(Monitor *mon, const QDict *qdict)
     dump_drift_info((FILE *)mon, monitor_fprintf);
 }
 
+static void do_info_opcount(Monitor *mon, const QDict *qdict)
+{
+    dump_opcount_info((FILE *)mon, monitor_fprintf);
+}
+
 static void do_info_history(Monitor *mon, const QDict *qdict)
 {
     int i;
@@ -2736,6 +2741,13 @@ static mon_cmd_t info_cmds[] = {
         .mhandler.cmd = do_info_jit,
     },
     {
+        .name       = "opcount",
+        .args_type  = "",
+        .params     = "",
+        .help       = "show dynamic compiler opcode counters",
+        .mhandler.cmd = do_info_opcount,
+    },
+    {
         .name       = "kvm",
         .args_type  = "",
         .params     = "",
diff --git a/tcg/tcg.c b/tcg/tcg.c
index 7a84b87..6ff8b51 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -2401,14 +2401,20 @@ static int tcg_reg_alloc_call(TCGContext *s, const TCGOpDef *def,
 
 static int64_t tcg_table_op_count[NB_OPS];
 
-static void dump_op_count(void)
+void tcg_dump_op_count(FILE *f, fprintf_function cpu_fprintf)
 {
     int i;
 
     for(i = INDEX_op_end; i < NB_OPS; i++) {
-        qemu_log("%s %" PRId64 "\n", tcg_op_defs[i].name, tcg_table_op_count[i]);
+        cpu_fprintf(f, "%s %" PRId64 "\n", tcg_op_defs[i].name,
+                    tcg_table_op_count[i]);
     }
 }
+#else
+void tcg_dump_op_count(FILE *f, fprintf_function cpu_fprintf)
+{
+    cpu_fprintf(f, "[TCG profiler not compiled]\n");
+}
 #endif
 
 
@@ -2620,8 +2626,6 @@ void tcg_dump_info(FILE *f, fprintf_function cpu_fprintf)
                 s->restore_count);
     cpu_fprintf(f, "  avg cycles        %0.1f\n",
                 s->restore_count ? (double)s->restore_time / s->restore_count : 0);
-
-    dump_op_count();
 }
 #else
 void tcg_dump_info(FILE *f, fprintf_function cpu_fprintf)
diff --git a/tcg/tcg.h b/tcg/tcg.h
index 7285f71..944b877 100644
--- a/tcg/tcg.h
+++ b/tcg/tcg.h
@@ -610,6 +610,7 @@ int tcg_check_temp_count(void);
 #endif
 
 void tcg_dump_info(FILE *f, fprintf_function cpu_fprintf);
+void tcg_dump_op_count(FILE *f, fprintf_function cpu_fprintf);
 
 #define TCG_CT_ALIAS  0x80
 #define TCG_CT_IALIAS 0x40
diff --git a/translate-all.c b/translate-all.c
index ba5c840..8ccd2ed 100644
--- a/translate-all.c
+++ b/translate-all.c
@@ -1645,6 +1645,11 @@ void dump_exec_info(FILE *f, fprintf_function cpu_fprintf)
     tcg_dump_info(f, cpu_fprintf);
 }
 
+void dump_opcount_info(FILE *f, fprintf_function cpu_fprintf)
+{
+    tcg_dump_op_count(f, cpu_fprintf);
+}
+
 #else /* CONFIG_USER_ONLY */
 
 void cpu_interrupt(CPUState *cpu, int mask)
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] tcg: add separate monitor command to dump opcode counters
  2014-11-02 20:28 [Qemu-devel] [PATCH] tcg: add separate monitor command to dump opcode counters Max Filippov
@ 2014-11-04 15:02 ` Richard Henderson
  2014-11-04 15:27 ` Alex Bennée
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Henderson @ 2014-11-04 15:02 UTC (permalink / raw)
  To: Max Filippov, qemu-devel

On 11/02/2014 09:28 PM, Max Filippov wrote:
> Currently 'info jit' outputs half of the information to monitor and the
> rest to qemu log. Dumping opcode counts to monitor as a part of 'info
> jit' command doesn't sound useful. Add new monitor command 'info
> opcount' that only dumps opcode counters.
> 
> Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
> ---
>  include/exec/cpu-all.h |  1 +
>  monitor.c              | 12 ++++++++++++
>  tcg/tcg.c              | 12 ++++++++----
>  tcg/tcg.h              |  1 +
>  translate-all.c        |  5 +++++
>  5 files changed, 27 insertions(+), 4 deletions(-)

Reviewed-by: Richard Henderson <rth@twiddle.net>


r~

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] tcg: add separate monitor command to dump opcode counters
  2014-11-02 20:28 [Qemu-devel] [PATCH] tcg: add separate monitor command to dump opcode counters Max Filippov
  2014-11-04 15:02 ` Richard Henderson
@ 2014-11-04 15:27 ` Alex Bennée
  1 sibling, 0 replies; 3+ messages in thread
From: Alex Bennée @ 2014-11-04 15:27 UTC (permalink / raw)
  To: Max Filippov; +Cc: qemu-devel, Richard Henderson


Max Filippov <jcmvbkbc@gmail.com> writes:

> Currently 'info jit' outputs half of the information to monitor and the
> rest to qemu log. Dumping opcode counts to monitor as a part of 'info
> jit' command doesn't sound useful. Add new monitor command 'info
> opcount' that only dumps opcode counters.
>
> Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>


> ---
>  include/exec/cpu-all.h |  1 +
>  monitor.c              | 12 ++++++++++++
>  tcg/tcg.c              | 12 ++++++++----
>  tcg/tcg.h              |  1 +
>  translate-all.c        |  5 +++++
>  5 files changed, 27 insertions(+), 4 deletions(-)
>
> diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h
> index c085804..f02f96f 100644
> --- a/include/exec/cpu-all.h
> +++ b/include/exec/cpu-all.h
> @@ -335,6 +335,7 @@ extern RAMList ram_list;
>  #define TLB_MMIO        (1 << 5)
>  
>  void dump_exec_info(FILE *f, fprintf_function cpu_fprintf);
> +void dump_opcount_info(FILE *f, fprintf_function cpu_fprintf);
>  ram_addr_t last_ram_offset(void);
>  void qemu_mutex_lock_ramlist(void);
>  void qemu_mutex_unlock_ramlist(void);
> diff --git a/monitor.c b/monitor.c
> index 2d14f39..946f8fd 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -1043,6 +1043,11 @@ static void do_info_jit(Monitor *mon, const QDict *qdict)
>      dump_drift_info((FILE *)mon, monitor_fprintf);
>  }
>  
> +static void do_info_opcount(Monitor *mon, const QDict *qdict)
> +{
> +    dump_opcount_info((FILE *)mon, monitor_fprintf);
> +}
> +
>  static void do_info_history(Monitor *mon, const QDict *qdict)
>  {
>      int i;
> @@ -2736,6 +2741,13 @@ static mon_cmd_t info_cmds[] = {
>          .mhandler.cmd = do_info_jit,
>      },
>      {
> +        .name       = "opcount",
> +        .args_type  = "",
> +        .params     = "",
> +        .help       = "show dynamic compiler opcode counters",
> +        .mhandler.cmd = do_info_opcount,
> +    },
> +    {
>          .name       = "kvm",
>          .args_type  = "",
>          .params     = "",
> diff --git a/tcg/tcg.c b/tcg/tcg.c
> index 7a84b87..6ff8b51 100644
> --- a/tcg/tcg.c
> +++ b/tcg/tcg.c
> @@ -2401,14 +2401,20 @@ static int tcg_reg_alloc_call(TCGContext *s, const TCGOpDef *def,
>  
>  static int64_t tcg_table_op_count[NB_OPS];
>  
> -static void dump_op_count(void)
> +void tcg_dump_op_count(FILE *f, fprintf_function cpu_fprintf)
>  {
>      int i;
>  
>      for(i = INDEX_op_end; i < NB_OPS; i++) {
> -        qemu_log("%s %" PRId64 "\n", tcg_op_defs[i].name, tcg_table_op_count[i]);
> +        cpu_fprintf(f, "%s %" PRId64 "\n", tcg_op_defs[i].name,
> +                    tcg_table_op_count[i]);
>      }
>  }
> +#else
> +void tcg_dump_op_count(FILE *f, fprintf_function cpu_fprintf)
> +{
> +    cpu_fprintf(f, "[TCG profiler not compiled]\n");
> +}
>  #endif
>  
>  
> @@ -2620,8 +2626,6 @@ void tcg_dump_info(FILE *f, fprintf_function cpu_fprintf)
>                  s->restore_count);
>      cpu_fprintf(f, "  avg cycles        %0.1f\n",
>                  s->restore_count ? (double)s->restore_time / s->restore_count : 0);
> -
> -    dump_op_count();
>  }
>  #else
>  void tcg_dump_info(FILE *f, fprintf_function cpu_fprintf)
> diff --git a/tcg/tcg.h b/tcg/tcg.h
> index 7285f71..944b877 100644
> --- a/tcg/tcg.h
> +++ b/tcg/tcg.h
> @@ -610,6 +610,7 @@ int tcg_check_temp_count(void);
>  #endif
>  
>  void tcg_dump_info(FILE *f, fprintf_function cpu_fprintf);
> +void tcg_dump_op_count(FILE *f, fprintf_function cpu_fprintf);
>  
>  #define TCG_CT_ALIAS  0x80
>  #define TCG_CT_IALIAS 0x40
> diff --git a/translate-all.c b/translate-all.c
> index ba5c840..8ccd2ed 100644
> --- a/translate-all.c
> +++ b/translate-all.c
> @@ -1645,6 +1645,11 @@ void dump_exec_info(FILE *f, fprintf_function cpu_fprintf)
>      tcg_dump_info(f, cpu_fprintf);
>  }
>  
> +void dump_opcount_info(FILE *f, fprintf_function cpu_fprintf)
> +{
> +    tcg_dump_op_count(f, cpu_fprintf);
> +}
> +
>  #else /* CONFIG_USER_ONLY */
>  
>  void cpu_interrupt(CPUState *cpu, int mask)

-- 
Alex Bennée

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-11-04 15:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-02 20:28 [Qemu-devel] [PATCH] tcg: add separate monitor command to dump opcode counters Max Filippov
2014-11-04 15:02 ` Richard Henderson
2014-11-04 15:27 ` Alex Bennée

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).