Update: You can find an updated and significantly improved version of this post in my book "Pro .NET Benchmarking".
In the previous post, we discussed
This structure can be used in situations when you don't need a good level of precision.
If you want to do high-precision time measurements, you need a better tool because
DateTime has a small resolution and a big latency.
Also, time is tricky, you can create wonderful bugs if you don't understand how it works (see Falsehoods programmers believe about time and More falsehoods programmers believe about time).
In this post, we will briefly talk about the Stopwatch class:
Stopwatchin different environments
If you are not a .NET developer, you can also find a lot of useful information in this post: mainly we will discuss low-level details of high-resolution timestamping (probably your favorite language also uses the same API). As usual, you can also find useful links for further reading.Read more