git-svn-id: svn+ssh://idea.nguyen.vg/svn/sxsi/trunk/xpathcomp@84 3cdefd35-fc62-479d...
authorkim <kim@3cdefd35-fc62-479d-8e8d-bae585ffb9ca>
Wed, 28 Jan 2009 03:52:45 +0000 (03:52 +0000)
committerkim <kim@3cdefd35-fc62-479d-8e8d-bae585ffb9ca>
Wed, 28 Jan 2009 03:52:45 +0000 (03:52 +0000)
SXSIStorageInterface.cpp
benchmark/main.ml
debug.ml
main.ml
tree.ml
tree.mli

index 98d15b7..6fe4883 100644 (file)
@@ -57,8 +57,9 @@ void SXSIStorageInterface::nodeFinished(string name)
 }
 
 void *SXSIStorageInterface::returnDocument(){
-
+#ifdef DEBUG
   printStats();
+#endif
   return ((void *) tree);
   
 }
index 7f6b3ad..93c673b 100644 (file)
@@ -62,7 +62,7 @@ struct
   let reference = false
   let time_factor = 1.0
   let mk_queryfile b doc q out = ()
-  let mk_cmdline b qout qfile doc q = [ doc; q ]@ (if b then [qout] else [])
+  let mk_cmdline b qout qfile doc q = [ "-d"; doc; q ]@ (if b then [qout] else [])
   let parse_rules = 
     [  ( ".*Parsing document :[ \\t]*\\([0-9]+\\.[0-9]*\\)ms.*",
         [ Input_parsing_time 1]);
index 1a1b3b3..de10dd0 100644 (file)
--- a/debug.ml
+++ b/debug.ml
@@ -20,14 +20,14 @@ module Loc = Camlp4.PreCast.Loc
 
 DEFINE D(x) = ignore(x);
 
-DEFINE MM(v,l) = Memory.register v (Loc.to_string (l))
+DEFINE MM(v,l) = (let ____x = v in (Memory.register ____x (Loc.to_string (l)));____x)
 let () = Memory.schedule_stats ()
 
 
 ELSE
 
 DEFINE D(x) = ();
-DEFINE MM(v,l) = ()
+DEFINE MM(v,l) = (v)
 
 END (* IFDEF DEBUG *)
 
diff --git a/main.ml b/main.ml
index b342388..217b2e2 100644 (file)
--- a/main.ml
+++ b/main.ml
@@ -29,7 +29,6 @@ let main filename query output =
                 ) () 
     in
     let _ = Tag.init (Tree.Binary.tag_pool v) in
-      MM(v,__LOCATION__);
       Printf.eprintf "Parsing query : ";    
       let query = try
        time
@@ -66,6 +65,9 @@ Options.parse_cmdline();;
 
 main !Options.input_file !Options.query !Options.output_file;;
 
+IFDEF DEBUG
+THEN
 Printf.eprintf "\n=================================================\nDEBUGGING\n%!";
 Tree.DEBUGTREE.print_stats Format.err_formatter;;
 Gc.full_major()
+ENDIF
diff --git a/tree.ml b/tree.ml
index ecd8e3b..3bfbfce 100644 (file)
--- a/tree.ml
+++ b/tree.ml
@@ -4,6 +4,7 @@
 (*  Copyright NICTA 2008                                                      *)
 (*  Distributed under the terms of the LGPL (see LICENCE)                     *)
 (******************************************************************************)
+INCLUDE "debug.ml"
 module type BINARY =
 sig
   type node_content
@@ -178,12 +179,16 @@ struct
 
 
     let parse_xml_uri str = node_of_t       
-      (parse_xml_uri str 
-        !Options.sample_factor !Options.index_empty_texts !Options.disable_text_collection)
+      (MM((parse_xml_uri str 
+            !Options.sample_factor 
+            !Options.index_empty_texts
+            !Options.disable_text_collection),__LOCATION__))
 
     let parse_xml_string str = node_of_t 
-      (parse_xml_string str
-        !Options.sample_factor !Options.index_empty_texts !Options.disable_text_collection)
+      (MM((parse_xml_string str
+        !Options.sample_factor 
+        !Options.index_empty_texts 
+        !Options.disable_text_collection),__LOCATION__))
 
 
     external pool : doc -> Tag.pool = "%identity"
@@ -384,8 +389,8 @@ end
 
 
 
-
-
+IFDEF DEBUG
+THEN
 module DEBUGTREE 
   = struct
     
@@ -572,3 +577,6 @@ module DEBUGTREE
 end
 
 module Binary = DEBUGTREE
+ELSE
+module Binary = XML.Binary
+END (* IFDEF DEBUG *)
index 6fa19b0..f3a4de6 100644 (file)
--- a/tree.mli
+++ b/tree.mli
@@ -32,7 +32,10 @@ end
 
 module Binary : BINARY
 
+IFDEF DEBUG
+THEN
 module DEBUGTREE : sig
   include BINARY
   val print_stats : Format.formatter -> unit
 end
+ENDIF