aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMutantAura <44103205+MutantAura@users.noreply.github.com>2021-09-15 01:26:10 +0100
committerGitHub <noreply@github.com>2021-09-15 02:26:10 +0200
commit843401635acb08686c745351666f86146de841b7 (patch)
tree274227f5b8e65e4aac51f10d5eb774ca4adb3e21
parentfb2e61a435f6a9d2201d521df47c9bfd12031df3 (diff)
Adjustments to framerate metric and addition of frametime (#2638)
* Adjust framerate data and add frametime * Update PerformanceStatistics.cs * Revert deletions of average framerate * Update Ryujinx.csproj * Remove separate GTK column * Increase FPS precision * general cleanup * even generaler cleanup * fix dumb * Remove legacy code * Update PerformanceStatistics.cs * Update PerformanceStatistics.cs
-rw-r--r--Ryujinx.HLE/PerformanceStatistics.cs29
-rw-r--r--Ryujinx.Headless.SDL2/WindowBase.cs2
-rw-r--r--Ryujinx/Ui/RendererWidgetBase.cs2
3 files changed, 16 insertions, 17 deletions
diff --git a/Ryujinx.HLE/PerformanceStatistics.cs b/Ryujinx.HLE/PerformanceStatistics.cs
index b254356c..95fc2abe 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 6297e64e..858b0801 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 2ddd44dc..c25e2163 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}"));