//public void CreateCollection(int step, int bulksize,int filenum)
        public void CreateCollection(int filenum)
        {
            GuangZhou_GbEntities_209 gb = new GuangZhou_GbEntities_209();
            gb.CommandTimeout = 0;
            gb.ContextOptions.LazyLoadingEnabled = true;
            gb.Gb_FlowControly.MergeOption = MergeOption.NoTracking;
            LacCellBvci lcb = new LacCellBvci();
            //List<FlowControlOneBvc> fcob_list = new List<FlowControlOneBvc>();
            //查询
            var fc = from p in gb.Gb_FlowControly.Where(e => e.FileNum == filenum)
                     //.OrderBy(e => e.PacketNum ).Skip(step * bulksize).Take(bulksize)
                     //var fc = from p in gb.Gb_FlowControly
                     select new
                     {
                         p.FileNum,
                         p.PacketNum,
                         p.bssgp_tlli,
                         p.Flow_Control_time,
                         p.ip_src_host,
                         p.ip_dst_host,
                         p.nsip_bvci,
                         p.Flow_Control_MsgType,
                         p.ip_len,
                         p.bssgp_direction,
                         p.bssgp_bmax_default_ms,
                         p.bssgp_bucket_full_ratio,
                         p.bssgp_bucket_leak_rate,
                         p.bssgp_bvc_bucket_size,
                         p.bssgp_ms_bucket_size,
                         p.bssgp_R_default_ms,
                     };

            Parallel.ForEach(fc, p =>
            //foreach (var p in fc.AsParallel().ToList())
            {
                FlowControlOneBvc fcob = new FlowControlOneBvc();
                fcob._id = p.FileNum * 100000000 + p.PacketNum;
                //fcob.FileNum = p.FileNum;
                //fcob.PacketNum = p.PacketNum;
                fcob.tlli = p.bssgp_tlli;
                fcob.Flow_Control_time = DateTime.Parse(p.Flow_Control_time);
                fcob.lac_cell = lcb.GetLacCell(p.ip_src_host, p.ip_dst_host, p.nsip_bvci.ToString());
                fcob.bvci = p.nsip_bvci.ToString();
                fcob.Flow_Control_MsgType = p.Flow_Control_MsgType;
                fcob.ip_len = (int)p.ip_len;
                fcob.bssgp_direction = p.bssgp_direction;
                fcob.bssgp_bmax_default_ms = Convert.ToDouble(p.bssgp_bmax_default_ms) / 1000.0;
                fcob.bssgp_bucket_full_ratio = p.bssgp_bucket_full_ratio;
                fcob.bssgp_bucket_leak_rate = Convert.ToDouble(p.bssgp_bucket_leak_rate) / 1000.0;
                fcob.bssgp_bvc_bucket_size = Convert.ToDouble(p.bssgp_bvc_bucket_size) / 1000.0;
                fcob.bssgp_ms_bucket_size = Convert.ToDouble(p.bssgp_ms_bucket_size) / 1000.0;
                fcob.bssgp_R_default_ms = Convert.ToDouble(p.bssgp_R_default_ms) / 1000.0;

                //Task.Factory.StartNew(() => FCOB_col.Insert(fcob));
                //fcob_list.Add(fcob);
                FCOB_col.Insert(fcob);
                //}
            });

            /*
             *
             * tolist 修改成  asienumble,预计可以解决内存不足的问题
             * */

            //BulkMongo(fcob_list);
            //fcob_list.Clear();
            //var fclook = fc.AsParallel().ToList();

            //var fcl = from p in fclook.AsParallel()
            //          select new FlowControlOneBvc
            //          {
            //              _id = p.PacketNum,
            //              PacketNum = p.PacketNum,
            //              Flow_Control_time = DateTime.Parse(p.Flow_Control_time),
            //              lac_cell = lcb.GetLacCell(p.ip_src_host, p.ip_dst_host, p.nsip_bvci.ToString()),
            //              Flow_Control_MsgType = p.Flow_Control_MsgType,
            //              ip_len = (int)p.ip_len,
            //              bssgp_direction = p.bssgp_direction,
            //              bssgp_bmax_default_ms = Convert.ToDouble(p.bssgp_bmax_default_ms) / 1000.0,
            //              bssgp_bucket_full_ratio = p.bssgp_bucket_full_ratio,
            //              bssgp_bucket_leak_rate = Convert.ToDouble(p.bssgp_bucket_leak_rate) / 1000.0,
            //              bssgp_bvc_bucket_size = Convert.ToDouble(p.bssgp_bvc_bucket_size) / 1000.0,
            //              bssgp_ms_bucket_size = Convert.ToDouble(p.bssgp_ms_bucket_size) / 1000.0,
            //              bssgp_R_default_ms = Convert.ToDouble(p.bssgp_R_default_ms) / 1000.0,
            //          };

            //BulkMongo(fcl.AsParallel().ToList());
        }
