use tracing::span;
use tracing_core::callsite;
use crate::config::ProfileConfig;
#[cfg(feature = "pprof")]
pub mod pprof;
pub trait ProfileReporter {
fn init(&mut self, config: &ProfileConfig) {
_ = config;
}
fn span_created(&mut self, span: &span::Id, metadata: SpanMetadata) {
_ = (span, metadata);
}
fn span_destroyed(&mut self, span: &span::Id) {
_ = span;
}
fn span_cpu(&mut self, span: &span::Id, cpu: SpanCpuTime) {
_ = (span, cpu);
}
fn span_wall(&mut self, span: &span::Id, wall: SpanWallTime) {
_ = (span, wall);
}
fn span_allocations(&mut self, span: &span::Id, allocs: SpanAllocations) {
_ = (span, allocs);
}
fn span_heap(&mut self, span: &span::Id, heap: SpanHeap) {
_ = (span, heap);
}
fn flush(&mut self) {}
}
pub struct SpanMetadata {
pub scope: Vec<span::Id>,
pub callsite: callsite::Identifier,
pub target: &'static str,
pub span_name: &'static str,
pub file: &'static str,
pub line: u32,
pub labels: Vec<(&'static str, String)>,
}
#[derive(Debug)]
pub struct SpanCpuTime {
pub elapsed_user_nanos: u64,
pub elapsed_system_nanos: u64,
}
#[derive(Debug)]
pub struct SpanWallTime {
pub elapsed_busy_nanos: u64,
pub elapsed_idle_nanos: u64,
}
#[derive(Debug, Default)]
pub struct SpanAllocations {
pub allocation_count: u64,
pub allocated_bytes: u64,
}
#[derive(Debug)]
pub struct SpanHeap {
pub in_use_bytes: u64,
pub in_use_count: u64,
}