|
@@ -57,8 +57,8 @@ let safe_decode com v expected t p f =
|
|
raise_decode_error (Printf.sprintf "Expected %s but got %s" expected (Interp.value_string v))
|
|
raise_decode_error (Printf.sprintf "Expected %s but got %s" expected (Interp.value_string v))
|
|
|
|
|
|
|
|
|
|
-let macro_timer timer_ctx level label identifier f arg =
|
|
|
|
- let id = Timer.determine_id level ["macro"] [label] identifier in
|
|
|
|
|
|
+let macro_timer timer_ctx level s identifier f arg =
|
|
|
|
+ let id = Timer.determine_id level ["macro"] s identifier in
|
|
Timer.time timer_ctx id f arg
|
|
Timer.time timer_ctx id f arg
|
|
|
|
|
|
let typing_timer ctx need_type f =
|
|
let typing_timer ctx need_type f =
|
|
@@ -141,22 +141,22 @@ let make_macro_com_api com mcom p =
|
|
);
|
|
);
|
|
after_init_macros = (fun f ->
|
|
after_init_macros = (fun f ->
|
|
com.callbacks#add_after_init_macros (fun () ->
|
|
com.callbacks#add_after_init_macros (fun () ->
|
|
- macro_timer com.timer_ctx timer_level "afterInitMacros" None f ();
|
|
|
|
|
|
+ macro_timer com.timer_ctx timer_level ["afterInitMacros"] None f ();
|
|
)
|
|
)
|
|
);
|
|
);
|
|
after_typing = (fun f ->
|
|
after_typing = (fun f ->
|
|
com.callbacks#add_after_typing (fun tl ->
|
|
com.callbacks#add_after_typing (fun tl ->
|
|
- macro_timer com.timer_ctx timer_level "afterTyping" None f tl;
|
|
|
|
|
|
+ macro_timer com.timer_ctx timer_level ["afterTyping"] None f tl;
|
|
)
|
|
)
|
|
);
|
|
);
|
|
on_generate = (fun f b ->
|
|
on_generate = (fun f b ->
|
|
(if b then com.callbacks#add_before_save else com.callbacks#add_after_save) (fun() ->
|
|
(if b then com.callbacks#add_before_save else com.callbacks#add_after_save) (fun() ->
|
|
- macro_timer com.timer_ctx timer_level "onGenerate"None f (List.map type_of_module_type com.types);
|
|
|
|
|
|
+ macro_timer com.timer_ctx timer_level ["onGenerate"] None f (List.map type_of_module_type com.types);
|
|
)
|
|
)
|
|
);
|
|
);
|
|
after_generate = (fun f ->
|
|
after_generate = (fun f ->
|
|
com.callbacks#add_after_generation (fun() ->
|
|
com.callbacks#add_after_generation (fun() ->
|
|
- macro_timer com.timer_ctx timer_level "afterGenerate" None f ();
|
|
|
|
|
|
+ macro_timer com.timer_ctx timer_level ["afterGenerate"] None f ();
|
|
)
|
|
)
|
|
);
|
|
);
|
|
on_type_not_found = (fun f ->
|
|
on_type_not_found = (fun f ->
|
|
@@ -677,7 +677,7 @@ and flush_macro_context mint mctx =
|
|
with Error err -> raise (Fatal_error err));
|
|
with Error err -> raise (Fatal_error err));
|
|
in
|
|
in
|
|
let timer_level = Timer.level_from_define mctx.com.defines Define.MacroTimes in
|
|
let timer_level = Timer.level_from_define mctx.com.defines Define.MacroTimes in
|
|
- macro_timer mctx.com.timer_ctx timer_level "flush" None f ()
|
|
|
|
|
|
+ macro_timer mctx.com.timer_ctx timer_level ["flush"] None f ()
|
|
|
|
|
|
let create_macro_interp api mctx =
|
|
let create_macro_interp api mctx =
|
|
let com2 = mctx.com in
|
|
let com2 = mctx.com in
|
|
@@ -810,7 +810,7 @@ let load_macro'' com mctx display cpath fname p =
|
|
mctx.com.cached_macros#add (cpath,fname) meth;
|
|
mctx.com.cached_macros#add (cpath,fname) meth;
|
|
meth
|
|
meth
|
|
in
|
|
in
|
|
- macro_timer com.timer_ctx timer_level "typing" (Some (s_type_path cpath ^ "." ^ fname)) f ()
|
|
|
|
|
|
+ macro_timer com.timer_ctx timer_level ["typing";s_type_path cpath ^ "." ^ fname] None f ()
|
|
|
|
|
|
let load_macro' ctx display cpath f p =
|
|
let load_macro' ctx display cpath f p =
|
|
(* TODO: The only reason this nonsense is here is because this is the signature
|
|
(* TODO: The only reason this nonsense is here is because this is the signature
|
|
@@ -823,7 +823,7 @@ let do_call_macro com api cpath name args p =
|
|
incr stats.s_macros_called;
|
|
incr stats.s_macros_called;
|
|
let timer_level = Timer.level_from_define com.defines Define.MacroTimes in
|
|
let timer_level = Timer.level_from_define com.defines Define.MacroTimes in
|
|
let f = Interp.call_path (Interp.get_ctx()) ((fst cpath) @ [snd cpath]) name args in
|
|
let f = Interp.call_path (Interp.get_ctx()) ((fst cpath) @ [snd cpath]) name args in
|
|
- let r = macro_timer com.timer_ctx timer_level "execution" (Some (s_type_path cpath ^ "." ^ name)) f api in
|
|
|
|
|
|
+ let r = macro_timer com.timer_ctx timer_level ["execution";s_type_path cpath ^ "." ^ name] None f api in
|
|
if com.verbose then Common.log com ("Exiting macro " ^ s_type_path cpath ^ "." ^ name);
|
|
if com.verbose then Common.log com ("Exiting macro " ^ s_type_path cpath ^ "." ^ name);
|
|
r
|
|
r
|
|
|
|
|