Skip to content

Commit

Permalink
Move bench framework to multicore-bench project
Browse files Browse the repository at this point in the history
  • Loading branch information
polytypic committed Jan 25, 2024
1 parent bf0d66d commit f3d3406
Show file tree
Hide file tree
Showing 22 changed files with 135 additions and 599 deletions.
13 changes: 0 additions & 13 deletions bench/barrier.ml

This file was deleted.

4 changes: 0 additions & 4 deletions bench/barrier.mli

This file was deleted.

174 changes: 0 additions & 174 deletions bench/bench.ml

This file was deleted.

27 changes: 0 additions & 27 deletions bench/bench.mli

This file was deleted.

25 changes: 5 additions & 20 deletions bench/bench_accumulator.ml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
open Kcas_data
open Bench
open Multicore_bench

let run_one ~budgetf ~n_domains ?(n_ops = 180 * Util.iter_factor) () =
let n_ops = n_ops * n_domains in
Expand Down Expand Up @@ -29,28 +29,13 @@ let run_one ~budgetf ~n_domains ?(n_ops = 180 * Util.iter_factor) () =

let after () = Atomic.set n_ops_todo n_ops in

let times = Times.record ~n_domains ~budgetf ~init ~work ~after () in

let name metric =
Printf.sprintf "%s/%d worker%s, 0%% reads" metric n_domains
let config =
Printf.sprintf "%d worker%s, 0%% reads" n_domains
(if n_domains = 1 then "" else "s")
in

List.concat
[
Stats.of_times times
|> Stats.scale (1_000_000_000.0 /. Float.of_int n_ops)
|> Stats.to_json
~name:(name "time per operation")
~description:"Average time to increment accumulator" ~units:"ns";
Times.invert times |> Stats.of_times
|> Stats.scale (Float.of_int (n_ops * n_domains) /. 1_000_000.0)
|> Stats.to_json
~name:(name "operations over time")
~description:
"Number of operations performed over time using all domains"
~units:"M/s";
]
Times.record ~budgetf ~n_domains ~init ~work ~after ()
|> Util.thruput_metrics ~n:n_ops ~config ~singular:"operation"

let run_suite ~budgetf =
[ 1; 2; 4 ]
Expand Down
19 changes: 3 additions & 16 deletions bench/bench_atomic.ml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
open Bench
open Multicore_bench

module Atomic = struct
include Stdlib.Atomic
Expand Down Expand Up @@ -31,21 +31,8 @@ let run_one ~budgetf ?(n_iter = 500 * Util.iter_factor)
loop n_iter
in

let times = Times.record ~n_domains:1 ~budgetf ~init ~work () in

List.concat
[
Stats.of_times times
|> Stats.scale (1_000_000_000.0 /. Float.of_int n_iter)
|> Stats.to_json
~name:(Printf.sprintf "time per op/%s" name)
~description:"Time to perform a single op" ~units:"ns";
Times.invert times |> Stats.of_times
|> Stats.scale (Float.of_int n_iter /. 1_000_000.0)
|> Stats.to_json
~name:(Printf.sprintf "ops over time/%s" name)
~description:"Number of operations performed over time" ~units:"M/s";
]
Times.record ~budgetf ~n_domains:1 ~init ~work ()
|> Util.thruput_metrics ~n:n_iter ~singular:"op" ~config:name

let run_suite ~budgetf =
[
Expand Down
Loading

0 comments on commit f3d3406

Please sign in to comment.