コード例 #1
0
        //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
        public void CreatCollection()
        {
            GuangZhou_GbEntities_209 gb = new GuangZhou_GbEntities_209();
            gb.CommandTimeout = 0;
            gb.ContextOptions.LazyLoadingEnabled = true;
            gb.Gb_FlowControly.MergeOption = MergeOption.NoTracking;
            var fc = from p in gb.Gb_FlowControly
                     group p by new
                     {
                         p.bssgp_lac,
                         p.bssgp_ci,
                         p.nsip_bvci,
                         p.ip_src_host,
                         p.ip_dst_host,
                     } into ttt
                     select new
                     {
                         ttt.Key.bssgp_lac,
                         ttt.Key.bssgp_ci,
                         ttt.Key.nsip_bvci,
                         ttt.Key.ip_src_host,
                         ttt.Key.ip_dst_host,
                         cnt = ttt.Count()
                     };

            var bv = from p in fc.ToList()
                     where p.nsip_bvci != null
                     where p.bssgp_ci != null
                     where p.bssgp_lac != null
                     where p.ip_src_host != null
                     where p.ip_dst_host != null
                     select new LacCellBvci
                     {
                         _id = GenerateId(),
                         lac_cell = p.bssgp_lac.ToString() + "-" + p.bssgp_ci.ToString(),
                         src = p.ip_src_host,
                         dst = p.ip_dst_host,
                         bvci = p.nsip_bvci.ToString(),
                     };

            BulkMongo(bv.ToList());
        }
コード例 #3
0
 private void navBarItem7_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs ee)
 {
     GuangZhou_GbEntities_209 gb = new GuangZhou_GbEntities_209();
     gb.CommandTimeout = 0;
     gb.ContextOptions.LazyLoadingEnabled = true;
     gb.Gb_FlowControly.MergeOption = MergeOption.NoTracking;
     var maxt = gb.Gb_FlowControly.Max(e => e.PacketTime);
     var mint = gb.Gb_FlowControly.Min(e => e.PacketTime);
     TimeSpan ts = maxt.Value - mint.Value;
     var ttim = mint.Value.ToString() + "-" + maxt.Value.ToString() + "," + ts.TotalSeconds.ToString();
     richTextBox1.Text = ttim.ToString();
 }