From 1472006dd3cdf94b916987bc63d59d23d3dc18fe Mon Sep 17 00:00:00 2001 From: Anmol Sahoo Date: Tue, 6 Oct 2020 23:01:49 +0530 Subject: [PATCH] added DLS --- benchmarks/multicore-lockfree/test_ctrie.ml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/benchmarks/multicore-lockfree/test_ctrie.ml b/benchmarks/multicore-lockfree/test_ctrie.ml index 568a9440e8..cc925e0fc9 100644 --- a/benchmarks/multicore-lockfree/test_ctrie.ml +++ b/benchmarks/multicore-lockfree/test_ctrie.ml @@ -2,16 +2,18 @@ let threads = int_of_string Sys.argv.(1) let insert_percent = int_of_string Sys.argv.(2) let num_opers = int_of_string Sys.argv.(3) / threads -let () = Random.init 42 +let state_key = Domain.DLS.new_key Random.State.make_self_init let tree = Ctrie.empty () let work () = + let state = Domain.DLS.get state_key in + let rand_int n = Random.State.int state n in for _ = 1 to num_opers do - if Random.int 100 > insert_percent then - ignore (Ctrie.mem (Random.int 1000000) tree) + if rand_int 100 > insert_percent then + ignore (Ctrie.mem (rand_int 1000000) tree) else - Ctrie.insert (Random.int 1000000) 0 tree + Ctrie.insert (rand_int 1000000) 0 tree done let () =