l->qos.threshold_reapply = data->qos_threshold_reapply;
l->qos.limit_duration = data->qos_limit_duration;
l->qos.file_path = data->qos_file_path;
+ l->qos.distribution_func = data->distribution_func;
data->qos_file_path = NULL;
// Check if the daemon is being launched for the first time since reboot
data->qos_max_throughput = log_config_get_int(&conf, "qos_max_throughput_logs", DEFAULT_QOS_THROUGHPUT_LOGS);
data->qos_threshold = log_config_get_int(&conf, "qos_threshold_logs", DEFAULT_QOS_THRESHOLD_LOGS);
data->qos_threshold_reapply = log_config_get_int(&conf, "qos_threshold_reapply_logs", DEFAULT_QOS_THRESHOLD_REAPPLY_LOGS);
-
- struct {
- void (*func)(struct qos_module *qos, struct metrics_pid_aggr_info *infos, int count);
- const char *name;
- } const qos_methods[] = {
- { qos_distribution_proportional_raw , "proportional_raw" },
- { qos_distribution_proportional_talmud, "proportional_talmud" },
- { qos_distribution_equal , "equal" },
- { qos_distribution_equal_dual , "equal_dual" },
- { qos_distribution_equal_multi , "equal_multi" },
- };
- qos_distribution_func = qos_distribution_equal_multi; // default
- const char *const qos_method = log_config_get(&conf, "qos_method");
- if (qos_method)
- for (int i = 0; i < NELEMS(qos_methods); ++i)
- if (!strcmp(qos_method, qos_methods[i].name))
- qos_distribution_func = qos_methods[i].func;
+ data->distribution_func = qos_get_distribution_func_by_name(log_config_get(&conf, "qos_method"));
const char *const first_time_file_path = log_config_get(&conf, "first_time_file_path");
data->first_time_file_path = first_time_file_path ? strdup(first_time_file_path) : NULL;