Commit 75c35c55 authored by Niklas Mischkulnig's avatar Niklas Mischkulnig

Turbopack: try to improve trace viewer

parent 229b28e6
......@@ -738,7 +738,9 @@ pub(crate) async fn analyse_ecmascript_module_internal(
let handler = Handler::with_emitter(true, false, Box::new(emitter));
let mut var_graph = {
let _span = tracing::info_span!("analyze variable values");
// This span messes with persistent caching because the resulting effects are freed in a
// different span
// let _span = tracing::info_span!("analyze variable values").entered();
set_handler_and_globals(&handler, globals, || create_graph(program, eval_context))
};
......
......@@ -215,10 +215,17 @@ impl<'a> SpanGraphRef<'a> {
pub fn self_persistent_allocations(&self) -> u64 {
*self.graph.self_persistent_allocations.get_or_init(|| {
self.recursive_spans()
.map(|span| span.self_persistent_allocations())
let expected_total = self
.total_allocations()
.saturating_sub(self.total_deallocations());
let child_total = self
.children()
.map(|graph| graph.total_persistent_allocations())
.reduce(|a, b| a + b)
.unwrap_or_default()
.unwrap_or_default();
expected_total.saturating_sub(child_total)
})
}
......
......@@ -153,8 +153,17 @@ impl<'a> SpanRef<'a> {
}
pub fn self_persistent_allocations(&self) -> u64 {
self.self_allocations()
.saturating_sub(self.span.self_deallocations)
let expected_total = self
.total_allocations()
.saturating_sub(self.total_deallocations());
let child_total = self
.children()
.map(|child| child.total_persistent_allocations())
.reduce(|a, b| a + b)
.unwrap_or_default();
expected_total.saturating_sub(child_total)
}
pub fn self_allocation_count(&self) -> u64 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment