Example #1
0
        private Load CalculatePredictedTotalLoad()
        {
            switch (Global.PredictionSource)
            {
            case PredictionSource.Container:
                var totalLoad = new Load(_osLoad);
                totalLoad += _containerTable.GetContainersTotalPredictedLoad();

                return(new Load(totalLoad));

            case PredictionSource.Host:
                Load finalLoad;
                switch (CurrentLoadPrediction)
                {
                case LoadPrediction.None:
                    finalLoad = CalculateNeededTotalLoad();
                    break;

                case LoadPrediction.Ewma:
                    finalLoad = LastPredictedLoad;
                    break;

                case LoadPrediction.Arma:
                    finalLoad = LastPredictedLoad;
                    break;

                case LoadPrediction.LinReg:
                    finalLoad = LastPredictedLoad;
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
                if (finalLoad == null || finalLoad.CpuLoad < 0)
                {
                    throw new NotImplementedException("Final Load");
                }
                return(new Load(finalLoad));

            default:
                throw new ArgumentOutOfRangeException();
            }
        }