summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/format.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2017-04-19 06:52:28 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2017-04-19 06:52:28 +0000
commit97651b5718e9a73acc8d9d8d7f05052650d06773 (patch)
treec22246b786ad8996e3f5564647598d01fcf183e7 /usr.bin/tmux/format.c
parent79c49c8a4d06f0dcd7167e9e0ee5e5c0585c990f (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 'usr.bin/tmux/format.c')
-rw-r--r--usr.bin/tmux/format.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.bin/tmux/format.c b/usr.bin/tmux/format.c
index 80dda8370e6..fb43f429075 100644
--- a/usr.bin/tmux/format.c
+++ b/usr.bin/tmux/format.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: format.c,v 1.125 2017/04/18 15:44:17 nicm Exp $ */
+/* $OpenBSD: format.c,v 1.126 2017/04/19 06:52:27 nicm Exp $ */
/*
* Copyright (c) 2011 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -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)