X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=src%2Fmain.ml;h=909a0b87ea76e4e3ca963a61670d293bdb3e4eab;hb=7e27afe6fa006ad355237ccc0695c6493ea57929;hp=96e835e4050f4d743134162fe6b47727036efa20;hpb=e55eb5e1ceafa840dc1d137d7fae5fb06eac3875;p=SXSI%2Fxpathcomp.git diff --git a/src/main.ml b/src/main.ml index 96e835e..909a0b8 100644 --- a/src/main.ml +++ b/src/main.ml @@ -21,60 +21,60 @@ let tuned_gc = { default_gc with let mk_runtime run auto doc arg count print outfile = fun () -> - if !Options.do_perf then start_perf (); - let r = time ~count:!Options.repeat ~msg:"Execution time" (run auto doc) arg in - if !Options.do_perf then stop_perf (); + if !Config.do_perf then start_perf (); + let r = Utils.time ~count:!Config.repeat ~msg:"Execution time" (run auto doc) arg in + if !Config.do_perf then stop_perf (); Logger.verbose Format.err_formatter "Number of results: %i@\n" (count r); match outfile with None -> () | Some file -> - time ~count:1 ~msg:"Serialization time" (print file doc) r + Utils.time ~count:1 ~msg:"Serialization time" (print file !Config.no_wrap_results doc) r ;; let main v query_string output = Tag.init (Tree.tag_operations v); - if !Options.docstats then Tree.stats v; + if !Config.docstats then Tree.stats v; let query = - time ~msg:"Parsing query" XPath.parse query_string + Utils.time ~msg:"Parsing query" XPath.parse query_string in Logger.verbose Format.err_formatter "Parsed query:%a@\n" XPath.Ast.print query; let auto, bu_info = - time ~msg:"Compiling query" Compile.compile query + Utils.time ~msg:"Compiling query" Compile.compile query in - if !Options.verbose then Ata.print Format.err_formatter auto; + if !Config.verbose then Ata.print Format.err_formatter auto; Gc.full_major(); Gc.compact(); Gc.set (tuned_gc); let runtime = - match !Options.bottom_up, bu_info with + match !Config.bottom_up, bu_info with | true, Some [ (query, pattern) ] -> - if !Options.count_only then + if !Config.count_only then let module R = ResJIT.Count in let module M = Runtime.Make(R) in - mk_runtime M.bottom_up_run auto v (query, pattern) R.NS.length R.NS.serialize !Options.output_file + mk_runtime M.bottom_up_run auto v (query, pattern) R.NS.length R.NS.serialize !Config.output_file else let module R = ResJIT.Mat in let module M = Runtime.Make(R) in - mk_runtime M.bottom_up_run auto v (query, pattern) R.NS.length R.NS.serialize !Options.output_file + mk_runtime M.bottom_up_run auto v (query, pattern) R.NS.length R.NS.serialize !Config.output_file | _ -> (* run the query top_down *) - if !Options.bottom_up then + if !Config.bottom_up then Logger.verbose Format.err_formatter "Cannot run the query in bottom-up mode, using top-down evaluator@\n@?"; - if !Options.count_only then + if !Config.count_only then let module R = ResJIT.Count in let module M = Runtime.Make(R) in - if !Options.twopass then + if !Config.twopass then mk_runtime M.twopass_top_down_run auto v Tree.root R.NS.length R.NS.serialize None else - mk_runtime M.top_down_run auto v Tree.root R.NS.length R.NS.serialize !Options.output_file + mk_runtime M.top_down_run auto v Tree.root R.NS.length R.NS.serialize !Config.output_file else let module R = ResJIT.Mat in let module M = Runtime.Make(R) in - mk_runtime M.top_down_run auto v Tree.root R.NS.length R.NS.serialize !Options.output_file + mk_runtime M.top_down_run auto v Tree.root R.NS.length R.NS.serialize !Config.output_file in runtime () ;; @@ -85,32 +85,32 @@ let _ = try Printexc.record_backtrace true; let document = - if Filename.check_suffix !Options.input_file ".srx" + if Filename.check_suffix !Config.input_file ".srx" then - time - ~msg:"Loading file" + Utils.time + ~msg:"Loading Index file" (Tree.load - ~sample:!Options.sample_factor - ~load_text:(not !Options.disable_text_collection)) - !Options.input_file + ~sample:!Config.sample_factor + ~load_text:(not !Config.disable_text_collection)) + !Config.input_file else let v = - time - ~msg:"Parsing document" + Utils.time + ~msg:"Loading XML file" (Tree.parse_xml_uri) - !Options.input_file + !Config.input_file in let () = - if !Options.save_file <> "" + if !Config.save_file <> "" then - time + Utils.time ~msg:"Writing file to disk" (Tree.save v) - !Options.save_file; + !Config.save_file; in v in - main document !Options.query !Options.output_file; + main document !Config.query !Config.output_file; Logger.verbose Format.err_formatter "Maximum resident set size: %s @\n" (read_procmem()); Gc.full_major(); Profile.summary Format.err_formatter