@@ -7,6 +7,7 @@ use crate::error::Result;
77/// Key metrics extracted from a single run's JSON result.
88struct RunMetrics {
99 request_throughput : f64 ,
10+ input_sequence_throughput : Option < f64 > ,
1011 output_throughput : f64 ,
1112 total_token_throughput : f64 ,
1213 mean_ttft_ms : f64 ,
@@ -38,6 +39,7 @@ impl RunMetrics {
3839 fn from_json ( json : & serde_json:: Value ) -> Self {
3940 Self {
4041 request_throughput : get ( json, "request_throughput" ) ,
42+ input_sequence_throughput : get_opt ( json, "input_sequence_throughput" ) ,
4143 output_throughput : get ( json, "output_throughput" ) ,
4244 total_token_throughput : get ( json, "total_token_throughput" ) ,
4345 mean_ttft_ms : get ( json, "mean_ttft_ms" ) ,
@@ -71,6 +73,10 @@ fn get(json: &serde_json::Value, key: &str) -> f64 {
7173 json. get ( key) . and_then ( |v| v. as_f64 ( ) ) . unwrap_or ( 0.0 )
7274}
7375
76+ fn get_opt ( json : & serde_json:: Value , key : & str ) -> Option < f64 > {
77+ json. get ( key) . and_then ( |v| v. as_f64 ( ) )
78+ }
79+
7480fn get_ss_opt ( json : & serde_json:: Value , key : & str ) -> Option < f64 > {
7581 json. get ( "steady_state" )
7682 . and_then ( |ss| if ss. is_null ( ) { None } else { Some ( ss) } )
@@ -119,8 +125,15 @@ fn print_multi_run_summary(runs: &[RunMetrics]) {
119125 let n = runs. len ( ) ;
120126
121127 // Collect each metric into a series, compute stats
122- let stats = vec ! [
123- compute_stats( "Request throughput (req/s)" , runs, |r| r. request_throughput) ,
128+ let mut stats = vec ! [ compute_stats( "Request throughput (req/s)" , runs, |r| {
129+ r. request_throughput
130+ } ) ] ;
131+ if runs. iter ( ) . all ( |r| r. input_sequence_throughput . is_some ( ) ) {
132+ stats. push ( compute_stats ( "Input throughput (inputs/s)" , runs, |r| {
133+ r. input_sequence_throughput . unwrap_or_default ( )
134+ } ) ) ;
135+ }
136+ stats. extend ( [
124137 compute_stats ( "Output throughput (tok/s)" , runs, |r| r. output_throughput ) ,
125138 compute_stats ( "Total token throughput (tok/s)" , runs, |r| {
126139 r. total_token_throughput
@@ -138,7 +151,7 @@ fn print_multi_run_summary(runs: &[RunMetrics]) {
138151 compute_stats ( "Completed requests" , runs, |r| r. completed ) ,
139152 compute_stats ( "Failed requests" , runs, |r| r. failed ) ,
140153 compute_stats ( "Duration (s)" , runs, |r| r. duration ) ,
141- ] ;
154+ ] ) ;
142155
143156 println ! ( "{:=^80}" , format!( " Multi-Run Summary ({n} runs) " ) ) ;
144157 println ! (
@@ -307,6 +320,7 @@ mod tests {
307320 fn mk_run ( ss : Option < f64 > ) -> RunMetrics {
308321 RunMetrics {
309322 request_throughput : 0.0 ,
323+ input_sequence_throughput : None ,
310324 output_throughput : 0.0 ,
311325 total_token_throughput : 0.0 ,
312326 mean_ttft_ms : 0.0 ,
0 commit comments