1

I'd like to profile the performance of tmux. In particular how fast starting up a session is (and maybe also attaching to a session). I'm especially interested in how the content of my .tmux.conf file affects startup times (I use plugins).

How could I measure that in an objective way?

As an example of what I'm interested in, I run this to profile the startup times of my zsh setup.

repeat 5 {/usr/bin/time zsh -i -c exit}

I've tried automating things with commands like the one below, but I can't figure out how to get timings. Also, this seems to execute asynchonously, the command finishes before the session is killed.

tmux new-session -d -s test && tmux send-keys "exit" Enter

1 Answer 1

0

You could do something like this for startup time:

date +%T.%N; tmux -Ltest new -d 'date +%T.%N; sleep 10'
tmux -Ltest capturep -p|sed '/^$/d'
tmux -Ltest kill-server

You can also add -vv to tmux and you will get a log file with timestamps, but it will take some interpretation...

5
  • I can't manage to capture anything. tmux -L test capturep -p doesn't output anything but empty lines Commented Nov 22, 2019 at 17:49
  • It works for me, maybe your date doesn't work or doesn't have %N. What if you do "new -d 'echo xyz; sleep 10'"? Commented Nov 22, 2019 at 18:12
  • Just empty lines Commented Nov 22, 2019 at 18:41
  • Strange, if you attach you don't see anything either? Even if you scroll into the history with C-b [? Commented Nov 22, 2019 at 18:54
  • If I attach I see the output in the pane. Commented Nov 22, 2019 at 19:20

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.