mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-09 09:09:03 -04:00
add stat for notcurses_refresh()
This commit is contained in:
parent
361a253aea
commit
e60a7aa463
1
USAGE.md
1
USAGE.md
@ -2916,6 +2916,7 @@ typedef struct ncstats {
|
||||
uint64_t bgemissions; // RGB bg emissions
|
||||
uint64_t defaultelisions; // default color was emitted
|
||||
uint64_t defaultemissions; // default color was elided
|
||||
uint64_t refreshes; // refreshes (suboptimal redraws)
|
||||
|
||||
// current state -- these can decrease
|
||||
uint64_t fbbytes; // total bytes devoted to all active framebuffers
|
||||
|
@ -153,23 +153,24 @@ void ncplane_set_styles(struct ncplane* n, unsigned stylebits);
|
||||
void ncplane_on_styles(struct ncplane* n, unsigned stylebits);
|
||||
void ncplane_off_styles(struct ncplane* n, unsigned stylebits);
|
||||
typedef struct ncstats {
|
||||
uint64_t renders; // number of successful notcurses_render() runs
|
||||
uint64_t failed_renders; // number of aborted renders, should be 0
|
||||
uint64_t render_bytes; // bytes emitted to ttyfp
|
||||
int64_t render_max_bytes; // max bytes emitted for a frame
|
||||
int64_t render_min_bytes; // min bytes emitted for a frame
|
||||
uint64_t render_ns; // nanoseconds spent in notcurses_render()
|
||||
int64_t render_max_ns; // max ns spent in notcurses_render()
|
||||
int64_t render_min_ns; // min ns spent in successful notcurses_render()
|
||||
uint64_t cellelisions; // cells we elided entirely thanks to damage maps
|
||||
uint64_t cellemissions; // cells we emitted due to inferred damage
|
||||
uint64_t fbbytes; // total bytes devoted to all active framebuffers
|
||||
uint64_t fgelisions; // RGB fg elision count
|
||||
uint64_t fgemissions; // RGB fg emissions
|
||||
uint64_t bgelisions; // RGB bg elision count
|
||||
uint64_t bgemissions; // RGB bg emissions
|
||||
uint64_t defaultelisions; // default color was emitted
|
||||
uint64_t defaultemissions; // default color was elided
|
||||
uint64_t renders;
|
||||
uint64_t failed_renders;
|
||||
uint64_t render_bytes;
|
||||
int64_t render_max_bytes;
|
||||
int64_t render_min_bytes;
|
||||
uint64_t render_ns;
|
||||
int64_t render_max_ns;
|
||||
int64_t render_min_ns;
|
||||
uint64_t cellelisions;
|
||||
uint64_t cellemissions;
|
||||
uint64_t fbbytes;
|
||||
uint64_t fgelisions;
|
||||
uint64_t fgemissions;
|
||||
uint64_t bgelisions;
|
||||
uint64_t bgemissions;
|
||||
uint64_t defaultelisions;
|
||||
uint64_t defaultemissions;
|
||||
uint64_t refreshes;
|
||||
} ncstats;
|
||||
ncstats* notcurses_stats_alloc(struct notcurses* nc);
|
||||
void notcurses_stats(struct notcurses* nc, ncstats* stats);
|
||||
|
@ -50,6 +50,9 @@ Highest performance in a rendering loop would actually call for disabling
|
||||
Notcurses's **SIGWINCH** handling in the call to **notcurses_init**, so that no
|
||||
time is spent handling a signal you're not going to use.
|
||||
|
||||
Each time **notcurses_refresh** is successfully executed, the **refreshes**
|
||||
stat is incremented by 1.
|
||||
|
||||
# RETURN VALUES
|
||||
|
||||
Returns 0 on success, and -1 on failure. The causes for failure include system
|
||||
@ -62,5 +65,6 @@ of these are particularly good things, and the most reasonable response to a
|
||||
**notcurses_init(3)**,
|
||||
**notcurses_input(3)**,
|
||||
**notcurses_render(3)**,
|
||||
**notcurses_stats(3)**,
|
||||
**termios(3)**,
|
||||
**signal(7)**
|
||||
|
@ -32,6 +32,7 @@ typedef struct ncstats {
|
||||
uint64_t bgemissions; // RGB bg emissions
|
||||
uint64_t defaultelisions; // default color was emitted
|
||||
uint64_t defaultemissions; // default color was elided
|
||||
uint64_t refreshes; // refreshes (unoptimized redraws)
|
||||
|
||||
// current state -- these can decrease
|
||||
uint64_t fbbytes; // bytes devoted to framebuffers
|
||||
@ -84,6 +85,9 @@ any stat.
|
||||
**cellelisions** reflects the number of cells which were not written, due to
|
||||
damage detection.
|
||||
|
||||
**refreshes** is the number of times **notcurses_refresh** has been
|
||||
successfully executed.
|
||||
|
||||
**fbbytes** is the total number of bytes devoted to framebuffers throughout
|
||||
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
|
||||
|
@ -1196,6 +1196,7 @@ typedef struct ncstats {
|
||||
uint64_t bgemissions; // RGB bg emissions
|
||||
uint64_t defaultelisions; // default color was emitted
|
||||
uint64_t defaultemissions; // default color was elided
|
||||
uint64_t refreshes; // refresh requests (non-optimized redraw)
|
||||
|
||||
// current state -- these can decrease
|
||||
uint64_t fbbytes; // total bytes devoted to all active framebuffers
|
||||
|
@ -766,6 +766,7 @@ stash_stats(notcurses* nc){
|
||||
nc->stashstats.bgemissions += nc->stats.bgemissions;
|
||||
nc->stashstats.defaultelisions += nc->stats.defaultelisions;
|
||||
nc->stashstats.defaultemissions += nc->stats.defaultemissions;
|
||||
nc->stashstats.refreshes += nc->stats.refreshes;
|
||||
// fbbytes aren't stashed
|
||||
reset_stats(&nc->stats);
|
||||
}
|
||||
@ -1227,11 +1228,13 @@ int notcurses_stop(notcurses* nc){
|
||||
nc->stashstats.render_bytes / (double)nc->stashstats.renders / 1024);
|
||||
}
|
||||
if(nc->stashstats.renders || nc->stashstats.failed_renders){
|
||||
fprintf(stderr, "%.1f theoretical FPS, %ju failed render%s\n",
|
||||
fprintf(stderr, "%.1f theoretical FPS, %ju failed render%s, %ju refresh%s\n",
|
||||
nc->stashstats.renders ?
|
||||
NANOSECS_IN_SEC * (double)nc->stashstats.renders / nc->stashstats.render_ns : 0.0,
|
||||
nc->stashstats.failed_renders,
|
||||
nc->stashstats.failed_renders == 1 ? "" : "s");
|
||||
nc->stashstats.failed_renders == 1 ? "" : "s",
|
||||
nc->stashstats.refreshes,
|
||||
nc->stashstats.refreshes == 1 ? "" : "es");
|
||||
fprintf(stderr, "RGB emits:elides: def %ju:%ju fg %ju:%ju bg %ju:%ju\n",
|
||||
nc->stashstats.defaultemissions,
|
||||
nc->stashstats.defaultelisions,
|
||||
|
@ -1013,6 +1013,7 @@ int notcurses_refresh(notcurses* nc, int* restrict dimy, int* restrict dimx){
|
||||
if(ret < 0){
|
||||
return -1;
|
||||
}
|
||||
++nc->stats.refreshes;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,7 @@ usage() { echo "usage: `basename $0` version" ; }
|
||||
|
||||
VERSION="$1"
|
||||
|
||||
rm -fv debian/files
|
||||
dch -v $VERSION+dfsg.1-1
|
||||
dch -r
|
||||
uscan --repack --compression xz --force
|
||||
|
Loading…
x
Reference in New Issue
Block a user