Exemplo 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(NetClrIntrp counter)
        {
            switch (counter)
            {
            case NetClrIntrp.NumberOfCCWs:
                return(new PerformanceCounter(
                           ".NET CLR Interop",
                           @"# of CCWs",
                           "_Global_",
                           true
                           ));

            case NetClrIntrp.NumberOfMarshalling:
                return(new PerformanceCounter(
                           ".NET CLR Interop",
                           @"# of Marshalling",
                           "_Global_",
                           true
                           ));

            case NetClrIntrp.NumberOfStubs:
                return(new PerformanceCounter(
                           ".NET CLR Interop",
                           "# of Stubs",
                           "_Global_",
                           true
                           ));

            case NetClrIntrp.NumberOfTlbExportsPerSec:
                return(new PerformanceCounter(
                           ".NET CLR Interop",
                           @"# of TLB exports / sec",
                           "_Global_",
                           true
                           ));

            case NetClrIntrp.NumberOfTlbImportsPerSec:
                return(new PerformanceCounter(
                           ".NET CLR Interop",
                           @"# of TLB imports / sec",
                           "_Global_",
                           true
                           ));

            default:
                return(null);
            }
        }
Exemplo 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(NetClrIntrp counter)
		{
			switch (counter) 
			{
				case NetClrIntrp.NumberOfCCWs:
					return new PerformanceCounter(
						".NET CLR Interop",
						@"# of CCWs",
						"_Global_",
						true
						);
				case NetClrIntrp.NumberOfMarshalling:
					return new PerformanceCounter(
						".NET CLR Interop",
						@"# of Marshalling",
						"_Global_",
						true
						);
				case NetClrIntrp.NumberOfStubs:
					return new PerformanceCounter(
						".NET CLR Interop",
						"# of Stubs",
						"_Global_",
						true
						);
				case NetClrIntrp.NumberOfTlbExportsPerSec:
					return new PerformanceCounter(
						".NET CLR Interop",
						@"# of TLB exports / sec",
						"_Global_",
						true
						);
				case NetClrIntrp.NumberOfTlbImportsPerSec:
					return new PerformanceCounter(
						".NET CLR Interop",
						@"# of TLB imports / sec",
						"_Global_",
						true
						);
				default:
					return null;
			}
		}