summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2017-04-18 15:44:18 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2017-04-18 15:44:18 +0000
commitcd7822d800a6792f32cf2c8d7b0afd6f066595e3 (patch)
treed905f89132e974320fd1ab0ab8a92de8d4543e26 /usr.bin
parentc92518dcd460555fc79912c4449216d4e9137348 (diff)
Add a format for number of bytes writtent to client, useful for debugging.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tmux/format.c3
-rw-r--r--usr.bin/tmux/tmux.15
-rw-r--r--usr.bin/tmux/tmux.h3
-rw-r--r--usr.bin/tmux/tty.c3
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 <nicholas.marriott@gmail.com>
@@ -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 <nicholas.marriott@gmail.com>
.\"
@@ -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 <nicholas.marriott@gmail.com>
@@ -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 <nicholas.marriott@gmail.com>
@@ -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);