From e5dbe4466b6d67a63f1db115b0154be0e9764bc0 Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 18 Apr 2017 15:44:17 +0000 Subject: [PATCH] Add a format for number of bytes writtent to client, useful for debugging. --- usr.bin/tmux/format.c | 3 ++- usr.bin/tmux/tmux.1 | 5 +++-- usr.bin/tmux/tmux.h | 3 ++- usr.bin/tmux/tty.c | 3 ++- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/usr.bin/tmux/format.c b/usr.bin/tmux/format.c index 17873f0ef33..80dda8370e6 100644 --- a/usr.bin/tmux/format.c +++ b/usr.bin/tmux/format.c @@ -1,4 +1,4 @@ -/* $OpenBSD: format.c,v 1.124 2017/04/05 10:49:46 nicm Exp $ */ +/* $OpenBSD: format.c,v 1.125 2017/04/18 15:44:17 nicm Exp $ */ /* * Copyright (c) 2011 Nicholas Marriott @@ -1154,6 +1154,7 @@ 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); name = server_client_get_key_table(c); if (strcmp(c->keytable->name, name) == 0) diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1 index ec8ad6e8549..efb0ef8d557 100644 --- a/usr.bin/tmux/tmux.1 +++ b/usr.bin/tmux/tmux.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: tmux.1,v 1.540 2017/04/05 10:49:46 nicm Exp $ +.\" $OpenBSD: tmux.1,v 1.541 2017/04/18 15:44:17 nicm Exp $ .\" .\" Copyright (c) 2007 Nicholas Marriott .\" @@ -14,7 +14,7 @@ .\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING .\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: April 5 2017 $ +.Dd $Mdocdate: April 18 2017 $ .Dt TMUX 1 .Os .Sh NAME @@ -3521,6 +3521,7 @@ The following variables are available, where appropriate: .It Li "client_tty" Ta "" Ta "Pseudo terminal of client" .It Li "client_utf8" Ta "" Ta "1 if client supports utf8" .It Li "client_width" Ta "" Ta "Width of client" +.It Li "client_written" Ta "" Ta "Bytes written to client" .It Li "command" Ta "" Ta "Name of command in use, if any" .It Li "command_list_name" Ta "" Ta "Command name if listing commands" .It Li "command_list_alias" Ta "" Ta "Command alias if listing commands" diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index 537dfcaed52..44300a662b4 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.735 2017/04/17 06:40:32 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.736 2017/04/18 15:44:17 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -1043,6 +1043,7 @@ struct tty { struct evbuffer *in; struct event event_out; struct evbuffer *out; + size_t written; struct termios tio; diff --git a/usr.bin/tmux/tty.c b/usr.bin/tmux/tty.c index c489edcbffd..f69eaa99c10 100644 --- a/usr.bin/tmux/tty.c +++ b/usr.bin/tmux/tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty.c,v 1.262 2017/04/18 15:27:47 nicm Exp $ */ +/* $OpenBSD: tty.c,v 1.263 2017/04/18 15:44:17 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -427,6 +427,7 @@ tty_add(struct tty *tty, const char *buf, size_t len) evbuffer_add(tty->out, buf, len); log_debug("%s: %.*s", c->name, (int)len, (const char *)buf); + tty->written += len; if (tty_log_fd != -1) write(tty_log_fd, buf, len); -- 2.20.1