Skip to content

Commit b20fc78

Browse files
committed
Move bench framework to multicore-bench project
1 parent b3b3c41 commit b20fc78

23 files changed

+208
-599
lines changed

bench/barrier.ml

-13
This file was deleted.

bench/barrier.mli

-4
This file was deleted.

bench/bench.ml

-174
This file was deleted.

bench/bench.mli

-27
This file was deleted.

bench/bench_accumulator.ml

+5-20
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
open Kcas_data
2-
open Bench
2+
open Multicore_bench
33

44
let run_one ~budgetf ~n_domains ?(n_ops = 180 * Util.iter_factor) () =
55
let n_ops = n_ops * n_domains in
@@ -29,28 +29,13 @@ let run_one ~budgetf ~n_domains ?(n_ops = 180 * Util.iter_factor) () =
2929

3030
let after () = Atomic.set n_ops_todo n_ops in
3131

32-
let times = Times.record ~n_domains ~budgetf ~init ~work ~after () in
33-
34-
let name metric =
35-
Printf.sprintf "%s/%d worker%s, 0%% reads" metric n_domains
32+
let config =
33+
Printf.sprintf "%d worker%s, 0%% reads" n_domains
3634
(if n_domains = 1 then "" else "s")
3735
in
3836

39-
List.concat
40-
[
41-
Stats.of_times times
42-
|> Stats.scale (1_000_000_000.0 /. Float.of_int n_ops)
43-
|> Stats.to_json
44-
~name:(name "time per operation")
45-
~description:"Average time to increment accumulator" ~units:"ns";
46-
Times.invert times |> Stats.of_times
47-
|> Stats.scale (Float.of_int (n_ops * n_domains) /. 1_000_000.0)
48-
|> Stats.to_json
49-
~name:(name "operations over time")
50-
~description:
51-
"Number of operations performed over time using all domains"
52-
~units:"M/s";
53-
]
37+
Times.record ~budgetf ~n_domains ~init ~work ~after ()
38+
|> Util.thruput_metrics ~n:n_ops ~config ~singular:"operation"
5439

5540
let run_suite ~budgetf =
5641
[ 1; 2; 4 ]

bench/bench_atomic.ml

+3-16
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
open Bench
1+
open Multicore_bench
22

33
module Atomic = struct
44
include Stdlib.Atomic
@@ -31,21 +31,8 @@ let run_one ~budgetf ?(n_iter = 500 * Util.iter_factor)
3131
loop n_iter
3232
in
3333

34-
let times = Times.record ~n_domains:1 ~budgetf ~init ~work () in
35-
36-
List.concat
37-
[
38-
Stats.of_times times
39-
|> Stats.scale (1_000_000_000.0 /. Float.of_int n_iter)
40-
|> Stats.to_json
41-
~name:(Printf.sprintf "time per op/%s" name)
42-
~description:"Time to perform a single op" ~units:"ns";
43-
Times.invert times |> Stats.of_times
44-
|> Stats.scale (Float.of_int n_iter /. 1_000_000.0)
45-
|> Stats.to_json
46-
~name:(Printf.sprintf "ops over time/%s" name)
47-
~description:"Number of operations performed over time" ~units:"M/s";
48-
]
34+
Times.record ~budgetf ~n_domains:1 ~init ~work ()
35+
|> Util.thruput_metrics ~n:n_iter ~singular:"op" ~config:name
4936

5037
let run_suite ~budgetf =
5138
[

0 commit comments

Comments
 (0)