X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=src%2Ftatoo.ml;h=90d854604b44abeb02db9285a3d8922dc042d91d;hb=122fdb64ba001d728d0d94245753b1d7d31cc98d;hp=d8c3e0990a833fc66daacfda9805093e75715430;hpb=6ca42ffbd541cede6afcc473b563e54b848ee534;p=tatoo.git diff --git a/src/tatoo.ml b/src/tatoo.ml index d8c3e09..90d8546 100644 --- a/src/tatoo.ml +++ b/src/tatoo.ml @@ -104,9 +104,10 @@ let main () = Logger.msg `STATS "@[Automaton: @\n%a@]" Ata.print auto) auto_list; end; - let module Naive = Run.Make(Naive_tree) in + let module Naive = Run.Make(Naive_tree)(Naive_node_list) in let result_list = - let root = [ Naive_tree.root doc] in + let root = Naive_node_list.create () in + let () = Naive_node_list.add (Naive_tree.root doc) root in let f, msg = match !Options.parallel, !Options.compose with true, true -> @@ -118,8 +119,22 @@ let main () = | false, false -> restart_sequential Naive.eval auto_list doc root, "sequential/restart" in - time f () ("evaluating query in " ^ msg ^ " mode") + time f () (Printf.sprintf "evaluating quer%s in %s mode" + (match auto_list with + [] | [ _ ] -> "y" | _ -> "ies" ) + msg) in + let sl = Naive.stats () in + Run.( + List.iter (fun s -> + Logger.msg `STATS + "@[automaton: %d@\ntree size: %d@\ntraversals: %d@\ntransition fetch cache hit ratio: %f@\ntransition eval cache hit ratio: %f@\nNumber of visited nodes per pass: %a@]" + (s.auto :> int) s.tree_size s.pass + (float s.fetch_trans_cache_hit /. float s.fetch_trans_cache_access) + (float s.eval_trans_cache_hit /. float s.eval_trans_cache_access) + (let i = ref 0 in + Pretty.print_list ~sep:"," (fun fmt n -> Format.fprintf fmt "%i: %i" !i n;incr i)) + s.nodes_per_run)) sl; time (fun () -> let count = ref 1 in List.iter (fun results -> @@ -127,10 +142,10 @@ let main () = output_string output (string_of_int !count); output_string output "\" >\n"; if !Options.count then begin - output_string output (string_of_int (List.length results)); + output_string output (string_of_int (Naive_node_list.length results)); output_char output '\n'; end else - List.iter (fun n -> + Naive_node_list.iter (fun n -> Naive_tree.print_xml output doc n; output_char output '\n' ) results;