Пример #1
0
 private void AddOrUpdateCounter(ConcurrentDictionary <Guid, RawDomainStatistics> dictionary, IPageSelector data, PageRequest request)
 {
     if (RawGatheringRequestModule.Contains(data))
     {
         RawDomainStatistics counter = dictionary.GetOrAdd(data.Id, new RawDomainStatistics(data));
         counter.AddItemInCounter(request);
     }
 }
Пример #2
0
        public void Gather(Dictionary <Guid, RawDomainStatistics> stats)
        {
            foreach (var key in Stats.Keys)
            {
                var value = Stats[key];

                RawDomainStatistics stat;
                if (!stats.TryGetValue(key, out stat))
                {
                    stats.Add(key, stat = new RawDomainStatistics((IPageSelector)value));
                }

                stat.AddItemsInCounter(value.Requests);
            }
        }
Пример #3
0
        private void Reset(ConcurrentDictionary <Guid, RawDomainStatistics> counters, Dictionary <Guid, RawDomainStatistics> stats)
        {
            foreach (var key in counters.Keys)
            {
                var value = counters[key];
                counters[key] = new RawDomainStatistics((IPageSelector)value);

                RawDomainStatistics stat;
                if (!stats.TryGetValue(key, out stat))
                {
                    stats.Add(key, stat = new RawDomainStatistics((IPageSelector)value));
                }

                stat.AddItemsInCounter(value.Requests);
            }
        }