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
8 changes: 7 additions & 1 deletion crates/lsp-profiler-dotnet/src/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ struct SessionState {
snapshots: u32,
/// Heap bytes the latest snapshot or collection reported.
heap_bytes: Option<i64>,
/// The largest heap any snapshot of the session reported: the wire's
/// `peak_bytes`, peak since tracking began, which a collection never lowers.
peak_bytes: i64,
}

/// The .NET memory backend.
Expand Down Expand Up @@ -90,15 +93,18 @@ impl DotNetMemory {
"the engine answered a snapshot with another message".to_owned(),
));
};
let mut peak_bytes = heap_bytes;
self.remember(&context.session_id, |state| {
state.graph = Some(graph.clone());
state.heap_bytes = Some(heap_bytes);
state.peak_bytes = state.peak_bytes.max(heap_bytes).max(live_bytes);
peak_bytes = state.peak_bytes;
})
.await;
Ok(HeapSnapshot {
snapshot_id: String::new(),
current_bytes: live_bytes,
peak_bytes: heap_bytes,
peak_bytes,
object_count: live_objects,
gc_generations: vec![],
generation_sizes: Some(generation_sizes(generation_bytes)),
Expand Down
11 changes: 11 additions & 0 deletions crates/lsp-profiler-dotnet/tests/dotnet_e2e.rs
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,17 @@ async fn a_duration_caps_the_recorded_time() {
)
.await;
tokio::time::sleep(Duration::from_secs(3)).await;
// [PROF-CPU-SESSIONS] the duration ended the session: it is no longer active.
let listed = call(&service, methods::CPU_LIST, json!({})).await;
assert!(
!listed["sessions"]
.as_array()
.expect("sessions")
.iter()
.any(|session| session["session_id"] == started["session_id"]),
"a session past its duration is not listed as active: {listed}"
);
// Its report is kept for the next stop.
let report = call(
&service,
methods::CPU_STOP,
Expand Down
255 changes: 0 additions & 255 deletions crates/lsp-profiler-dotnet/tests/dotnet_fsharp_e2e.rs

This file was deleted.

Loading
Loading