mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-20 03:25:47 +00:00
render summary: autoscale all times
This commit is contained in:
parent
4f719b5405
commit
55699c6a3c
@ -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');
|
||||||
|
@ -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),
|
||||||
|
Loading…
Reference in New Issue
Block a user