mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
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...
This commit is contained in:
parent
a45786ef1b
commit
60b27a9686
1 changed files with 24 additions and 0 deletions
24
terminal.c
24
terminal.c
|
|
@ -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 */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue