Add API to allow stopping already stopped AsyncStopwatch

This commit is contained in:
embeddedt 2023-01-22 16:32:50 -05:00
parent 23b4652864
commit a8df933e19
No known key found for this signature in database
GPG Key ID: A69433EC199B5613

View File

@ -21,6 +21,12 @@ public class AsyncStopwatch {
watch.reset();
}
public void ensureStoppedAsync() {
Stopwatch watch = threadStopwatch.get();
if(watch.isRunning())
stopMeasuringAsync();
}
public long getCpuTime() {
return cpuTimeMs.get();
}