X-Git-Url: http://git.nguyen.vg/gitweb/?p=tatoo.git;a=blobdiff_plain;f=src%2Ftatoo.ml;h=5dec2f69a7b72ed4bc5f40cc68c32ad0e91f57e2;hp=57d5f1a5161b20616859dcf03f6950c3690dfe9a;hb=f41ff8d936d971eb0712e458826f6555b83746da;hpb=129708eaa5983b9463f96b714c00468602339b0a diff --git a/src/tatoo.ml b/src/tatoo.ml index 57d5f1a..5dec2f6 100644 --- a/src/tatoo.ml +++ b/src/tatoo.ml @@ -50,10 +50,9 @@ let main () = | Some input -> let fd = open_in input in fd, fun () -> close_in fd in - let d = time Naive_tree.load_xml_file fd "parsing xml document" in + let d = time Compact_tree.load_xml_file fd "parsing xml document" in close_fd (); d in - let () = Gc.compact () in let queries = time (fun l -> @@ -105,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(Compact_tree)(Compact_node_list) in let result_list = - let root = [ Naive_tree.root doc] in + let root = Compact_node_list.create () in + let () = Compact_node_list.add (Compact_tree.root doc) root in let f, msg = match !Options.parallel, !Options.compose with true, true -> @@ -124,10 +124,13 @@ let main () = let s = Naive.stats () in Run.( Logger.msg `STATS - "@[tree size: %d@\ntraversals: %d@\ntransition fetch cache hit ratio: %f@\ntransition eval cache hit ratio: %f@]" - s.tree_size s.run - (float s.fetch_trans_cache_hit /. float s.fetch_trans_cache_access) - (float s.eval_trans_cache_hit /. float s.eval_trans_cache_access)); + "@[tree size: %d@\ntraversals: %d@\ntransition fetch cache miss ratio: %f@\ntransition eval cache miss ratio: %f@\nNumber of visited nodes per pass: %a@]" + s.tree_size s.pass + (float s.fetch_trans_cache_miss /. float s.fetch_trans_cache_access) + (float s.eval_trans_cache_miss /. 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); time (fun () -> let count = ref 1 in List.iter (fun results -> @@ -135,11 +138,11 @@ 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 (Compact_node_list.length results)); output_char output '\n'; end else - List.iter (fun n -> - Naive_tree.print_xml output doc n; + Compact_node_list.iter (fun n -> + Compact_tree.print_xml output doc n; output_char output '\n' ) results; output_string output "\n"; @@ -163,4 +166,6 @@ let () = Some s -> ("file " ^ s) | None -> "[stdin]") msg; exit 3 | Xpath.Ulexer.Error (s, e, msg) -> eprintf "Error: character %i-%i: %s\n%!" s e msg; exit 4 - | e -> eprintf "FATAL ERROR: %s\n%!" (Printexc.to_string e); exit 128 +(* | e -> Printexc.print_backtrace stderr; + flush stderr; + eprintf "FATAL ERROR: %s\n%!" (Printexc.to_string e); exit 128 *)