How accurate is System.Diagnostics.Stopwatch?
.net, c#, performance, stopwatch
Solution
Why don't you profile your code instead of focusing on microbenchmarks?
There are some good open source profilers, like:
- NProf
- Prof-It for C#
- NProfiler
- ProfileSharp
Problem
How accurate is System.Diagnostics.Stopwatch? I am trying to do some metrics for different code paths and I need it to be exact. Should I be using stopwatch or is there another solution that is more accurate? I have been told that sometimes stopwatch gives incorrect information.