private void Initialize(string workLoadConfigFile) { // try to load feedback controllers from file: string message; LoadPredictionSystemSection section; string filename = Path.Combine(this.rootPath, workLoadConfigFile); if (!ConfigurationLoader.TryLoadFromFile(filename, out section, out message)) { log.WarnFormat( "Could not initialize Load Prediction System from configuration: Invalid configuration file {0}. Using default settings... ({1})", filename, message); } if (section != null) { // load controllers from config file.); foreach (FeedbackControllerElement controllerElement in section.FeedbackControllers) { if (controllerElement.Name != FeedbackName.PeerCount) { continue; } var dict = new SortedDictionary <FeedbackLevel, FeedbackLevelData>(); foreach (FeedbackLevelElement level in controllerElement.Levels) { var values = new FeedbackLevelData { UpperBound = level.Value, LowerBound = level.ValueDown == -1 ? level.Value : level.ValueDown, }; if (level.Level == FeedbackLevel.Highest) { values.UpperBound = int.MaxValue; } dict.Add(level.Level, values); } this.thresholdValues = dict; } log.InfoFormat("Initialized Load Prediction with {0} controllers from config file.", section.FeedbackControllers.Count); } else { // default settings, in case no config file was found. this.thresholdValues = DefaultConfiguration.GetDefaultControllers(); } }
public LoadStatsCollector(float factor = 1.0f) { this.initialFactor = factor; this.thresholdValues = DefaultConfiguration.GetDefaultControllers(); }