add stats for sprixel emissions/elisions #1563

This commit is contained in:
nick black 2021-04-21 11:42:59 -04:00
parent 6650fafca7
commit 6c7b40debf
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC
5 changed files with 20 additions and 0 deletions

View File

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

View File

@ -3328,6 +3328,8 @@ typedef struct ncstats {
uint64_t defaultelisions; // default color was emitted uint64_t defaultelisions; // default color was emitted
uint64_t defaultemissions; // default color was elided uint64_t defaultemissions; // default color was elided
uint64_t refreshes; // refresh requests (non-optimized redraw) 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 // current state -- these can decrease
uint64_t fbbytes; // total bytes devoted to all active framebuffers uint64_t fbbytes; // total bytes devoted to all active framebuffers

View File

@ -38,6 +38,8 @@ typedef struct ncstats {
uint64_t defaultelisions; // default color was emitted uint64_t defaultelisions; // default color was emitted
uint64_t defaultemissions; // default color was elided uint64_t defaultemissions; // default color was elided
uint64_t refreshes; // refreshes (unoptimized redraws) uint64_t refreshes; // refreshes (unoptimized redraws)
uint64_t sprixelemissions; // sprixel draw count
uint64_t sprixelelisions; // sprixel elision count
// current state -- these can decrease // current state -- these can decrease
uint64_t fbbytes; // bytes devoted to framebuffers 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 context. Neither of these stats can reach 0, due to the mandatory standard
plane. 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 # NOTES
Unsuccessful render operations do not contribute to the render timing stats. Unsuccessful render operations do not contribute to the render timing stats.

View File

@ -1417,6 +1417,8 @@ typedef struct ncstats {
uint64_t raster_ns; // nanoseconds spent rasterizing uint64_t raster_ns; // nanoseconds spent rasterizing
int64_t raster_max_ns; // max ns spent in raster for a frame 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 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; } ncstats;
// Allocate an ncstats object. Use this rather than allocating your own, since // Allocate an ncstats object. Use this rather than allocating your own, since

View File

@ -141,6 +141,9 @@ void notcurses_stats_reset(notcurses* nc, ncstats* stats){
stash->defaultelisions += nc->stats.defaultelisions; stash->defaultelisions += nc->stats.defaultelisions;
stash->defaultemissions += nc->stats.defaultemissions; stash->defaultemissions += nc->stats.defaultemissions;
stash->refreshes += nc->stats.refreshes; stash->refreshes += nc->stats.refreshes;
stash->sprixelemissions += nc->stats.sprixelemissions;
stash->sprixelelisions += nc->stats.sprixelelisions;
stash->fbbytes = nc->stats.fbbytes; stash->fbbytes = nc->stats.fbbytes;
stash->planes = nc->stats.planes; stash->planes = nc->stats.planes;
reset_stats(&nc->stats); reset_stats(&nc->stats);
@ -208,5 +211,9 @@ void summarize_stats(notcurses* nc){
(stats->fgelisions * 100.0) / (stats->fgemissions + stats->fgelisions), (stats->fgelisions * 100.0) / (stats->fgemissions + stats->fgelisions),
(stats->bgemissions + stats->bgelisions) == 0 ? 0 : (stats->bgemissions + stats->bgelisions) == 0 ? 0 :
(stats->bgelisions * 100.0) / (stats->bgemissions + stats->bgelisions)); (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));
} }
} }