More ideas about how to record data

This commit is contained in:
Nadja Reitzenstein
2022-06-23 14:37:17 +02:00
parent 567df800f3
commit 2f5f7cb0d7
4 changed files with 48 additions and 12 deletions

View File

@ -40,13 +40,17 @@ libc = "0.2"
num_cpus = "1.13"
pin-utils = "0.1.0"
slab = "0.4"
parking_lot = "0.12"
# Allocator
arrayvec = { version = "0.7.0" }
futures-timer = "3.0.2"
once_cell = "1.4.0"
tracing = "0.1.19"
crossbeam-queue = "0.3.0"
hdrhistogram = "7.5"
# Stats & Tracing
tracing = "0.1"
[dev-dependencies]
async-std = "1.10.0"

View File

@ -48,21 +48,12 @@ impl Spooler<'_> {
/// Global executor
pub struct Executor<'a> {
spooler: Arc<Spooler<'a>>,
span: Span,
}
impl<'a, 'executor: 'a> Executor<'executor> {
pub fn new() -> Self {
Executor {
spooler: Arc::new(Spooler::new()),
span: tracing::span!(Level::INFO, "executor"),
}
}
pub fn new_with_parent_span(parent: &Span) -> Self {
Executor {
spooler: Arc::new(Spooler::new()),
span: tracing::span!(parent: parent, Level::INFO, "executor"),
}
}
@ -115,7 +106,6 @@ impl<'a, 'executor: 'a> Executor<'executor> {
let location = std::panic::Location::caller();
let span = tracing::trace_span!(
target: "executor::task",
parent: Span::current(),
"runtime.spawn",
loc.file = location.file(),
loc.line = location.line(),
@ -138,7 +128,6 @@ impl<'a, 'executor: 'a> Executor<'executor> {
let location = std::panic::Location::caller();
let span = tracing::trace_span!(
target: "executor::task",
parent: Span::current(),
"runtime.spawn",
loc.file = location.file(),
loc.line = location.line(),

View File

@ -191,6 +191,14 @@ impl<R> Drop for ProcHandle<R> {
let mut output = None;
unsafe {
// Record dropping the handle for this task
let id = (&(*pdata).span).id().map(|id| id.into_u64()).unwrap_or(0);
tracing::trace!(
target: "executor::handle",
op = "handle.drop",
task.id = id,
);
// Optimistically assume the `ProcHandle` is being dropped just after creating the
// proc. This is a common case so if the handle is not used, the overhead of it is only
// one compare-exchange operation.