pstats: Perf improvement for smooth mode in strip chart with dropped frames

This significantly improves PStats strip chart performance with high frame rates and high number of dropped frames
This commit is contained in:
rdb 2024-03-15 12:45:19 +01:00
parent 07902429b8
commit 91c22a0fd6

View File

@ -672,16 +672,25 @@ compute_average_pixel_data(PStatStripChart::FrameData &result,
double last = then_end;
// Then we get all of each of the middle frames.
double weight = 0.0;
for (int frame_number = then_i + 1;
frame_number < now_i;
frame_number++) {
if (thread_data->has_frame(frame_number)) {
if (weight > 0.0) {
accumulate_frame_data(result, *fdata, weight);
weight = 0.0;
}
fdata = &get_frame_data(frame_number);
}
accumulate_frame_data(result, *fdata, fdata->_end - last);
weight += fdata->_end - last;
last = fdata->_end;
}
if (weight > 0.0) {
accumulate_frame_data(result, *fdata, weight);
}
// And finally, we get the remainder as now_i.
if (last <= now) {
accumulate_frame_data(result, get_frame_data(now_i), now - last);