-
Notifications
You must be signed in to change notification settings - Fork 368
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Setup benchmarking using current-bench
- Loading branch information
1 parent
fd29dc4
commit 20147b9
Showing
5 changed files
with
64 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM debian | ||
RUN apt-get update -qq && apt-get install -qq -yy make curl gcc g++ patch bzip2 git unzip | ||
RUN adduser --disabled-password --gecos '' --shell /bin/bash opam | ||
USER opam | ||
COPY --chown=opam:opam . /src | ||
WORKDIR /src | ||
RUN make cold | ||
USER root | ||
RUN install ./opam /usr/local/bin/ | ||
USER opam | ||
RUN opam init -n --disable-sandboxing git+https://github.com/ocaml/opam-repository#26770281fa1ea8b13aab979c1dfbd326e9ab512c |
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,45 @@ | ||
let fmt = Printf.sprintf | ||
|
||
let time_cmd ~exit cmd = | ||
let cmd = cmd ^ " 2> /dev/null > /dev/null" in | ||
let before = Unix.gettimeofday () in | ||
let code = Sys.command cmd in | ||
let timer = Unix.gettimeofday () -. before in | ||
if Int.equal code exit then | ||
timer | ||
else | ||
failwith (fmt "Command %S exited with error code %d" cmd code) | ||
|
||
let () = | ||
let bin = "./opam" in | ||
let bin_size = (Unix.stat bin).st_size in | ||
let time_misspelled_cmd = | ||
(* NOTE: https://github.com/ocaml/opam/issues/5479 *) | ||
time_cmd ~exit:2 (fmt "%s sitch" bin) | ||
in | ||
let json = fmt {|{ | ||
"results": [ | ||
{ | ||
"name": "Timings", | ||
"metrics": [ | ||
{ | ||
"name": "Misspelled command", | ||
"value": %f, | ||
"units": "secs" | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "Misc", | ||
"metrics": [ | ||
{ | ||
"name": "Size of opam.exe", | ||
"value": %d, | ||
"units": "bytes" | ||
} | ||
] | ||
} | ||
] | ||
}|} time_misspelled_cmd bin_size | ||
in | ||
print_endline json |
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,3 @@ | ||
(executable | ||
(name bench) | ||
(libraries unix)) |
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