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



    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: {0:00}:{1:00}:{2:00}.{3:00}",
    ts.Hours, ts.Minutes, ts.Seconds,
    ts.Milliseconds / 10);
    Console.WriteLine(elapsedTime, "RunTime");

  • 相关阅读:
    PHP静态
    PHP批量删除
    PHP增删改查
    PHP数据访问
    PHP继承和多态
    PHP封装
    PHP字符串处理和正则表达式
    PHP数组
    PHP函数
    PHP基础
  • 原文地址:https://www.cnblogs.com/luquanmingren/p/3789774.html
Copyright © 2020-2023  润新知