From e8b76b23ce1c6092e510984f32995ee92aa57da5 Mon Sep 17 00:00:00 2001 From: Andy Adshead Date: Sun, 27 Jan 2019 15:12:19 +0000 Subject: [PATCH] Internal Profile refactor and cleanup --- Ryujinx.Profiler/InternalProfile.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Ryujinx.Profiler/InternalProfile.cs b/Ryujinx.Profiler/InternalProfile.cs index 7e4612a83f..457f322c12 100644 --- a/Ryujinx.Profiler/InternalProfile.cs +++ b/Ryujinx.Profiler/InternalProfile.cs @@ -11,12 +11,13 @@ namespace Ryujinx.Profiler private Stopwatch SW; internal ConcurrentDictionary Timers; - private readonly object SessionLock = new object(); - private int SessionCounter = 0; + private readonly object _sessionLock = new object(); + private int _sessionCounter = 0; public InternalProfile() { Timers = new ConcurrentDictionary(); + SW = new Stopwatch(); SW.Start(); } @@ -69,18 +70,19 @@ namespace Ryujinx.Profiler public string GetSession() { // Can be called from multiple threads so locked to ensure no duplicate sessions are generated - lock (SessionLock) + lock (_sessionLock) { - return (SessionCounter++).ToString(); + return (_sessionCounter++).ToString(); } } public Dictionary GetProfilingData() { + Dictionary outDict = new Dictionary(); + // Forcibly get copy so user doesn't block profiling ProfileConfig[] configs = Timers.Keys.ToArray(); - TimingInfo[] times = Timers.Values.ToArray(); - Dictionary outDict = new Dictionary(); + TimingInfo[] times = Timers.Values.ToArray(); for (int i = 0; i < configs.Length; i++) {