File tree 1 file changed +3
-3
lines changed
1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 69
69
let worker_stats_shared_monitor = Arc :: clone ( & worker_stats_shared) ;
70
70
71
71
let handle_main_thread = thread:: spawn ( move || {
72
- let mut last_run = Instant :: now ( ) ;
72
+ let mut last_collect_time = Instant :: now ( ) ;
73
73
let mut current_time: Instant ;
74
74
let mut total_count_old: u64 = 0 ;
75
75
@@ -80,12 +80,13 @@ where
80
80
81
81
loop {
82
82
current_time = Instant :: now ( ) ;
83
- let elapsed = current_time. duration_since ( last_run ) . as_secs ( ) ; // Calculate the time elapsed (in seconds) since the last collect
83
+ let elapsed = current_time. duration_since ( last_collect_time ) . as_secs ( ) ;
84
84
if elapsed >= SLIDING_WINDOW_SIZE {
85
85
let total_count_u64: u64 = worker_stats_shared_monitor
86
86
. iter ( )
87
87
. map ( |worker_stat| worker_stat. count . load ( Ordering :: Relaxed ) )
88
88
. sum ( ) ;
89
+ last_collect_time = Instant :: now ( ) ;
89
90
let current_count = total_count_u64 - total_count_old;
90
91
total_count_old = total_count_u64;
91
92
let throughput = current_count / elapsed;
@@ -113,7 +114,6 @@ where
113
114
}
114
115
115
116
println ! ( "\n " ) ;
116
- last_run = Instant :: now ( ) ;
117
117
}
118
118
119
119
if STOP . load ( Ordering :: SeqCst ) {
You can’t perform that action at this time.
0 commit comments