@@ -703,7 +703,7 @@ impl PerformanceBenchmarker {
703703 max_time : Duration :: from_millis ( 200 ) ,
704704 ops_per_second : user_count as f64 * 2.0 ,
705705 success_rate : 0.9 ,
706- error_count : ( user_count / 10 ) as u32 ,
706+ error_count : ( user_count / 10 ) ,
707707 resource_usage : self . capture_resource_usage ( ) . await ?,
708708 } ;
709709
@@ -772,11 +772,8 @@ impl PerformanceBenchmarker {
772772 let disk_write_bytes = 0 ; // Not easily available from sysinfo
773773
774774 let networks = Networks :: new_with_refreshed_list ( ) ;
775- let network_rx_bytes = networks. iter ( ) . map ( |( _, network) | network. received ( ) ) . sum ( ) ;
776- let network_tx_bytes = networks
777- . iter ( )
778- . map ( |( _, network) | network. transmitted ( ) )
779- . sum ( ) ;
775+ let network_rx_bytes = networks. values ( ) . map ( |network| network. received ( ) ) . sum ( ) ;
776+ let network_tx_bytes = networks. values ( ) . map ( |network| network. transmitted ( ) ) . sum ( ) ;
780777
781778 Ok ( ResourceUsage {
782779 cpu_percent,
@@ -867,18 +864,16 @@ impl PerformanceBenchmarker {
867864 } ) ;
868865 }
869866 }
870- "resource_monitoring_load" => {
871- if result. resource_usage . cpu_percent > self . config . slos . max_cpu_load_percent {
872- violations. push ( SLOViolation {
873- metric : "CPU usage during load" . to_string ( ) ,
874- actual_value : format ! ( "{:.1}%" , result. resource_usage. cpu_percent) ,
875- threshold_value : format ! (
876- "{:.1}%" ,
877- self . config. slos. max_cpu_load_percent
878- ) ,
879- severity : ViolationSeverity :: Warning ,
880- } ) ;
881- }
867+ "resource_monitoring_load"
868+ if result. resource_usage . cpu_percent
869+ > self . config . slos . max_cpu_load_percent =>
870+ {
871+ violations. push ( SLOViolation {
872+ metric : "CPU usage during load" . to_string ( ) ,
873+ actual_value : format ! ( "{:.1}%" , result. resource_usage. cpu_percent) ,
874+ threshold_value : format ! ( "{:.1}%" , self . config. slos. max_cpu_load_percent) ,
875+ severity : ViolationSeverity :: Warning ,
876+ } ) ;
882877 }
883878 _ => { } // Other operations don't have specific SLOs yet
884879 }
0 commit comments