std.perf

Part of StandardLibraryCategory

Description

Use the HighPerformanceCounter object in std.perf to find out how long it takes to execute some code.

Example

import std.stdio;
import std.c.time;
import std.perf;


void main ()
{
  HighPerformanceCounter hpc = new HighPerformanceCounter();
  hpc.start();

  /* Code to be timed goes here ... just msleep for 1.2 seconds */
  std.c.time.msleep(1200);

  hpc.stop();
  writefln("hpc ms: ", hpc.microseconds(),
              "  Seconds: ", hpc.microseconds() / 1000000.0);
}

Source

Contributed by Lynn in the forum.

Link http://www.dsource.org/tutorials/index.php?show_example=118
Posted by jcc7
Date/Time Wed Dec 15, 2004 2:31 pm