Skip to content

Commit

Permalink
doc: note need to verify calculation logic
Browse files Browse the repository at this point in the history
  • Loading branch information
de-sh committed Nov 4, 2023
1 parent 4cbb802 commit 3a2374c
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions uplink/src/collector/systemstats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ impl Network {
/// Update metrics values for network usage over time
fn update(&mut self, data: &NetworkData, timestamp: u64, sequence: u32) {
let update_period = self.timer.elapsed().as_secs_f64();
// TODO: check if these calculations are correct
self.incoming_data_rate = data.total_received() as f64 / update_period;
self.outgoing_data_rate = data.total_transmitted() as f64 / update_period;
self.timestamp = timestamp;
Expand Down

1 comment on commit 3a2374c

@de-sh
Copy link
Contributor Author

@de-sh de-sh commented on 3a2374c Nov 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably calculate against data.received() and set self.time = Instant::now() to ensure we are calculating data rate between checkpoints instead of being between start of uplink and now(which is the behavior now).

Please sign in to comment.