feat(vm): add resource diagnostics and macOS stability qualification
Intrepid/Prometeu/Runtime/pipeline/pr-master This commit looks good
Intrepid/Prometeu/Runtime/pipeline/pr-master This commit looks good
This commit is contained in:
@@ -5,6 +5,8 @@ impl VirtualMachine {
|
||||
if self.gc_alloc_threshold > 0
|
||||
&& self.heap.len().saturating_sub(self.last_gc_live_count) >= self.gc_alloc_threshold
|
||||
{
|
||||
#[cfg(feature = "resource-diagnostics")]
|
||||
let (started, before) = (std::time::Instant::now(), self.heap.len());
|
||||
let roots = self
|
||||
.operand_stack
|
||||
.iter()
|
||||
@@ -12,11 +14,27 @@ impl VirtualMachine {
|
||||
.filter_map(crate::roots::value_heap_ref)
|
||||
.chain(self.call_stack.iter().filter_map(|frame| frame.closure));
|
||||
self.heap.mark_session_roots(roots)?;
|
||||
#[cfg(feature = "resource-diagnostics")]
|
||||
let sweep_started = {
|
||||
self.gc_diagnostics.mark.record(started.elapsed());
|
||||
std::time::Instant::now()
|
||||
};
|
||||
self.heap.sweep();
|
||||
self.last_gc_live_count = self.heap.len();
|
||||
#[cfg(feature = "resource-diagnostics")]
|
||||
{
|
||||
self.gc_diagnostics.collections += 1;
|
||||
self.gc_diagnostics.reclaimed += (before - self.last_gc_live_count) as u64;
|
||||
self.gc_diagnostics.sweep.record(sweep_started.elapsed());
|
||||
self.gc_diagnostics.total.record(started.elapsed());
|
||||
}
|
||||
}
|
||||
if let Some(strings) = &self.strings {
|
||||
#[cfg(feature = "resource-diagnostics")]
|
||||
let started = std::time::Instant::now();
|
||||
strings.reconcile();
|
||||
#[cfg(feature = "resource-diagnostics")]
|
||||
self.gc_diagnostics.string_reconciliation.record(started.elapsed());
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user