Stopwatch is designed for this purpose and is one of the best way to measure time execution in .NET.

System.Diagnostics.Stopwatch objWatch = System.Diagnostics.Stopwatch.StartNew(); 

//Codigo a medir desempeño
objWatch.Stop(); 
long lngMilisegundos = objWatch.ElapsedMilliseconds;
Advertisements