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)
|
private long GbpQueueBuffer(ServiceCtx Context, BinaryReader ParcelReader)
|
||||||
{
|
{
|
||||||
|
PerformanceStatistics.RecordGameFrameTime();
|
||||||
|
|
||||||
//TODO: Errors.
|
//TODO: Errors.
|
||||||
int Slot = ParcelReader.ReadInt32();
|
int Slot = ParcelReader.ReadInt32();
|
||||||
int Unknown4 = ParcelReader.ReadInt32();
|
int Unknown4 = ParcelReader.ReadInt32();
|
||||||
|
|
|
@ -9,14 +9,20 @@ namespace Ryujinx.Core
|
||||||
{
|
{
|
||||||
static Stopwatch ExecutionTime = new Stopwatch();
|
static Stopwatch ExecutionTime = new Stopwatch();
|
||||||
|
|
||||||
static long LastFrameEnded;
|
static long CurrentGameFrameEnded;
|
||||||
static long CurrentFrameEnded;
|
static long CurrentSystemFrameEnded;
|
||||||
static long CurrentFrameStart;
|
static long CurrentSystemFrameStart;
|
||||||
|
static long LastGameFrameEnded;
|
||||||
|
static long LastSystemFrameEnded;
|
||||||
|
|
||||||
public static double PreviousFrameTime;
|
public static double CurrentGameFrameTime;
|
||||||
public static double CurrentFrameTime;
|
public static double CurrentSystemFrameTime;
|
||||||
public static double FrameRate { get => 1000f/(CurrentFrameTime/1000);}
|
public static double PreviousGameFrameTime;
|
||||||
public static long RenderedFrames;
|
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 ElapsedMilliseconds { get => ExecutionTime.ElapsedMilliseconds; }
|
||||||
public static long ElapsedMicroseconds { get => (long)
|
public static long ElapsedMicroseconds { get => (long)
|
||||||
(((double)ExecutionTime.ElapsedTicks / Stopwatch.Frequency) * 1000000); }
|
(((double)ExecutionTime.ElapsedTicks / Stopwatch.Frequency) * 1000000); }
|
||||||
|
@ -28,18 +34,27 @@ namespace Ryujinx.Core
|
||||||
ExecutionTime.Start();
|
ExecutionTime.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void StartFrame()
|
public static void StartSystemFrame()
|
||||||
{
|
{
|
||||||
PreviousFrameTime = CurrentFrameTime;
|
PreviousSystemFrameTime = CurrentSystemFrameTime;
|
||||||
LastFrameEnded = CurrentFrameEnded;
|
LastSystemFrameEnded = CurrentSystemFrameEnded;
|
||||||
CurrentFrameStart = ElapsedMicroseconds;
|
CurrentSystemFrameStart = ElapsedMicroseconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void EndFrame()
|
public static void EndSystemFrame()
|
||||||
{
|
{
|
||||||
CurrentFrameEnded = ElapsedMicroseconds;
|
CurrentSystemFrameEnded = ElapsedMicroseconds;
|
||||||
CurrentFrameTime = CurrentFrameEnded - CurrentFrameStart;
|
CurrentSystemFrameTime = CurrentSystemFrameEnded - CurrentSystemFrameStart;
|
||||||
RenderedFrames++;
|
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)
|
protected override void OnRenderFrame(FrameEventArgs e)
|
||||||
{
|
{
|
||||||
PerformanceStatistics.StartFrame();
|
PerformanceStatistics.StartSystemFrame();
|
||||||
|
|
||||||
GL.Viewport(0, 0, Width, Height);
|
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);
|
GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
|
||||||
|
|
||||||
|
@ -179,7 +180,7 @@ namespace Ryujinx
|
||||||
|
|
||||||
SwapBuffers();
|
SwapBuffers();
|
||||||
|
|
||||||
PerformanceStatistics.EndFrame();
|
PerformanceStatistics.EndSystemFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnResize(EventArgs e)
|
protected override void OnResize(EventArgs e)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue