[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PATCH v4 03/21] block: define 'clock_type' for the account
From: |
Alberto Garcia |
Subject: |
[Qemu-block] [PATCH v4 03/21] block: define 'clock_type' for the accounting code |
Date: |
Wed, 28 Oct 2015 17:33:00 +0200 |
Its value is still QEMU_CLOCK_REALTIME, but having it in a variable will
allow us to change its value easily in the future when running in qtest
mode.
Signed-off-by: Alberto Garcia <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
---
block/accounting.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/block/accounting.c b/block/accounting.c
index a423560..6f4c0f1 100644
--- a/block/accounting.c
+++ b/block/accounting.c
@@ -26,13 +26,15 @@
#include "block/block_int.h"
#include "qemu/timer.h"
+static QEMUClockType clock_type = QEMU_CLOCK_REALTIME;
+
void block_acct_start(BlockAcctStats *stats, BlockAcctCookie *cookie,
int64_t bytes, enum BlockAcctType type)
{
assert(type < BLOCK_MAX_IOTYPE);
cookie->bytes = bytes;
- cookie->start_time_ns = qemu_clock_get_ns(QEMU_CLOCK_REALTIME);
+ cookie->start_time_ns = qemu_clock_get_ns(clock_type);
cookie->type = type;
}
@@ -43,7 +45,7 @@ void block_acct_done(BlockAcctStats *stats, BlockAcctCookie
*cookie)
stats->nr_bytes[cookie->type] += cookie->bytes;
stats->nr_ops[cookie->type]++;
stats->total_time_ns[cookie->type] +=
- qemu_clock_get_ns(QEMU_CLOCK_REALTIME) - cookie->start_time_ns;
+ qemu_clock_get_ns(clock_type) - cookie->start_time_ns;
}
--
2.6.1
- [Qemu-block] [PATCH v4 00/21] Extended I/O accounting, Alberto Garcia, 2015/10/28
- [Qemu-block] [PATCH v4 02/21] ide: Account for write operations correctly, Alberto Garcia, 2015/10/28
- [Qemu-block] [PATCH v4 05/21] block: Add idle_time_ns to BlockDeviceStats, Alberto Garcia, 2015/10/28
- [Qemu-block] [PATCH v4 01/21] xen_disk: Account for flush operations, Alberto Garcia, 2015/10/28
- [Qemu-block] [PATCH v4 06/21] block: Add statistics for failed and invalid I/O operations, Alberto Garcia, 2015/10/28
- [Qemu-block] [PATCH v4 09/21] block: Add average I/O queue depth to BlockDeviceTimedStats, Alberto Garcia, 2015/10/28
- [Qemu-block] [PATCH v4 04/21] util: Infrastructure for computing recent averages, Alberto Garcia, 2015/10/28
- [Qemu-block] [PATCH v4 03/21] block: define 'clock_type' for the accounting code,
Alberto Garcia <=
- [Qemu-block] [PATCH v4 16/21] xen_disk: Account for failed and invalid operations, Alberto Garcia, 2015/10/28
- [Qemu-block] [PATCH v4 11/21] qemu-io: Account for failed, invalid and flush operations, Alberto Garcia, 2015/10/28
- [Qemu-block] [PATCH v4 07/21] block: Allow configuring whether to account failed and invalid ops, Alberto Garcia, 2015/10/28
- [Qemu-block] [PATCH v4 08/21] block: Compute minimum, maximum and average I/O latencies, Alberto Garcia, 2015/10/28
- [Qemu-block] [PATCH v4 21/21] block: Update copyright of the accounting code, Alberto Garcia, 2015/10/28
- [Qemu-block] [PATCH v4 18/21] ide: Account for failed and invalid operations, Alberto Garcia, 2015/10/28
- [Qemu-block] [PATCH v4 19/21] macio: Account for failed operations, Alberto Garcia, 2015/10/28
- [Qemu-block] [PATCH v4 13/21] iotests: Add test for the block device statistics, Alberto Garcia, 2015/10/28
- [Qemu-block] [PATCH v4 15/21] virtio-blk: Account for failed and invalid operations, Alberto Garcia, 2015/10/28
- [Qemu-block] [PATCH v4 20/21] scsi-disk: Account for failed operations, Alberto Garcia, 2015/10/28