Possible Duplicate:
How do I measure how long a function is running?
I have an I/O time-taking method which c
StopWatch class looks for your best solution.
Stopwatch sw = Stopwatch.StartNew();
DoSomeWork();
sw.Stop();
Console.WriteLine("Time taken: {0}ms", sw.Elapsed.TotalMilliseconds);
Also it has a static field called Stopwatch.IsHighResolution. Of course, this is a hardware and operating system issue.
Indicates whether the timer is based on a high-resolution performance counter.