Am 25.08.2011 08:26, schrieb Christoph Hellwig: > Account the total latency for read/write/flush requests. This allows > management tools to average it based on a snapshot of the nr ops > counters and allow checking for SLAs or provide statistics. > > Signed-off-by: Christoph Hellwig <h...@lst.de> > > Index: qemu/block.c > =================================================================== > --- qemu.orig/block.c 2011-08-25 08:01:12.000000000 +0200 > +++ qemu/block.c 2011-08-25 08:03:02.908005646 +0200 > @@ -1889,12 +1889,18 @@ static void bdrv_stats_iter(QObject *dat > " 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", > qdict_get_int(qdict, "rd_bytes"), > qdict_get_int(qdict, "wr_bytes"), > qdict_get_int(qdict, "rd_operations"), > qdict_get_int(qdict, "wr_operations"), > - qdict_get_int(qdict, "flush_operations")); > + qdict_get_int(qdict, "flush_operations"), > + qdict_get_int(qdict, "wr_total_time_ns"), > + qdict_get_int(qdict, "rd_total_time_ns"), > + qdict_get_int(qdict, "flush_total_time_ns")); > } > > void bdrv_stats_print(Monitor *mon, const QObject *data) > @@ -1913,7 +1919,10 @@ static QObject* bdrv_info_stats_bs(Block > "'rd_operations': %" PRId64 "," > "'wr_operations': %" PRId64 "," > "'wr_highest_offset': %" PRId64 "," > - "'flush_operations': %" PRId64 > + "'flush_operations': %" PRId64 "," > + "'wr_total_time_ns': %" PRId64 "," > + "'rd_total_time_ns': %" PRId64 "," > + "'flush_total_time_ns': %" PRId64 > "} }", > bs->nr_bytes[BDRV_ACCT_READ], > bs->nr_bytes[BDRV_ACCT_WRITE], > @@ -1921,7 +1930,10 @@ static QObject* bdrv_info_stats_bs(Block > bs->nr_ops[BDRV_ACCT_WRITE], > bs->wr_highest_sector * > (uint64_t)BDRV_SECTOR_SIZE, > - bs->nr_ops[BDRV_ACCT_FLUSH]); > + bs->nr_ops[BDRV_ACCT_FLUSH], > + bs->total_time_ns[BDRV_ACCT_READ], > + bs->total_time_ns[BDRV_ACCT_WRITE], > + bs->total_time_ns[BDRV_ACCT_FLUSH]);
The order of READ vs. WRITE is wrong here, so read latencies show up as wr_total_time. I can fix it locally if you agree that swapping the two lines is the right fix. Kevin