@@ -173,6 +173,7 @@ pub struct BlockControl {
173173pub struct PerformanceTestControl {
174174 test_timeout : u32 ,
175175 test_iterations : u32 ,
176+ warmup_iterations : u32 ,
176177 num_queues : Option < u32 > ,
177178 queue_size : Option < u32 > ,
178179 net_control : Option < ( bool , bool ) > , // First bool is for RX(true)/TX(false), second bool is for bandwidth or PPS
@@ -183,8 +184,8 @@ pub struct PerformanceTestControl {
183184impl fmt:: Display for PerformanceTestControl {
184185 fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
185186 let mut output = format ! (
186- "test_timeout = {}s, test_iterations = {}" ,
187- self . test_timeout, self . test_iterations
187+ "test_timeout = {}s, test_iterations = {}, warmup_iterations = {} " ,
188+ self . test_timeout, self . test_iterations, self . warmup_iterations
188189 ) ;
189190 if let Some ( o) = self . num_queues {
190191 output = format ! ( "{output}, num_queues = {o}" ) ;
@@ -212,6 +213,7 @@ impl PerformanceTestControl {
212213 Self {
213214 test_timeout : 10 ,
214215 test_iterations : 5 ,
216+ warmup_iterations : 0 ,
215217 num_queues : None ,
216218 queue_size : None ,
217219 net_control : None ,
@@ -233,6 +235,17 @@ struct PerformanceTest {
233235
234236impl PerformanceTest {
235237 pub fn run ( & self , overrides : & PerformanceTestOverrides ) -> PerformanceTestResult {
238+ // Run warmup iterations if configured (results discarded)
239+ for _ in 0 ..self . control . warmup_iterations {
240+ if let Some ( test_timeout) = overrides. test_timeout {
241+ let mut control: PerformanceTestControl = self . control . clone ( ) ;
242+ control. test_timeout = test_timeout;
243+ let _ = ( self . func_ptr ) ( & control) ;
244+ } else {
245+ let _ = ( self . func_ptr ) ( & self . control ) ;
246+ }
247+ }
248+
236249 let mut metrics = Vec :: new ( ) ;
237250 for _ in 0 ..overrides
238251 . test_iterations
@@ -265,8 +278,9 @@ impl PerformanceTest {
265278 // Calculate the timeout for each test
266279 // Note: To cover the setup/cleanup time, 20s is added for each iteration of the test
267280 pub fn calc_timeout ( & self , test_iterations : & Option < u32 > , test_timeout : & Option < u32 > ) -> u64 {
268- ( ( test_timeout. unwrap_or ( self . control . test_timeout ) + 20 )
269- * test_iterations. unwrap_or ( self . control . test_iterations ) ) as u64
281+ let total_iterations = test_iterations. unwrap_or ( self . control . test_iterations )
282+ + self . control . warmup_iterations ;
283+ ( ( test_timeout. unwrap_or ( self . control . test_timeout ) + 20 ) * total_iterations) as u64
270284 }
271285}
272286
@@ -319,7 +333,7 @@ mod adjuster {
319333 }
320334}
321335
322- const TEST_LIST : [ PerformanceTest ; 34 ] = [
336+ const TEST_LIST : [ PerformanceTest ; 36 ] = [
323337 PerformanceTest {
324338 name : "boot_time_ms" ,
325339 func_ptr : performance_boot_time,
@@ -770,6 +784,38 @@ const TEST_LIST: [PerformanceTest; 34] = [
770784 } ,
771785 unit_adjuster : adjuster:: Bps_to_MiBps ,
772786 } ,
787+ PerformanceTest {
788+ name : "block_qcow2_backing_qcow2_read_warm_MiBps" ,
789+ func_ptr : performance_block_io,
790+ control : PerformanceTestControl {
791+ num_queues : Some ( 1 ) ,
792+ queue_size : Some ( 128 ) ,
793+ warmup_iterations : 2 ,
794+ block_control : Some ( BlockControl {
795+ fio_ops : FioOps :: Read ,
796+ bandwidth : true ,
797+ test_file : OVERLAY_WITH_QCOW2_BACKING ,
798+ } ) ,
799+ ..PerformanceTestControl :: default ( )
800+ } ,
801+ unit_adjuster : adjuster:: Bps_to_MiBps ,
802+ } ,
803+ PerformanceTest {
804+ name : "block_qcow2_backing_raw_read_warm_MiBps" ,
805+ func_ptr : performance_block_io,
806+ control : PerformanceTestControl {
807+ num_queues : Some ( 1 ) ,
808+ queue_size : Some ( 128 ) ,
809+ warmup_iterations : 2 ,
810+ block_control : Some ( BlockControl {
811+ fio_ops : FioOps :: Read ,
812+ bandwidth : true ,
813+ test_file : OVERLAY_WITH_RAW_BACKING ,
814+ } ) ,
815+ ..PerformanceTestControl :: default ( )
816+ } ,
817+ unit_adjuster : adjuster:: Bps_to_MiBps ,
818+ } ,
773819] ;
774820
775821fn run_test_with_timeout (
0 commit comments