Пример #2
0
 private void navBarItem29_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs ee)
 {
     clearColumns();
     FlowControlOneBvc fcob = new FlowControlOneBvc();
     var fcobmongo = fcob.QueryMongo().Where(e => e.lac_cell == textBox8.Text).AsParallel().ToList();
     var query = from p in fcobmongo
                 group p by p.Flow_Control_MsgType into ttt
                 select new
                 {
                     ttt.Key,
                     cnt = ttt.Count(),
                 };
     gridControl1.DataSource = query.OrderByDescending(e => e.cnt).AsParallel().ToList();
     gridView1.OptionsView.ColumnAutoWidth = true;
 }
Пример #3
0
        private void navBarItem25_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs ee)
        {
            FlowControlOneBvc fcob = new FlowControlOneBvc();
            var query = from p in fcob.QueryMongo()
                        select new
                            {
                                p._id,
                                p.Flow_Control_time,
                                p.lac_cell,
                                p.Flow_Control_MsgType,
                                p.bssgp_direction,
                                p.ip_len,
                                p.bssgp_bmax_default_ms,
                                p.bssgp_bucket_full_ratio,
                                p.bssgp_bucket_leak_rate,
                                p.bssgp_bvc_bucket_size,
                                p.bssgp_ms_bucket_size,
                                p.bssgp_R_default_ms,

                            };

            clearColumns();
            var dborder = query.Take(1000);
            gridControl1.DataSource = dborder.AsParallel().ToList();
            gridView1.OptionsView.ColumnAutoWidth = true;
        }
