Unverified Commit 18c99b60 authored by Luke Sandberg's avatar Luke Sandberg Committed by GitHub

[turbopack] Only send the filesystem caching timing messages for slow events (#84646)

These are not very actionable for end users, but if they take more than 10s it might be a useful clue about system performance.
parent 714a7020
...@@ -1184,11 +1184,14 @@ impl<B: BackingStorage> TurboTasksBackendInner<B> { ...@@ -1184,11 +1184,14 @@ impl<B: BackingStorage> TurboTasksBackendInner<B> {
if new_items { if new_items {
let elapsed = start.elapsed(); let elapsed = start.elapsed();
// avoid spamming the event queue with information about fast operations
if elapsed > Duration::from_secs(10) {
turbo_tasks().send_compilation_event(Arc::new(TimingEvent::new( turbo_tasks().send_compilation_event(Arc::new(TimingEvent::new(
"Finished writing to filesystem cache".to_string(), "Finished writing to filesystem cache".to_string(),
elapsed, elapsed,
))); )));
} }
}
Some((snapshot_time, new_items)) Some((snapshot_time, new_items))
} }
......
use std::{cmp::max, path::PathBuf, sync::Arc, thread::available_parallelism, time::Instant}; use std::{
cmp::max,
path::PathBuf,
sync::Arc,
thread::available_parallelism,
time::{Duration, Instant},
};
use anyhow::{Ok, Result}; use anyhow::{Ok, Result};
use parking_lot::Mutex; use parking_lot::Mutex;
...@@ -135,9 +141,12 @@ fn do_compact( ...@@ -135,9 +141,12 @@ fn do_compact(
})?; })?;
if ran { if ran {
let elapsed = start.elapsed(); let elapsed = start.elapsed();
// avoid spamming the event queue with information about fast operations
if elapsed > Duration::from_secs(10) {
turbo_tasks() turbo_tasks()
.send_compilation_event(Arc::new(TimingEvent::new(message.to_string(), elapsed))); .send_compilation_event(Arc::new(TimingEvent::new(message.to_string(), elapsed)));
} }
}
Ok(()) Ok(())
} }
......
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