From a1ee1cc6904fe7111716e4b10f5146a16d6208db Mon Sep 17 00:00:00 2001 From: CptMoore <39010654+cptmoore@users.noreply.github.com> Date: Tue, 7 Jan 2025 09:09:30 +0100 Subject: [PATCH] Print out saved time due to sampling in percent. --- ModTek/Util/Stopwatch/MTStopwatchStats.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ModTek/Util/Stopwatch/MTStopwatchStats.cs b/ModTek/Util/Stopwatch/MTStopwatchStats.cs index 06d7bb7..75f25fd 100644 --- a/ModTek/Util/Stopwatch/MTStopwatchStats.cs +++ b/ModTek/Util/Stopwatch/MTStopwatchStats.cs @@ -33,8 +33,8 @@ public override string ToString() var ifAllMeasured = Count * MTStopwatch.GetTimestampOverheadInAndAfterMeasurement; var onlySampledMeasured = sampled * MTStopwatch.GetTimestampOverheadInAndAfterMeasurement + Count * MTStopwatchWithSampling.SamplingCheckOverhead; var saved = ifAllMeasured - onlySampledMeasured; - var savedTimeSan = MTStopwatch.TimeSpanFromTicks((long)saved); - suffix = $", sampling interval of {_samplingInterval} saved {savedTimeSan}"; + var savedPercent = (byte)(saved / (Ticks + saved) * 100); + suffix = $", sampling interval of {_samplingInterval} saved {savedPercent}%"; } return $"{verb} {Count} times, taking a total of {TotalTime} with an average of {AverageNanoseconds}ns{suffix}"; }