calculate and show mins in benchmark

pull/666/head
FlightlessMango 2 years ago
parent 3366120364
commit 77e4d51d87

@ -230,36 +230,55 @@ void autostart_log(int sleep) {
}
void Logger::calculate_benchmark_data(){
vector<float> sorted = benchmark.fps_data;
std::sort(sorted.begin(), sorted.end());
benchmark.percentile_data.clear();
vector<float> sorted = benchmark.fps_data;
std::sort(sorted.begin(), sorted.end());
benchmark.percentile_data.clear();
benchmark.total = 0.f;
for (auto fps_ : sorted){
benchmark.total = benchmark.total + fps_;
}
size_t max_label_size = 0;
benchmark.total = 0.f;
for (auto fps_ : sorted){
benchmark.total = benchmark.total + fps_;
}
for (std::string percentile : m_params->benchmark_percentiles) {
float result;
size_t max_label_size = 0;
float result;
for (std::string percentile : m_params->benchmark_percentiles) {
// special case handling for a mean-based average
if (percentile == "AVG") {
result = benchmark.total / sorted.size();
result = benchmark.total / sorted.size();
} else {
// the percentiles are already validated when they're parsed from the config.
float fraction = parse_float(percentile) / 100;
// the percentiles are already validated when they're parsed from the config.
float fraction = parse_float(percentile) / 100;
result = sorted[(fraction * sorted.size()) - 1];
percentile += "%";
result = sorted[(fraction * sorted.size()) - 1];
percentile += "%";
}
if (percentile.length() > max_label_size)
max_label_size = percentile.length();
max_label_size = percentile.length();
benchmark.percentile_data.push_back({percentile, result});
}
}
string label;
float mins[2] = {0.01f, 0.001f}, total;
for (auto percent : mins){
total = 0;
size_t idx = ceil(sorted.size() * percent);
for (size_t i = 0; i < idx; i++){
total = total + sorted[i];
}
result = total / idx;
if (percent == 0.001f)
label = "0.1%";
if (percent == 0.01f)
label = "1%";
if (label.length() > max_label_size)
max_label_size = label.length();
benchmark.percentile_data.push_back({label, result});
}
for (auto& entry : benchmark.percentile_data) {
entry.first.append(max_label_size - entry.first.length(), ' ');

@ -607,7 +607,7 @@ parse_overlay_config(struct overlay_params *params,
params->log_interval = 100;
params->media_player_format = { "{title}", "{artist}", "{album}" };
params->permit_upload = 0;
params->benchmark_percentiles = { "97", "AVG", "1", "0.1" };
params->benchmark_percentiles = { "97", "AVG"};
params->gpu_load_value = { 60, 90 };
params->cpu_load_value = { 60, 90 };
params->cellpadding_y = -0.085;

Loading…
Cancel
Save