mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-01 07:15:32 -04:00
grid: add compile-time define to enable timing of the reflow operation
This commit is contained in:
parent
92e517ae34
commit
5bec83c406
1 changed files with 17 additions and 0 deletions
17
grid.c
17
grid.c
|
|
@ -12,6 +12,8 @@
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "xmalloc.h"
|
#include "xmalloc.h"
|
||||||
|
|
||||||
|
#define TIME_REFLOW 1
|
||||||
|
|
||||||
struct grid *
|
struct grid *
|
||||||
grid_snapshot(const struct grid *grid)
|
grid_snapshot(const struct grid *grid)
|
||||||
{
|
{
|
||||||
|
|
@ -391,6 +393,11 @@ grid_resize_and_reflow(
|
||||||
size_t compose_count, const struct
|
size_t compose_count, const struct
|
||||||
composed composed[static compose_count])
|
composed composed[static compose_count])
|
||||||
{
|
{
|
||||||
|
#if defined(TIME_REFLOW) && TIME_REFLOW
|
||||||
|
struct timeval start;
|
||||||
|
gettimeofday(&start, NULL);
|
||||||
|
#endif
|
||||||
|
|
||||||
struct row *const *old_grid = grid->rows;
|
struct row *const *old_grid = grid->rows;
|
||||||
const int old_rows = grid->num_rows;
|
const int old_rows = grid->num_rows;
|
||||||
const int old_cols = grid->num_cols;
|
const int old_cols = grid->num_cols;
|
||||||
|
|
@ -676,6 +683,16 @@ grid_resize_and_reflow(
|
||||||
tll_free(untranslated_sixels);
|
tll_free(untranslated_sixels);
|
||||||
|
|
||||||
tll_free(tracking_points);
|
tll_free(tracking_points);
|
||||||
|
|
||||||
|
#if defined(TIME_REFLOW) && TIME_REFLOW
|
||||||
|
struct timeval stop;
|
||||||
|
gettimeofday(&stop, NULL);
|
||||||
|
|
||||||
|
struct timeval diff;
|
||||||
|
timersub(&stop, &start, &diff);
|
||||||
|
LOG_INFO("reflowed %d -> %d rows in %lds %ldµs",
|
||||||
|
old_rows, new_rows, diff.tv_sec, diff.tv_usec);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue