pub struct Provider { /* private fields */ }Expand description
Represents a connection for writing dynamic Linux tracepoints.
Implementations§
Source§impl Provider
impl Provider
Sourcepub fn new_options<'a>() -> ProviderOptions<'a>
pub fn new_options<'a>() -> ProviderOptions<'a>
Returns a default ProviderOptions.
Sourcepub fn new(name: &str, options: &ProviderOptions<'_>) -> Self
pub fn new(name: &str, options: &ProviderOptions<'_>) -> Self
Creates a new provider.
-
nameis 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". -
optionscan usually be&Provider::new_options(). If the provider needs to join a provider group, useProvider::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.
Sourcepub fn unregister(&mut self)
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.
Sourcepub fn find_set(&self, level: Level, keyword: u64) -> Option<Arc<EventSet>>
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.
Sourcepub fn register_set(&mut self, level: Level, keyword: u64) -> Arc<EventSet>
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.
Sourcepub fn create_unregistered(
&mut self,
enabled: bool,
level: Level,
keyword: u64,
) -> Arc<EventSet>
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.