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); }