public void InterlockedAddSetup() { interlocked_value = 0; bench = new ThreadsBenchHelper(); bench.AddWorks(InterlockedAddWork, Threads); bench.Prepare(); }
public void AddSetup() { thread_id = 0; data = new ConcurrentDictionary <int, int>(); bench = new ThreadsBenchHelper(); bench.AddWorks(AddWork, Threads); bench.Prepare(); }
public void WaitFreeSetup() { counts = new ConcurrentDictionaryCounter[16]; // counts initialization for (var i = 0; i < counts.Length; ++i) { counts[i] = new ConcurrentDictionaryCounter(); } bench = new ThreadsBenchHelper(); bench.AddWorks(WaitFreeAddWork, Threads); bench.Prepare(); }
public void TryGetValueSetup() { thread_id = 0; data = new ConcurrentDictionary <int, int>(); // Preparing data so that the keys are different for each thread. for (var i = 0; i < Threads; ++i) { var key = (i + 1) * threads_key_range; for (var j = 0; j < ThreadsBenchConfig.OperationsCount; ++j) { data.TryAdd(key + j, j); } } bench = new ThreadsBenchHelper(); bench.AddWorks(TryGetValueWork, Threads); bench.Prepare(); }