pub struct PerfettoWriter { /* private fields */ }Expand description
A writer for Perfetto traces that writes packets through an AsyncWriter. Uses the AsyncWriter trait to abstract the underlying data sink.
Implementations§
Source§impl PerfettoWriter
impl PerfettoWriter
Sourcepub fn new(
writer: Box<dyn AsyncWriter + Send>,
micromegas_process_id: &str,
) -> PerfettoWriter
pub fn new( writer: Box<dyn AsyncWriter + Send>, micromegas_process_id: &str, ) -> PerfettoWriter
Creates a new PerfettoWriter instance.
Sourcepub async fn write_packet(&mut self, packet: TracePacket) -> Result<(), Error>
pub async fn write_packet(&mut self, packet: TracePacket) -> Result<(), Error>
Writes a single TracePacket to the chunk sender with proper protobuf framing.
Sourcepub async fn emit_process_descriptor(&mut self, exe: &str) -> Result<(), Error>
pub async fn emit_process_descriptor(&mut self, exe: &str) -> Result<(), Error>
Emits a process descriptor packet to the stream.
Sourcepub async fn emit_thread_descriptor(
&mut self,
stream_id: &str,
thread_id: i32,
thread_name: &str,
) -> Result<(), Error>
pub async fn emit_thread_descriptor( &mut self, stream_id: &str, thread_id: i32, thread_name: &str, ) -> Result<(), Error>
Emits a thread descriptor packet to the stream.
Sourcepub fn set_current_thread(&mut self, stream_id: &str)
pub fn set_current_thread(&mut self, stream_id: &str)
Sets the current thread for subsequent span emissions. Must be called before emitting spans for a specific thread.
Sourcepub async fn emit_async_track_descriptor(&mut self) -> Result<(), Error>
pub async fn emit_async_track_descriptor(&mut self) -> Result<(), Error>
Emits an async track descriptor packet to the stream (single track for all async spans).
Sourcepub async fn emit_span(
&mut self,
begin_ns: u64,
end_ns: u64,
name: &str,
target: &str,
filename: &str,
line: u32,
) -> Result<(), Error>
pub async fn emit_span( &mut self, begin_ns: u64, end_ns: u64, name: &str, target: &str, filename: &str, line: u32, ) -> Result<(), Error>
Emits a span event to the stream.
Sourcepub async fn emit_async_span_begin(
&mut self,
timestamp_ns: u64,
name: &str,
target: &str,
filename: &str,
line: u32,
) -> Result<(), Error>
pub async fn emit_async_span_begin( &mut self, timestamp_ns: u64, name: &str, target: &str, filename: &str, line: u32, ) -> Result<(), Error>
Emits an async span begin event to the stream.
Sourcepub async fn emit_async_span_end(
&mut self,
timestamp_ns: u64,
name: &str,
target: &str,
filename: &str,
line: u32,
) -> Result<(), Error>
pub async fn emit_async_span_end( &mut self, timestamp_ns: u64, name: &str, target: &str, filename: &str, line: u32, ) -> Result<(), Error>
Emits an async span end event to the stream.
Sourcepub fn into_inner(self) -> Box<dyn AsyncWriter + Send>
pub fn into_inner(self) -> Box<dyn AsyncWriter + Send>
Consumes the writer and returns the underlying AsyncWriter. This is useful for testing to extract the written data.
Auto Trait Implementations§
impl Freeze for PerfettoWriter
impl !RefUnwindSafe for PerfettoWriter
impl Send for PerfettoWriter
impl !Sync for PerfettoWriter
impl Unpin for PerfettoWriter
impl !UnwindSafe for PerfettoWriter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].