Esempio n. 1
0
        public IResourcePerformanceCounter CreateCounter(Guid resourceId, WarewolfPerfCounterType type, string name)
        {
            if (GetCounter(resourceId, type) == EmptyCounter)
            {
                IResourcePerformanceCounter counter;
                switch (type)
                {
                case WarewolfPerfCounterType.ExecutionErrors:
                    counter = new WarewolfNumberOfErrorsByResource(resourceId, name);
                    break;

                case WarewolfPerfCounterType.AverageExecutionTime:
                    counter = new WarewolfAverageExecutionTimePerformanceCounterByResource(resourceId, name);
                    break;

                case WarewolfPerfCounterType.ConcurrentRequests:
                    counter = new WarewolfCurrentExecutionsPerformanceCounterByResource(resourceId, name);
                    break;

                case WarewolfPerfCounterType.RequestsPerSecond:
                    counter = new WarewolfRequestsPerSecondPerformanceCounterByResource(resourceId, name);
                    break;

                default:
                    return(new EmptyCounter());
                }

                _resourceCounters.Add(counter);
                _perf.Save(_resourceCounters, EnvironmentVariables.ServerResourcePerfmonSettingsFile);
                return(counter);
            }
            return((IResourcePerformanceCounter)GetCounter(resourceId, type).FromSafe());
        }
Esempio n. 2
0
 public WarewolfCurrentExecutionsPerformanceCounter(IRealPerformanceCounterFactory performanceCounterFactory)
     : base(performanceCounterFactory)
 {
     _started         = false;
     IsActive         = true;
     _perfCounterType = WarewolfPerfCounterType.ConcurrentRequests;
 }
Esempio n. 3
0
 public WarewolfAverageExecutionTimePerformanceCounter(IRealPerformanceCounterFactory performanceCounterFactory)
     : base(performanceCounterFactory)
 {
     _started         = false;
     IsActive         = true;
     _perfCounterType = WarewolfPerfCounterType.AverageExecutionTime;
 }
 public WarewolfNumberOfErrors(IRealPerformanceCounterFactory performanceCounterFactory)
     : base(performanceCounterFactory)
 {
     _started         = false;
     IsActive         = true;
     _perfCounterType = WarewolfPerfCounterType.ExecutionErrors;
 }
 public WarewolfNumberOfAuthErrors(IRealPerformanceCounterFactory performanceCounterFactory)
     : base(performanceCounterFactory)
 {
     _started         = false;
     IsActive         = true;
     _perfCounterType = WarewolfPerfCounterType.NotAuthorisedErrors;
 }
Esempio n. 6
0
 public WarewolfServicesNotFoundCounter(IRealPerformanceCounterFactory performanceCounterFactory)
     : base(performanceCounterFactory)
 {
     _started         = false;
     IsActive         = true;
     _perfCounterType = WarewolfPerfCounterType.ServicesNotFound;
 }
 public TestCounter(WarewolfPerfCounterType warewolfPerfCounterType, bool isActive = true)
 {
     Category        = "";
     Name            = "bob";
     IsActive        = isActive;
     PerfCounterType = warewolfPerfCounterType;
 }
Esempio n. 8
0
 public WarewolfNumberOfErrorsByResource(Guid resourceId, string categoryInstanceName)
 {
     ResourceId           = resourceId;
     CategoryInstanceName = categoryInstanceName;
     _started             = false;
     IsActive             = true;
     _perfCounterType     = WarewolfPerfCounterType.ExecutionErrors;
 }
 public WarewolfCurrentExecutionsPerformanceCounterByResource(Guid resourceId, string categoryInstanceName)
 {
     ResourceId           = resourceId;
     CategoryInstanceName = categoryInstanceName;
     _started             = false;
     IsActive             = true;
     _perfCounterType     = WarewolfPerfCounterType.ConcurrentRequests;
 }
Esempio n. 10
0
 public DefaultCounterTest(Guid resourceId, string name, WarewolfPerfCounterType type)
 {
     _resourceId          = resourceId;
     CategoryInstanceName = name;
     _started             = false;
     IsActive             = true;
     _perfCounterType     = type;
 }
 public WarewolfAverageExecutionTimePerformanceCounterByResource(Guid resourceId, string categoryInstanceName)
 {
     ResourceId           = resourceId;
     CategoryInstanceName = categoryInstanceName;
     _started             = false;
     IsActive             = true;
     _perfCounterType     = WarewolfPerfCounterType.AverageExecutionTime;
 }
Esempio n. 12
0
 public TestResourceCounter(WarewolfPerfCounterType warewolfPerfCounterType, Guid resourceId)
 {
     Category             = "";
     Name                 = "bob";
     PerfCounterType      = warewolfPerfCounterType;
     ResourceId           = resourceId;
     CategoryInstanceName = "bobcat";
 }
Esempio n. 13
0
 public IPerformanceCounter GetCounter(Guid resourceId, WarewolfPerfCounterType type)
 {
     try
     {
         var returnValue = _resourceCounters.Where(a => a is IResourcePerformanceCounter).Cast <IResourcePerformanceCounter>().First(a => a.ResourceId == resourceId && a.PerfCounterType == type).ToSafe();
         return(returnValue);
     }
     catch (Exception)
     {
         return(EmptyCounter);
     }
 }
Esempio n. 14
0
        public void RemoverCounter(Guid resourceId, WarewolfPerfCounterType type, string name)
        {
            var toRemove = _resourceCounters.FirstOrDefault(a =>
            {
                var resourcePerformanceCounter = a as IResourcePerformanceCounter;
                return(resourcePerformanceCounter != null && (resourcePerformanceCounter.ResourceId == resourceId && resourcePerformanceCounter.PerfCounterType == type));
            });

            if (toRemove != null)
            {
                _resourceCounters.Remove(toRemove);
                _perf.Save(_resourceCounters, EnvironmentVariables.ServerResourcePerfmonSettingsFile);
            }
        }
 public WarewolfAverageExecutionTimePerformanceCounter()
 {
     _started         = false;
     IsActive         = true;
     _perfCounterType = WarewolfPerfCounterType.AverageExecutionTime;
 }
Esempio n. 16
0
 public WarewolfNumberOfAuthErrors()
 {
     _started         = false;
     IsActive         = true;
     _perfCounterType = WarewolfPerfCounterType.NotAuthorisedErrors;
 }
Esempio n. 17
0
 public IPerformanceCounter GetCounter(WarewolfPerfCounterType type) => _counters.First(a => a.PerfCounterType == type).ToSafe();
 public WarewolfServicesNotFoundCounter()
 {
     _started         = false;
     IsActive         = true;
     _perfCounterType = WarewolfPerfCounterType.ServicesNotFound;
 }
Esempio n. 19
0
 public WarewolfNumberOfErrors()
 {
     _started         = false;
     IsActive         = true;
     _perfCounterType = WarewolfPerfCounterType.ExecutionErrors;
 }