public void Add(DisposableObject instance) { Stopwatch countTime = new Stopwatch(); countTime.Start(); repository.TryAdd(instance.Id, instance); countTime.Stop(); ExecutionTimes.Add(countTime.Elapsed); // Console.WriteLine($"Add lock took: {countTime.Elapsed}"); }
public void Remove(string id) { Stopwatch countTime = new Stopwatch(); countTime.Start(); repository.TryRemove(id, out var removed); countTime.Stop(); ExecutionTimes.Add(countTime.Elapsed); // Console.WriteLine($"Remove lock took: {countTime.Elapsed}"); }
public void Remove(string id) { Stopwatch countTime = new Stopwatch(); countTime.Start(); lock (lockObj) { // Console.WriteLine($"Remove lock took: {countTime.Elapsed}"); repository.Remove(id); countTime.Stop(); } ExecutionTimes.Add(countTime.Elapsed); }
public void Clear() { Stopwatch countTime = new Stopwatch(); countTime.Start(); foreach (var item in repository) { item.Value.Dispose(); } countTime.Stop(); ExecutionTimes.Add(countTime.Elapsed); repository.Clear(); }
public void Clear() { Stopwatch countTime = new Stopwatch(); countTime.Start(); lock (lockObj) { foreach (var item in repository.Values) { item.Dispose(); } repository.Clear(); countTime.Stop(); ExecutionTimes.Add(countTime.Elapsed); } }