[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 2/2] new monitor command: info iostats
From: |
Glauber Costa |
Subject: |
[Qemu-devel] [PATCH 2/2] new monitor command: info iostats |
Date: |
Fri, 24 Oct 2008 13:55:16 -0200 |
This command provides per-cpu statistics on I/O that
has taken place in this cpu since the last time the command
was issued. We track reads and writes for pio and mmio.
Signed-off-by: Glauber Costa <address@hidden>
---
monitor.c | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/monitor.c b/monitor.c
index f0a0bc3..f70dfe9 100644
--- a/monitor.c
+++ b/monitor.c
@@ -291,6 +291,27 @@ static CPUState *mon_get_cpu(void)
return mon_cpu;
}
+static void do_info_iostats(void)
+{
+ uint32_t total_mmio = 0;
+ uint32_t total_pio = 0;
+ CPUState *env;
+
+ mon_get_cpu();
+
+ for(env = first_cpu; env != NULL; env = env->next_cpu) {
+ term_printf("CPU%d: pio_read=%d pio_write=%d mmio_read=%d
mmio_write=%d\n",
+ env->cpu_index, env->pio_read_count, env->pio_write_count,
+ env->mmio_read_count, env->mmio_write_count);
+ total_mmio += env->mmio_read_count + env->mmio_write_count;
+ env->mmio_read_count = env->mmio_write_count = 0;
+ total_pio += env->pio_read_count + env->pio_write_count;
+ env->pio_read_count = env->pio_write_count = 0;
+ }
+ term_printf("total: pio=%d mmio=%d\n", total_pio, total_mmio);
+}
+
+
static void do_info_registers(void)
{
CPUState *env;
@@ -1473,6 +1494,8 @@ static const term_cmd_t info_cmds[] = {
"", "show the block devices" },
{ "blockstats", "", do_info_blockstats,
"", "show block device statistics" },
+ { "iostats", "", do_info_iostats,
+ "", "show I/O statistics"},
{ "registers", "", do_info_registers,
"", "show the cpu registers" },
{ "cpus", "", do_info_cpus,
--
1.5.5.1