diff --git a/Ryujinx.Core/OsHle/Services/Vi/NvFlinger.cs b/Ryujinx.Core/OsHle/Services/Vi/NvFlinger.cs index 4b5f9819aa..6ab2f930e6 100644 --- a/Ryujinx.Core/OsHle/Services/Vi/NvFlinger.cs +++ b/Ryujinx.Core/OsHle/Services/Vi/NvFlinger.cs @@ -154,6 +154,8 @@ namespace Ryujinx.Core.OsHle.IpcServices.Android private long GbpQueueBuffer(ServiceCtx Context, BinaryReader ParcelReader) { + PerformanceStatistics.RecordGameFrameTime(); + //TODO: Errors. int Slot = ParcelReader.ReadInt32(); int Unknown4 = ParcelReader.ReadInt32(); diff --git a/Ryujinx.Core/PerformanceStatistics.cs b/Ryujinx.Core/PerformanceStatistics.cs index 02d2ca8454..de487563af 100644 --- a/Ryujinx.Core/PerformanceStatistics.cs +++ b/Ryujinx.Core/PerformanceStatistics.cs @@ -9,14 +9,20 @@ namespace Ryujinx.Core { static Stopwatch ExecutionTime = new Stopwatch(); - static long LastFrameEnded; - static long CurrentFrameEnded; - static long CurrentFrameStart; + static long CurrentGameFrameEnded; + static long CurrentSystemFrameEnded; + static long CurrentSystemFrameStart; + static long LastGameFrameEnded; + static long LastSystemFrameEnded; - public static double PreviousFrameTime; - public static double CurrentFrameTime; - public static double FrameRate { get => 1000f/(CurrentFrameTime/1000);} - public static long RenderedFrames; + public static double CurrentGameFrameTime; + public static double CurrentSystemFrameTime; + public static double PreviousGameFrameTime; + public static double PreviousSystemFrameTime; + public static double GameFrameRate => 1000f / (CurrentSystemFrameTime / 1000); + public static double SystemFrameRate => 1000f/(CurrentSystemFrameTime/1000); + public static long SystemFramesRendered; + public static long GameFramesRendered; public static long ElapsedMilliseconds { get => ExecutionTime.ElapsedMilliseconds; } public static long ElapsedMicroseconds { get => (long) (((double)ExecutionTime.ElapsedTicks / Stopwatch.Frequency) * 1000000); } @@ -28,18 +34,27 @@ namespace Ryujinx.Core ExecutionTime.Start(); } - public static void StartFrame() + public static void StartSystemFrame() { - PreviousFrameTime = CurrentFrameTime; - LastFrameEnded = CurrentFrameEnded; - CurrentFrameStart = ElapsedMicroseconds; + PreviousSystemFrameTime = CurrentSystemFrameTime; + LastSystemFrameEnded = CurrentSystemFrameEnded; + CurrentSystemFrameStart = ElapsedMicroseconds; } - public static void EndFrame() + public static void EndSystemFrame() { - CurrentFrameEnded = ElapsedMicroseconds; - CurrentFrameTime = CurrentFrameEnded - CurrentFrameStart; - RenderedFrames++; + CurrentSystemFrameEnded = ElapsedMicroseconds; + CurrentSystemFrameTime = CurrentSystemFrameEnded - CurrentSystemFrameStart; + SystemFramesRendered++; + } + + public static void RecordGameFrameTime() + { + CurrentGameFrameEnded = ElapsedMicroseconds; + CurrentGameFrameTime = CurrentGameFrameEnded - LastGameFrameEnded; + PreviousGameFrameTime = CurrentGameFrameTime; + LastGameFrameEnded = CurrentGameFrameEnded; + GameFramesRendered++; } } } diff --git a/Ryujinx/Ui/GLScreen.cs b/Ryujinx/Ui/GLScreen.cs index 4f353c4b00..0a58481271 100644 --- a/Ryujinx/Ui/GLScreen.cs +++ b/Ryujinx/Ui/GLScreen.cs @@ -166,11 +166,12 @@ namespace Ryujinx protected override void OnRenderFrame(FrameEventArgs e) { - PerformanceStatistics.StartFrame(); + PerformanceStatistics.StartSystemFrame(); GL.Viewport(0, 0, Width, Height); - Title = $"Ryujinx Screen - (Vsync: {VSync} - FPS: {PerformanceStatistics.FrameRate:0})"; + Title = $"Ryujinx Screen - (Vsync: {VSync} - FPS: {PerformanceStatistics.SystemFrameRate:0} - Guest FPS: " + + $"{PerformanceStatistics.GameFrameRate:0})"; GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); @@ -179,7 +180,7 @@ namespace Ryujinx SwapBuffers(); - PerformanceStatistics.EndFrame(); + PerformanceStatistics.EndSystemFrame(); } protected override void OnResize(EventArgs e)