From 07bb13d4efdcb08d1a52c3e16829c60eb4025561 Mon Sep 17 00:00:00 2001
From: Erwan Jahier <jahier@imag.fr>
Date: Mon, 4 Feb 2013 21:33:39 +0100
Subject: [PATCH] Fix a performance bug (again) due to verbose printing not
 being lazy.

The only culprit was the one in unifyClock.ml::249, but
I've lazyfied most of the non-trivial verbose call.

The 2 remaining unresolved testq that were timeout-ing now pass in a few ms...

The whole non-reg test time has been divided by more than 2!
---
 src/ast2lic.ml         |  6 ++--
 src/evalClock.ml       |  9 +++---
 src/l2lExpandArrays.ml |  6 ++--
 src/l2lExpandMetaOp.ml |  5 ++--
 src/l2lExpandNodes.ml  |  7 +++--
 src/l2lRmPoly.ml       | 12 ++++----
 src/l2lSplit.ml        |  9 +++---
 src/lic.ml             |  5 ++--
 src/licEvalType.ml     |  5 ++--
 src/licPrg.ml          |  3 +-
 src/licTab.ml          | 64 +++++++++++++++++++++++-------------------
 src/unifyClock.ml      |  5 ++--
 src/verbose.mli        |  2 +-
 test/lus2lic.log.ref   | 15 +++++-----
 test/lus2lic.sum       |  9 +++---
 test/lus2lic.time      |  4 +--
 todo.org               | 25 ++---------------
 todo.org_archive       | 31 ++++++++++++++++++++
 18 files changed, 124 insertions(+), 98 deletions(-)

diff --git a/src/ast2lic.ml b/src/ast2lic.ml
index 1bc54607..f54e7b5b 100644
--- a/src/ast2lic.ml
+++ b/src/ast2lic.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 01/02/2013 (at 14:58) by Erwan Jahier> *)
+(* Time-stamp: <modified the 04/02/2013 (at 21:10) by Erwan JAHIER> *)
 
 
 open Lxm
@@ -133,8 +133,8 @@ let get_abstract_static_params
 : abstract_static_param list =
                      
    Verbose.exe ~flag:dbg (fun () ->
-      Printf.fprintf stderr "#DBG: Ast2lic.get_abstract_static %s\n"
-         (Ident.raw_string_of_idref idref)
+     Printf.fprintf stderr "#DBG: Ast2lic.get_abstract_static %s\n"
+       (Ident.raw_string_of_idref idref)
    ) ;
    match (idref.id_pack, idref.id_id) with
       | (Some "Lustre", "map")
diff --git a/src/evalClock.ml b/src/evalClock.ml
index db41a92a..42014c7f 100644
--- a/src/evalClock.ml
+++ b/src/evalClock.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 01/02/2013 (at 17:52) by Erwan Jahier> *)
+(* Time-stamp: <modified the 04/02/2013 (at 20:53) by Erwan JAHIER> *)
  
   
 open AstPredef
