Пример #1
0
        public static CacheBaselines CalculateBaselines()
        {
            lock (Nrdo.LockObj)
            {
                var global = Nrdo.GlobalStats;

                var baseline = new CacheBaseline(getCostBaseline(global.CumulativeCost, c => c.CacheStats), Nrdo.TotalPulses,
                                                 getImpactBaseline(global.TotalQueryTime, c => c.CacheStats), global.TotalQueries);

                var           lastCycle     = Nrdo.LastShrinkCycleStats;
                CacheBaseline cycleBaseline = null;
                if (lastCycle != null)
                {
                    var thisCycle = global.Since(lastCycle);

                    var cyclePulses = Nrdo.ShrinkCycleCounter;
                    if (cyclePulses == 0)
                    {
                        cyclePulses = Nrdo.CacheCycleIntervalPulses;
                    }

                    cycleBaseline = new CacheBaseline(getCostBaseline(thisCycle.CumulativeCost, c => c.CacheStats.Since(c.LastShrinkCycleStats)), cyclePulses,
                                                      getImpactBaseline(thisCycle.TotalQueryTime, c => c.CacheStats.Since(c.LastShrinkCycleStats)), thisCycle.TotalQueries);
                }

                return(new CacheBaselines(baseline, cycleBaseline));
            }
        }
Пример #2
0
 internal CacheBaselines(CacheBaseline baseline, CacheBaseline cycleBaseline)
 {
     this.baseline      = baseline;
     this.cycleBaseline = cycleBaseline;
 }