Esempio n. 1
0
        protected override void ConsumeStatistics()
        {
            Dictionary <uint, List <int> > dictionary = new Dictionary <uint, List <int> >();

            foreach (PacketInfo queuedStat in this.m_queuedStats)
            {
                if (!dictionary.ContainsKey(queuedStat.PacketID.RawId))
                {
                    dictionary.Add(queuedStat.PacketID.RawId, new List <int>());
                }
                dictionary[queuedStat.PacketID.RawId].Add(queuedStat.PacketSize);
            }

            List <ExtendedPacketInfo> extendedPacketInfoList = new List <ExtendedPacketInfo>();

            foreach (KeyValuePair <uint, List <int> > keyValuePair in dictionary)
            {
                ExtendedPacketInfo extendedPacketInfo = new ExtendedPacketInfo()
                {
                    OpCode            = (RealmServerOpCode)keyValuePair.Key,
                    PacketCount       = keyValuePair.Value.Count,
                    TotalPacketSize   = (long)keyValuePair.Value.Sum(),
                    AveragePacketSize = (int)keyValuePair.Value.Average(),
                    StartTime         = DateTime.Now.Subtract(TimeSpan.FromMinutes(5.0)),
                    EndTime           = DateTime.Now
                };
                this.GetStandardDeviation((IEnumerable <int>)keyValuePair.Value);
            }
        }
Esempio n. 2
0
        protected override void ConsumeStatistics()
        {
            var packetCounts = new Dictionary <uint, List <int> >();

            // every 5 minutes we update packet count/total size and flush to the DB
            foreach (PacketInfo pktInfo in m_queuedStats)
            {
                if (!packetCounts.ContainsKey(pktInfo.PacketID.RawId))
                {
                    packetCounts.Add(pktInfo.PacketID.RawId, new List <int>());
                }

                packetCounts[pktInfo.PacketID.RawId].Add(pktInfo.PacketSize);
            }

            var extInfoList = new List <ExtendedPacketInfo>();

            // calculate extended pkt info
            foreach (var packetCount in packetCounts)
            {
                var pktInfo = new ExtendedPacketInfo
                {
                    OpCode            = (RealmServerOpCode)packetCount.Key,
                    PacketCount       = packetCount.Value.Count,
                    TotalPacketSize   = packetCount.Value.Sum(),
                    AveragePacketSize = (int)packetCount.Value.Average(),
                    StartTime         = DateTime.Now.Subtract(TimeSpan.FromMinutes(5)),
                    EndTime           = DateTime.Now
                };

                List <int> packetSizes = packetCount.Value;

                int stdDev = GetStandardDeviation(packetSizes);
                pktInfo.StandardDeviation = stdDev;

                // push to le db.
            }
        }
Esempio n. 3
0
		protected override void ConsumeStatistics()
		{
			var packetCounts = new Dictionary<uint, List<int>>();

			// every 5 minutes we update packet count/total size and flush to the DB
			foreach (PacketInfo pktInfo in m_queuedStats)
			{
				if (!packetCounts.ContainsKey(pktInfo.PacketID.RawId))
				{
					packetCounts.Add(pktInfo.PacketID.RawId, new List<int>());
				}

				packetCounts[pktInfo.PacketID.RawId].Add(pktInfo.PacketSize);
			}

			var extInfoList = new List<ExtendedPacketInfo>();

			// calculate extended pkt info
			foreach (var packetCount in packetCounts)
			{
				var pktInfo = new ExtendedPacketInfo
				              	{
					OpCode = (RealmServerOpCode)packetCount.Key,
					PacketCount = packetCount.Value.Count,
					TotalPacketSize = packetCount.Value.Sum(),
					AveragePacketSize = (int)packetCount.Value.Average(),
					StartTime = DateTime.Now.Subtract(TimeSpan.FromMinutes(5)),
					EndTime = DateTime.Now
				};

				List<int> packetSizes = packetCount.Value;

				int stdDev = GetStandardDeviation(packetSizes);
				pktInfo.StandardDeviation = stdDev;

				// push to le db.
			}
		}