File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
crates/hotshot/task-impls/src Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -186,6 +186,13 @@ impl<TYPES: NodeType> StatsTaskState<TYPES> {
186
186
187
187
fn log_basic_stats ( & self , now : i128 , epoch : & TYPES :: Epoch ) {
188
188
let num_views = self . latencies_by_view . len ( ) ;
189
+ let total_size = self . sizes_by_view . values ( ) . sum :: < i128 > ( ) ;
190
+
191
+ // Either we have no views logged yet, no TXNs or we are not in the DA committee and don't know block sizes
192
+ if num_views == 0 || total_size == 0 {
193
+ return ;
194
+ }
195
+
189
196
let total_latency = self . latencies_by_view . values ( ) . sum :: < i128 > ( ) ;
190
197
let average_latency = total_latency / num_views as i128 ;
191
198
tracing:: warn!( "Average latency: {}ms" , average_latency) ;
@@ -194,11 +201,6 @@ impl<TYPES: NodeType> StatsTaskState<TYPES> {
194
201
epoch,
195
202
self . timeouts. len( )
196
203
) ;
197
- let total_size = self . sizes_by_view . values ( ) . sum :: < i128 > ( ) ;
198
- if total_size == 0 {
199
- // Either no TXNs or we are not in the DA committee and don't know block sizes
200
- return ;
201
- }
202
204
if let Some ( epoch_start_time) = self . epoch_start_times . get ( epoch) {
203
205
let elapsed_time = now - epoch_start_time;
204
206
// multiply by 1000 to convert to seconds
You can’t perform that action at this time.
0 commit comments