-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
129 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,7 @@ | |
solver_intf | ||
solver_dispatcher | ||
symbol | ||
statistics | ||
ty | ||
utils | ||
value | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
type entry = | ||
[ `Int of int | ||
| `Float of float | ||
] | ||
|
||
module Map = Map.Make (String) | ||
|
||
type t = entry Map.t | ||
|
||
let combine e1 e2 = | ||
match (e1, e2) with | ||
| `Int i1, `Int i2 -> `Int (i1 + i2) | ||
| `Float f1, `Float f2 -> `Float (f1 +. f2) | ||
| _ -> failwith "Statistics: entry type mismatch" | ||
|
||
let merge s1 s2 = | ||
Map.merge | ||
(fun _ left right -> | ||
match (left, right) with | ||
| Some v1, Some v2 -> Some (combine v1 v2) | ||
| (Some _ as v), None | None, (Some _ as v) -> v | ||
| None, None -> None ) | ||
s1 s2 | ||
|
||
let pp_entry fmt = function | ||
| `Int i -> Format.pp_print_int fmt i | ||
| `Float f -> Format.pp_print_float fmt f | ||
|
||
let pp fmt m = | ||
let iter f v = Map.iter (fun a b -> f (a, b)) v in | ||
let pp_v fmt (k, v) = Format.fprintf fmt "(%s, %a)" k pp_entry v in | ||
let is_first = ref true in | ||
let pp_v v = | ||
if !is_first then is_first := false else Format.pp_print_newline fmt (); | ||
pp_v fmt v | ||
in | ||
iter pp_v m |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,5 +8,6 @@ | |
test_relop | ||
test_cvtop | ||
test_naryop | ||
test_model) | ||
test_model | ||
test_statistics) | ||
(libraries smtml yojson)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
open Smtml | ||
module Map = Statistics.Map | ||
|
||
let () = | ||
let s1 = Map.empty |> Map.add "time" (`Float 10.0) in | ||
let s2 = Map.empty |> Map.add "time" (`Float 20.0) in | ||
assert (Statistics.merge s1 s2 |> Map.find "time" = `Float 30.0) |