Skip to content

Commit

Permalink
improve logging
Browse files Browse the repository at this point in the history
  • Loading branch information
mxinden committed Nov 23, 2023
1 parent 9706812 commit 59415c7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
2 changes: 0 additions & 2 deletions test-harness/tests/poll_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ fn concurrent_streams() {
let mut cfg = Config::default();
cfg.set_split_send_size(PAYLOAD_SIZE); // Use a large frame size to speed up the test.

println!("here");

// TODO: Rethink these.
cfg.set_connection_window(n_streams * DEFAULT_CREDIT);
cfg.set_max_num_streams(n_streams);
Expand Down
5 changes: 4 additions & 1 deletion yamux/src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,10 @@ impl Rtt {
}

inner.rtt = Some(sent_at.elapsed());
println!("{}", inner.rtt.as_ref().unwrap().as_secs_f64());
log::debug!(
"estimated round-trip-time: {}s",
inner.rtt.as_ref().unwrap().as_secs_f64()
);
// TODO
inner.state = RttState::Waiting {
next: Instant::now() + Duration::from_secs(10),
Expand Down
14 changes: 11 additions & 3 deletions yamux/src/connection/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,14 @@ impl Shared {
let buffer_len = self.buffer.len();
let mut new_credit = bytes_received.saturating_sub(buffer_len);

log::debug!(
"received {} mb in {} seconds ({} mbit/s)",
new_credit as f64 / 1024.0 / 1024.0,
self.last_window_update.elapsed().as_secs_f64(),
new_credit as f64 / 1024.0 / 1024.0 * 8.0
/ self.last_window_update.elapsed().as_secs_f64()
);

if new_credit < self.window_max / 2 {
return None;
}
Expand All @@ -586,9 +594,9 @@ impl Shared {

*accumulated_max_stream_windows += self.window_max - previous_window_max;
log::debug!(
"old/new window_max: {}/{}",
previous_window_max,
self.window_max
"old window_max: {} mb, new window_max: {} mb",
previous_window_max as f64 / 1024.0 / 1024.0,
self.window_max as f64 / 1024.0 / 1024.0
);

let bytes_received = self.window_max.saturating_sub(self.window);
Expand Down

0 comments on commit 59415c7

Please sign in to comment.