aboutsummaryrefslogtreecommitdiff
path: root/tmux.h
diff options
context:
space:
mode:
authornicm <nicm>2016-09-16 13:43:41 +0000
committernicm <nicm>2016-09-16 13:43:41 +0000
commiteb50e7a2c87ed8c18f2944e0082e961acb70765b (patch)
tree980730cb291256386e94ecb929c04631f062d9c0 /tmux.h
parent2e5584c2b41df1c1b836c3229ea78f8ea3d81054 (diff)
downloadrtmux-eb50e7a2c87ed8c18f2944e0082e961acb70765b.tar.gz
rtmux-eb50e7a2c87ed8c18f2944e0082e961acb70765b.tar.bz2
rtmux-eb50e7a2c87ed8c18f2944e0082e961acb70765b.zip
Swap watermarks from high (4096) to low (128) when we get full buffers
into the read callback several times in succession; swap back when we see empty buffers several times. This hopefully limits how much programs that print a lot for a long period can monopolize tmux (like large, fast compiling), without penalizing programs that print a lot briefly (like most curses applications). Helps a lot for me, the actual numbers may need tweaking later.
Diffstat (limited to 'tmux.h')
-rw-r--r--tmux.h17
1 files changed, 15 insertions, 2 deletions
diff --git a/tmux.h b/tmux.h
index 4a3bff4d..528b0b7b 100644
--- a/tmux.h
+++ b/tmux.h
@@ -59,8 +59,18 @@ struct tmuxproc;
/* Automatic name refresh interval, in microseconds. Must be < 1 second. */
#define NAME_INTERVAL 500000
-/* The maximum amount of data to hold from a pty (the event high watermark). */
-#define READ_SIZE 4096
+/*
+ * 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
/* Attribute to make gcc check printf-like arguments. */
#define printflike(a, b) __attribute__ ((format (printf, a, b)))
@@ -884,6 +894,9 @@ struct window_pane {
int fd;
struct bufferevent *event;
+ u_int wmark_size;
+ u_int wmark_hits;
+
struct input_ctx *ictx;
struct grid_cell colgc;