mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-12-23 01:21:21 -08:00
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
This commit is contained in:
parent
fb2e61a435
commit
843401635a
@ -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];
|
||||
}
|
||||
}
|
||||
}
|
@ -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}"));
|
||||
|
||||
|
@ -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}"));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user