mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
performance-metrics: Add submit_reads helper
Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
This commit is contained in:
committed by
Rob Bradford
parent
97b109bc89
commit
f8deeb8a1c
@@ -73,6 +73,15 @@ pub fn drain_completions(async_io: &mut dyn AsyncIo, count: usize) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Submit `count` sequential read_vectored calls at `stride`-byte intervals.
|
||||||
|
pub fn submit_reads(async_io: &mut dyn AsyncIo, count: usize, stride: u64, iovec: &[libc::iovec]) {
|
||||||
|
for i in 0..count {
|
||||||
|
async_io
|
||||||
|
.read_vectored((i as u64 * stride) as libc::off_t, iovec, i as u64)
|
||||||
|
.expect("read_vectored failed");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Spin and wait until the given eventfd becomes readable.
|
/// Spin and wait until the given eventfd becomes readable.
|
||||||
pub fn wait_for_eventfd(notifier: &EventFd) {
|
pub fn wait_for_eventfd(notifier: &EventFd) {
|
||||||
loop {
|
loop {
|
||||||
|
|||||||
Reference in New Issue
Block a user