pub struct Range { /* private fields */ }
Expand description
A range denoting a time span.
A range denotes an arbitrary time span in a process. Each range can contain a text message or specify additional attributes.
A unique (opaque) correlation ID is created for each range. The correlation ID is annotated to the nvprof profiler output.
The official documentation is available in Nvidia’s Profiler User Guide.
Thread-safety
A range may be ended by a different thread than it is started by. Thus, a
range is Send
but not Sync
, Copy
or Clone
. However, a pop must occur
on the same thread as the push.
Examples
A range can be started and stopped at arbitrary points.
let message = unsafe { CStr::from_bytes_with_nul_unchecked(b"Hello World!\0") };
let range = Range::new(message);
// ...
let range_id = range.end();
println!("Range {} ended", range_id);
Alternatively, a ranges can be nested by pushing and popping them.
let message = unsafe { CStr::from_bytes_with_nul_unchecked(b"Hello World!\0") };
Range::push(&message).unwrap();
// ...
Range::pop().unwrap();
Implementations
sourceimpl Range
impl Range
sourcepub fn new(message: &CStr) -> Self
pub fn new(message: &CStr) -> Self
Start a process range.
The message
is associated to this range event.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Range
impl Send for Range
impl Sync for Range
impl Unpin for Range
impl UnwindSafe for Range
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more