Tuesday, February 6, 2024

[SOLVED] Is there a better way to display cpu usage in tmux?

Issue

Here's a solution which may consume a lot of cpu usage (stolen from this article):

There's a difference in my Ubuntu 12 ec2 server, I have to use top -bn1 instead of top -ln.

Here's my related .tmux.conf file:

set -g status-right '#[fg=yellow]#[(getCpuUsage.sh)]'

It actually calls top every 2 seconds and outputs a whole lot of information. I think there should be a way involving less cpu consumption or use some flag to limit the output of top to only cpu usage.


Solution

I use the small tmux-mem-cpu-load C++ program. It's at least one fork/exec per update either way, but probably better than invoking a shell.



Answered By - ormaaj
Answer Checked By - Timothy Miller (WPSolving Admin)