Skip to main content

ThreadLocalState

Struct ThreadLocalState 

Source
pub struct ThreadLocalState {
    pub steps_count: AtomicU64,
    pub nodes_visited: AtomicU64,
    pub rewrites_applied: AtomicU64,
}
Expand description

Per-thread telemetry for staged simplification.

Tracks three per-thread metrics (parallel_review §3.1):

  • steps_count — total simplification rounds performed by this thread
  • nodes_visited — total DAG nodes inspected during traversal
  • rewrites_applied — total rewrite rules that fired (pattern matches)

The 128-byte repr(align) was removed: cache-line padding guards against false-sharing only when different threads write to adjacent memory. A thread_local! value lives in per-thread storage — no other thread can touch it — so over-alignment is pure waste.

Fields§

§steps_count: AtomicU64

Total simplification steps (one per run_staged_simplification round).

§nodes_visited: AtomicU64

Total DAG nodes visited across all steps. Useful for throughput profiling.

§rewrites_applied: AtomicU64

Total rewrite rules that fired. Non-zero means the expression changed.

Implementations§

Source§

impl ThreadLocalState

Source

pub const fn new() -> Self

Creates a new instance with all counters at zero.

Source

pub fn increment(&self)

Increments the simplification-step counter.

Source

pub fn get_count(&self) -> u64

Retrieves the simplification-step count.

Source

pub fn record_nodes_visited(&self, n: u64)

Records that n additional DAG nodes were visited.

Source

pub fn record_rewrites(&self, n: u64)

Records that n rewrite rules fired.

Source

pub fn get_nodes_visited(&self) -> u64

Returns the total number of nodes visited.

Source

pub fn get_rewrites_applied(&self) -> u64

Returns the total number of rewrites applied.

Source

pub fn reset(&self)

Resets all counters to zero.

Trait Implementations§

Source§

impl Debug for ThreadLocalState

Source§

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

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

impl Default for ThreadLocalState

Source§

fn default() -> Self

Returns the “default value” for a 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> Downcast<T> for T

Source§

fn downcast(&self) -> &T

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

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,