Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions crates/rds-cli/src/desktop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -475,9 +475,8 @@ mod native {
Some(rds_core::DesktopEvent::Heartbeat { ts_ms, .. }) => view
.control_rtt((started.elapsed().as_millis() as u64).saturating_sub(ts_ms)),
Some(rds_core::DesktopEvent::InputAck { seq, .. }) => view.input_ack(seq),
Some(rds_core::DesktopEvent::ClipboardReady { bytes, .. }) => {
view.clipboard_ready(bytes);
tracing::info!(bytes, "remote clipboard ready");
Some(rds_core::DesktopEvent::ClipboardReady { id, bytes }) => {
view.clipboard_ack(id, bytes);
}
None => {
tracing::warn!("managed desktop event channel ended");
Expand Down Expand Up @@ -566,7 +565,7 @@ mod native {
event = session.events.recv() => match event {
Some(rds_core::DesktopEvent::Heartbeat { ts_ms,.. }) => view.control_rtt((started.elapsed().as_millis() as u64).saturating_sub(ts_ms)),
Some(rds_core::DesktopEvent::InputAck { seq,.. }) => view.input_ack(seq),
Some(rds_core::DesktopEvent::ClipboardReady { bytes,.. }) => {view.clipboard_ready(bytes);tracing::info!(bytes,"remote clipboard ready");},
Some(rds_core::DesktopEvent::ClipboardReady { id, bytes }) => {view.clipboard_ack(id, bytes);},
None => break Ok(false),
},
frame = session.frames.recv() => match frame {
Expand Down
37 changes: 37 additions & 0 deletions crates/rds-cli/src/desktop/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ pub(super) struct Recorder {
pending: Option<Incident>,
previous_reconnects: Option<u64>,
previous_slow_acks: Option<u64>,
previous_slow_clipboards: Option<u64>,
cooldown_until_ms: u64,
}

Expand All @@ -36,6 +37,10 @@ impl Recorder {
.previous_slow_acks
.is_some_and(|previous| snapshot.report.slow_input_acks > previous);
self.previous_slow_acks = Some(snapshot.report.slow_input_acks);
let slow_clipboard = self
.previous_slow_clipboards
.is_some_and(|previous| snapshot.report.slow_clipboard_transfers > previous);
self.previous_slow_clipboards = Some(snapshot.report.slow_clipboard_transfers);
if let Some(incident) = &mut self.pending {
// Keep memory bounded even if the diagnostic timer runs rapidly.
if incident.snapshots.len() < HISTORY + 6 {
Expand All @@ -55,13 +60,23 @@ impl Recorder {
// Completed stalls can fall entirely between periodic snapshots.
reasons.push("input_ack_delayed");
}
if slow_clipboard {
reasons.push("clipboard_ready_delayed");
}
if snapshot
.report
.oldest_input_ack_age_ms
.is_some_and(|ms| ms >= 250)
{
reasons.push("input_ack_pending");
}
if snapshot
.report
.clipboard_oldest_pending_age_ms
.is_some_and(|ms| ms >= 250)
{
reasons.push("clipboard_ready_pending");
}
if snapshot.decoded_frame_age_ms.is_some_and(|ms| ms >= 3000) {
reasons.push("decoded_video_stalled");
}
Expand Down Expand Up @@ -195,6 +210,28 @@ mod tests {
assert_eq!(data["reasons"][0], "input_ack_delayed");
}

#[test]
fn pending_and_completed_slow_clipboard_transfers_preserve_an_incident() {
for completed in [false, true] {
let mut recorder = Recorder::default();
recorder.observe(&snapshot(0));
let mut delayed = snapshot(2000);
let reason = if completed {
delayed.report.slow_clipboard_transfers = 1;
delayed.report.last_clipboard_transfer_ms = Some(600.);
"clipboard_ready_delayed"
} else {
delayed.report.clipboard_pending_transfers = 1;
delayed.report.clipboard_oldest_pending_age_ms = Some(600);
"clipboard_ready_pending"
};
recorder.observe(&delayed);
let data: serde_json::Value =
serde_json::from_slice(&recorder.finish(true).unwrap()).unwrap();
assert_eq!(data["reasons"], serde_json::json!([reason]));
}
}

#[test]
fn idle_and_a_fresh_update_do_not_report_a_visible_renderer_stall() {
let mut recorder = Recorder::default();
Expand Down
Loading
Loading