mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
performance-metrics: Add sync drain completions helper
Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
This commit is contained in:
committed by
Rob Bradford
parent
ab1dddb62a
commit
97b109bc89
@@ -8,6 +8,7 @@ use std::io::{ErrorKind, Seek, SeekFrom, Write};
|
|||||||
use std::thread;
|
use std::thread;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
|
use block::async_io::AsyncIo;
|
||||||
use block::qcow::{QcowFile, RawFile};
|
use block::qcow::{QcowFile, RawFile};
|
||||||
use block::qcow_async::QcowDiskAsync;
|
use block::qcow_async::QcowDiskAsync;
|
||||||
use block::qcow_sync::QcowDiskSync;
|
use block::qcow_sync::QcowDiskSync;
|
||||||
@@ -65,6 +66,13 @@ pub fn qcow_async_tempfile(num_clusters: usize) -> (TempFile, QcowDiskAsync) {
|
|||||||
(tmp, disk)
|
(tmp, disk)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Drain `count` completions from a synchronous async_io backend.
|
||||||
|
pub fn drain_completions(async_io: &mut dyn AsyncIo, count: usize) {
|
||||||
|
for _ in 0..count {
|
||||||
|
async_io.next_completed_request();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// 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