Skip to content

Commit faeabe8

Browse files
Julowjonludlam
authored andcommitted
driver.mld: Metrics for the 5 longest commands
The previous 'longest' metric was not useful as it was a duplicate of the other running time metrics that output a 'max' value. Make this metric more useful by averaging the 5 longest runs. This correspond roughly to the top 1%.
1 parent b520749 commit faeabe8

File tree

1 file changed

+22
-16
lines changed

1 file changed

+22
-16
lines changed

doc/driver.mld

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,24 +1010,30 @@ let compute_produced_cmd cmd =
10101010
];
10111011
]
10121012

1013-
(** Analyze the size of files produced by a command. *)
1013+
(** Analyze the running time of the slowest commands. *)
10141014
let compute_longest_cmd cmd =
1015-
match k_longest_commands cmd 1 with
1016-
| hd :: _ ->
1015+
let k = 5 in
1016+
let cmds = k_longest_commands cmd k in
1017+
let times = List.map (fun c -> c.time) cmds in
1018+
let min, max, avg, _count = compute_min_max_avg times in
1019+
[
1020+
`Assoc
10171021
[
1018-
`Assoc
1019-
[
1020-
("name", `String ("longest-" ^ cmd));
1021-
("value", `Float hd.time);
1022-
("units", `String "s");
1023-
( "description",
1024-
`String
1025-
("Time taken by the longest invokation of 'odoc " ^ cmd ^ "'")
1026-
);
1027-
("trend", `String "lower-is-better");
1028-
];
1029-
]
1030-
| [] -> []
1022+
("name", `String ("longest-" ^ cmd));
1023+
( "value",
1024+
`Assoc
1025+
[
1026+
("min", `Float min); ("max", `Float max); ("avg", `Float avg);
1027+
] );
1028+
("units", `String "s");
1029+
( "description",
1030+
`String
1031+
(Printf.sprintf "Time taken by the %d longest calls to 'odoc %s'"
1032+
k cmd)
1033+
);
1034+
("trend", `String "lower-is-better");
1035+
];
1036+
]
10311037

10321038
let metrics =
10331039
compute_metric_cmd "compile"

0 commit comments

Comments
 (0)