Ejemplo n.º 1
0
        public NetStatistic GetStatisticInfo()
        {
            NetStatistic s = new NetStatistic();

            try
            {
                NetStatisticGroup basicGrop = s.AddGroup("基本信息", true);
                lock (sendList)
                {
                    basicGrop.AddItem("队列数", sendList.Count);
                    basicGrop.AddItem("队列字节", sendList.Sum(x => x.Frame.UDPData.Length));
                }

                NetStatisticGroup costGroup = s.AddGroup("平均发送耗时", true);
                costGroup.Columns[0].Unit = "byte";
                lock (avgSendCost)
                {
                    foreach (KeyValuePair <string, long> ci in avgSendCost)
                    {
                        costGroup.AddItem(ci.Key, ci.Value);
                    }
                }
            }
            catch { }
            return(s);
        }
Ejemplo n.º 2
0
        public override NetStatistic GetStatisticInfo()
        {
            NetStatistic s = base.GetStatisticInfo();

            NetStatisticGroup gs = s.AddGroup("会话信息", false);

            gs.AddColumn("代理ID", "SEQ");
            gs.AddColumn("接收字节数", "BYTE");
            gs.AddColumn("发送字节数", "BYTE");
            gs.AddColumn("错误字节数", "BYTE");
            gs.AddColumn("开始时间", "TIME");
            gs.AddColumn("最后接收时间", "TIME");
            gs.AddColumn("最后发送时间", "TIME");

            List <UdpServerSession> sl = null;

            lock (clientList)
            {
                sl = clientList.ToList();
            }
            foreach (UdpServerSession session in sl)
            {
                string           sn = string.Format("{0},{1},{2}", session.SessionID, session.Target.ToString(), session.Url ?? "");
                NetStatisticItem si = gs.AddItem(sn, session.ProxyID);
                si.Value2 = session.ReceivedBytes;
                si.Value3 = session.SendedBytes;
                si.Value4 = session.ErrorBytes;
                si.Value5 = session.StartTime.Ticks;
                si.Value6 = session.LastReceiveTime.Ticks;
                si.Value7 = session.LastSendTime.Ticks;
            }

            return(s);
        }
Ejemplo n.º 3
0
        public virtual NetStatistic GetStatisticInfo()
        {
            NetStatistic      s = Sender.GetStatisticInfo();
            NetStatisticGroup g = s.AddGroup("接收缓存", true);

            lock (receivedCache)
            {
                g.AddItem("接收缓存包总数", receivedCache.Count);
                g.AddItem("已处理包数", processedPackage.Count);
            }


            return(s);
        }