Beispiel #1
0
        // Token: 0x06007239 RID: 29241 RVA: 0x0017A3B0 File Offset: 0x001785B0
        public static PercentileUsage Get(BudgetKey key)
        {
            PercentileUsage percentileUsage = null;

            if (!BudgetUsageTracker.budgetUsage.TryGetValue(key, out percentileUsage) || percentileUsage == null)
            {
                lock (BudgetUsageTracker.staticLock)
                {
                    if (!BudgetUsageTracker.budgetUsage.TryGetValue(key, out percentileUsage) || percentileUsage == null)
                    {
                        percentileUsage = new PercentileUsage();
                        BudgetUsageTracker.budgetUsage[key] = percentileUsage;
                    }
                }
            }
            return(percentileUsage);
        }
 // Token: 0x060073CE RID: 29646 RVA: 0x0017D96F File Offset: 0x0017BB6F
 public PercentileUsage(PercentileUsage source)
 {
     this.FiveMinuteUsage = source.FiveMinuteUsage;
     this.OneHourUsage    = source.OneHourUsage;
     this.CreationTime    = source.CreationTime;
 }
 // Token: 0x060073CC RID: 29644 RVA: 0x0017D944 File Offset: 0x0017BB44
 public static int OneHourComparer(PercentileUsage x, PercentileUsage y)
 {
     return(Comparer <int> .Default.Compare(x.OneHourUsage, y.OneHourUsage));
 }
 // Token: 0x060073CB RID: 29643 RVA: 0x0017D92C File Offset: 0x0017BB2C
 public static int FiveMinuteComparer(PercentileUsage x, PercentileUsage y)
 {
     return(Comparer <int> .Default.Compare(x.FiveMinuteUsage, y.FiveMinuteUsage));
 }
Beispiel #5
0
        // Token: 0x0600723C RID: 29244 RVA: 0x0017A49C File Offset: 0x0017869C
        public static void Update(bool isOneHour)
        {
            if (!ThrottlingPerfCounterWrapper.PerfCountersInitialized)
            {
                return;
            }
            int[] array        = null;
            int   averageUsage = 0;

            int[] array2        = null;
            int   averageUsage2 = 0;

            PercentileUsage[] array3 = null;
            if (BudgetUsageTracker.budgetUsage.Count > 0)
            {
                List <BudgetKey> list = null;
                lock (BudgetUsageTracker.staticLock)
                {
                    if (BudgetUsageTracker.budgetUsage.Count > 0)
                    {
                        array3 = new PercentileUsage[BudgetUsageTracker.budgetUsage.Count];
                        int num = 0;
                        foreach (KeyValuePair <BudgetKey, PercentileUsage> keyValuePair in BudgetUsageTracker.budgetUsage)
                        {
                            array3[num++] = new PercentileUsage(keyValuePair.Value);
                            if (keyValuePair.Value.FiveMinuteUsage == 0 && keyValuePair.Value.OneHourUsage == 0 && TimeProvider.UtcNow - keyValuePair.Value.CreationTime > BudgetUsageTracker.PeriodicLoggingInterval)
                            {
                                if (list == null)
                                {
                                    list = new List <BudgetKey>();
                                }
                                list.Add(keyValuePair.Key);
                            }
                            keyValuePair.Value.Clear(isOneHour);
                        }
                        if (list != null)
                        {
                            foreach (BudgetKey key in list)
                            {
                                PercentileUsage percentileUsage;
                                if (BudgetUsageTracker.budgetUsage.TryGetValue(key, out percentileUsage))
                                {
                                    percentileUsage.Expired = true;
                                    BudgetUsageTracker.budgetUsage.Remove(key);
                                }
                            }
                        }
                    }
                }
            }
            if (array3 != null)
            {
                BudgetUsageTracker.GetPercentileUsage(array3, false, out array, out averageUsage);
                ThrottlingPerfCounterWrapper.SetFiveMinuteBudgetUsage(array[0], array[1], array[2], averageUsage);
                if (isOneHour)
                {
                    BudgetUsageTracker.GetPercentileUsage(array3, true, out array2, out averageUsage2);
                    ThrottlingPerfCounterWrapper.SetOneHourBudgetUsage(array2[0], array2[1], array2[2], averageUsage2);
                    return;
                }
            }
            else
            {
                if (isOneHour)
                {
                    ThrottlingPerfCounterWrapper.SetOneHourBudgetUsage(0, 0, 0, 0);
                    return;
                }
                ThrottlingPerfCounterWrapper.SetFiveMinuteBudgetUsage(0, 0, 0, 0);
            }
        }