Improve this page Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone. Page wiki View or edit the community-maintained wiki page associated with this page.

std.perf

Platform-independent performance measurement and timing classes.

PerformanceCounter is the main platform-independent timer class provided, covering the most typical use case, measuring elapsed wall-clock time.

The module also provides several Windows-specific timers that can be useful in specialized situations.

Synopsis:
alias PerformanceCounter.interval_t interval_t;
auto timer = new PerformanceCounter;
timer.start();
// do computation
timer.stop();
interval_t elapsedMsec = timer.milliseconds;
writefln("Time elapsed: %s msec", elapsedMsec);
In particular note that stop() must be called before querying the elapsed time.

These classes were ported to D from the STLSoft C++ libraries, which were documented in the article " Win32 Performance Measurement Options", May 2003 issue of Windows Develper Network.

Author:
Matthew Wilson

Source:
std/perf.d