Struct ferrisetw::EventRecord

source ·
#[repr(transparent)]
pub struct EventRecord(_);
Expand description

A read-only wrapper over an EVENT_RECORD

Implementations§

source§

impl EventRecord

source

pub fn provider_id(&self) -> GUID

The ProviderId field from the wrapped EVENT_RECORD

source

pub fn event_id(&self) -> u16

The Id field from the wrapped EVENT_RECORD

source

pub fn opcode(&self) -> u8

The Opcode field from the wrapped EVENT_RECORD

source

pub fn version(&self) -> u8

The Version field from the wrapped EVENT_RECORD

source

pub fn level(&self) -> u8

The Level field from the wrapped EVENT_RECORD

source

pub fn event_flags(&self) -> u16

The Flags field from the wrapped EVENT_RECORD

source

pub fn process_id(&self) -> u32

The ProcessId field from the wrapped EVENT_RECORD

source

pub fn thread_id(&self) -> u32

The ThreadId field from the wrapped EVENT_RECORD

source

pub fn activity_id(&self) -> GUID

The ActivityId field from the wrapped EVENT_RECORD

source

pub fn raw_timestamp(&self) -> i64

The TimeStamp field from the wrapped EVENT_RECORD

As per Microsoft’s documentation:

Contains the time that the event occurred.
The resolution is system time unless the ProcessTraceMode member of EVENT_TRACE_LOGFILE contains the PROCESS_TRACE_MODE_RAW_TIMESTAMP flag, in which case the resolution depends on the value of the Wnode.ClientContext member of EVENT_TRACE_PROPERTIES at the time the controller created the session.

Note: the time_rs Cargo feature enables to convert this into strongly-typed values

source

pub fn extended_data(&self) -> &[EventHeaderExtendedDataItem]

Returns the ExtendedData from the ETW Event

Their availability is mostly determined by the flags passed to Provider::trace_flags

Example
use windows::Win32::System::Diagnostics::Etw::EVENT_HEADER_EXT_TYPE_RELATED_ACTIVITYID;

let my_callback = |record: &EventRecord, schema_locator: &SchemaLocator| {
    let schema = schema_locator.event_schema(record).unwrap();
    let activity_id = record
        .extended_data()
        .iter()
        .find(|edata| edata.data_type() as u32 == EVENT_HEADER_EXT_TYPE_RELATED_ACTIVITYID)
        .map(|edata| edata.to_extended_data_item());
};

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,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · 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.
const: unstable · source§

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

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V