public void StopCounter(int counterId) { if (counterId <= 0) { return; } lock (_counters) { ViewModelPerformanceCounter c = getCounter(counterId); c.Stop(); } }
public void Start(int counterId, double curFrameTime) { if (counterId <= 0) { return; } lock (_counters) { ViewModelPerformanceCounter c = getCounter(counterId); c.Start(curFrameTime); } }
public int RegisterCounter(string deviceName, string functionName) { ViewModelPerformanceCounter counter = new ViewModelPerformanceCounter(_UIDispatcher); counter.DeviceName = deviceName; counter.FunctionName = functionName; int counterId; //bool noVacancy = true; lock (_counters) { counterId = getUniqueId(); counter.CounterId = counterId; _counters.Add(counter); } //OnPropertyChanged("Counters"); return(counterId); }
public void UnregisterCounter(int counterId) { bool nullWarning = false; if (counterId < 0) { return; } lock (_counters) { ViewModelPerformanceCounter c = getCounter(counterId); if (c == null) { nullWarning = true; } else { c.Stop(); _counters.Remove(c); } System.Diagnostics.Debug.Assert(!nullWarning); } }