Permalink
Browse files

Add timing stats to Db_gc.single_pass

Signed-off-by: John Else <john.else@citrix.com>
  • Loading branch information...
1 parent ef7819c commit 7aa3934000342700205fc64a46d9cf8ad57d84ed @johnelse johnelse committed with jonludlam Sep 20, 2012
Showing with 22 additions and 16 deletions.
  1. +22 −16 ocaml/xapi/db_gc.ml
View
38 ocaml/xapi/db_gc.ml
@@ -453,24 +453,30 @@ let single_pass () =
(fun __context ->
Db_lock.with_lock
(fun () ->
+ let time_one (name, f) =
+ Stats.time_this (Printf.sprintf "Db_gc: %s" name)
+ (fun () -> f ~__context)
+ in
(* do VDIs first because this will *)
(* cause some VBDs to be affected *)
- gc_VDIs ~__context;
- gc_PIFs ~__context;
- gc_VBDs ~__context;
- gc_crashdumps ~__context;
- gc_VIFs ~__context;
- gc_PBDs ~__context;
- gc_VGPUs ~__context;
- gc_PGPUs ~__context;
- gc_Host_patches ~__context;
- gc_host_cpus ~__context;
- timeout_sessions ~__context;
- timeout_tasks ~__context;
- gc_messages ~__context;
- (* timeout_alerts ~__context; *)
- (* CA-29253: wake up all blocked clients *)
- Xapi_event.heartbeat ~__context;
+ List.iter time_one [
+ "VDIs", gc_VDIs;
+ "PIFs", gc_PIFs;
+ "VBDs", gc_VBDs;
+ "crashdumps", gc_crashdumps;
+ "VIFs", gc_VIFs;
+ "PBDs", gc_PBDs;
+ "VGPUs", gc_VGPUs;
+ "PGPUs", gc_PGPUs;
+ "Host patches", gc_Host_patches;
+ "Host CPUs", gc_host_cpus;
+ "Sessions", timeout_sessions;
+ "Tasks", timeout_tasks;
+ "Messages", gc_messages;
+ (* timeout_alerts; *)
+ (* CA-29253: wake up all blocked clients *)
+ "Heartbeat", Xapi_event.heartbeat;
+ ]
);
Mutex.execute use_host_heartbeat_for_liveness_m
(fun () ->

0 comments on commit 7aa3934

Please sign in to comment.