Пример #4
0
        private void navBarItem27_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs ee)
        {
            string msfc_msg = "BSSGP.FLOW-CONTROL-MS";
            string fc_msg = "BSSGP.FLOW-CONTROL-BVC";
            //分组
            FlowControlOneBvc fcob = new FlowControlOneBvc();

               var fcobmongo = fcob.QueryMongo().Where(e => e.lac_cell != null).AsParallel().ToList();

            //var fcobmongo = fcob.QueryMongo().Where(e => e.lac_cell != null).AsParallel().AsEnumerable();

            var query = from p in fcobmongo
                        group p by p.lac_cell into ttt
                        select new FlowControlMapBvc
                        {
                            _id = GenerateId(),
                            lac_cell = ttt.Key,
                            //lac_cell = ttt.Key.lac_cell,
                            //bvci=ttt.Key.bvci,
                            fcb_cnt = ttt.Where(e => e.Flow_Control_MsgType == fc_msg).Count(),
                            packet_cnt = ttt.Count(),
                            tlli_cnt = ttt.Select(e => e.tlli).Distinct().Count(),

                            bssgp_R_default_ms = ttt.Where(e => e.Flow_Control_MsgType == fc_msg).Average(e => e.bssgp_R_default_ms),
                            bssgp_ms_bucket_size = ttt.Where(e => e.Flow_Control_MsgType == fc_msg).Average(e => e.bssgp_ms_bucket_size),
                            //bssgp_bvc_bucket_size = ttt.Where(e => e.Flow_Control_MsgType == fc_msg).Average(e => e.bssgp_bvc_bucket_size),
                            //bssgp_bucket_leak_rate = ttt.Where(e => e.Flow_Control_MsgType == fc_msg).Average(e => e.bssgp_bucket_leak_rate),
                            bssgp_bucket_full_ratio = ttt.Where(e => e.Flow_Control_MsgType == fc_msg).Average(e => e.bssgp_bucket_full_ratio),
                            bssgp_bmax_default_ms = ttt.Where(e => e.Flow_Control_MsgType == fc_msg).Average(e => e.bssgp_bmax_default_ms),

                            //用户级别
                            ms_bucket_size = ttt.Where(e => e.Flow_Control_MsgType == msfc_msg).Where(e => e.bssgp_ms_bucket_size > 0).Average(e => e.bssgp_ms_bucket_size),
                            ms_leak_rate = ttt.Where(e => e.Flow_Control_MsgType == msfc_msg).Where(e => e.bssgp_bucket_leak_rate > 0).Average(e => e.bssgp_bucket_leak_rate),

                            fcb_delay_aggre = ttt.Where(e => e.Flow_Control_MsgType == fc_msg).OrderBy(e => e._id)
                                                .Select(e => new { fd = (e.Flow_Control_time - ttt.Min(f => f.Flow_Control_time)).TotalMilliseconds })
                                                .Select(e => (e.fd / 1000).ToString("f1"))
                                                .Aggregate((a, b) => a + "," + b),

                            bssgp_bucket_leak_rate = ttt.Where(e => e.Flow_Control_MsgType == fc_msg)
                            .OrderBy(e => e._id)
                                            .Select(e => (e.bssgp_bucket_leak_rate).ToString("f1"))
                                            .Aggregate((a, b) => a + "," + b),

                            bssgp_bvc_bucket_size = ttt.Where(e => e.Flow_Control_MsgType == fc_msg)
                            .OrderBy(e => e._id)
                                             .Select(e => (e.bssgp_bvc_bucket_size).ToString("f1"))
                                             .Aggregate((a, b) => a + "," + b),

                            ////用扩展方法实现, 在fc消息之间进行ip.len的累加
                            tlli_distinct_aggre = ttt.Select(e => e.tlli).Distinct().Aggregate((a, b) => a + "," + b),

                            msg_distinct_aggre = ttt.Select(e => e.Flow_Control_MsgType).Distinct().Aggregate((a, b) => a + "," + b),

                            down_total_len = ttt.OrderBy(e => e._id)
                            .AggregateSum(e => (int)e.ip_len, e => e.Flow_Control_MsgType, fc_msg),

                            down_packet_rate = ttt.OrderBy(e => e._id)
                            .AggregatePacketRate(e => (int)e.ip_len, e => e.Flow_Control_time, e => e.Flow_Control_MsgType, fc_msg),

                            fcb_time_aggre = ttt.OrderBy(e => e._id)
                            .AggregatePacketTime(e => e.Flow_Control_time, e => e.Flow_Control_MsgType, fc_msg),
                        };

            FlowControlMapBvc fcmb = new FlowControlMapBvc();
            fcmb.BulkMongo(query.ToList());
            MessageBox.Show("OK");
        }
Пример #5
0
 /*计算bvci级流量控制
  *    ,[bssgp_ms_bucket_size]
   ,[bssgp_bucket_leak_rate]
   ,[bssgp_bvc_bucket_size]
   ,[bssgp_bmax_default_ms]
   ,[bssgp_R_default_ms]
   ,[bssgp_bucket_full_ratio]
  * */
 //再弄一个库出来
 private void navBarItem23_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs ee)
 {
     FlowControlOneBvc fcob = new FlowControlOneBvc();
     fcob.CreateCollection();
     MessageBox.Show("ok");
 }