diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2019-12-31 19:26:30 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2019-12-31 19:26:30 +0000 |
| commit | 60b27a9686931986f6f62d970a1f1112720816ba (patch) | |
| tree | 26dcaa22f81d2d34bce9cba54f58c904575bf42a | |
| parent | render: presentation: also use seconds when calculating frame interval count (diff) | |
term: commented out code to measure time between slave output
This allows us to measure the time between to refresh delays. That is,
when we decide to delay a refresh, we store the current time.
If we hit that code path _again_, without having refreshed, we
calculate the time that has passed.
This gives us an estimate for how we should set our lower delay
timeout.
This is of course application dependent, but is still much better than
simply guessing a value...
| -rw-r--r-- | terminal.c | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -117,6 +117,10 @@ fdm_ptmx_out(struct fdm *fdm, int fd, int events, void *data) return true; } +#if 0 +static struct timespec last = {0}; +#endif + static bool fdm_ptmx(struct fdm *fdm, int fd, int events, void *data) { @@ -181,6 +185,22 @@ fdm_ptmx(struct fdm *fdm, int fd, int events, void *data) */ if (term->window->frame_callback == NULL) { /* First timeout - reset each time we receive input. */ + +#if 0 + struct timespec now; + + clock_gettime(1, &now); + if (last.tv_sec > 0 || last.tv_nsec > 0) { + struct timeval diff; + struct timeval l = {last.tv_sec, last.tv_nsec / 1000}; + struct timeval n = {now.tv_sec, now.tv_nsec / 1000}; + + timersub(&n, &l, &diff); + LOG_INFO("waited %lu µs for more input", diff.tv_usec); + } + last = now; +#endif + timerfd_settime( term->delayed_render_timer.lower_fd, 0, &(struct itimerspec){.it_value = {.tv_nsec = 2000000}}, @@ -375,6 +395,10 @@ fdm_delayed_render(struct fdm *fdm, int fd, int events, void *data) else if (ret2 > 0) LOG_DBG("upper delay timer expired"); +#if 0 + last = (struct timespec){0}; +#endif + render_refresh(term); /* Reset timers */ |
