add stats for sprixel emissions/elisions #1563

pull/1573/head
nick black 3 years ago
parent 6650fafca7
commit 6c7b40debf
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -1,6 +1,9 @@
This document attempts to list user-visible changes and any major internal
rearrangements of Notcurses.
* 2.2.9 (not yet released)
* Added two new stats, `sprixelemissions` and `sprixelelisions`.
* 2.2.8 (2021-04-18)
* All remaining functions prefixed with `cell_` or `cells_` have been
deprecated in favor of versions prefixed with `nccell_` or `nccell_`,

@ -3328,6 +3328,8 @@ typedef struct ncstats {
uint64_t defaultelisions; // default color was emitted
uint64_t defaultemissions; // default color was elided
uint64_t refreshes; // refresh requests (non-optimized redraw)
uint64_t sprixelemissions; // sprixel draw count
uint64_t sprixelelisions; // sprixel elision count
// current state -- these can decrease
uint64_t fbbytes; // total bytes devoted to all active framebuffers

@ -38,6 +38,8 @@ typedef struct ncstats {
uint64_t defaultelisions; // default color was emitted
uint64_t defaultemissions; // default color was elided
uint64_t refreshes; // refreshes (unoptimized redraws)
uint64_t sprixelemissions; // sprixel draw count
uint64_t sprixelelisions; // sprixel elision count
// current state -- these can decrease
uint64_t fbbytes; // bytes devoted to framebuffers
@ -102,6 +104,10 @@ the **struct notcurses** context. **planes** is the number of planes in the
context. Neither of these stats can reach 0, due to the mandatory standard
plane.
**sprixelemissions** is the number of sprixel draws. **sprixelelisions** is
the number of times a sprixel was elided--essentially, the number of times
a sprixel appeared in a rendered frame without freshly drawing it.
# NOTES
Unsuccessful render operations do not contribute to the render timing stats.

@ -1417,6 +1417,8 @@ typedef struct ncstats {
uint64_t raster_ns; // nanoseconds spent rasterizing
int64_t raster_max_ns; // max ns spent in raster for a frame
int64_t raster_min_ns; // min ns spent in raster for a frame
uint64_t sprixelemissions; // sprixel draw count
uint64_t sprixelelisions; // sprixel elision count
} ncstats;
// Allocate an ncstats object. Use this rather than allocating your own, since

@ -141,6 +141,9 @@ void notcurses_stats_reset(notcurses* nc, ncstats* stats){
stash->defaultelisions += nc->stats.defaultelisions;
stash->defaultemissions += nc->stats.defaultemissions;
stash->refreshes += nc->stats.refreshes;
stash->sprixelemissions += nc->stats.sprixelemissions;
stash->sprixelelisions += nc->stats.sprixelelisions;
stash->fbbytes = nc->stats.fbbytes;
stash->planes = nc->stats.planes;
reset_stats(&nc->stats);
@ -208,5 +211,9 @@ void summarize_stats(notcurses* nc){
(stats->fgelisions * 100.0) / (stats->fgemissions + stats->fgelisions),
(stats->bgemissions + stats->bgelisions) == 0 ? 0 :
(stats->bgelisions * 100.0) / (stats->bgemissions + stats->bgelisions));
fprintf(stderr, "Sprixel emits:elides: %ju/%ju (%.2f%%)\n",
stats->sprixelemissions, stats->sprixelelisions,
(stats->sprixelemissions + stats->sprixelelisions) == 0 ? 0 :
(stats->sprixelelisions * 100.0) / (stats->sprixelemissions + stats->sprixelelisions));
}
}

Loading…
Cancel
Save