File tree Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -129,6 +129,7 @@ impl RunOpt {
129129 self . register_hits ( & ctx) . await ?;
130130
131131 let iterations = self . common . iterations ;
132+ let mut millis = Vec :: with_capacity ( iterations) ;
132133 let mut benchmark_run = BenchmarkRun :: new ( ) ;
133134 for query_id in query_range {
134135 benchmark_run. start_new_case ( & format ! ( "Query {query_id}" ) ) ;
@@ -140,6 +141,7 @@ impl RunOpt {
140141 let results = ctx. sql ( sql) . await ?. collect ( ) . await ?;
141142 let elapsed = start. elapsed ( ) ;
142143 let ms = elapsed. as_secs_f64 ( ) * 1000.0 ;
144+ millis. push ( ms) ;
143145 let row_count: usize = results. iter ( ) . map ( |b| b. num_rows ( ) ) . sum ( ) ;
144146 println ! (
145147 "Query {query_id} iteration {i} took {ms:.1} ms and returned {row_count} rows"
@@ -149,6 +151,8 @@ impl RunOpt {
149151 if self . common . debug {
150152 ctx. sql ( sql) . await ?. explain ( false , false ) ?. show ( ) . await ?;
151153 }
154+ let avg = millis. iter ( ) . sum :: < f64 > ( ) / millis. len ( ) as f64 ;
155+ println ! ( "Query {query_id} avg time: {avg:.2} ms" ) ;
152156 }
153157 benchmark_run. maybe_write_json ( self . output_path . as_ref ( ) ) ?;
154158 Ok ( ( ) )
You can’t perform that action at this time.
0 commit comments