From f11f57e405a99732ed0f3294904c2dd258d77629 Mon Sep 17 00:00:00 2001 From: Luiz Capitulino Date: Thu, 22 Sep 2011 15:56:36 -0300 Subject: qapi: Convert query-blockstats Signed-off-by: Anthony Liguori Signed-off-by: Luiz Capitulino --- hmp.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'hmp.c') diff --git a/hmp.c b/hmp.c index 5912250d04..eab2ddfce9 100644 --- a/hmp.c +++ b/hmp.c @@ -226,6 +226,40 @@ void hmp_info_block(Monitor *mon) qapi_free_BlockInfoList(block_list); } +void hmp_info_blockstats(Monitor *mon) +{ + BlockStatsList *stats_list, *stats; + + stats_list = qmp_query_blockstats(NULL); + + for (stats = stats_list; stats; stats = stats->next) { + if (!stats->value->has_device) { + continue; + } + + monitor_printf(mon, "%s:", stats->value->device); + monitor_printf(mon, " rd_bytes=%" PRId64 + " wr_bytes=%" PRId64 + " rd_operations=%" PRId64 + " wr_operations=%" PRId64 + " flush_operations=%" PRId64 + " wr_total_time_ns=%" PRId64 + " rd_total_time_ns=%" PRId64 + " flush_total_time_ns=%" PRId64 + "\n", + stats->value->stats->rd_bytes, + stats->value->stats->wr_bytes, + stats->value->stats->rd_operations, + stats->value->stats->wr_operations, + stats->value->stats->flush_operations, + stats->value->stats->wr_total_time_ns, + stats->value->stats->rd_total_time_ns, + stats->value->stats->flush_total_time_ns); + } + + qapi_free_BlockStatsList(stats_list); +} + void hmp_quit(Monitor *mon, const QDict *qdict) { monitor_suspend(mon); -- cgit v1.2.1