Forráskód Böngészése

[java/cs] Added more detailed timer output

Caue Waneck 13 éve
szülő
commit
70c5524063
2 módosított fájl, 12 hozzáadás és 5 törlés
  1. 5 4
      gencommon.ml
  2. 7 1
      gencs.ml

+ 5 - 4
gencommon.ml

@@ -266,11 +266,9 @@ struct
   let len w = Buffer.length w.sw_buf
   
   let write w x =
-    let t = timer "write contents" in
     (if not w.sw_has_content then begin w.sw_has_content <- true; Buffer.add_string w.sw_buf w.sw_indent; Buffer.add_string w.sw_buf x; end else Buffer.add_string w.sw_buf x);
     let len = (String.length x)-1 in
-    if len >= 0 && String.get x len = '\n' then begin w.sw_has_content <- false end else w.sw_has_content <- true;
-    t()
+    if len >= 0 && String.get x len = '\n' then begin w.sw_has_content <- false end else w.sw_has_content <- true
 
   let push_indent w = w.sw_indents <- "\t"::w.sw_indents; w.sw_indent <- String.concat "" w.sw_indents
 
@@ -789,6 +787,8 @@ let run_filters_from gen t filters =
       | TTypeDecl _ -> ()
 
 let run_filters gen =
+  (* first of all, we have to make sure that the filters won't trigger a major Gc collection *)
+  let t = Common.timer "gencommon_filters" in
   (if Common.defined gen.gcon "gencommon_debug" then debug_mode := true);
   let run_filters filter = 
     let rec loop acc mds =
@@ -869,7 +869,8 @@ let run_filters gen =
   gen.gcon.types <- run_filters gen.gsyntax_filters;
   List.iter (fun fn -> fn()) gen.gafter_filters_ended;
   
-  reorder_modules gen
+  reorder_modules gen;
+  t()
 
 (* ******************************************* *)
 (* basic generation module that source code compilation implementations can use *)

+ 7 - 1
gencs.ml

@@ -1087,17 +1087,23 @@ let configure gen =
                         | None -> ()
                         | Some sc ->
                           write w " : ";
-                          expr_s w sc
+                          let t = Common.timer "expression to string" in
+                          expr_s w sc;
+                          t()
                       );
                       begin_block w;
                       write w "unchecked ";
+                      let t = Common.timer "expression to string" in
                       expr_s w { expr with eexpr = TBlock(rest) };
+                      t();
                       end_block w
                     | _ -> assert false
                 end else begin
                   begin_block w;
                   write w "unchecked ";
+                  let t = Common.timer "expression to string" in
                   expr_s w expr;
+                  t();
                   end_block w
                 end)
               | (":functionBody", [Ast.EConst (Ast.String contents),_],_) :: tl ->