summaryrefslogtreecommitdiffstats
path: root/format.c
diff options
context:
space:
mode:
authornicm <nicm>2017-04-19 06:52:27 +0000
committernicm <nicm>2017-04-19 06:52:27 +0000
commitfa6deb58664739a8073f188a4e3a88a122270537 (patch)
tree8051621e0d3aff1bcf8f19ea3867eee68d450fd1 /format.c
parentf731ae4a2dc6aca565b20dffd6ddf661e585cbb5 (diff)
When the data we have buffered to write to a terminal grows beyond a
reasonable amount (currently width * height * 8 bytes), discard all output to the terminal and start trying to redraw periodically instead. Continue with this until the amount of data we are trying to write falls to a low level again. This helps to prevent tmux sitting on a huge buffer of data when there are processes with fast output running inside tmux but the outside terminal is slow. A new client_discarded format holds the amount of data that has been discarded due to this mechanism. The three variables (when to start this, when to stop, and how often to redraw) are basically "works for me" at the moment, this is going in to see how it goes and if it causes problems for anyone else.
Diffstat (limited to 'format.c')
-rw-r--r--format.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/format.c b/format.c
index 633be101..269d506a 100644
--- a/format.c
+++ b/format.c
@@ -1154,7 +1154,9 @@ format_defaults_client(struct format_tree *ft, struct client *c)
format_add_tv(ft, "client_created", &c->creation_time);
format_add_tv(ft, "client_activity", &c->activity_time);
- format_add(ft, "client_written", "%zu", tty->written);
+
+ format_add(ft, "client_written", "%zu", c->written);
+ format_add(ft, "client_discarded", "%zu", c->discarded);
name = server_client_get_key_table(c);
if (strcmp(c->keytable->name, name) == 0)