首页 > 其他 > 详细

wp8 入门到精通 测量代码执行时间

时间:2014-06-18 23:14:32      阅读:361      评论:0      收藏:0      [点我收藏+]


Stopwatch time = new Stopwatch();

byte[] target = new byte[size];
for (int j = 0; j < size; j++)
target[j] = unchecked((byte)j); //Otherwise parts of the array are optimised out.

CCMD5Core.GetHash(target);

time.Start();
for (int i = 1; i <= iterations; i++)
{
target[0] = unchecked((byte)i);
CCMD5Core.GetHash(target);
}
time.Stop();

TimeSpan ts = time.Elapsed;

// Format and display the TimeSpan value.
string elapsedTime = String.Format(CultureInfo.CurrentCulture, "Total time for core iterations: \t{0:00}:{1:00}:{2:00}.{3:00}",
ts.Hours, ts.Minutes, ts.Seconds,
ts.Milliseconds / 10);
Console.WriteLine(elapsedTime, "RunTime");

wp8 入门到精通 测量代码执行时间,布布扣,bubuko.com

wp8 入门到精通 测量代码执行时间

原文:http://www.cnblogs.com/luquanmingren/p/3789774.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!