From: Glauber Costa <glommer@redhat.com>
To: qemu-devel@nongnu.org
Cc: aliguori@us.ibm.com, avi@redhat.com
Subject: [Qemu-devel] [PATCH 2/2] new monitor command: info iostats
Date: Fri, 24 Oct 2008 13:55:16 -0200 [thread overview]
Message-ID: <1224863716-23793-3-git-send-email-glommer@redhat.com> (raw)
In-Reply-To: <1224863716-23793-1-git-send-email-glommer@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 <glommer@redhat.com>
---
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
next prev parent reply other threads:[~2008-10-24 13:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-24 15:55 [Qemu-devel] [PATCH 0/2] Add generic infrastructure to trace I/O Glauber Costa
2008-10-24 15:55 ` [Qemu-devel] [PATCH 1/2] trace io operations Glauber Costa
2008-10-26 13:25 ` [Qemu-devel] " Avi Kivity
2008-10-24 15:55 ` Glauber Costa [this message]
2008-10-26 13:24 ` [Qemu-devel] Re: [PATCH 2/2] new monitor command: info iostats Avi Kivity
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1224863716-23793-3-git-send-email-glommer@redhat.com \
--to=glommer@redhat.com \
--cc=aliguori@us.ibm.com \
--cc=avi@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).