Skip to content

Commit

Permalink
correct by allocation done by tracing
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed Jan 10, 2024
1 parent 3d544df commit bf2552b
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions crates/turbopack-trace-server/src/span_ref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use std::{
use indexmap::IndexMap;

use crate::{
bottom_up::{self, build_bottom_up_graph},
bottom_up::build_bottom_up_graph,
span::{Span, SpanEvent, SpanGraphEvent, SpanIndex},
span_bottom_up_ref::SpanBottomUpRef,
span_graph_ref::{event_map_to_list, SpanGraphEventRef, SpanGraphRef},
Expand Down Expand Up @@ -121,21 +121,22 @@ impl<'a> SpanRef<'a> {
}

pub fn self_allocations(&self) -> u64 {
self.span.self_allocations
// 32 bytes for the tracing itself
self.span.self_allocations.saturating_sub(32)
}

pub fn self_deallocations(&self) -> u64 {
self.span.self_deallocations
}

pub fn self_persistent_allocations(&self) -> u64 {
self.span
.self_allocations
self.self_allocations()
.saturating_sub(self.span.self_deallocations)
}

pub fn self_allocation_count(&self) -> u64 {
self.span.self_allocation_count
// 4 allocations for the tracing itself
self.span.self_allocation_count.saturating_sub(4)
}

// TODO(sokra) use events instead of children for visualizing span graphs
Expand Down

0 comments on commit bf2552b

Please sign in to comment.