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.