added game frame time
This commit is contained in:
parent
5b343a83a9
commit
702d388510
3 changed files with 36 additions and 18 deletions
|
@ -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();
|
||||
|
|
|
@ -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++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue