|
using System;
using System.Runtime.InteropServices;
namespace IterativeQuickSort
{
class Stopwatch
{
[DllImport("kernel32.dll")]
extern static short QueryPerformanceCounter(ref long x);
[DllImport("kernel32.dll")]
extern static short QueryPerformanceFrequency(ref long x);
private static double strt;
public static double time;
public static void Start()
{
long cnt = 0;
long frq = 0;
QueryPerformanceCounter(ref cnt);
QueryPerformanceFrequency(ref frq);
strt = (double)cnt / (double)frq;
}
public static void Stop()
{
long cnt = 0;
long frq = 0;
QueryPerformanceCounter(ref cnt);
QueryPerformanceFrequency(ref frq);
double c = (double)cnt / (double)frq;
time = (c - strt) * 1000;
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.