diff --git a/src/lib.rs b/src/lib.rs index 3397b14..3819751 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -34,6 +34,8 @@ mod set_cost; pub use set_cost::*; mod size; pub use size::*; +mod stats; +pub use stats::*; pub fn new_experimental_egraph() -> EGraph { let mut egraph = EGraph::default(); @@ -48,4 +50,7 @@ pub fn new_experimental_egraph() -> EGraph { .add_command("run-schedule".into(), Arc::new(RunExtendedSchedule)) .unwrap(); egraph + .add_command("egraph-detailed-stats".into(), Arc::new(EgraphDetailedStats)) + .unwrap(); + egraph } diff --git a/tests/herbie-rational.egg b/tests/herbie-rational.egg index 6b19c31..fd31030 100644 --- a/tests/herbie-rational.egg +++ b/tests/herbie-rational.egg @@ -567,4 +567,8 @@ (let tgt (Div one sqrt5)) (run 6) (check (= e14 tgt)) + +; Get detailed statistics +(egraph-detailed-stats) + (pop) \ No newline at end of file diff --git a/tests/web-demo/detailed-stats.egg b/tests/web-demo/detailed-stats.egg new file mode 100644 index 0000000..b705adb --- /dev/null +++ b/tests/web-demo/detailed-stats.egg @@ -0,0 +1,20 @@ +; Test the egraph-detailed-stats command + +(datatype Math) +(constructor add (Math Math) Math) +(constructor mul (Math Math) Math) +(constructor num (i64) Math) + +; Add some terms +(num 1) +(num 2) +(add (num 1) (num 2)) +(mul (num 1) (num 2)) + +; Create some equality classes +(union (num 1) (num 2)) + +(run-schedule (saturate (run))) + +; Get detailed statistics +(egraph-detailed-stats)