Ejemplo n.º 1
0
		/// <summary>
		/// Returns initialized performance counter according to the specified parameters.
		/// </summary>
		/// <param name="counter">Type of the counter.</param>
		/// <returns>Initialized performance counter.</returns>
		public static PerformanceCounter GetCounter(P counter)
		{
			switch (counter) 
			{
				case P.PercentUsage:
					return new PerformanceCounter(
						"Paging File",
						"% Usage",
						"_Total",
						true
						);
				case P.PercentUsagePeak:
					return new PerformanceCounter(
						"Paging File",
						"% Usage Peak",
						"_Total",
						true
						);
				default:
					return null;
			}
		}
Ejemplo n.º 2
0
        /// <summary>
        /// Returns initialized performance counter according to the specified parameters.
        /// </summary>
        /// <param name="counter">Type of the counter.</param>
        /// <returns>Initialized performance counter.</returns>
        public static PerformanceCounter GetCounter(P counter)
        {
            switch (counter)
            {
            case P.PercentUsage:
                return(new PerformanceCounter(
                           "Paging File",
                           "% Usage",
                           "_Total",
                           true
                           ));

            case P.PercentUsagePeak:
                return(new PerformanceCounter(
                           "Paging File",
                           "% Usage Peak",
                           "_Total",
                           true
                           ));

            default:
                return(null);
            }
        }