From 10c783dd2ce9da615e083e09ec1ebe3bb2ae557e Mon Sep 17 00:00:00 2001 From: David Scott Date: Tue, 12 Oct 2010 10:32:46 +0100 Subject: [PATCH] CA-44731: record timings for all xapi startup tasks for diagnostic purposes. Data can be retrieved with existing 'xe diagnostic-timing-stats' CLI command. Signed-off-by: David Scott --- ocaml/xapi/startup.ml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ocaml/xapi/startup.ml b/ocaml/xapi/startup.ml index fbc7894a..569186ae 100644 --- a/ocaml/xapi/startup.ml +++ b/ocaml/xapi/startup.ml @@ -53,6 +53,9 @@ let run ~__context tasks = (* iterate tasks *) List.iter (fun (tsk_name, tsk_flags, tsk_fct) -> + (* Wrap the function with a timer *) + let tsk_fct () = Stats.time_this tsk_name tsk_fct in + let only_master, only_slave, exnraise, onthread = get_flags_of_list tsk_flags in try if (only_master && is_master) @@ -73,3 +76,5 @@ let run ~__context tasks = if exnraise then raise exn ) tasks + +let run ~__context tasks = Stats.time_this "overall xapi startup" (fun () -> run ~__context tasks) \ No newline at end of file -- 2.39.5