From e153b928ff5139fdc39b45db493a1c81d2175d21 Mon Sep 17 00:00:00 2001 From: nicm Date: Sat, 18 Apr 2020 07:19:28 +0000 Subject: [PATCH] Add formats for pane written/skipped bytes for debugging. --- format.c | 3 +++ screen-write.c | 4 ++++ tmux.1 | 2 ++ tmux.h | 3 +++ 4 files changed, 12 insertions(+) diff --git a/format.c b/format.c index f2387f7a..b410f46f 100644 --- a/format.c +++ b/format.c @@ -2690,6 +2690,9 @@ format_defaults_pane(struct format_tree *ft, struct window_pane *wp) format_add(ft, "history_limit", "%u", gd->hlimit); format_add_cb(ft, "history_bytes", format_cb_history_bytes); + format_add(ft, "pane_written", "%zu", wp->written); + format_add(ft, "pane_skipped", "%zu", wp->skipped); + if (window_pane_index(wp, &idx) != 0) fatalx("index not found"); format_add(ft, "pane_index", "%u", idx); diff --git a/screen-write.c b/screen-write.c index bd756ce3..34895c7b 100644 --- a/screen-write.c +++ b/screen-write.c @@ -174,6 +174,10 @@ screen_write_stop(struct screen_write_ctx *ctx) log_debug("%s: %u cells (%u written, %u skipped)", __func__, ctx->cells, ctx->written, ctx->skipped); + if (ctx->wp != NULL) { + ctx->wp->written += ctx->written; + ctx->wp->skipped += ctx->skipped; + } if (ctx->sync) { screen_write_initctx(ctx, &ttyctx, 0); diff --git a/tmux.1 b/tmux.1 index 28c8c9c3..325ccd98 100644 --- a/tmux.1 +++ b/tmux.1 @@ -4450,6 +4450,7 @@ The following variables are available, where appropriate: .It Li "pane_pipe" Ta "" Ta "1 if pane is being piped" .It Li "pane_right" Ta "" Ta "Right of pane" .It Li "pane_search_string" Ta "" Ta "Last search string in copy mode" +.It Li "pane_skipped" Ta "" Ta "Bytes skipped as not visible in pane" .It Li "pane_start_command" Ta "" Ta "Command pane started with" .It Li "pane_synchronized" Ta "" Ta "1 if pane is synchronized" .It Li "pane_tabs" Ta "" Ta "Pane tab positions" @@ -4457,6 +4458,7 @@ The following variables are available, where appropriate: .It Li "pane_top" Ta "" Ta "Top of pane" .It Li "pane_tty" Ta "" Ta "Pseudo terminal of pane" .It Li "pane_width" Ta "" Ta "Width of pane" +.It Li "pane_written" Ta "" Ta "Bytes written by pane (aside from redrawing)" .It Li "pid" Ta "" Ta "Server PID" .It Li "popup_key" Ta "" Ta "Key pressed in popup" .It Li "popup_mouse_x" Ta "" Ta "Mouse X position in popup" diff --git a/tmux.h b/tmux.h index 16cf414b..e5d7be90 100644 --- a/tmux.h +++ b/tmux.h @@ -934,6 +934,9 @@ struct window_pane { char *searchstr; int searchregex; + u_int written; + u_int skipped; + TAILQ_ENTRY(window_pane) entry; RB_ENTRY(window_pane) tree_entry; };