made performancestatictics class non-static
This commit is contained in:
parent
702d388510
commit
f5376a48a7
5 changed files with 34 additions and 30 deletions
|
@ -8,6 +8,7 @@ namespace Ryujinx.Core
|
|||
{
|
||||
public static class Logging
|
||||
{
|
||||
private static Stopwatch ExecutionTime = new Stopwatch();
|
||||
private const string LogFileName = "Ryujinx.log";
|
||||
|
||||
private static bool EnableInfo = Config.LoggingEnableInfo;
|
||||
|
@ -26,7 +27,7 @@ namespace Ryujinx.Core
|
|||
|
||||
public static string GetExecutionTime()
|
||||
{
|
||||
return PerformanceStatistics.ElapsedMilliseconds.ToString().PadLeft(8, '0') + "ms";
|
||||
return ExecutionTime.ElapsedMilliseconds.ToString().PadLeft(8, '0') + "ms";
|
||||
}
|
||||
|
||||
private static string WhoCalledMe()
|
||||
|
|
|
@ -154,7 +154,7 @@ namespace Ryujinx.Core.OsHle.IpcServices.Android
|
|||
|
||||
private long GbpQueueBuffer(ServiceCtx Context, BinaryReader ParcelReader)
|
||||
{
|
||||
PerformanceStatistics.RecordGameFrameTime();
|
||||
Context.Ns.Statistics.RecordGameFrameTime();
|
||||
|
||||
//TODO: Errors.
|
||||
int Slot = ParcelReader.ReadInt32();
|
||||
|
|
|
@ -5,50 +5,50 @@ using System.Text;
|
|||
|
||||
namespace Ryujinx.Core
|
||||
{
|
||||
public static class PerformanceStatistics
|
||||
public class PerformanceStatistics
|
||||
{
|
||||
static Stopwatch ExecutionTime = new Stopwatch();
|
||||
Stopwatch ExecutionTime = new Stopwatch();
|
||||
|
||||
static long CurrentGameFrameEnded;
|
||||
static long CurrentSystemFrameEnded;
|
||||
static long CurrentSystemFrameStart;
|
||||
static long LastGameFrameEnded;
|
||||
static long LastSystemFrameEnded;
|
||||
long CurrentGameFrameEnded;
|
||||
long CurrentSystemFrameEnded;
|
||||
long CurrentSystemFrameStart;
|
||||
long LastGameFrameEnded;
|
||||
long LastSystemFrameEnded;
|
||||
|
||||
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)
|
||||
public double CurrentGameFrameTime;
|
||||
public double CurrentSystemFrameTime;
|
||||
public double PreviousGameFrameTime;
|
||||
public double PreviousSystemFrameTime;
|
||||
public double GameFrameRate => 1000f / (CurrentSystemFrameTime / 1000);
|
||||
public double SystemFrameRate => 1000f/(CurrentSystemFrameTime/1000);
|
||||
public long SystemFramesRendered;
|
||||
public long GameFramesRendered;
|
||||
public long ElapsedMilliseconds { get => ExecutionTime.ElapsedMilliseconds; }
|
||||
public long ElapsedMicroseconds { get => (long)
|
||||
(((double)ExecutionTime.ElapsedTicks / Stopwatch.Frequency) * 1000000); }
|
||||
public static long ElapsedNanoseconds { get => (long)
|
||||
public long ElapsedNanoseconds { get => (long)
|
||||
(((double)ExecutionTime.ElapsedTicks / Stopwatch.Frequency) * 1000000000); }
|
||||
|
||||
static PerformanceStatistics()
|
||||
public PerformanceStatistics()
|
||||
{
|
||||
ExecutionTime.Start();
|
||||
}
|
||||
|
||||
public static void StartSystemFrame()
|
||||
public void StartSystemFrame()
|
||||
{
|
||||
PreviousSystemFrameTime = CurrentSystemFrameTime;
|
||||
LastSystemFrameEnded = CurrentSystemFrameEnded;
|
||||
CurrentSystemFrameStart = ElapsedMicroseconds;
|
||||
}
|
||||
|
||||
public static void EndSystemFrame()
|
||||
public void EndSystemFrame()
|
||||
{
|
||||
CurrentSystemFrameEnded = ElapsedMicroseconds;
|
||||
CurrentSystemFrameTime = CurrentSystemFrameEnded - CurrentSystemFrameStart;
|
||||
SystemFramesRendered++;
|
||||
}
|
||||
|
||||
public static void RecordGameFrameTime()
|
||||
public void RecordGameFrameTime()
|
||||
{
|
||||
CurrentGameFrameEnded = ElapsedMicroseconds;
|
||||
CurrentGameFrameTime = CurrentGameFrameEnded - LastGameFrameEnded;
|
||||
|
|
|
@ -17,8 +17,9 @@ namespace Ryujinx.Core
|
|||
internal Horizon Os { get; private set; }
|
||||
internal VirtualFs VFs { get; private set; }
|
||||
|
||||
public Hid Hid { get; private set; }
|
||||
public SetSys Settings { get; private set; }
|
||||
public Hid Hid { get; private set; }
|
||||
public SetSys Settings { get; private set; }
|
||||
public PerformanceStatistics Statistics { get; private set; }
|
||||
|
||||
public event EventHandler Finish;
|
||||
|
||||
|
@ -32,6 +33,8 @@ namespace Ryujinx.Core
|
|||
|
||||
Hid = new Hid(Ram);
|
||||
|
||||
Statistics = new PerformanceStatistics();
|
||||
|
||||
Os = new Horizon(this);
|
||||
|
||||
Os.HidSharedMem.MemoryMapped += Hid.ShMemMap;
|
||||
|
|
|
@ -166,12 +166,12 @@ namespace Ryujinx
|
|||
|
||||
protected override void OnRenderFrame(FrameEventArgs e)
|
||||
{
|
||||
PerformanceStatistics.StartSystemFrame();
|
||||
Ns.Statistics.StartSystemFrame();
|
||||
|
||||
GL.Viewport(0, 0, Width, Height);
|
||||
|
||||
Title = $"Ryujinx Screen - (Vsync: {VSync} - FPS: {PerformanceStatistics.SystemFrameRate:0} - Guest FPS: " +
|
||||
$"{PerformanceStatistics.GameFrameRate:0})";
|
||||
Title = $"Ryujinx Screen - (Vsync: {VSync} - FPS: {Ns.Statistics.SystemFrameRate:0} - Guest FPS: " +
|
||||
$"{Ns.Statistics.GameFrameRate:0})";
|
||||
|
||||
GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
|
||||
|
||||
|
@ -180,7 +180,7 @@ namespace Ryujinx
|
|||
|
||||
SwapBuffers();
|
||||
|
||||
PerformanceStatistics.EndSystemFrame();
|
||||
Ns.Statistics.EndSystemFrame();
|
||||
}
|
||||
|
||||
protected override void OnResize(EventArgs e)
|
||||
|
|
Loading…
Add table
Reference in a new issue