示例#1
0
 public void StopCounter(int counterId)
 {
     if (counterId <= 0)
     {
         return;
     }
     lock (_counters)
     {
         ViewModelPerformanceCounter c = getCounter(counterId);
         c.Stop();
     }
 }
示例#2
0
 public void Start(int counterId, double curFrameTime)
 {
     if (counterId <= 0)
     {
         return;
     }
     lock (_counters)
     {
         ViewModelPerformanceCounter c = getCounter(counterId);
         c.Start(curFrameTime);
     }
 }
示例#3
0
        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);
        }
示例#4
0
        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);
            }
        }