1
1
open Multicore_bench
2
2
3
3
let run_one ~budgetf ~n_domains () =
4
- let n_bytes = 65536 in
4
+ let block_size = 4096 in
5
+ let n_blocks = 16 in
5
6
6
7
let init _ =
7
8
let inn, out = Unix. pipe ~cloexec: true () in
8
- (inn, out, Bytes. create 1 )
9
+ (inn, out, Bytes. create block_size, Bytes. create 1 )
9
10
in
10
- let work _ (inn , out , byte ) =
11
- let n = Unix. write out (Bytes. create n_bytes) 0 n_bytes in
12
- assert (n = n_bytes);
13
- for _ = 1 to n_bytes do
14
- let n : int = Unix. read inn byte 0 1 in
15
- assert (n = 1 )
11
+ let work _ (inn , out , block , byte ) =
12
+ for _ = 1 to n_blocks do
13
+ let n = Unix. write out block 0 block_size in
14
+ assert (n = block_size);
15
+ for _ = 1 to block_size do
16
+ let n : int = Unix. read inn byte 0 1 in
17
+ assert (n = 1 )
18
+ done
16
19
done ;
17
20
Unix. close inn;
18
21
Unix. close out
@@ -22,8 +25,9 @@ let run_one ~budgetf ~n_domains () =
22
25
Printf. sprintf " %d worker%s" n_domains (if n_domains = 1 then " " else " s" )
23
26
in
24
27
Times. record ~budgetf ~n_domains ~n_warmups: 1 ~n_runs_min: 1 ~init ~work ()
25
- |> Times. to_thruput_metrics ~n: (n_bytes * n_domains) ~singular: " blocking read"
26
- ~config
28
+ |> Times. to_thruput_metrics
29
+ ~n: (block_size * n_blocks * n_domains)
30
+ ~singular: " blocking read" ~config
27
31
28
32
let run_suite ~budgetf =
29
33
[ 1 ; 2 ; 4 ]
0 commit comments