.\" Automatically generated by Pandoc 2.9.2.1 .\" .TH "notcurses_stats" "3" "v3.0.0" "" "" .hy .SH NAME .PP notcurses_stats - notcurses runtime statistics .SH SYNOPSIS .PP \f[B]#include \f[R] .IP .nf \f[C] typedef struct ncstats { // purely increasing stats uint64_t renders; // successful ncpile_render() runs uint64_t writeouts; // successful ncpile_rasterize() runs uint64_t failed_renders; // aborted renders, should be 0 uint64_t failed_writeouts; // aborted writes uint64_t raster_bytes; // bytes emitted to ttyfp int64_t raster_max_bytes; // max bytes emitted for a frame int64_t raster_min_bytes; // min bytes emitted for a frame uint64_t render_ns; // nanoseconds spent rendering int64_t render_max_ns; // max ns spent for a frame int64_t render_min_ns; // min ns spent for a frame 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 writeout_ns; // ns spent writing frames to terminal int64_t writeout_max_ns; // max ns spent writing out a frame int64_t writeout_min_ns; // min ns spent writing out a frame uint64_t cellelisions; // cells elided entirely uint64_t cellemissions; // cells emitted 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 refreshes; // refreshes (unoptimized redraws) uint64_t sprixelemissions; // sprixel draw count uint64_t sprixelelisions; // sprixel elision count uint64_t sprixelbytes; // sprixel bytes emitted uint64_t appsync_updates; // application-synchronized updates uint64_t input_events; // inputs received or synthesized uint64_t input_errors; // errors processing input uint64_t hpa_gratuitous; // gratuitous HPAs issued uint64_t cell_geo_changes; // cell geometry changes (resizes) uint64_t pixel_geo_changes;// pixel geometry changes (font resize) // current state -- these can decrease uint64_t fbbytes; // bytes devoted to framebuffers unsigned planes; // planes currently in existence } ncstats; \f[R] .fi .PP \f[B]ncstats* notcurses_stats_alloc(struct notcurses* \f[R]\f[I]nc\f[R]\f[B]);\f[R] .PP \f[B]void notcurses_stats(struct notcurses* \f[R]\f[I]nc\f[R]\f[B], ncstats* \f[R]\f[I]stats\f[R]\f[B]);\f[R] .PP \f[B]void notcurses_stats_reset(struct notcurses* \f[R]\f[I]nc\f[R]\f[B], ncstats* \f[R]\f[I]stats\f[R]\f[B]);\f[R] .SH DESCRIPTION .PP \f[B]notcurses_stats_alloc\f[R] allocates an \f[B]ncstats\f[R] object. This should be used rather than allocating the object in client code, to future-proof against the struct being enlarged by later Notcurses versions. .PP \f[B]notcurses_stats\f[R] acquires an atomic snapshot of statistics, primarily related to notcurses_render(3). \f[B]notcurses_stats_reset\f[R] does the same, but also resets all cumulative stats (immediate stats such as \f[B]fbbytes\f[R] are not reset). .PP \f[B]renders\f[R] is the number of successful calls to \f[B]notcurses_render(3)\f[R] or \f[B]ncpile_render_to_buffer(3)\f[R]. \f[B]failed_renders\f[R] is the number of unsuccessful calls to these functions. \f[B]failed_renders\f[R] should be 0; renders are not expected to fail except under exceptional circumstances. should \f[B]notcurses_render(3)\f[R] fail while writing out a frame to the terminal, it counts as a failed render. .PP \f[B]raster_max_bytes\f[R] and \f[B]raster_min_bytes\f[R] track the maximum and minimum number of bytes used rasterizing a frame. A given state of Notcurses does not correspond to a unique number of bytes; the size is also dependent on the existing terminal state. As a first approximation, the time a terminal takes to ingest and reflect a frame is dependent on the size of the rasterized frame. .PP \f[B]render_ns\f[R], \f[B]render_max_ns\f[R], and \f[B]render_min_ns\f[R] track the total amount of time spent rendering frames in nanoseconds. Rendering takes place in \f[B]ncpile_render\f[R] (called by \f[B]notcurses_render(3)\f[R] and \f[B]ncpile_render_to_buffer\f[R]). This step is independent of the terminal. .PP \f[B]raster_ns\f[R], \f[B]raster_max_ns\f[R], and \f[B]raster_min_ns\f[R] track the total amount of time spent rasterizing frames in nanoseconds. Rasterizing takes place in \f[B]ncpile_raster\f[R] (called by \f[B]notcurses_raster(3)\f[R] and \f[B]ncpile_render_to_buffer\f[R]). This step depends on the terminal definitions. The same frame might not rasterize to the same bytes for different terminals. .PP \f[B]writeout_ns\f[R], \f[B]writeout_max_ns\f[R], and \f[B]writeout_min_ns\f[R] track the total amount of time spent writing frames to the terminal. This takes place in \f[B]ncpile_rasterize\f[R] (called by \f[B]notcurses_render(3)\f[R]). .PP \f[B]cellemissions\f[R] reflects the number of EGCs written to the terminal. \f[B]cellelisions\f[R] reflects the number of cells which were not written, due to damage detection. .PP \f[B]refreshes\f[R] is the number of times \f[B]notcurses_refresh\f[R] has been successfully executed. .PP \f[B]fbbytes\f[R] is the total number of bytes devoted to framebuffers throughout the \f[B]struct notcurses\f[R] context. \f[B]planes\f[R] is the number of planes in the context. Neither of these stats can reach 0, due to the mandatory standard plane. .PP \f[B]sprixelemissions\f[R] is the number of sprixel draws. \f[B]sprixelelisions\f[R] 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. \f[B]sprixelbytes\f[R] is the number of bytes used for sprixel drawing. It does not include move/delete operations, nor glyphs used to erase sprixels. .PP \f[B]input_errors\f[R] is the number of errors while processing input, e.g. malformed control sequences or invalid UTF-8 (see \f[B]utf8(7)\f[R]). .PP \f[B]hpa_gratuitous\f[R] is the number of \f[B]hpa\f[R] (horizontal position absolute, see \f[B]terminfo(5)\f[R]) control sequences issued where not strictly necessary. This is done to cope with fundamental ambiguities regarding glyph width. It is not generally possible to know how wide a glyph will be rendered on a given combination of font, font rendering engine, and terminal. Indeed, it is not even generally possible to know how many glyphs will result from a sequence of EGCs. As a result, Notcurses sometimes issues \[dq]gratuitous\[dq] \f[B]hpa\f[R] controls. .PP \f[B]cell_geo_changes\f[R] is the number of changes to the visible area\[aq]s cell geometry. The cell geometry changes whenever the visible area is resized without a corresponding cell-pixel geometry change. \f[B]pixel_geo_changes\f[R] is the number of changes to cells\[aq] pixel geometry (i.e. the height and width of each cell), and changes whenever the font size changes. Both can change at the same time if e.g. a terminal undergoes a font size change without changing its total size. .SH NOTES .PP Unsuccessful render operations do not contribute to the render timing stats. .PP Linux framebuffer bitmaps are not written through the terminal device, but instead directly into the memory-mapped framebuffer (see \f[B]mmap(2)\f[R]). Bytes used for framebuffer graphics are thus independent of bytes written to the terminal. This explains why \f[B]sprixelbytes\f[R] may be surprising given the value of \f[B]raster_bytes\f[R]. .SH RETURN VALUES .PP Neither \f[B]notcurses_stats\f[R] nor \f[B]notcurses_stats_reset\f[R] can fail. Neither returns any value. \f[B]notcurses_stats_alloc\f[R] returns a valid \f[B]ncstats\f[R] object on success, or \f[B]NULL\f[R] on allocation failure. .SH SEE ALSO .PP \f[B]mmap(2)\f[R], \f[B]notcurses(3)\f[R], \f[B]notcurses_render(3)\f[R], \f[B]terminfo(5)\f[R], \f[B]utf8(7)\f[R] .SH AUTHORS nick black .