Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

linux

shell

tmux

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.

like image 650
mko Avatar asked Jul 19 '12 10:07

mko


People also ask

How do I monitor CPU usage?

Task Manager also offers a way to keep an eye on CPU usage in real-time, provided you can spare some screen real estate. To create a floating CPU monitor, click on the Performance tab of Task Manager, click CPU, then hover your mouse over the charts showing your CPU cores, right-click, and select Graph Summary View.

How do I monitor CPU usage in Linux?

Running the mpstat command on a Linux system will display an output like the one shown in figure 2. This command shows various CPU statistics including idle time, io wait time and steal time. Similar to the top command, the idle time shown here can be used to compute the CPU utilization using the same formula.

Can you measure CPU utilization network traffic?

OpManager is both a Linux and Windows CPU usage monitor console. To monitor CPU usage means to monitor the following: CPU utilization: Monitors the CPU utilization of the network device.


2 Answers

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.

like image 150
ormaaj Avatar answered Nov 07 '22 14:11

ormaaj


If I knew tmux-mem-cpu-load, I would become too lazy to write my own rainbarf:

rainbarf

It has a fancier look, but it is a Perl script so it is not a good idea to run it every 2 seconds (on my experience, 15 seconds suffice).

like image 35
creaktive Avatar answered Nov 07 '22 12:11

creaktive