pub struct EunomiaObjectMeta {
    pub export_types: Vec<ExportedTypesStructMeta>,
    pub bpf_skel: BpfSkeletonMeta,
    pub perf_buffer_pages: usize,
    pub perf_buffer_time_ms: usize,
    pub poll_timeout_ms: i32,
    pub debug_verbose: bool,
    pub print_header: bool,
}
Expand description

global meta data config

Fields§

§export_types: Vec<ExportedTypesStructMeta>

Export types

§bpf_skel: BpfSkeletonMeta

The object skeleton

§perf_buffer_pages: usize

perf buffer related config

§perf_buffer_time_ms: usize

perf buffer related config

§poll_timeout_ms: i32

poll config

§debug_verbose: bool

Whether libbpf should print debug info This will only be apply to libbpf when start running

§print_header: bool

print config print the types and names of export headers

Implementations§

source§

impl EunomiaObjectMeta

source

pub fn build_argument_parser(&self) -> Result<Command>

Build an argument parser use the cmdarg sections in .rodata/.bss variables.

Each variable in the .bss or .rodata sections will be mapped into a command line argument.

If a variable has it’s default value, the default value will be used in the command line parser.

Variables with bool will have some special cases:

  • If the variable has no default values, a switch named --<NAME> will be added, indicating to set the value to true or false
  • If the default value if true, a switch named --disable-<NAME> will be added, means set the value to false
  • If the default value if false, a switch named --enable-<NAME> will be added, means to set the value to true.

The first will be used to set the value of the variable to true, second one will be used to set false

Variables with other types will accept values. But values will be checked in parse_arguments_and_fill_skeleton_variables, so here the values input in the command line parser will be regarded as strings.

source§

impl EunomiaObjectMeta

source

pub fn parse_arguments_and_fill_skeleton_variables( &mut self, args: &ArgMatches, on_unpresent: UnpresentVariableAction ) -> Result<()>

Parser the values from the command line parser

The clap parser gives us all values as strings, so here will try to parse the strings into the variable’s own types (e.g, string, int, unsigned int). If it failes, Err will be returned

This function will fill the value field in the DataSectionVariableMeta.

If the on_unpresent behavior is FillWithZero, in this way if we find a command line argument with no values provided (this situation may only happen if the command line argument was created with no default values, a.k.a the value field is None in DataSectionVariableMeta), the value field will still be leaved None. In this way, the section_loader will fill zeros in the corresponding memory areas.

If the on_unpresent behavior is ReportError, in this way if we find a command line argument with no values, we’ll report an error.

Trait Implementations§

source§

impl Clone for EunomiaObjectMeta

source§

fn clone(&self) -> EunomiaObjectMeta

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for EunomiaObjectMeta

source§

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

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

impl<'de> Deserialize<'de> for EunomiaObjectMeta

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl PartialEq<EunomiaObjectMeta> for EunomiaObjectMeta

source§

fn eq(&self, other: &EunomiaObjectMeta) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for EunomiaObjectMeta

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Eq for EunomiaObjectMeta

source§

impl StructuralEq for EunomiaObjectMeta

source§

impl StructuralPartialEq for EunomiaObjectMeta

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere 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> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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 Twhere U: TryFrom<T>,

§

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.
source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,