From 1c5c95673d1d3595f948e5dc674861a1f86b6158 Mon Sep 17 00:00:00 2001 From: kim Date: Wed, 28 Jan 2009 23:45:00 +0000 Subject: [PATCH] Actually commit the files. git-svn-id: svn+ssh://idea.nguyen.vg/svn/sxsi/trunk/xpathcomp@87 3cdefd35-fc62-479d-8e8d-bae585ffb9ca --- benchmark/Makefile | 12 ++++++------ benchmark/benchmark.ml | 42 ++++++++++++++++++++++-------------------- benchmark/config.ml | 27 +++++++++++++++++++++++++++ benchmark/main.ml | 22 +++++----------------- 4 files changed, 60 insertions(+), 43 deletions(-) create mode 100644 benchmark/config.ml diff --git a/benchmark/Makefile b/benchmark/Makefile index 11f4991..f02d6b8 100644 --- a/benchmark/Makefile +++ b/benchmark/Makefile @@ -1,10 +1,10 @@ -MLSRCS = benchmark.ml main.ml +MLSRCS = benchmark.ml main.ml MLISRCS = benchmark.mli MLOBJS = $(MLSRCS:.ml=.cmx) MLCINT = $(MLISRCS:.mli=.cmi) -OCAMLPACKAGES = unix,str +OCAMLPACKAGES = unix,str,camlp4 PPINCLUDES=$(OCAMLINCLUDES:%=-ppopt %) @@ -13,11 +13,11 @@ OCAMLOPT = ocamlopt OCAMLFIND = ocamlfind OCAMLMKLIB = ocamlmklib OCAMLDEP = ocamldep -LINK=$(OCAMLOPT) -linkpkg - +LINK=$(OCAMLOPT) -linkpkg camlp4lib.cmxa +SYNTAX=-syntax camlp4o -ppopt pa_macro.cmo all: $(MLOBJS) - $(OCAMLFIND) $(LINK) -o test_suite -package "$(OCAMLPACKAGES)" $(MLOBJS) + $(OCAMLFIND) $(LINK) -o test_suite -package "$(OCAMLPACKAGES)" $(SYNTAX) $(MLOBJS) .SUFFIXES: .ml .mli .cmx .cmi .PHONY: depend @@ -33,7 +33,7 @@ clean: depend: $(MLSRCS) $(MLISRCS) - @ $(OCAMLFIND) $(OCAMLDEP) -package "$(OCAMLPACKAGES)" $(MLSRCS) $(MLISRCS) >depend + @$(OCAMLFIND) $(OCAMLDEP) -package "$(OCAMLPACKAGES)" $(SYNTAX) $(MLSRCS) $(MLISRCS) >depend include depend diff --git a/benchmark/benchmark.ml b/benchmark/benchmark.ml index da741db..5418b64 100644 --- a/benchmark/benchmark.ml +++ b/benchmark/benchmark.ml @@ -251,27 +251,29 @@ struct Array.iteri ( fun docnum (_,docsize) -> let sres = [| (empty_stats()); (empty_stats()) |] in Printf.printf "Running query %.2d on document %.2d :\n%!" qnum docnum; - for j = (vb (not Conf.run_without_output)) to (vb Conf.run_with_output) do - if j = 0 then Printf.printf "No output : \t%!" - else Printf.printf "With output : \t%!"; - for i = 1 to Conf.num_runs do - let s = extract(run_query false (j==1) qnum docnum qset) in - if sres.(j).query_execution_time > s.query_execution_time - then sres.(j) <- s; - Printf.printf "pass %i ... %!" i; + + for k = 0 to 1 do + for j = (vb (not Conf.run_without_output)) to (vb Conf.run_with_output) do + if j = 0 then Printf.printf "No output : \t%!" + else Printf.printf "With output : \t%!"; + for i = 1 to Conf.num_runs do + let s = extract(run_query (k==1) (j==1) qnum docnum qset) in + if sres.(j).query_execution_time > s.query_execution_time + then sres.(j) <- s; + if (k==1) then + sres.(j).memory_usage <- s.memory_usage; + Printf.printf "pass %i ... %!" i; + done; + Printf.printf "Ok\n%!"; done; - Printf.printf "Ok\n%!"; - done; - Printf.printf "Monitoring memory use: ... %!"; - let s = extract(run_query true false qnum docnum qset) - in - sres.(1).memory_usage <- s.memory_usage; - Printf.printf "Ok\n%!"; - let _ = Array.iteri (fun i s -> s.print_output <- (i==1); - s.query <- qnum; - s.input_document <- docnum; - s.input_size <- docsize) sres - in lres := sres::!lres + if (k == 0) + then Printf.printf "Monitoring memory use: ... \n%!"; + done; + let _ = Array.iteri (fun i s -> s.print_output <- (i==1); + s.query <- qnum; + s.input_document <- docnum; + s.input_size <- docsize) sres + in lres := sres::!lres ) qset.documents )qset.queries in diff --git a/benchmark/config.ml b/benchmark/config.ml new file mode 100644 index 0000000..025b417 --- /dev/null +++ b/benchmark/config.ml @@ -0,0 +1,27 @@ +(* semi-colon separated list of input documents *) +let documents = [ "../tests/base.xml" ] + +(* semi-colon separated list of XPath queries *) +let queries = [ "/child::*"; "//*" ] + + +(* I is the initial configuration + * MK (engine) (configuration) gives a new configuration + * valid engines are SXSI and SaxonBXQuery + * ex: if you only want to test SaxonBXQuery : + * module TEST = MK (SaxonBXQuery) (I) + *) + +module CONF : CONFIGURATION = +struct + let path = "." + let result_basename = "test" + let num_runs = 5 + let run_with_output = true + let run_without_output = true +end + +module I = INIT_TESTER (CONF) + +module TEST = MK (SXSI) (MK (SaxonBXQuery) (I)) + diff --git a/benchmark/main.ml b/benchmark/main.ml index 93c673b..935528c 100644 --- a/benchmark/main.ml +++ b/benchmark/main.ml @@ -79,29 +79,17 @@ struct end -module CONF : CONFIGURATION = -struct - let path = "." - let result_basename = "test" - let num_runs = 1 - let run_with_output = false - let run_without_output = true -end -module I = INIT_TESTER (CONF) -module TestOld = MK (SXSI) (MK (SaxonBXQuery) (I)) -module Test = MK (SXSI) (I) +INCLUDE "config.ml" -let l = Test.test_engine [] (make_queryset - ["/home/kim/Documents/Work/Code/xpathcomp/tests/tiny.xml"] - ["/child::*"]) +let l = TEST.test_engine [] (make_queryset + documents + queries + ) ;; - - - List.iter (function (e,d),s -> Printf.printf "\n-------------- %s -----------------" e; Array.iter ( fun i -> -- 2.17.1