From 55f7fa8f44ff638172f9056e90d97dd1e790449a Mon Sep 17 00:00:00 2001 From: Filipe Marques Date: Fri, 2 Aug 2024 18:46:46 +0200 Subject: [PATCH] Add output dir and tables in zulip notification --- bench/report/runs.ml | 25 +++++++++++++++++++++++++ bench/report/runs.mli | 4 ++++ bench/testcomp/testcomp.ml | 20 ++++++++++++++++---- 3 files changed, 45 insertions(+), 4 deletions(-) diff --git a/bench/report/runs.ml b/bench/report/runs.ml index 82fd1a586..56867b8a1 100644 --- a/bench/report/runs.ml +++ b/bench/report/runs.ml @@ -108,6 +108,31 @@ let pp_quick_results fmt results = "Nothing: %6i Reached: %6i Timeout: %6i Other: %6i Killed: %6i" !nothing !reached !timeout !other !killed +let pp_table_results fmt results = + let nothing = count_nothing results in + let reached = count_reached results in + let timeout = count_timeout results in + let other = count_other results in + let killed = count_killed results in + let total = count_all results in + Format.fprintf fmt + "| Nothing | Reached | Timeout | Other | Killed | Total |@\n\ + |:-------:|:-------:|:-------:|:-----:|:------:|:-----:|@\n\ + | %6i | %6i | %6i | %6i | %6i | %6i |" nothing reached timeout other killed + total + +let pp_table_statistics fmt results = + let total = sum_clock results in + let mean = mean_clock results in + let median = median_clock results in + let min = min_clock results in + let max = max_clock results in + Format.fprintf fmt + "| Total | Mean | Median | Min | Max |@\n\ + |:-----:|:----:|:------:|:---:|:---:|@\n\ + | %0.2f | %0.2f | %0.2f | %0.2f | %0.2f |@\n" + total mean median min max + let map = List.map let files = List.map (fun run -> run.Run.file) diff --git a/bench/report/runs.mli b/bench/report/runs.mli index c620667ce..fce121d37 100644 --- a/bench/report/runs.mli +++ b/bench/report/runs.mli @@ -50,6 +50,10 @@ val to_distribution : max_time:int -> t -> float list val pp_quick_results : Format.formatter -> t -> unit +val pp_table_results : Format.formatter -> t -> unit + +val pp_table_statistics : Format.formatter -> t -> unit + val map : (Run.t -> 'a) -> t -> 'a list val files : t -> Fpath.t list diff --git a/bench/testcomp/testcomp.ml b/bench/testcomp/testcomp.ml index 4f561ec28..af3696d3b 100644 --- a/bench/testcomp/testcomp.ml +++ b/bench/testcomp/testcomp.ml @@ -152,7 +152,7 @@ let notify_finished runs = let headers = let headers = Header.init () in Header.add_list headers - [ ("Content-type", "application/json"); ("User-Agent", "Owibot/1.0") ] + [ ("Content-type", "application/json"); ("User-Agent", "Owibot/1.1") ] in let send url body = let body = Cohttp_lwt.Body.of_string (Yojson.to_string body) in @@ -172,9 +172,21 @@ let notify_finished runs = "unknown" in let text = - Format.asprintf "Using tool=*%s* and timeout=*%F*@\n@\n%a@." - (Tool.to_reference_name tool) - timeout Report.Runs.pp_quick_results runs + Format.asprintf + "@[Using:@;\ + - Tool: `%s`@;\ + - Timeout: `%F`@;\ + - Output dir: `%a`@]@\n\ + @\n\ + Results:@\n\ + @\n\ + %a@\n\ + @\n\ + Time stats (in seconds):@\n\ + @\n\ + %a@." + reference_name timeout Fpath.pp output_dir Report.Runs.pp_table_results + runs Report.Runs.pp_table_statistics runs in (* Notify on `ZULIP_WEBHOOK` *) match Bos.OS.Env.var "ZULIP_WEBHOOK" with