Example #1
0
        public static IList <IPerformanceCountersByResource> GetResourceCountersTo(this IPerformanceCounterTo to)
        {
            var res = new List <IPerformanceCountersByResource>();
            var ids = to.ResourceCounters;

            foreach (var resourcePerformanceCounter in ids)
            {
                var current = res.FirstOrDefault(a => a.ResourceId == resourcePerformanceCounter.ResourceId);
                if (current == null)
                {
                    current = new PerformanceCountersByResource {
                        ResourceId = resourcePerformanceCounter.ResourceId, CounterName = resourcePerformanceCounter.CategoryInstanceName
                    };
                    res.Add(current);
                }
                switch (resourcePerformanceCounter.PerfCounterType)
                {
                case WarewolfPerfCounterType.AverageExecutionTime: current.AverageExecutionTime = true; break;

                case WarewolfPerfCounterType.ExecutionErrors: current.TotalErrors = true; break;

                case WarewolfPerfCounterType.ConcurrentRequests: current.ConcurrentRequests = true; break;

                case WarewolfPerfCounterType.RequestsPerSecond: current.RequestPerSecond = true; break;
                }
            }

            return(res);
        }
Example #2
0
        PerformanceCountersByResource CreateNewCounter()
        {
            var counter = new PerformanceCountersByResource {
                IsNew = true
            };

            RegisterPropertyChanged(counter);
            return(counter);
        }