/// <summary>
        ///
        /// </summary>
        /// <param name="instName"></param>
        /// <returns></returns>
        public static PMPerformanceCounters GetCounters(string instName)
        {
            ExceptionHelper.CheckStringIsNullOrEmpty(instName, "instanceName");

            PMPerformanceCounters result = null;

            lock (PMPerformanceCounters.counters)
            {
                if (PMPerformanceCounters.counters.TryGetValue(instName, out result) == false)
                {
                    result = new PMPerformanceCounters(instName);
                    PMPerformanceCounters.counters.Add(instName, result);
                }
            }

            return(result);
        }
		/// <summary>
		/// 
		/// </summary>
		/// <param name="instName"></param>
		/// <returns></returns>
		public static PMPerformanceCounters GetCounters(string instName)
		{
			ExceptionHelper.CheckStringIsNullOrEmpty(instName, "instanceName");

			PMPerformanceCounters result = null;

			lock (PMPerformanceCounters.counters)
			{
				if (PMPerformanceCounters.counters.TryGetValue(instName, out result) == false)
				{
					result = new PMPerformanceCounters(instName);
					PMPerformanceCounters.counters.Add(instName, result);
				}
			}

			return result;
		}
Пример #3
0
        private void SetCountersValue(MonitorData md)
        {
            PMPerformanceCounters counters = PMPerformanceCounters.GetCounters(md.InstanceName);

            counters.PageAccessCount.Increment();
            counters.PageAccessCountPerSecond.Increment();

            if (md.HasErrors)
            {
                counters.PageErrorCount.Increment();
            }
            else
            {
                counters.PageSuccessCount.Increment();
                counters.PageSuccessRatio.Increment();
            }

            counters.PageSuccessRatioBase.Increment();

            counters.PageAccessCurrentAverageBase.Increment();
            counters.PageAccessCurrentAverage.IncrementBy(md.Stopwatch.ElapsedTicks);
            counters.PageAccessTotalAverageBase.Increment();
            counters.PageAccessTotalAverage.IncrementBy(md.Stopwatch.ElapsedMilliseconds / 100);
        }