render summary: autoscale all times

This commit is contained in:
nick black 2020-01-22 08:28:56 -05:00
parent 4f719b5405
commit 55699c6a3c
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC
2 changed files with 8 additions and 6 deletions

View File

@ -1988,7 +1988,7 @@ API const struct ncplane* tablet_ncplane_const(const struct tablet* t);
API const char* enmetric(uintmax_t val, unsigned decimal, char* buf, API const char* enmetric(uintmax_t val, unsigned decimal, char* buf,
int omitdec, unsigned mult, int uprefix); int omitdec, unsigned mult, int uprefix);
// Mega, kilo, gigabytes. Use PREFIXSTRLEN + 1. // Mega, kilo, gigafoo. Use PREFIXSTRLEN + 1.
static inline const char* static inline const char*
qprefix(uintmax_t val, unsigned decimal, char* buf, int omitdec){ qprefix(uintmax_t val, unsigned decimal, char* buf, int omitdec){
return enmetric(val, decimal, buf, omitdec, 1000, '\0'); return enmetric(val, decimal, buf, omitdec, 1000, '\0');

View File

@ -918,13 +918,15 @@ int notcurses_stop(notcurses* nc){
char totalbuf[BPREFIXSTRLEN + 1]; char totalbuf[BPREFIXSTRLEN + 1];
char minbuf[BPREFIXSTRLEN + 1]; char minbuf[BPREFIXSTRLEN + 1];
char maxbuf[BPREFIXSTRLEN + 1]; char maxbuf[BPREFIXSTRLEN + 1];
char avgbuf[BPREFIXSTRLEN + 1];
double avg = nc->stashstats.render_ns / (double)nc->stashstats.renders; double avg = nc->stashstats.render_ns / (double)nc->stashstats.renders;
fprintf(stderr, "\n%ju render%s, %.03gs total (%.03gs min, %.03gs max, %.03gs avg %.1f fps)\n", qprefix(nc->stashstats.render_ns, NANOSECS_IN_SEC, totalbuf, 0);
qprefix(nc->stashstats.render_min_ns, NANOSECS_IN_SEC, minbuf, 0);
qprefix(nc->stashstats.render_max_ns, NANOSECS_IN_SEC, maxbuf, 0);
qprefix(nc->stashstats.render_ns / nc->stashstats.renders, NANOSECS_IN_SEC, avgbuf, 0);
fprintf(stderr, "\n%ju render%s, %ss total (%ss min, %ss max, %ss avg %.1f fps)\n",
nc->stashstats.renders, nc->stashstats.renders == 1 ? "" : "s", nc->stashstats.renders, nc->stashstats.renders == 1 ? "" : "s",
nc->stashstats.render_ns / 1000000000.0, totalbuf, minbuf, maxbuf, avgbuf, NANOSECS_IN_SEC / avg);
nc->stashstats.render_min_ns / 1000000000.0,
nc->stashstats.render_max_ns / 1000000000.0,
avg / NANOSECS_IN_SEC, NANOSECS_IN_SEC / avg);
avg = nc->stashstats.render_bytes / (double)nc->stashstats.renders; avg = nc->stashstats.render_bytes / (double)nc->stashstats.renders;
bprefix(nc->stashstats.render_bytes, 1, totalbuf, 0), bprefix(nc->stashstats.render_bytes, 1, totalbuf, 0),
bprefix(nc->stashstats.render_min_bytes, 1, minbuf, 0), bprefix(nc->stashstats.render_min_bytes, 1, minbuf, 0),