diff options
author | rodri <rgl@antares-labs.eu> | 2024-04-05 08:37:11 +0000 |
---|---|---|
committer | rodri <rgl@antares-labs.eu> | 2024-04-05 08:37:11 +0000 |
commit | 8551f75ceaafd6678d8e489abfa82f5b414ef42a (patch) | |
tree | db529131ad56fee30653b2d655eb44c2137b3116 | |
parent | 0ec7a0bbcae886a0d36dbe931a3ed0b0e0be1089 (diff) | |
download | renderfs-8551f75ceaafd6678d8e489abfa82f5b414ef42a.tar.gz renderfs-8551f75ceaafd6678d8e489abfa82f5b414ef42a.tar.bz2 renderfs-8551f75ceaafd6678d8e489abfa82f5b414ef42a.zip |
add a stats file for camera statistics.
-rw-r--r-- | fs.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -48,6 +48,7 @@ enum { Qnew, Qn, Qctl, + Qstats, Qframe, Qscene, }; @@ -67,6 +68,7 @@ Dirtab dirtab[] = { [Qnew] "new", 0666, [Qn] nil, DMDIR|0555, [Qctl] "ctl", 0666, + [Qstats] "stats", 0444, [Qframe] "frame", 0444, [Qscene] "scene", 0666, }; @@ -163,6 +165,7 @@ resetcamera(Camera *c) c->rctl = renderer; 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); } static ulong @@ -416,6 +419,16 @@ fsread(Req *r) readstr(r, buf); respond(r, nil); break; + case Qstats: + n = snprint(buf, sizeof buf, "fps %.0f/%.0f/%.0f/%.0f\n", + !c->cam->stats.max? 0: 1e9/c->cam->stats.max, + !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); + 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; |