Skip to content

Commit 09eaee2

Browse files
Output more sophisticated stats
1 parent 1ee4dc0 commit 09eaee2

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

src/util/precCompare.ml

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ struct
107107

108108
let compare_dumps ({name = name1; results = lvh1}: result) ({name = name2; results = lvh2}: result) =
109109
let (c, d) = CompareDump.compare ~verbose:true ~name1 lvh1 ~name2 lvh2 in
110-
comparisons := (name1, name2, c) :: !comparisons;
110+
comparisons := (name1, name2, c, d) :: !comparisons;
111111
(c, d)
112112

113113
let count_locations (dumps: result list) =
@@ -125,8 +125,8 @@ struct
125125
let group () =
126126
let new_bucket_id = ref 0 in
127127
let equality_buckets = Hashtbl.create 113 in
128-
let sorted = List.sort (fun (n1, _, _) (n2, _, _) -> String.compare n1 n2) !comparisons in
129-
List.iter (fun (name1, name2, (c:Comparison.t)) ->
128+
let sorted = List.sort (fun (n1, _, _, _) (n2, _, _, _) -> String.compare n1 n2) !comparisons in
129+
List.iter (fun (name1, name2, (c:Comparison.t), _) ->
130130
(if not (Hashtbl.mem equality_buckets name1) then
131131
(* Make its own bucket if it does not appear yet *)
132132
(let bucket_id = !new_bucket_id in
@@ -142,8 +142,24 @@ struct
142142
List.iter (fun bucket ->
143143
Logs.result "Bucket %d:" (snd (List.hd bucket));
144144
List.iter (fun (name, _) -> Logs.result " %s" name) bucket
145-
) buckets
146-
145+
) buckets;
146+
let comparison_produced = Hashtbl.create 113 in
147+
List.iter (fun (name1, name2, c,d) ->
148+
let bucket1 = Hashtbl.find equality_buckets name1 in
149+
let bucket2 = Hashtbl.find equality_buckets name2 in
150+
if bucket1 = bucket2 then
151+
()
152+
else
153+
begin
154+
let comp_tumple = (min bucket1 bucket2, max bucket1 bucket2) in
155+
if not @@ Hashtbl.mem comparison_produced comp_tumple then
156+
begin
157+
Hashtbl.add comparison_produced comp_tumple ();
158+
Logs.result "Comparison between bucket %d and %d: %t" (fst comp_tumple) (snd comp_tumple) (fun () -> d);
159+
end
160+
end
161+
) sorted;
162+
()
147163

148164
let main () =
149165
Util.init ();

0 commit comments

Comments
 (0)