diff --git a/Ryujinx.HLE/PerformanceStatistics.cs b/Ryujinx.HLE/PerformanceStatistics.cs index b254356c1b..95fc2abe39 100644 --- a/Ryujinx.HLE/PerformanceStatistics.cs +++ b/Ryujinx.HLE/PerformanceStatistics.cs @@ -5,11 +5,10 @@ namespace Ryujinx.HLE { public class PerformanceStatistics { - private const double FrameRateWeight = 0.5; - private const int FrameTypeGame = 0; - private const int PercentTypeFifo = 0; + private const int FrameTypeGame = 0; + private const int PercentTypeFifo = 0; - private double[] _averageFrameRate; + private double[] _frameRate; private double[] _accumulatedFrameTime; private double[] _previousFrameTime; @@ -30,7 +29,7 @@ namespace Ryujinx.HLE public PerformanceStatistics() { - _averageFrameRate = new double[1]; + _frameRate = new double[1]; _accumulatedFrameTime = new double[1]; _previousFrameTime = new double[1]; @@ -45,7 +44,7 @@ namespace Ryujinx.HLE _frameLock = new object[] { new object() }; _percentLock = new object[] { new object() }; - _resetTimer = new Timer(1000); + _resetTimer = new Timer(750); _resetTimer.Elapsed += ResetTimerElapsed; _resetTimer.AutoReset = true; @@ -57,11 +56,11 @@ namespace Ryujinx.HLE private void ResetTimerElapsed(object sender, ElapsedEventArgs e) { - CalculateAverageFrameRate(FrameTypeGame); + CalculateFrameRate(FrameTypeGame); CalculateAveragePercent(PercentTypeFifo); } - private void CalculateAverageFrameRate(int frameType) + private void CalculateFrameRate(int frameType) { double frameRate = 0; @@ -72,7 +71,7 @@ namespace Ryujinx.HLE frameRate = _framesRendered[frameType] / _accumulatedFrameTime[frameType]; } - _averageFrameRate[frameType] = LinearInterpolate(_averageFrameRate[frameType], frameRate); + _frameRate[frameType] = frameRate; _framesRendered[frameType] = 0; _accumulatedFrameTime[frameType] = 0; } @@ -97,11 +96,6 @@ namespace Ryujinx.HLE } } - private static double LinearInterpolate(double lhs, double rhs) - { - return lhs * (1.0 - FrameRateWeight) + rhs * FrameRateWeight; - } - public void RecordGameFrameTime() { RecordFrameTime(FrameTypeGame); @@ -157,12 +151,17 @@ namespace Ryujinx.HLE public double GetGameFrameRate() { - return _averageFrameRate[FrameTypeGame]; + return _frameRate[FrameTypeGame]; } public double GetFifoPercent() { return _averagePercent[PercentTypeFifo]; } + + public double GetGameFrameTime() + { + return 1000 / _frameRate[FrameTypeGame]; + } } } \ No newline at end of file diff --git a/Ryujinx.Headless.SDL2/WindowBase.cs b/Ryujinx.Headless.SDL2/WindowBase.cs index 6297e64e15..858b08010e 100644 --- a/Ryujinx.Headless.SDL2/WindowBase.cs +++ b/Ryujinx.Headless.SDL2/WindowBase.cs @@ -198,7 +198,7 @@ namespace Ryujinx.Headless.SDL2 Device.EnableDeviceVsync, dockedMode, Device.Configuration.AspectRatio.ToText(), - $"Game: {Device.Statistics.GetGameFrameRate():00.00} FPS", + $"Game: {Device.Statistics.GetGameFrameRate():00.00} FPS ({Device.Statistics.GetGameFrameTime():00.00} ms)", $"FIFO: {Device.Statistics.GetFifoPercent():0.00} %", $"GPU: {_gpuVendorName}")); diff --git a/Ryujinx/Ui/RendererWidgetBase.cs b/Ryujinx/Ui/RendererWidgetBase.cs index 2ddd44dca8..c25e2163d1 100644 --- a/Ryujinx/Ui/RendererWidgetBase.cs +++ b/Ryujinx/Ui/RendererWidgetBase.cs @@ -427,7 +427,7 @@ namespace Ryujinx.Ui Device.EnableDeviceVsync, dockedMode, ConfigurationState.Instance.Graphics.AspectRatio.Value.ToText(), - $"Game: {Device.Statistics.GetGameFrameRate():00.00} FPS", + $"Game: {Device.Statistics.GetGameFrameRate():00.00} FPS ({Device.Statistics.GetGameFrameTime():00.00} ms)", $"FIFO: {Device.Statistics.GetFifoPercent():0.00} %", $"GPU: {_gpuVendorName}"));