Fix average computation in burst stats

This commit is contained in:
Rodrigo Arias 2022-10-07 13:10:05 +02:00
parent bacf33450d
commit 58286dbd1a

View File

@ -557,14 +557,13 @@ pre_burst(struct ovni_emu *emu)
double avg = 0.0; double avg = 0.0;
double maxdelta = 0; double maxdelta = 0;
for (int i = 1; i < th->nbursts; i++) { for (int i = 0; i < n; i++) {
double delta = th->burst_time[i] - th->burst_time[i - 1]; if (deltas[i] > maxdelta)
if (delta > maxdelta) maxdelta = deltas[i];
maxdelta = delta; avg += deltas[i];
avg += delta;
} }
avg /= (double) th->nbursts; avg /= (double) n;
double median = deltas[n / 2]; double median = deltas[n / 2];
err("%s burst stats: median %.0f ns, avg %.1f ns, max %.0f ns\n", err("%s burst stats: median %.0f ns, avg %.1f ns, max %.0f ns\n",