From: David Scott Date: Tue, 12 Oct 2010 09:32:46 +0000 (+0100) Subject: CA-44731: record timings for all xapi startup tasks for diagnostic purposes. Data... X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=10c783dd2ce9da615e083e09ec1ebe3bb2ae557e;p=xcp%2Fxen-api.git 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 --- 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