You can use TStopwatch
from the System.Diagnostics
unit to measure elapsed time using the system's high-resolution performance counter.
var
Stopwatch: TStopwatch;
Elapsed: TTimeSpan;
....
Stopwatch := TStopwatch.StartNew;
DoSomething;
Elapsed := Stopwatch.Elapsed;
To read a time value in seconds, say, from a time span, do this:
var
Seconds: Double;
....
Seconds := Elapsed.TotalSeconds;
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…