public void ExitZone(String zoneName) { if (!GameSettings.Default.DrawDebugData || FirstFrameAfterShown) { return; } TrackerZone z; if (!zoneList.TryGetValue(zoneName, out z)) { return; // Just give up if the zone doesn't exist. } TrackerZone cur = zone.Peek(); if (z != zone.Peek()) { throw new Exception("TrackerZone " + z.Name + " trying to exit but we are actually in " + cur.Name); } lock (internalTrackerLockObject) { foreach (KeyValuePair <string, Tracker> kvp in internalTrackers) { kvp.Value.ExitZone(); } } zone.Pop(); }
public ZoneData(TrackerZone zone, int historySize) { threadName = GamePerformance.threadName; if (threadName == null) { Debugger.Break(); } name = zone.Name; history = new Queue <long>(historySize); maxHistory = historySize; }
public void EnterZone(String zoneName) { int id = ThreadID; TrackerZone z; if (!zoneList.TryGetValue(zoneName, out z)) { z = new TrackerZone(zoneName); zoneList.TryAdd(zoneName, z); } zone.Push(z); lock (internalTrackerLockObject) { foreach (KeyValuePair <string, Tracker> kvp in internalTrackers) { kvp.Value.EnterZone(); } } }
private ZoneData GetData(bool autoCreate = true) { ZoneData data; TrackerZone z = zone.Peek(); if (!zoneData.TryGetValue(z.ID, out data)) { if (!autoCreate) { return(null); } data = new ZoneData(z, maxHistory); lock (zoneDataLockObject) { zoneData.Add(z.ID, data); } zonesUsed++; } return(data); }
public void ExitZone(String zoneName) { TrackerZone z; if (!zoneList.TryGetValue(zoneName, out z)) { throw new Exception("Unknown TrackerZone found."); } TrackerZone cur = zone.Peek(); if (z != zone.Peek()) { throw new Exception("TrackerZone " + z.Name + " trying to exit but we are actually in " + cur.Name); } lock (internalTrackerLockObject) { foreach (KeyValuePair <string, Tracker> kvp in internalTrackers) { kvp.Value.ExitZone(); } } zone.Pop(); }
public void EnterZone(String zoneName) { if (!GameSettings.Default.DrawDebugData || FirstFrameAfterShown) { return; } int id = ThreadID; TrackerZone z; if (!zoneList.TryGetValue(zoneName, out z)) { z = new TrackerZone(zoneName); zoneList.TryAdd(zoneName, z); } zone.Push(z); lock (internalTrackerLockObject) { foreach (KeyValuePair <string, Tracker> kvp in internalTrackers) { kvp.Value.EnterZone(); } } }