diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2017-02-08 08:25:13 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2017-02-08 08:25:13 +0000 |
commit | fdf4e49cbef73f1c05fd6268fa99505c235e861d (patch) | |
tree | 9107a2442cdc57b1e0c12d60edf7ce31d4899785 /usr.bin/tmux | |
parent | d3ad958da56e345c9284b868f35e912ebfab29f5 (diff) |
Remove event watermarks, don't work well enough to be worth it.
Diffstat (limited to 'usr.bin/tmux')
-rw-r--r-- | usr.bin/tmux/tmux.h | 21 | ||||
-rw-r--r-- | usr.bin/tmux/window.c | 29 |
2 files changed, 7 insertions, 43 deletions
diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index dc7d630df7f..f102f22f0d3 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.717 2017/02/06 22:05:11 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.718 2017/02/08 08:25:12 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -64,18 +64,8 @@ struct tmuxproc; /* Automatic name refresh interval, in microseconds. Must be < 1 second. */ #define NAME_INTERVAL 500000 -/* - * Event watermarks. We start with FAST then if we hit full size for HITS reads - * in succession switch to SLOW, and return when we hit EMPTY the same number - * of times. - */ -#define READ_FAST_SIZE 4096 -#define READ_SLOW_SIZE 128 - -#define READ_FULL_SIZE (4096 - 16) -#define READ_EMPTY_SIZE 16 - -#define READ_CHANGE_HITS 3 +/* Maximum size of data to hold from a pane. */ +#define READ_SIZE 4096 /* Attribute to make GCC check printf-like arguments. */ #define printflike(a, b) __attribute__ ((format (printf, a, b))) @@ -240,7 +230,7 @@ enum tty_code_code { TTYC_DL1, /* delete_line, dl */ TTYC_E3, TTYC_ECH, /* erase_chars, ec */ - TTYC_ED, /* csr_eos, cd */ + TTYC_ED, /* clr_eos, cd */ TTYC_EL, /* clr_eol, ce */ TTYC_EL1, /* clr_bol, cb */ TTYC_ENACS, /* ena_acs, eA */ @@ -762,9 +752,6 @@ struct window_pane { struct event resize_timer; - u_int wmark_size; - u_int wmark_hits; - struct input_ctx *ictx; struct grid_cell colgc; diff --git a/usr.bin/tmux/window.c b/usr.bin/tmux/window.c index 7ae4bdb56b1..a2b9718845e 100644 --- a/usr.bin/tmux/window.c +++ b/usr.bin/tmux/window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window.c,v 1.182 2017/01/24 13:28:33 nicm Exp $ */ +/* $OpenBSD: window.c,v 1.183 2017/02/08 08:25:12 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -66,8 +66,6 @@ static struct window_pane *window_pane_create(struct window *, u_int, u_int, u_int); static void window_pane_destroy(struct window_pane *); -static void window_pane_set_watermark(struct window_pane *, size_t); - static void window_pane_read_callback(struct bufferevent *, void *); static void window_pane_error_callback(struct bufferevent *, short, void *); @@ -839,14 +837,6 @@ window_pane_destroy(struct window_pane *wp) free(wp); } -static void -window_pane_set_watermark(struct window_pane *wp, size_t size) -{ - wp->wmark_hits = 0; - wp->wmark_size = size; - bufferevent_setwatermark(wp->event, EV_READ, 0, size); -} - int window_pane_spawn(struct window_pane *wp, int argc, char **argv, const char *path, const char *shell, const char *cwd, struct environ *env, @@ -954,7 +944,7 @@ window_pane_spawn(struct window_pane *wp, int argc, char **argv, wp->event = bufferevent_new(wp->fd, window_pane_read_callback, NULL, window_pane_error_callback, wp); - window_pane_set_watermark(wp, READ_FAST_SIZE); + bufferevent_setwatermark(wp->event, EV_READ, 0, READ_SIZE); bufferevent_enable(wp->event, EV_READ|EV_WRITE); free(cmd); @@ -970,26 +960,13 @@ window_pane_read_callback(__unused struct bufferevent *bufev, void *data) char *new_data; size_t new_size; - if (wp->wmark_size == READ_FAST_SIZE) { - if (size > READ_FULL_SIZE) - wp->wmark_hits++; - if (wp->wmark_hits == READ_CHANGE_HITS) - window_pane_set_watermark(wp, READ_SLOW_SIZE); - } else if (wp->wmark_size == READ_SLOW_SIZE) { - if (size < READ_EMPTY_SIZE) - wp->wmark_hits++; - if (wp->wmark_hits == READ_CHANGE_HITS) - window_pane_set_watermark(wp, READ_FAST_SIZE); - } - log_debug("%%%u has %zu bytes (of %u, %u hits)", wp->id, size, - wp->wmark_size, wp->wmark_hits); - new_size = size - wp->pipe_off; if (wp->pipe_fd != -1 && new_size > 0) { new_data = EVBUFFER_DATA(evb) + wp->pipe_off; bufferevent_write(wp->pipe_event, new_data, new_size); } + log_debug("%%%u has %zu bytes", wp->id, size); input_parse(wp); wp->pipe_off = EVBUFFER_LENGTH(evb); |