(***********************************************************************)
(*
- Time-stamp: <Last modified on 2013-03-15 18:18:11 CET by Kim Nguyen>
+ Time-stamp: <Last modified on 2013-03-15 23:38:04 CET by Kim Nguyen>
*)
INCLUDE "utils.ml"
let dummy6 = (dummy2, StateSet.empty)
-let create s ss = { id = next ();
- states = s;
- selection_states = ss;
- transitions = Hashtbl.create 17;
- cache2 = Cache.N2.create dummy2;
- cache6 = Cache.N6.create dummy6;
- }
+let create s ss =
+ let auto = { id = next ();
+ states = s;
+ selection_states = ss;
+ transitions = Hashtbl.create 17;
+ cache2 = Cache.N2.create dummy2;
+ cache6 = Cache.N6.create dummy6;
+ }
+ in
+ at_exit (fun () ->
+ let n6 = ref 0 in
+ let n2 = ref 0 in
+ Cache.N2.iteri (fun _ _ _ b -> if b then incr n2) auto.cache2;
+ Cache.N6.iteri (fun _ _ _ _ _ _ _ b -> if b then incr n6) auto.cache6;
+ Format.eprintf "INFO: automaton %i, cache2: %i entries, cache6: %i entries\n%!"
+ (auto.id :> int) !n2 !n6
+ );
+ auto
let reset a =
a.cache2 <- Cache.N2.create dummy2;