예제 #1
0
        private static void CountStats(object o)
        {
            if (DateTime.Now >= _timeLine)
            {
                _timeLine = _timeLine.AddSeconds(_config.CoreDelay / 5.0);

                var slot = _requestSlots[_currentSlotIndex];
                if (_currentSlotIndex >= _requestSlots.Length - 1)
                {
                    _currentSlotIndex = 0;
                }
                else
                {
                    _currentSlotIndex++;
                }
                _currentSlot = _requestSlots[_currentSlotIndex];

                slot.Reset();
                var stats = new Dictionary <Guid, RawDomainStatistics>();
                _requestSlots.Each(i => i.Gather(stats));

                foreach (var statItem in stats.Values)
                {
                    var selector  = (IPageSelector)statItem;
                    var statCount = statItem.Requests.ToList();
                    if (selector.SelectorType == (int)PageSelectorType.DomainPattern)
                    {
                        _statisticsModule.SetDomainRequests(new DomainSelector(DomainSelector.TotalDomain, selector.Id), statCount);
                    }
                    _statisticsModule.SetDomainRequests(selector, statCount);
                }
            }
        }
 private static bool PutList(IPageSelector site, IEnumerable <PageRequest> list)
 {
     if (site == null)
     {
         return(false);
     }
     _domainStatistics.SetDomainRequests(site, list);
     return(true);
 }