Provider

Struct Provider 

Source
pub struct Provider { /* private fields */ }
Expand description

Represents a connection for writing dynamic Linux tracepoints.

Implementations§

Source§

impl Provider

Source

pub fn new_options<'a>() -> ProviderOptions<'a>

Returns a default ProviderOptions.

Source

pub fn new(name: &str, options: &ProviderOptions<'_>) -> Self

Creates a new provider.

  • name is the name to use for this provider. It must be less than 234 chars and must not contain '\0', ' ', or ':'. For best compatibility with trace processing components, it should contain only ASCII letters, digits, and '_'. It should be short, human-readable, and unique enough to not conflict with names of other providers. The provider name will typically include a company name and a component name, e.g. "MyCompany_MyComponent".

  • options can usually be &Provider::new_options(). If the provider needs to join a provider group, use Provider::new_options().group_name(provider_group_name). Note that the total length of the provider name + the group name must be less than 234.

Use register_set() to register event sets.

Use EventBuilder to create events, then write them to a registered event set.

Source

pub fn name(&self) -> &str

Returns this provider’s name.

Source

pub fn options(&self) -> &str

Returns this provider’s options, e.g. “” or “Gmygroup”.

Source

pub fn unregister(&mut self)

If this provider is not registered, does nothing and returns 0. Otherwise, unregisters all event sets that were registered by this provider and clears the list of already-created event sets.

Use provider.unregister() if you want to unregister the provider before it goes out of scope. The provider automatically unregisters when it is dropped so most users do not need to call unregister directly.

Source

pub fn find_set(&self, level: Level, keyword: u64) -> Option<Arc<EventSet>>

If an event set with the specified level and keyword is in the list of already-created sets, returns it. Otherwise, returns None.

Source

pub fn register_set(&mut self, level: Level, keyword: u64) -> Arc<EventSet>

If an event set with the specified level and keyword is in the list of already-created sets, returns it. Otherwise, creates a new event set, adds it to the list of already-created sets, attempts to register it, and returns the new event set. If registration fails, the new event set will have a non-zero errno and will never be enabled.

Source

pub fn create_unregistered( &mut self, enabled: bool, level: Level, keyword: u64, ) -> Arc<EventSet>

For testing purposes: Creates an inactive (unregistered) event set.

If an event set with the specified level and keyword is in the list of already-created sets, returns it. Otherwise, creates a new unregistered event set, adds it to the list of already-created sets, and returns the new event set.

Trait Implementations§

Source§

impl Debug for Provider

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for Provider

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.