Skip to content

Commit

Permalink
added DLS
Browse files Browse the repository at this point in the history
  • Loading branch information
anmolsahoo25 committed Oct 6, 2020
1 parent 93064ea commit 1472006
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions benchmarks/multicore-lockfree/test_ctrie.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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 () =
Expand Down

0 comments on commit 1472006

Please sign in to comment.