Exemple #1
0
        public RpcServiceMethod(object service, IICPerformanceCounterCategory category, string methodName, MethodInfo method, bool enableCounters)
        {
            MethodName = methodName;
            Method     = method;
            Service    = service;

            if (enableCounters)
            {
                RatePerSecond = category.CreateCounter(methodName + " /sec.", PerformanceCounterType.RateOfCountsPerSecond32);
                Concurrent    = category.CreateCounter(methodName + " Concurrent.", PerformanceCounterType.NumberOfItems32);
            }
            else
            {
                RatePerSecond = null;
                Concurrent    = null;
            }
        }
Exemple #2
0
        public void Sample2()         // V4 新增模式
        {
            IICPerformanceCounterCategory           category = new IICPerformanceCounterCategory("Imps:SampleCategory", PerformanceCounterCategoryType.MultiInstance);
            Dictionary <int, IICPerformanceCounter> counters = new Dictionary <int, IICPerformanceCounter>();

            for (int i = 0; i < 5; i++)
            {
                counters.Add(i, category.CreateCounter("SampleCounter-" + i, PerformanceCounterType.RateOfCountsPerSecond32));
            }
            IICPerformanceCounterFactory.GetCounters(category);

            for (int i = 0; i < 5; i++)
            {
                counters[i].Increment();
            }
        }