14
14
15
15
use std:: collections:: hash_map:: Entry ;
16
16
use std:: collections:: HashMap ;
17
+ use std:: sync:: atomic:: Ordering ;
17
18
use std:: sync:: Arc ;
18
19
use std:: time:: SystemTime ;
19
20
@@ -72,6 +73,8 @@ impl BlockReader {
72
73
let column_leaves = ColumnLeaves :: new_from_schema ( & arrow_schema) ;
73
74
74
75
Ok ( Arc :: new ( BlockReader {
76
+ normal_all_cost : Arc :: new ( 0 . into ( ) ) ,
77
+ merge_all_cost : Arc :: new ( 0 . into ( ) ) ,
75
78
operator,
76
79
projection,
77
80
projected_schema,
@@ -301,7 +304,9 @@ impl BlockReader {
301
304
302
305
let now = SystemTime :: now ( ) ;
303
306
let res = futures:: future:: try_join_all ( join_handlers) . await ;
304
- let normal_cost = now. elapsed ( ) . unwrap ( ) . as_millis ( ) ;
307
+ let normal_cost = now. elapsed ( ) . unwrap ( ) . as_millis ( ) as u64 ;
308
+ self . normal_all_cost
309
+ . fetch_add ( normal_cost, Ordering :: Release ) ;
305
310
306
311
// Merge io requests.
307
312
let max_gap_size = ctx. get_settings ( ) . get_max_storage_io_requests_merge_gap ( ) ?;
@@ -321,21 +326,24 @@ impl BlockReader {
321
326
}
322
327
let now = SystemTime :: now ( ) ;
323
328
let _ = futures:: future:: try_join_all ( merge_io_handlers) . await ;
324
- let merge_cost = now. elapsed ( ) . unwrap ( ) . as_millis ( ) ;
329
+ let merge_cost = now. elapsed ( ) . unwrap ( ) . as_millis ( ) as u64 ;
330
+ self . merge_all_cost . fetch_add ( merge_cost, Ordering :: Release ) ;
325
331
326
332
info ! (
327
- "async read norma partition={}, count={}, bytes={}, took:{} ms" ,
333
+ "norma read partition={}, count={}, bytes={}, took:{} ms, all :{} ms" ,
328
334
part. location,
329
335
part. columns_meta. len( ) ,
330
336
normal_read_bytes,
331
337
normal_cost,
338
+ self . normal_all_cost. load( Ordering :: Acquire ) ,
332
339
) ;
333
340
info ! (
334
- "async read merge partition={}, count={}, bytes={}, took:{} ms" ,
341
+ "merge read partition={}, count={}, bytes={}, took:{} ms, all :{} ms" ,
335
342
part. location,
336
343
ranges. len( ) ,
337
344
merge_read_bytes,
338
345
merge_cost,
346
+ self . merge_all_cost. load( Ordering :: Acquire )
339
347
) ;
340
348
341
349
res
0 commit comments