(******************************************************************************) (* SXSI : XPath evaluator *) (* Kim Nguyen (Kim.Nguyen@nicta.com.au) *) (* Copyright NICTA 2008 *) (* Distributed under the terms of the LGPL (see LICENCE) *) (******************************************************************************) (* This file should not be compiled but included with INCLUDE. This requires pa_macro.cmo to be loaded (see Makefile) *) IFNDEF DEBUG__ML__ THEN DEFINE DEBUG__ML__ IFDEF DEBUG THEN module Loc = Camlp4.PreCast.Loc DEFINE D_IGNORE_(e1,e2) = (let () = e1 in ();e2) DEFINE D_IF_(e1,e2) = e1 DEFINE D_TRACE_(e) = e ELSE DEFINE D_IGNORE_(e1,e2) = (e2) DEFINE D_IF_(e1,e2) = e2 DEFINE D_TRACE_(e) = () END (* IFDEF DEBUG *) IFDEF PROFILE THEN DEFINE REGISTER_PROF_(s) = (Hashtbl.replace Profile.table ("", s) (ref (0, []))) DEFINE PROF_(s, e) = let ___tmp_t1 = Unix.gettimeofday () in let ___tmp_result = e in let ___tmp_t2 = Unix.gettimeofday () in let ___r = Hashtbl.find Profile.table ("", s) in let ___c,___tl = !___r in ___r := (___c+1, ((___tmp_t2 -. ___tmp_t1) *. 1000.)::___tl); ___tmp_result ELSE DEFINE PROF_(s, e) = e DEFINE REGISTER_PROF_(s) = () END END (* IFNDEF DEBUG__ML__ *)