Internal Profile refactor and cleanup
This commit is contained in:
parent
d339848802
commit
e8b76b23ce
1 changed files with 8 additions and 6 deletions
|
@ -11,12 +11,13 @@ namespace Ryujinx.Profiler
|
||||||
private Stopwatch SW;
|
private Stopwatch SW;
|
||||||
internal ConcurrentDictionary<ProfileConfig, TimingInfo> Timers;
|
internal ConcurrentDictionary<ProfileConfig, TimingInfo> Timers;
|
||||||
|
|
||||||
private readonly object SessionLock = new object();
|
private readonly object _sessionLock = new object();
|
||||||
private int SessionCounter = 0;
|
private int _sessionCounter = 0;
|
||||||
|
|
||||||
public InternalProfile()
|
public InternalProfile()
|
||||||
{
|
{
|
||||||
Timers = new ConcurrentDictionary<ProfileConfig, TimingInfo>();
|
Timers = new ConcurrentDictionary<ProfileConfig, TimingInfo>();
|
||||||
|
|
||||||
SW = new Stopwatch();
|
SW = new Stopwatch();
|
||||||
SW.Start();
|
SW.Start();
|
||||||
}
|
}
|
||||||
|
@ -69,18 +70,19 @@ namespace Ryujinx.Profiler
|
||||||
public string GetSession()
|
public string GetSession()
|
||||||
{
|
{
|
||||||
// Can be called from multiple threads so locked to ensure no duplicate sessions are generated
|
// 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<ProfileConfig, TimingInfo> GetProfilingData()
|
public Dictionary<ProfileConfig, TimingInfo> GetProfilingData()
|
||||||
{
|
{
|
||||||
|
Dictionary<ProfileConfig, TimingInfo> outDict = new Dictionary<ProfileConfig, TimingInfo>();
|
||||||
|
|
||||||
// Forcibly get copy so user doesn't block profiling
|
// Forcibly get copy so user doesn't block profiling
|
||||||
ProfileConfig[] configs = Timers.Keys.ToArray();
|
ProfileConfig[] configs = Timers.Keys.ToArray();
|
||||||
TimingInfo[] times = Timers.Values.ToArray();
|
TimingInfo[] times = Timers.Values.ToArray();
|
||||||
Dictionary<ProfileConfig, TimingInfo> outDict = new Dictionary<ProfileConfig, TimingInfo>();
|
|
||||||
|
|
||||||
for (int i = 0; i < configs.Length; i++)
|
for (int i = 0; i < configs.Length; i++)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue