egg_stats::recorders

Struct Timestamp

source
pub struct Timestamp { /* private fields */ }

Implementations§

source§

impl Timestamp

source

pub fn new(start: Instant) -> Self

Examples found in repository?
examples/simple.rs (line 60)
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
fn simplify_with(
    s: &str,
    scheduler: impl RewriteScheduler<SimpleLanguage, ()> + 'static,
    path: impl AsRef<Path>,
) {
    // parse the expression, the type annotation tells it which Language to use
    let expr: RecExpr<SimpleLanguage> = s.parse().unwrap();

    let mut egraph = EGraph::new(());
    let root = egraph.add_expr(&expr);

    // simplify the expression using a Runner, which creates an e-graph with
    // the given expression and runs the given rules over it
    Runner::default()
        .with_scheduler(
            LoggingScheduler::from(scheduler)
                .with_out_file(
                    OpenOptions::new()
                        .write(true)
                        .create(true)
                        .truncate(true)
                        .open(path.as_ref())
                        .unwrap(),
                )
                .with_logging_enabled(true)
                .with_recorder(recorders::Timestamp::new(Instant::now()))
                .with_recorder(recorders::NumberENodes)
                .with_recorder(recorders::NumberEClasses)
                .with_recorder(recorders::BestProgram::new_with(|| AstSize, root)),
        )
        .with_egraph(egraph)
        .run(&make_rules());

    println!("Wrote {:?}", path.as_ref());
}

Trait Implementations§

source§

impl Default for Timestamp

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<L, N> Recorder<L, N> for Timestamp
where L: Language, N: Analysis<L>,

source§

fn identifier(&self) -> Cow<'static, str>

source§

fn record_before_rewrite( &self, iteration: usize, egraph: &mut EGraph<L, N>, rewrite: &Rewrite<L, N>, matches: &[SearchMatches<'_, L>], ) -> Option<String>

source§

fn record_after_rewrite( &self, iteration: usize, egraph: &mut EGraph<L, N>, rewrite: &Rewrite<L, N>, n_matches: usize, ) -> Option<String>

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.