From df92f606034a287ef2cbd3ca3d5ac7a2622ddb9e Mon Sep 17 00:00:00 2001 From: rodri Date: Mon, 15 Apr 2024 22:27:03 +0000 Subject: show pipeline stage times in the stats file. --- fs.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/fs.c b/fs.c index 011baf2..32828f6 100644 --- a/fs.c +++ b/fs.c @@ -167,6 +167,7 @@ resetcamera(Camera *c) placecamera(c, Pt3(0,0,100,1), Pt3(0,0,0,1), Vec3(0,1,0)); reloadcamera(c); memset(&c->stats, 0, sizeof c->stats); + memset(&c->times, 0, sizeof c->times); } static ulong @@ -392,11 +393,11 @@ fsread(Req *r) { Client *c; Framebuf *fb; - Memimage *i; + Memimage *img; char buf[1024], cbuf[30], *t; uvlong path; ulong off, cnt; - int n; + int n, i; path = r->fid->qid.path; off = r->ifcall.offset; @@ -426,17 +427,24 @@ fsread(Req *r) !c->cam->stats.avg? 0: 1e9/c->cam->stats.avg, !c->cam->stats.min? 0: 1e9/c->cam->stats.min, !c->cam->stats.v? 0: 1e9/c->cam->stats.v); + n += snprint(buf+n, sizeof(buf)-n, "times\n"); + for(i = 0; i < c->cam->times.cur; i++) + n += snprint(buf+n, sizeof(buf)-n, "%d\tR\t[%llud %llud] (%.0f µs)\n\tE\t[%llud %llud] (%.0f µs)\n\tTn\t[%llud %llud] (%.0f µs)\n\tRn\t[%llud %llud] (%.0f µs)\n", + i, c->cam->times.R[i].t0, c->cam->times.R[i].t1, (c->cam->times.R[i].t1-c->cam->times.R[i].t0)/1e3, + c->cam->times.E[i].t0, c->cam->times.E[i].t1, (c->cam->times.E[i].t1-c->cam->times.E[i].t0)/1e3, + c->cam->times.Tn[i].t0, c->cam->times.Tn[i].t1, (c->cam->times.Tn[i].t1-c->cam->times.Tn[i].t0)/1e3, + c->cam->times.Rn[i].t0, c->cam->times.Rn[i].t1, (c->cam->times.Rn[i].t1-c->cam->times.Rn[i].t0)/1e3); snprint(buf+n, sizeof(buf)-n, "frame #%llud\n", c->cam->stats.nframes); readstr(r, buf); respond(r, nil); break; case Qframe: fb = c->cam->vp->getfb(c->cam->vp); - i = fb->cb; + img = fb->cb; if(off < 5*12){ n = snprint(buf, sizeof buf, "%11s %11d %11d %11d %11d ", - chantostr(cbuf, i->chan), - i->r.min.x, i->r.min.y, i->r.max.x, i->r.max.y); + chantostr(cbuf, img->chan), + img->r.min.x, img->r.min.y, img->r.max.x, img->r.max.y); t = estrdup9p(buf); if(off > n){ @@ -459,7 +467,7 @@ fsread(Req *r) t = malloc(cnt); if(t != nil){ r->ofcall.data = t; - n = readimg(i, t, i->r, off, cnt); + n = readimg(img, t, img->r, off, cnt); } if(n < 0){ -- cgit v1.2.3