Example #1
0
 public void AddSample(ResourceLoadState healthState, int currentCapacity)
 {
     this.avg5min.AddSample(healthState, currentCapacity);
     this.avg1hour.AddSample(healthState, currentCapacity);
     this.avg1day.AddSample(healthState, currentCapacity);
     this.avgCustom.AddSample(healthState, currentCapacity);
 }
Example #2
0
        public static ResourceLoad operator +(ResourceLoad load, double delta)
        {
            ResourceLoadState state = load.State;

            if (state == ResourceLoadState.Unknown || state == ResourceLoadState.Critical)
            {
                return(load);
            }
            return(new ResourceLoad(load.LoadRatio + delta, load.Metric, load.Info));
        }
Example #3
0
        public override string ToString()
        {
            ResourceLoadState state = this.State;

            if (state != ResourceLoadState.Critical && state != ResourceLoadState.Unknown)
            {
                return(string.Format("{0}/{1:#0.00}/{2}", state, this.LoadRatio, this.Metric));
            }
            return(string.Format("{0}//{1}", state, this.Metric));
        }
Example #4
0
            public Bucketizer(TimeSpan windowWidth)
            {
                ushort numberOfBuckets = (ushort)windowWidth.TotalMinutes;

                this.healthValues = new Dictionary <ResourceLoadState, FixedTimeSum>();
                foreach (object obj in Enum.GetValues(typeof(ResourceLoadState)))
                {
                    ResourceLoadState key = (ResourceLoadState)obj;
                    this.healthValues[key] = new FixedTimeSum(60000, numberOfBuckets);
                }
                this.averageCapacity = new FixedTimeAverage(60000, numberOfBuckets, Environment.TickCount);
            }
Example #5
0
        // Token: 0x060009DD RID: 2525 RVA: 0x0002C5C8 File Offset: 0x0002A7C8
        private void LogRow(string processName, int processId, int threadId, string targetForest, ResourceLoadState resourceLoadState, int metricValue, string topDomainControllersIncomingDebt)
        {
            LogRowFormatter logRowFormatter = new LogRowFormatter(this.logSchema);

            logRowFormatter[1] = processName;
            logRowFormatter[2] = processId;
            logRowFormatter[3] = threadId;
            logRowFormatter[4] = targetForest;
            logRowFormatter[5] = resourceLoadState;
            logRowFormatter[6] = metricValue;
            logRowFormatter[7] = topDomainControllersIncomingDebt;
            this.AppendLogRow(logRowFormatter);
        }
Example #6
0
        private bool TryReadRegistryHealthOverride(out ResourceLoadState healthValue)
        {
            uint num;
            bool int32ValueFromRegistryValue = TenantRelocationSyncCoordinator.GetInt32ValueFromRegistryValue("ADHealthOverrideForTenantRelocation", out num);

            if (int32ValueFromRegistryValue)
            {
                healthValue = (ResourceLoadState)num;
            }
            else
            {
                healthValue = ResourceLoadState.Unknown;
            }
            return(int32ValueFromRegistryValue);
        }
Example #7
0
        public static double operator -(ResourceLoad load1, ResourceLoad load2)
        {
            ResourceLoadState state = load1.State;

            if (state == ResourceLoadState.Unknown || state == ResourceLoadState.Critical)
            {
                return(double.NaN);
            }
            ResourceLoadState state2 = load2.State;

            if (state2 == ResourceLoadState.Unknown || state2 == ResourceLoadState.Critical)
            {
                return(double.NaN);
            }
            return(load1.LoadRatio - load2.LoadRatio);
        }
Example #8
0
 // Token: 0x060009DA RID: 2522 RVA: 0x0002C4F4 File Offset: 0x0002A6F4
 public void Log(string targetForest, ResourceLoadState resourceLoadState, int metricValue, Dictionary <string, ADServerMetrics> topDCsToLog)
 {
     if (DirectoryThrottlingLog.LoggingEnabled)
     {
         int           count         = topDCsToLog.Count;
         StringBuilder stringBuilder = new StringBuilder();
         foreach (KeyValuePair <string, ADServerMetrics> keyValuePair in topDCsToLog)
         {
             stringBuilder.AppendFormat("{0},{1},", keyValuePair.Key, keyValuePair.Value.IncomingDebt);
         }
         string topDomainControllersIncomingDebt = stringBuilder.ToString().Trim(new char[]
         {
             ','
         });
         this.LogRow(Globals.ProcessName, Globals.ProcessId, Thread.CurrentThread.ManagedThreadId, targetForest, resourceLoadState, metricValue, topDomainControllersIncomingDebt);
     }
 }
Example #9
0
        private long Convert(ResourceLoad load)
        {
            ResourceLoadState state = load.State;

            if (state == ResourceLoadState.Unknown)
            {
                return(0L);
            }
            if (state == ResourceLoadState.Critical)
            {
                return(long.MaxValue);
            }
            if (load.LoadRatio >= 92233720368547760.0)
            {
                return(long.MaxValue);
            }
            return((long)(load.LoadRatio * 100.0));
        }
Example #10
0
        public int GetHealthAndCalculateDelay(out ResourceLoadState health)
        {
            if (this.TryReadRegistryHealthOverride(out health))
            {
                ExTraceGlobals.TenantRelocationTracer.TraceDebug <ResourceLoadState, string>((long)this.GetHashCode(), "TenantRelocationThrottlingManager.Throttle() - override detected, override value:{0}. Current forest: {1}", health, this.partitionFqdn);
            }
            else
            {
                health = this.GetWlmADHealthMetric();
                ExTraceGlobals.TenantRelocationTracer.TraceDebug <ResourceLoadState, string>((long)this.GetHashCode(), "TenantRelocationThrottlingManager.Throttle() - AD Health monitor returned value:{0}. Current forest: {1}", health, this.partitionFqdn);
            }
            int num;

            switch (health)
            {
            case ResourceLoadState.Unknown:
            case ResourceLoadState.Underloaded:
                num = TenantRelocationConfigImpl.GetConfig <int>("LoadStateNoDelayMs");
                break;

            case ResourceLoadState.Full:
                num = TenantRelocationConfigImpl.GetConfig <int>("LoadStateDefaultDelayMs");
                break;

            case ResourceLoadState.Overloaded:
                num = TenantRelocationConfigImpl.GetConfig <int>("LoadStateOverloadedDelayMs");
                break;

            case ResourceLoadState.Critical:
                num = TenantRelocationConfigImpl.GetConfig <int>("LoadStateCriticalDelayMs");
                break;

            default:
                throw new NotImplementedException();
            }
            if (num < 100)
            {
                num = 100;
            }
            return(num);
        }
Example #11
0
 public void AddSample(ResourceLoadState healthState, int currentCapacity)
 {
     this.healthValues[healthState].Add(1U);
     this.averageCapacity.Add((uint)currentCapacity);
 }