private void ProcessTurn(int i) { var key = _keySequence[i]; CacheNode <int, object> .TestCurrentTime = _startTime.AddMilliseconds(i * _configuration.ExperimentTimeStep); bool inCache = true; _watch.Start(); _cache.RetrieveByFunc(key, k => { inCache = false; return(null); }, CacheNode <int, object> .TestCurrentTime); _watch.Stop(); if (!inCache) { Interlocked.Increment(ref _externalGetPenalties); } Interlocked.Increment(ref gotBeforeResultShow); if (Interlocked.CompareExchange(ref _wasRebalance, 0, 1) == 1) { AddEventRow(i, "Tree was rebalanced"); } if (i != 0 && i % _configuration.GarbageCollectingRate == 0) { GC.Collect(); AddEventRow(i, "Garbage force collected"); } if (i != 0 && _configuration.Frequences.Any(k => k.IterationToSwitch == i)) { AddEventRow(i, "Frequences changed"); } if (i != 0 && i % (_configuration.ResultShowRate) == 0) { lock (_resultSendLock) { if (i != 0 && i % (_configuration.ResultShowRate) == 0) { AddRowWithCurrentData(i, gotBeforeResultShow); _externalGetPenalties = 0; gotBeforeResultShow = 0; _watch.Reset(); _nodeGoneCounter = 0; _branchChangedCounter = 0; } } } }