Print burst stats

This commit is contained in:
Rodrigo Arias 2022-09-29 18:03:16 +02:00
parent 70ed426ab3
commit 06823a6e69

View File

@ -551,26 +551,35 @@ pre_affinity(struct ovni_emu *emu)
static void static void
pre_burst(struct ovni_emu *emu) pre_burst(struct ovni_emu *emu)
{ {
struct ovni_ethread *th;
int64_t dt = 0; int64_t dt = 0;
UNUSED(dt); UNUSED(dt);
th = emu->cur_thread; struct ovni_ethread *th = emu->cur_thread;
if (th->nbursts >= MAX_BURSTS) { if (th->nbursts >= MAX_BURSTS) {
err("too many bursts: ignored\n"); err("too many bursts: ignored\n");
return; return;
} }
th->burst_time[th->nbursts] = emu->delta_time; th->burst_time[th->nbursts++] = emu->delta_time;
if (th->nbursts > 0) { if (th->nbursts == MAX_BURSTS) {
dt = th->burst_time[th->nbursts] - th->burst_time[th->nbursts - 1]; double avg = 0.0;
double maxdelta = 0;
for (int i = 1; i < th->nbursts; i++) {
double delta = th->burst_time[i] - th->burst_time[i - 1];
if (delta > maxdelta)
maxdelta = delta;
avg += delta;
}
dbg("burst delta time %ld ns\n", dt); avg /= (double) th->nbursts;
err("burst avg %.1f ns, max %.0f ns\n",
MAX_BURSTS, avg, maxdelta);
th->nbursts = 0;
} }
th->nbursts++;
} }
static void static void