码迷,mamicode.com
首页 > 其他好文 > 详细

计算运行时间

时间:2014-05-23 03:23:49      阅读:239      评论:0      收藏:0      [点我收藏+]

标签:style   c   color   a   strong   rgb   

            如下参考实例:

            TimeSpan ts= new TimeSpan(0);
            TimeSpan ts2 = new TimeSpan(0);
            foreach (var item in alarmListOfSpecifyOrg)
            {
                if (_graphicsManager.ExistsAlarm(_graphicsManager.AlarmGraphics, item))
                    continue;

                //long aa = System.Environment.TickCount;

                DateTime a1 = DateTime.Now;
                Graphic g = _graphicsManager.AlarmDataToGraphic(item);
                DateTime a2 = DateTime.Now;

                ts = ts+(a2 - a1);

               // long bb = System.Environment.TickCount - aa;
              //  s += bb;

                if (g != null)
                {
                   // long cc = System.Environment.TickCount;
                    DateTime b1 = DateTime.Now;
                    _graphicsManager.Graphics.Add(g);
                    DateTime b2 = DateTime.Now;

                    ts2 = ts2 + (b2 - b1);
                   
                }
            }

            System.Diagnostics.Debug.WriteLine("创建:" + ts.TotalMilliseconds);
            System.Diagnostics.Debug.WriteLine("添加:" + ts2.TotalMilliseconds);

            _graphicsLayerHelper.GLayer.Visible = true;

            //long gg = System.Environment.TickCount - qq;

            //DateTime b = DateTime.Now;
           // TimeSpan ts = b - a;
          //System.Diagnostics.Debug.WriteLine("总计:" +ts.TotalMilliseconds);

        }

计算运行时间,布布扣,bubuko.com

计算运行时间

标签:style   c   color   a   strong   rgb   

原文地址:http://www.cnblogs.com/changbaishan/p/3742685.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!