File tree 1 file changed +5
-5
lines changed
1 file changed +5
-5
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 start_time = Instant :: now ( ) ;
73
- let mut end_time = start_time ;
72
+ let mut last_run = Instant :: now ( ) ;
73
+ let mut current_time : Instant ;
74
74
let mut total_count_old: u64 = 0 ;
75
75
76
76
#[ cfg( feature = "stats" ) ]
79
79
let mut system = System :: new_all ( ) ;
80
80
81
81
loop {
82
- let elapsed = end_time. duration_since ( start_time) . as_secs ( ) ;
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
84
if elapsed >= SLIDING_WINDOW_SIZE {
84
85
let total_count_u64: u64 = worker_stats_shared_monitor
85
86
. iter ( )
@@ -112,14 +113,13 @@ where
112
113
}
113
114
114
115
println ! ( "\n " ) ;
115
- start_time = Instant :: now ( ) ;
116
+ last_run = Instant :: now ( ) ;
116
117
}
117
118
118
119
if STOP . load ( Ordering :: SeqCst ) {
119
120
break ;
120
121
}
121
122
122
- end_time = Instant :: now ( ) ;
123
123
thread:: sleep ( Duration :: from_millis ( 5000 ) ) ;
124
124
}
125
125
} ) ;
You can’t perform that action at this time.
0 commit comments