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

Start a process range.

The message is associated to this range event.

End a process range.

Get the ID of a range.

Start a new nested process range.

The message is associated to this range event. The push returns the zero-based depth of the range being started.

Stop a nested range.

The pop returns the zero-based depth of the range being ended. A runtime error is returned if no range was pushed before the pop.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.