Пример #1
0
        /// <summary>
        /// Сбросить значения всех счётчиков
        /// </summary>
        protected void ResetAllCounters()
        {
            var counterProps = CounterPropertyInfoExtractor.GetContainerCounterProperties(this.GetType());

            foreach (var prop in counterProps)
            {
                Counter counter = (Counter)prop.GetCounterValue(this);
                counter.Reset();
            }
        }
Пример #2
0
        /// <summary>
        /// Инициализация счётчиков (внутренний метод)
        /// </summary>
        internal sealed override void InitCounters()
        {
            var type = this.GetType();

            var counterProps = CounterPropertyInfoExtractor.GetContainerCounterProperties(type);

            foreach (var prop in counterProps)
            {
                Counter counter = _category.CreateCounter(prop.CounterType, prop.GetCounterName(), prop.GetCounterDescription());
                prop.SetCounterValue(this, counter);
            }

            _category.Init();
        }
Пример #3
0
        /// <summary>
        /// Отключить все счётчики времени
        /// </summary>
        protected void DisableAllTimeCounters()
        {
            var counterProps = CounterPropertyInfoExtractor.GetContainerCounterProperties(this.GetType());

            foreach (var prop in counterProps)
            {
                if (prop.CounterType == CounterTypes.AverageTime)
                {
                    ((AverageTimeCounter)prop.GetCounterValue(this)).DisableMeasurement();
                }
                else if (prop.CounterType == CounterTypes.MomentTime)
                {
                    ((MomentTimeCounter)prop.GetCounterValue(this)).DisableMeasurement();
                }
            }
        }