pub struct ProfileRecorder { /* private fields */ }Expand description
Records ResourceSpan data from a running program.
Usage:
use grafos_profile::ProfileRecorder;
use grafos_observe::span::ResourceSpan;
use grafos_observe::trace::TraceContext;
let mut recorder = ProfileRecorder::start();
// ... instrument program, record spans ...
let recording = recorder.stop();
recording.save("/tmp/profile.ndjson").unwrap();Implementations§
Source§impl ProfileRecorder
impl ProfileRecorder
Sourcepub fn with_program_name(self, name: &str) -> Self
pub fn with_program_name(self, name: &str) -> Self
Set an optional program name for the recording header.
Sourcepub fn record_span(&mut self, span: ResourceSpan)
pub fn record_span(&mut self, span: ResourceSpan)
Record a completed span.
Sourcepub fn span_count(&self) -> usize
pub fn span_count(&self) -> usize
Number of spans captured so far.
Sourcepub fn stop(self) -> ProfileRecording
pub fn stop(self) -> ProfileRecording
Stop recording and return the captured data.
Auto Trait Implementations§
impl Freeze for ProfileRecorder
impl RefUnwindSafe for ProfileRecorder
impl Send for ProfileRecorder
impl Sync for ProfileRecorder
impl Unpin for ProfileRecorder
impl UnwindSafe for ProfileRecorder
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
Mutably borrows from an owned value. Read more