// Token: 0x060073F8 RID: 29688 RVA: 0x0017EB6C File Offset: 0x0017CD6C protected virtual void UpdatePolicyValueTakingEffectInThisBudget(SingleComponentThrottlingPolicy policy) { bool flag = this.IsRwsApplication(); if (flag) { this.exchangeMaxCmdletsPolicyValue = (policy.ExchangeMaxCmdlets.IsUnlimited ? Unlimited <uint> .UnlimitedValue : Math.Max(policy.ExchangeMaxCmdlets.Value, policy.ExchangeMaxCmdlets.Value * 2U)); this.powerShellMaxCmdletQueueDepthPolicyValue = policy.PowerShellMaxCmdletQueueDepth; this.powerShellMaxCmdletsPolicyValue = (policy.PowerShellMaxCmdlets.IsUnlimited ? Unlimited <uint> .UnlimitedValue : Math.Max(policy.PowerShellMaxCmdlets.Value, policy.PowerShellMaxCmdlets.Value * 2U)); this.powerShellMaxCmdletsTimePeriodPolicyValue = policy.PowerShellMaxCmdletsTimePeriod; this.powerShellMaxDestructiveCmdletsPolicyValue = policy.PowerShellMaxDestructiveCmdlets; this.powerShellMaxDestructiveCmdletsTimePeriodPolicyValue = policy.PowerShellMaxDestructiveCmdletsTimePeriod; this.activeRunspacesPolicyValue = (policy.MaxConcurrency.IsUnlimited ? Unlimited <uint> .UnlimitedValue : Math.Max(policy.MaxConcurrency.Value, policy.MaxConcurrency.Value * 3U)); this.powerShellMaxRunspacesPolicyValue = (policy.PowerShellMaxRunspaces.IsUnlimited ? Unlimited <uint> .UnlimitedValue : Math.Max(policy.PowerShellMaxRunspaces.Value, policy.PowerShellMaxRunspaces.Value * 3U)); this.powerShellMaxRunspacesTimePeriodPolicyValue = policy.PowerShellMaxRunspacesTimePeriod; return; } this.exchangeMaxCmdletsPolicyValue = policy.ExchangeMaxCmdlets; this.powerShellMaxCmdletQueueDepthPolicyValue = policy.PowerShellMaxCmdletQueueDepth; this.powerShellMaxCmdletsPolicyValue = policy.PowerShellMaxCmdlets; this.powerShellMaxCmdletsTimePeriodPolicyValue = policy.PowerShellMaxCmdletsTimePeriod; this.powerShellMaxDestructiveCmdletsPolicyValue = policy.PowerShellMaxDestructiveCmdlets; this.powerShellMaxDestructiveCmdletsTimePeriodPolicyValue = policy.PowerShellMaxDestructiveCmdletsTimePeriod; this.activeRunspacesPolicyValue = policy.MaxConcurrency; this.powerShellMaxRunspacesPolicyValue = policy.PowerShellMaxRunspaces; this.powerShellMaxRunspacesTimePeriodPolicyValue = policy.PowerShellMaxRunspacesTimePeriod; }
protected override void UpdatePolicyValueTakingEffectInThisBudget(SingleComponentThrottlingPolicy policy) { this.activeRunspacesPolicyValue = policy.MaxConcurrency; this.powerShellMaxCmdletsPolicyValue = policy.PowerShellMaxCmdlets; this.powerShellMaxCmdletsTimePeriodPolicyValue = policy.PowerShellMaxCmdletsTimePeriod; this.powerShellMaxRunspacesPolicyValue = policy.PowerShellMaxRunspaces; this.powerShellMaxRunspacesTimePeriodPolicyValue = policy.PowerShellMaxRunspacesTimePeriod; }
// Token: 0x060071D8 RID: 29144 RVA: 0x00179090 File Offset: 0x00177290 internal void SetPolicy(IThrottlingPolicy policy, bool resetBudgetValues) { lock (this.SyncRoot) { SingleComponentThrottlingPolicy singleComponentPolicy = this.GetSingleComponentPolicy(policy); this.ThrottlingPolicy = singleComponentPolicy; this.InternalUpdateCachedPolicyValues(resetBudgetValues); } }
private DelayInfo GetMicroDelay(ICollection <CostType> consideredCostTypes, BudgetTypeSetting budgetTypeSetting) { if (this.microDelayWorthyWork == TimeSpan.Zero || !consideredCostTypes.Contains(CostType.CAS)) { return(DelayInfo.NoDelay); } float balance = this.innerBudget.CasTokenBucket.GetBalance(); if (balance < 0f) { SingleComponentThrottlingPolicy throttlingPolicy = this.innerBudget.ThrottlingPolicy; int num = (int)this.microDelayWorthyWork.TotalMilliseconds; int num2 = num * (int)(3600000U / throttlingPolicy.RechargeRate.Value); float num3 = -balance / throttlingPolicy.RechargeRate.Value; TimeSpan timeSpan = TimeSpan.FromMilliseconds((double)((float)num2 * num3)); TimeSpan timeSpan2 = (BudgetWrapper <T> .MinimumMicroDelay > timeSpan) ? BudgetWrapper <T> .MinimumMicroDelay : timeSpan; TimeSpan timeSpan3 = timeSpan2; TimeSpan timeSpan4 = (budgetTypeSetting.MaxMicroDelayMultiplier == int.MaxValue) ? TimeSpan.MaxValue : TimeSpan.FromMilliseconds((double)(num * budgetTypeSetting.MaxMicroDelayMultiplier)); if (timeSpan3 > timeSpan4) { ExTraceGlobals.ClientThrottlingTracer.TraceDebug((long)this.GetHashCode(), "[BudgetWrapper.GetDelay] Budget '{0}' calculated an overBudgetFactor of '{1}', but used registry cap of '{2}' instead. Budget Snapshot: '{3}'", new object[] { this.Owner, num3, budgetTypeSetting.MaxMicroDelayMultiplier, this }); timeSpan3 = timeSpan4; } if (timeSpan3 > budgetTypeSetting.MaxDelay) { ExTraceGlobals.ClientThrottlingTracer.TraceDebug <BudgetKey, TimeSpan, TimeSpan>((long)this.GetHashCode(), "[BudgetWrapper.GetDelay] Budget '{0}' calculated a cappedDelay of '{1}' which was higher than registry MaxDelay of '{2}'. Using MaxDelay instead.", this.Owner, timeSpan3, budgetTypeSetting.MaxDelay); ThrottlingPerfCounterWrapper.IncrementBudgetsAtMaxDelay(this.Owner); timeSpan3 = budgetTypeSetting.MaxDelay; } ThrottlingPerfCounterWrapper.IncrementBudgetsMicroDelayed(this.Owner); DelayInfo.TraceMicroDelays(this, TimeSpan.FromMilliseconds((double)num), timeSpan3); return(new DelayInfo(timeSpan3, false)); } return(DelayInfo.NoDelay); }