Skip to content

Commit b1d900b

Browse files
authored
Sort output of diagnostic-timing-stats (#6808)
xe diagnostic-timing-stats reports timings for functions in a key/value format. This patch sorts the output by key.
2 parents fefe7cf + 2efeb43 commit b1d900b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

ocaml/xapi-cli-server/cli_operations.ml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ let get_file_or_fail fd desc filename =
197197

198198
let diagnostic_timing_stats printer rpc session_id params =
199199
let counts = get_bool_param params "counts" in
200+
let sort = List.sort (fun (x, _) (y, _) -> String.compare x y) in
200201
let table_of_host host =
201202
[
202203
("host-uuid", Client.Host.get_uuid ~rpc ~session_id ~self:host)
@@ -207,7 +208,8 @@ let diagnostic_timing_stats printer rpc session_id params =
207208
with e -> [("Error", Api_errors.to_string e)]
208209
in
209210
let all = List.map table_of_host (Client.Host.get_all ~rpc ~session_id) in
210-
printer (Cli_printer.PTable all)
211+
let sorted = List.map sort all in
212+
printer (Cli_printer.PTable sorted)
211213

212214
let get_hosts_by_name_or_id rpc session_id name =
213215
let hosts = Client.Host.get_all_records_where ~rpc ~session_id ~expr:"true" in

0 commit comments

Comments
 (0)