@@ -194,9 +194,10 @@ let rec (f : Lxm.t -> Lic.id_solver -> subst -> Lic.val_exp -> Lic.clock list ->
     let inf_clks = List.map (fun (id,clk) -> id, apply_subst2 s clk) inf_clks in
     let clks = snd (List.split inf_clks) in
     let ve = { ve with ve_clk = clks } in
-    Verbose.print_string ~level:3 (
-      "Clocking the expression '" ^ (LicDump.string_of_val_exp_eff ve) ^"': "^ 
-        (LicDump.string_of_clock2 (List.hd clks)) ^"\n");
+    if Verbose.level() > 2 then
+      print_string  (
+        "Clocking the expression '" ^ (LicDump.string_of_val_exp_eff ve) ^"': "^ 
+          (LicDump.string_of_clock2 (List.hd clks)) ^"\n");
     ve, inf_clks, s
 
 and f_aux id_solver s ve =
diff --git a/src/l2lExpandArrays.ml b/src/l2lExpandArrays.ml
index d4900356..34f116e2 100644
--- a/src/l2lExpandArrays.ml
+++ b/src/l2lExpandArrays.ml
@@ -1,4 +1,4 @@
-(** Time-stamp: <modified the 01/02/2013 (at 17:25) by Erwan Jahier> *)
+(** Time-stamp: <modified the 04/02/2013 (at 21:22) by Erwan JAHIER> *)
 
 (* Replace structures and arrays by as many variables as necessary.
    Since structures can be recursive, it migth be a lot of new variables...
@@ -630,8 +630,8 @@ let rec (doit : LicPrg.t -> LicPrg.t) =
   (** transform nodes *)
     let rec (do_node : Lic.node_key -> Lic.node_exp -> LicPrg.t -> LicPrg.t) = 
       fun nk ne outprg -> 
-        Verbose.printf ~flag:dbg "#DBG: L2lExpandArrays expands '%s'\n"
-            (Lic.string_of_node_key nk);
+        Verbose.exe ~flag:dbg (fun() -> Printf.printf "#DBG: L2lExpandArrays expands '%s'\n"
+            (Lic.string_of_node_key nk));
         let lctx = {
           idgen = LicPrg.fresh_var_id_generator inprg ne;
           node = ne;
diff --git a/src/l2lExpandMetaOp.ml b/src/l2lExpandMetaOp.ml
index dbce7c06..ab094537 100644
--- a/src/l2lExpandMetaOp.ml
+++ b/src/l2lExpandMetaOp.ml
@@ -1,4 +1,4 @@
-(** Time-stamp: <modified the 29/01/2013 (at 16:20) by Erwan Jahier> *)
+(** Time-stamp: <modified the 04/02/2013 (at 21:14) by Erwan JAHIER> *)
 
 open Lxm
 open Lic
@@ -398,7 +398,8 @@ let rec (create_meta_op_body:  local_ctx -> Lic.node_key -> Lic.node_body * var_
 let rec (node : local_ctx -> Lic.node_exp -> Lic.node_exp) =
   fun lctx n ->
     let sonk = Lic.string_of_node_key in
-    Verbose.printf ~flag:dbg "#DBG: L2lInlineMetaOp %s\n" (sonk n.node_key_eff);
+    Verbose.exe ~flag:dbg (fun () ->
+      Printf.printf "#DBG: L2lInlineMetaOp %s\n" (sonk n.node_key_eff));
     match n.def_eff with
       | MetaOpLic nk ->
         let nbody, nlocs = create_meta_op_body lctx nk in
diff --git a/src/l2lExpandNodes.ml b/src/l2lExpandNodes.ml
index 08b21f30..a191a20d 100644
--- a/src/l2lExpandNodes.ml
+++ b/src/l2lExpandNodes.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 01/02/2013 (at 08:42) by Erwan Jahier> *)
+(* Time-stamp: <modified the 04/02/2013 (at 21:14) by Erwan JAHIER> *)
 
 
 open Lxm
@@ -292,8 +292,9 @@ let (doit :  LicPrg.t -> LicPrg.t) =
     (** transform nodes *)
     let rec (do_node : Lic.node_key -> Lic.node_exp -> LicPrg.t -> LicPrg.t) = 
       fun nk ne outprg -> 
-        Verbose.printf ~flag:dbg "#DBG: expand nodes of '%s'\n"
-          (Lic.string_of_node_key nk);
+        Verbose.exe ~flag:dbg (fun () ->
+          Printf.printf "#DBG: expand nodes of '%s'\n"
+            (Lic.string_of_node_key nk));
         let lctx = {
           idgen = LicPrg.fresh_var_id_generator inprg ne;
           node = ne;
diff --git a/src/l2lRmPoly.ml b/src/l2lRmPoly.ml
index 7fb5a9d3..eb0e2031 100644
--- a/src/l2lRmPoly.ml
+++ b/src/l2lRmPoly.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 01/02/2013 (at 08:43) by Erwan Jahier> *)
+(* Time-stamp: <modified the 04/02/2013 (at 21:23) by Erwan JAHIER> *)
 
 (*
 Source 2 source transformation :
@@ -48,8 +48,9 @@ let rec doit (inprg : LicPrg.t) : LicPrg.t =
   let rec do_node k (ne:Lic.node_exp) = (
     if node_is_poly ne then
       (* pour les noeuds polymorphes/surchagés, on fait rien du tout *)
-      Verbose.printf "### Warning: no code generated for polymorphic/overloaded node '%s'\n"
-        (Lic.string_of_node_key ne.node_key_eff)
+      Verbose.exe (fun() -> Printf.printf
+        "### Warning: no code generated for polymorphic/overloaded node '%s'\n"
+        (Lic.string_of_node_key ne.node_key_eff))
     else
       let def' = match ne.def_eff with
         | MetaOpLic _
@@ -155,12 +156,13 @@ let rec doit (inprg : LicPrg.t) : LicPrg.t =
   *)
     and solve_poly (tmatches: Lic.type_matches) (nk: Lic.node_key) (ne: Lic.node_exp)
         : Lic.node_key = 
-      Verbose.printf ~flag:dbg
+    Verbose.exe ~flag:dbg (fun () ->
+      Printf.printf 
         "#DBG: L2lRmPoly.solve_poly nk='%s'\n#  prof=%s'\n# matches='%s'\n"
         (Lic.string_of_node_key nk)
         (Lic.string_of_type_profile (Lic.profile_of_node_exp ne))
         (Lic.string_of_type_matches tmatches)
-      ;
+    );
       let do_var vi =
         let nt = Lic.subst_matches tmatches vi.var_type_eff in
         assert(not (Lic.type_is_poly nt));
diff --git a/src/l2lSplit.ml b/src/l2lSplit.ml
index 188a81e7..9a82d4ca 100644
--- a/src/l2lSplit.ml
+++ b/src/l2lSplit.ml
@@ -321,8 +321,9 @@ and (split_val_exp_list : bool ->
     (vel,(eql,vl))
 
 and split_node (getid: LicPrg.id_generator) (n: Lic.node_exp) : Lic.node_exp =
-  Verbose.printf ~flag:dbg "*** Splitting node  %s\n"
-    (LicDump.string_of_node_key_iter n.node_key_eff);
+      Verbose.exe ~flag:dbg (fun () ->
+        Printf.printf "*** Splitting node  %s\n"
+          (LicDump.string_of_node_key_iter n.node_key_eff));
   let res = match n.def_eff with
     | ExternLic 
     | MetaOpLic _
@@ -366,8 +367,8 @@ let rec doit (inprg : LicPrg.t) : LicPrg.t =
    (** TRAITE LES NOEUDS : *)
    let rec do_node k (ne:Lic.node_exp) =
       (* On passe en parametre un constructeur de nouvelle variable locale *)
-     Verbose.printf ~flag:dbg "#DBG: split equations of '%s'\n"
-       (Lic.string_of_node_key k);
+     Verbose.exe ~flag:dbg (fun() -> Printf.printf  "#DBG: split equations of '%s'\n"
+       (Lic.string_of_node_key k));
       let getid = LicPrg.fresh_var_id_generator inprg ne in
       let ne' = split_node getid ne in
       res := LicPrg.add_node k ne' !res
diff --git a/src/lic.ml b/src/lic.ml
index b841c8af..269266a5 100644
--- a/src/lic.ml
+++ b/src/lic.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 01/02/2013 (at 17:57) by Erwan Jahier> *)
+(* Time-stamp: <modified the 04/02/2013 (at 21:00) by Erwan JAHIER> *)
 
 (** Define the Data Structure representing Compiled programs. *)
 
@@ -778,7 +778,8 @@ exception Global_node_error of node_key * string
 
 let (make_local_env : node_key -> local_env) =
   fun nk ->
-    Verbose.printf ~flag:dbg "#make_local_env %s\n" (string_of_node_key nk);
+    Verbose.exe ~flag:dbg (fun () ->
+      printf "#make_local_env %s\n" (string_of_node_key nk));
     let res =
       {
         lenv_node_key = nk;
diff --git a/src/licEvalType.ml b/src/licEvalType.ml
index 62936a90..dd4f9045 100644
--- a/src/licEvalType.ml
+++ b/src/licEvalType.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 30/01/2013 (at 13:49) by Erwan Jahier> *)
+(* Time-stamp: <modified the 04/02/2013 (at 21:24) by Erwan JAHIER> *)
 
 open AstPredef
 open Lxm
@@ -142,7 +142,8 @@ let condact_profile
     let dflt_types = types_of_const dflt in
     let dl = List.length dflt_types in
     let ol = List.length outlist in
-    Verbose.printf ~level:3 "  condact_profile: dflt=%s\n" (string_of_const_eff dflt);
+        Verbose.exe ~flag:dbg ~level:3  (fun () ->
+          Verbose.printf "  condact_profile: dflt=%s\n" (string_of_const_eff dflt));
     let _ = if (dl <> ol) then
         raise_arity_error " in condact default arg" dl ol in
     let out_types = List.map (fun x -> x.var_type_eff) outlist in
diff --git a/src/licPrg.ml b/src/licPrg.ml
index 11122196..28753423 100644
--- a/src/licPrg.ml
+++ b/src/licPrg.ml
@@ -100,7 +100,8 @@ let add_const (k:Lic.item_key) (v:Lic.const) (prg:t) : t =
    { prg with consts = ItemKeyMap.add k v prg.consts }
 
 let add_node (k:Lic.node_key) (v:Lic.node_exp) (prg:t) : t =
-  Verbose.printf ~level:3 "## LicPrg.add_node %s\n" (LicDump.string_of_node_key_rec k);
+  Verbose.exe ~level:3 (fun () ->
+    Printf.printf  "## LicPrg.add_node %s\n" (LicDump.string_of_node_key_rec k));
    { prg with nodes = NodeKeyMap.add k v prg.nodes }
 
 
diff --git a/src/licTab.ml b/src/licTab.ml
index 0ca80a01..3622f8eb 100644
--- a/src/licTab.ml
+++ b/src/licTab.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 01/02/2013 (at 17:25) by Erwan Jahier> *)
+(* Time-stamp: <modified the 04/02/2013 (at 21:27) by Erwan JAHIER> *)
 
 
 open Lxm
@@ -173,7 +173,7 @@ let x_check
    (x_key          : 'x_key)
    (lxm            : Lxm.t)
 : 'x_eff =
-   Verbose.printf ~flag:dbg "#DBG: licTab.x_check '%s'\n" (Lxm.details lxm);
+   Verbose.exe ~flag:dbg (fun () -> Printf.printf "#DBG: licTab.x_check '%s'\n" (Lxm.details lxm));
    try lookup_x_eff tab x_key lxm 
    with Not_found -> (
       let res = try x_builtin this x_key lxm 
@@ -255,10 +255,10 @@ let lookup_node_exp_eff
 : Lic.node_exp = 
    try 
       let node_exp = lookup_x_eff "node ref "  (fun k -> fst k) tbl key lxm in
-      Verbose.printf ~flag:dbg
-         "#DBG: licTab.lookup_node_exp_eff: FOUND node key '%s'\n"
-            (Lic.string_of_node_key key)
-      ; 
+      Verbose.exe ~flag:dbg (fun () -> Printf.printf
+        "#DBG: licTab.lookup_node_exp_eff: FOUND node key '%s'\n"
+        (Lic.string_of_node_key key)
+      ); 
       node_exp
    with Not_found -> (
       Verbose.exe ~flag:dbg (
@@ -285,10 +285,10 @@ let node_builtin
       with Not_found -> assert false
    in
    let node_exp = LicMetaOp.do_node nk2nd key lxm in
-   Verbose.printf ~flag:dbg
+      Verbose.exe ~flag:dbg (fun () -> Printf.printf 
       "#DBG: licTab.lookup_node_exp_eff: BUILT-IN node key '%s'\n"
          (Lic.string_of_node_key key)
-   ;
+      );
    Hashtbl.replace this.nodes key (Lic.Checked node_exp);
    Hashtbl.replace this.prov_nodes key (Lic.Checked node_exp);
    node_exp
@@ -351,7 +351,8 @@ let rec type_check
     (key: Ident.long)
     (lxm: Lxm.t)
     : Lic.type_ =
-  Verbose.printf ~flag:dbg "#DBG: licTab.type_check '%s'\n" (Ident.string_of_long2 key);
+  Verbose.exe ~flag:dbg (fun () -> 
+    Printf.printf "#DBG: licTab.type_check '%s'\n" (Ident.string_of_long2 key));
   x_check this.types AstTabSymbol.find_type type_check_do type_builtin lookup_type_eff 
     Ident.pack_of_long Ident.of_long this
     key lxm
@@ -362,7 +363,8 @@ and const_check
     (key: Ident.long)
     (lxm: Lxm.t)
     : Lic.const =
-  Verbose.printf ~flag:dbg "#DBG: licTab.const_check '%s'\n" (Ident.string_of_long2 key);
+  Verbose.exe ~flag:dbg (fun() -> Printf.printf 
+    "#DBG: licTab.const_check '%s'\n" (Ident.string_of_long2 key));
   x_check this.consts AstTabSymbol.find_const const_check_do const_builtin lookup_const_eff 
     Ident.pack_of_long Ident.of_long this
     key lxm
@@ -373,7 +375,8 @@ and type_check_interface
     (key: Ident.long)
     (lxm: Lxm.t)
     : Lic.type_ =
-  Verbose.printf ~flag:dbg "#DBG: licTab.type_check_interface '%s'\n" (Ident.string_of_long2 key);
+  Verbose.exe ~flag:dbg (fun() -> Printf.printf
+    "#DBG: licTab.type_check_interface '%s'\n" (Ident.string_of_long2 key));
   x_check_interface 
     this.prov_types AstTabSymbol.find_type type_check type_check_interface_do 
     type_builtin lookup_type_eff Ident.pack_of_long Ident.of_long this
@@ -385,7 +388,8 @@ and const_check_interface
     (key: Ident.long)
     (lxm: Lxm.t)
     : Lic.const =
-  Verbose.printf ~flag:dbg "#DBG: licTab.const_check_interface '%s'\n" (Ident.string_of_long2 key);
+  Verbose.exe ~flag:dbg (fun () -> Printf.printf
+    "#DBG: licTab.const_check_interface '%s'\n" (Ident.string_of_long2 key));
   x_check_interface 
     this.prov_consts AstTabSymbol.find_const const_check const_check_interface_do
     const_builtin lookup_const_eff Ident.pack_of_long Ident.of_long this
@@ -676,7 +680,7 @@ and (node_check_interface_do: t -> Lic.node_key -> Lxm.t ->
     and obtypes = List.map (fun v -> v.var_type_eff) body_node_exp_eff.outlist_eff
     and optypes = List.map (fun v -> v.var_type_eff) prov_node_exp_eff.outlist_eff 
     in
-    let topt = UnifyType.profile_is_compatible nk
+    let _topt = UnifyType.profile_is_compatible nk
       node_def.src (iptypes,ibtypes) (optypes,obtypes)
     in
     if
@@ -742,19 +746,18 @@ and (node_check_interface_do: t -> Lic.node_key -> Lxm.t ->
           : Lic.node_exp =
            (* START node_check_do *)
            (
-             Verbose.printf ~flag:dbg
+             Verbose.exe ~flag:dbg (fun () -> Printf.printf
                "#DBG: ENTERING node_check_do '%s'\n     (%s)\n"
                (Lic.string_of_node_key nk)
                (Lxm.details lxm)
-             ; 
+             ); 
              let lxm = node_def.src in
              (* Creates a local_env with just the global bindings,
                 local bindinds will be added later (side effect)
              *)
              let local_env = make_local_env nk in
              let _ =
-               Verbose.exe ~flag:dbg
-                 ( fun () -> 
+               Verbose.exe ~flag:dbg (fun () -> 
                    Printf.printf "#  local_env while entering (node_check_do %s):\n" 
                      (Lic.string_of_node_key nk);
                    Lic.dump_local_env stderr local_env;
@@ -814,8 +817,8 @@ and (node_check_interface_do: t -> Lic.node_key -> Lxm.t ->
              let make_node_eff id node_def_eff = (
                (* building not aliased nodes *)
                Verbose.exe ~level:3 
-                 ( fun () -> 
-                   Printf.printf "*** local_env while entering (make_node_eff %s):\n" (Ident.to_string id);
+                 (fun () -> Printf.printf
+                   "*** local_env while entering (make_node_eff %s):\n" (Ident.to_string id);
                    Lic.dump_local_env stderr local_env
                  );
                (********************************************************)
@@ -857,8 +860,8 @@ and (node_check_interface_do: t -> Lic.node_key -> Lxm.t ->
                  let id_key = ("", id) in
                  try (
                    let ce = lookup_const_eff temp_const_eff_tab id_key lxm in
-                   Verbose.printf ~level:3 " * const %s already treated = %s\n" 
-                     id (LicDump.string_of_const_eff ce);
+                   Verbose.exe ~level:3 (fun() -> Printf.printf " * const %s already treated = %s\n" 
+                     id (LicDump.string_of_const_eff ce));
                    ce
                  ) with Not_found -> (
                    let (lxmdef, toptdef, vedef) = Hashtbl.find temp_const_def_tab id in
@@ -884,8 +887,8 @@ and (node_check_interface_do: t -> Lic.node_key -> Lxm.t ->
                      | [] -> assert false (* should not occur *)
                      | _::_ -> raise (Compile_error(lxmdef, "bad constant value: tuple not allowed"))
                    in
-                   Verbose.printf ~level:3 " * const %s evaluated to %s\n"
-                     id (LicDump.string_of_const_eff ce);
+                   Verbose.exe ~level:3 (fun() -> Printf.printf " * const %s evaluated to %s\n"
+                     id (LicDump.string_of_const_eff ce));
                    Hashtbl.replace temp_const_eff_tab id_key (Checked ce) ;
                    ce
                  )
@@ -905,7 +908,8 @@ and (node_check_interface_do: t -> Lic.node_key -> Lxm.t ->
                    Verbose.printf ~level:3 
                      " * %s not a local const, should be global ?" (Ident.string_of_idref idrf);
                    let ce = node_id_solver.id2const idrf lxm in
-                   Verbose.printf ~level:3 " YES -> %s\n" (LicDump.string_of_const_eff ce);
+                   Verbose.exe ~level:3 (fun() -> Printf.printf
+                     " YES -> %s\n" (LicDump.string_of_const_eff ce));
                    ce
                  )
                ) in
@@ -913,13 +917,14 @@ and (node_check_interface_do: t -> Lic.node_key -> Lxm.t ->
                Hashtbl.iter (fun id _ -> let _ = treat_local_const id in ()) temp_const_def_tab ;
                (* Finally, adds each local const to ICI *)
                let add_local_const idref ceck = (
-                 Verbose.printf ~level:3 " * add_local_const %s = %s\n"
+                 Verbose.exe ~level:3 (fun() -> Printf.printf 
+                   " * add_local_const %s = %s\n"
                    (snd idref)
                    (match ceck with
                      | Checking -> "Checking"
                      | Checked ce -> (LicDump.string_of_const_eff ce)
                      | Incorrect -> "Incorrect"
-                   );
+                   ));
                  match ceck with
                    | Checked ce -> Hashtbl.add local_env.lenv_const (snd idref) ce
                    | _ -> assert false
@@ -1124,10 +1129,10 @@ and (node_check_interface_do: t -> Lic.node_key -> Lxm.t ->
              in
              L2lCheckOutputs.check_node res;
              (* gen_code provide_flag current_env res; *)
-             Verbose.printf ~flag:dbg
+             Verbose.exe ~flag:dbg (fun() -> Printf.printf
                "#DBG: EXITING  node_check_do '%s'\n"
                (Lic.string_of_node_key nk)
-             ; 
+             ); 
              res
            )
     (*END node_check_do *)
@@ -1156,7 +1161,8 @@ and (node_check_interface_do: t -> Lic.node_key -> Lxm.t ->
           (vol: var_info list)
           (lxm: Lxm.t)
           : node_exp =
-           Verbose.printf ~level:3 "*** Lic.make_alias_node %s \n" (Ident.long_to_string (fst alias_nk));
+           Verbose.printf ~level:3 
+             "*** Lic.make_alias_node %s \n" (Ident.long_to_string (fst alias_nk));
       flush stdout;
 
       let (outs:left list) = List.map  (fun vi -> LeftVarLic (vi, lxm)) vol in
diff --git a/src/unifyClock.ml b/src/unifyClock.ml
index 3a92f536..23de6e6c 100644
--- a/src/unifyClock.ml
+++ b/src/unifyClock.ml
@@ -1,4 +1,4 @@
-(* Time-stamp: <modified the 01/02/2013 (at 08:28) by Erwan Jahier> *)
+(* Time-stamp: <modified the 04/02/2013 (at 20:42) by Erwan JAHIER> *)
 
 
 open LicDump
@@ -246,7 +246,8 @@ let (f : Lxm.t -> subst -> Lic.clock -> Lic.clock -> subst) =
       ci1 = ci2 || is_clock_var ci1 || is_clock_var ci2
     in
     if unifiable then (
-	   Verbose.print_string ~level:3 (
+ 	   if Verbose.level() > 2 then
+	   Verbose.print_string (
 	     "# clock checking: unifying '" ^ (ci2str ci1) ^
 	       "' and '" ^ (ci2str ci2) ^ "' ->  "^ (subst_to_string s) ^"\n");
 	   flush stdout;
diff --git a/src/verbose.mli b/src/verbose.mli
index 1d2b4d4c..6dd664ff 100644
--- a/src/verbose.mli
+++ b/src/verbose.mli
@@ -13,7 +13,7 @@ Verbose.put "format" args...
 val on : unit -> unit
 val off : unit -> unit
 val set : int -> unit
-
+val level : unit -> int
 
 (* GESTION DES FLAGS DE VERBBOSE POUR LE DEBUG "FIN" 
 Usage typique :
diff --git a/test/lus2lic.log.ref b/test/lus2lic.log.ref
index 63e3b305..20681a6a 100644
--- a/test/lus2lic.log.ref
+++ b/test/lus2lic.log.ref
@@ -1,4 +1,4 @@
-Test Run By jahier on Mon Feb  4 19:16:58 2013
+Test Run By jahier on Mon Feb  4 21:18:05 2013
 Native configuration is i686-pc-linux-gnu
 
 		=== lus2lic tests ===
@@ -464,9 +464,9 @@ PASS: ./lus2lic {-ec -o /tmp/filter.ec should_work/filter.lus}
 spawn ./ec2c -o /tmp/filter.c /tmp/filter.ec
 PASS: ./ec2c {-o /tmp/filter.c /tmp/filter.ec}
 spawn ./lus2lic -o /tmp/ec.lic should_work/ec.lus
-UNRESOLVED: Time out: ./lus2lic {-o /tmp/ec.lic should_work/ec.lus}
+PASS: ./lus2lic {-o /tmp/ec.lic should_work/ec.lus}
 spawn ./lus2lic -ec -o /tmp/ec.ec should_work/ec.lus
-UNRESOLVED: Time out: ./lus2lic {-ec -o /tmp/ec.ec should_work/ec.lus}
+PASS: ./lus2lic {-ec -o /tmp/ec.ec should_work/ec.lus}
 spawn ./ec2c -o /tmp/ec.c /tmp/ec.ec
 PASS: ./ec2c {-o /tmp/ec.c /tmp/ec.ec}
 spawn ./lus2lic -o /tmp/morel3.lic should_work/morel3.lus
@@ -1711,7 +1711,7 @@ spawn ./lus2lic -o /tmp/m.lic should_fail/semantics/m.lus
 *** syntax error
 
 XFAIL: Test bad programs (semantics): lus2lic {-o /tmp/m.lic should_fail/semantics/m.lus}
-testcase ./lus2lic.tests/non-reg.exp completed in 54 seconds
+testcase ./lus2lic.tests/non-reg.exp completed in 24 seconds
 Running ./lus2lic.tests/progression.exp ...
 spawn ./lus2lic -o /tmp/when_not.out should_work/broken/when_not.lus
 PASS: ./lus2lic {    -o /tmp/when_not.out should_work/broken/when_not.lus}
@@ -1748,12 +1748,11 @@ spawn ./lus2lic -o /tmp/activation1.lic should_fail/semantics/broken/activation1
 XPASS: Test bad programs (semantics): lus2lic {-o /tmp/activation1.lic should_fail/semantics/broken/activation1.lus}
 spawn ./lus2lic -o /tmp/bug.lic should_fail/semantics/broken/bug.lus
 XPASS: Test bad programs (semantics): lus2lic {-o /tmp/bug.lic should_fail/semantics/broken/bug.lus}
-testcase ./lus2lic.tests/progression.exp completed in 1 seconds
+testcase ./lus2lic.tests/progression.exp completed in 0 seconds
 
 		=== lus2lic Summary ===
 
-# of expected passes		739
+# of expected passes		741
 # of unexpected successes	11
 # of expected failures		37
-# of unresolved testcases	2
-runtest completed at Mon Feb  4 19:17:53 2013
+runtest completed at Mon Feb  4 21:18:29 2013
diff --git a/test/lus2lic.sum b/test/lus2lic.sum
index 3797267e..ce96debf 100644
--- a/test/lus2lic.sum
+++ b/test/lus2lic.sum
@@ -1,4 +1,4 @@
-Test Run By jahier on Mon Feb  4 19:26:05 2013
+Test Run By jahier on Mon Feb  4 21:28:30 2013
 Native configuration is i686-pc-linux-gnu
 
 		=== lus2lic tests ===
@@ -234,8 +234,8 @@ PASS: ./ec2c {-o /tmp/X3.c /tmp/X3.ec}
 PASS: ./lus2lic {-o /tmp/filter.lic should_work/filter.lus}
 PASS: ./lus2lic {-ec -o /tmp/filter.ec should_work/filter.lus}
 PASS: ./ec2c {-o /tmp/filter.c /tmp/filter.ec}
-UNRESOLVED: Time out: ./lus2lic {-o /tmp/ec.lic should_work/ec.lus}
-UNRESOLVED: Time out: ./lus2lic {-ec -o /tmp/ec.ec should_work/ec.lus}
+PASS: ./lus2lic {-o /tmp/ec.lic should_work/ec.lus}
+PASS: ./lus2lic {-ec -o /tmp/ec.ec should_work/ec.lus}
 PASS: ./ec2c {-o /tmp/ec.c /tmp/ec.ec}
 PASS: ./lus2lic {-o /tmp/morel3.lic should_work/morel3.lus}
 PASS: ./lus2lic {-ec -o /tmp/morel3.ec should_work/morel3.lus}
@@ -801,7 +801,6 @@ XPASS: Test bad programs (semantics): lus2lic {-o /tmp/bug.lic should_fail/seman
 
 		=== lus2lic Summary ===
 
-# of expected passes		739
+# of expected passes		741
 # of unexpected successes	11
 # of expected failures		37
-# of unresolved testcases	2
diff --git a/test/lus2lic.time b/test/lus2lic.time
index 140ab4d8..dfafd0d5 100644
--- a/test/lus2lic.time
+++ b/test/lus2lic.time
@@ -1,2 +1,2 @@
-testcase ./lus2lic.tests/non-reg.exp completed in 54 seconds
-testcase ./lus2lic.tests/progression.exp completed in 1 seconds
+testcase ./lus2lic.tests/non-reg.exp completed in 23 seconds
+testcase ./lus2lic.tests/progression.exp completed in 0 seconds
diff --git a/todo.org b/todo.org
index ffeab9b2..821e977e 100644
--- a/todo.org
+++ b/todo.org
@@ -42,28 +42,7 @@ file:test/should_fail/type/parametric_node.lus
 * Testing process
 ** TODO try to compile the C code resulting from ec2c at some point
    - State "TODO"       from ""           [2013-01-18 Fri 23:12]
-in particuler, are nodes using extern nodes generated properly?
-
-** TODO fix unresolved tests (timeout -> performance bugs)
-   - State "TODO"       from ""           [2013-01-11 Fri 11:04]
-
-par ex,  file:./test/should_work/ec.lus prend  un temps  infini alors
-qu'il n'est pas si gros (y'a  500 variables, mais bon).  bon, en fait
-il prend 26 seconds, ce qui n'est  pas infini, mais bien long tout de
-meme.
-
-nb: c'était deja le cas avant les changements de Pascal.
-
-cf file:test/lus2lic.gprof
-69% du temps est passé dans unify clock !!!!!
- 
-J'ai l'impression que  c'est lié au fait que ce  programme ne definit
-que  des  contantes.   Or  les constantes  sont  potentiellement  sur
-n'importe quelle horloge, ce qui fait que l'algo manipule un gros paquet
-de 'clock_var of int' et que l'on passe beaucoup de temps à faire des 
-apply_substs2
-
-cf file:test/perf/ contenant les resultats de gprof et ocamlprof sur ec.lus
+in particular, are nodes using extern nodes generated properly?
 
 ** TODO les (nouveaux) tests ne capturent pas les changements de # lignes dans les should_fail
    - State "TODO"       from ""    [2013-01-11 Fri 11:15]
@@ -72,6 +51,7 @@ cf file:test/perf/ contenant les resultats de gprof et ocamlprof sur ec.lus
    - State "TODO"       from "STARTED"    [2013-01-23 Wed 18:26]
 du coup les stats sont un peu fausses. a revoir.
 
+
 * Aesthetes issues
 ** TODO Nommage des variables fraiches : Reprendre LicVarName.ml
    - State "TODO"       from ""           [2013-01-16 Wed 18:03]
@@ -120,6 +100,7 @@ file:src/unifyClock.ml::271
    - State "TODO"       from ""           [2013-02-01 Fri 17:54]
 cf le XXX  file:src/lic.ml::655
 
+
 * Languages issues
 ** TODO Verifier les boucles combinatoires meme quand on ne genere pas de ec
    - State "TODO"       from "STARTED"    [2013-01-29 Tue 09:49]
diff --git a/todo.org_archive b/todo.org_archive
index bfb08031..c9ce8d82 100644
--- a/todo.org_archive
+++ b/todo.org_archive
@@ -339,6 +339,37 @@ FAIL: without any option: ./lus2lic {    -o /tmp/multipar.out should_work/broken
 ./lus2lic should_work/broken/merge.lus 
 file:test/should_work/broken/merge.lus::7
 
+* TODO fix unresolved tests (timeout -> performance bugs)
+   - State "TODO"       from ""           [2013-01-11 Fri 11:04]
+  :PROPERTIES:
+  :ARCHIVE_TIME: 2013-02-04 Mon 21:33
+  :ARCHIVE_FILE: ~/lus2lic/todo.org
+  :ARCHIVE_OLPATH: Testing process
+  :ARCHIVE_CATEGORY: lv6
+  :ARCHIVE_TODO: TODO
+  :END:
+
+par ex,  file:./test/should_work/ec.lus prend  un temps  infini alors
+qu'il n'est pas si gros (y'a  500 variables, mais bon).  bon, en fait
+il prend 26 secondes, ce qui n'est  pas infini, mais bien long tout de
+meme.
+
+nb: c'était deja le cas avant les changements de Pascal.
+
+cf file:test/lus2lic.gprof
+69% du temps est passé dans unify clock !!!!!
+ 
+J'ai l'impression que  c'est lié au fait que ce  programme ne definit
+que  des  contantes.   Or  les constantes  sont  potentiellement  sur
+n'importe quelle horloge, ce qui fait que l'algo manipule un gros paquet
+de 'clock_var of int' et que l'on passe beaucoup de temps à faire des 
+apply_substs2
+
+cf file:test/perf/ contenant les resultats de gprof et ocamlprof sur ec.lus
+
+-----> ca y est, j'ai trouvé : encore une histoire de Verbose pas lazy !!!
+
+
 
 
 
-- 
GitLab