Recording program time consuming method

Use in C#Stopwatch  

Namespace: System.Diagnostics;

System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch(); 
stopwatch.Start();
// Here: Computation time consuming process / method
stopwatch.Stop();
stopwatch.Elapsed.TotalSeconds //Here is the total number of seconds to run, accurate to milliseconds.

Leave a Reply

Your email address will not be published. Required fields are marked *