Esempio n. 1
0
        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}");
        }
Esempio n. 2
0
        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}");
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        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();
        }
Esempio n. 5
0
        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);
            }
        }