From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KtNBZ-0001ST-B8 for qemu-devel@nongnu.org; Fri, 24 Oct 2008 09:58:41 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KtNBX-0001Qm-S1 for qemu-devel@nongnu.org; Fri, 24 Oct 2008 09:58:40 -0400 Received: from [199.232.76.173] (port=54882 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KtNBX-0001QO-4o for qemu-devel@nongnu.org; Fri, 24 Oct 2008 09:58:39 -0400 Received: from mx2.redhat.com ([66.187.237.31]:48995) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KtNBW-0003aY-Rb for qemu-devel@nongnu.org; Fri, 24 Oct 2008 09:58:39 -0400 From: Glauber Costa Date: Fri, 24 Oct 2008 13:55:16 -0200 Message-Id: <1224863716-23793-3-git-send-email-glommer@redhat.com> In-Reply-To: <1224863716-23793-1-git-send-email-glommer@redhat.com> References: <1224863716-23793-1-git-send-email-glommer@redhat.com> Subject: [Qemu-devel] [PATCH 2/2] new monitor command: info iostats Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aliguori@us.ibm.com, avi@redhat.com 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 --- 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