CPU, RAM, and load monitor for use with tmux
Go to file
Sam James 59cca005e4
Fix build with GCC 13
GCC 13 (as usual for new compiler releases) shuffles around some internal includes so some
are no longer transitively included.

See https://gnu.org/software/gcc/gcc-13/porting_to.html.

Bug: https://bugs.gentoo.org/895304
2023-04-18 04:25:00 +01:00
.github Bump actions/stale from 7 to 8 2023-03-24 05:01:16 +00:00
builder Add github CI and builder scripts (dockcross) 2021-07-07 02:15:22 +02:00
common Fix build with GCC 13 2023-04-18 04:25:00 +01:00
freebsd Consistent get_cpu_count for FreeBSD 2021-08-04 15:05:19 -04:00
linux uint32_t get_cpu_count() : support >255 threads 2020-02-23 02:40:10 +00:00
netbsd Adapt NetBSD code to signature change. 2023-01-19 14:59:30 +01:00
openbsd openbsd: use actual number of cpus being used 2019-12-02 14:06:38 +01:00
osx uint32_t get_cpu_count() : support >255 threads 2020-02-23 02:40:10 +00:00
windows uint32_t get_cpu_count() : support >255 threads 2020-02-23 02:40:10 +00:00
.gitattributes Add .gitattributes to check whitespace errors. 2016-02-10 16:59:39 -05:00
.gitignore Add github CI and builder scripts (dockcross) 2021-07-07 02:15:22 +02:00
.travis.yml Also run an OSX Travis build. 2015-01-26 15:57:36 -05:00
AUTHORS Update README.rst and AUTHORS 2016-04-28 22:13:05 +02:00
CMakeLists.txt Bump version to 3.7.0 2023-03-27 21:37:42 -04:00
CONTRIBUTING.rst suggestion about script that can be used to strip whitespaces 2015-01-20 15:13:39 +01:00
LICENSE Add Apache-2.0 license. 2012-11-25 17:20:31 +00:00
README.rst Corrected a character in usage output and updated README.rst 2023-03-27 12:21:36 -04:00
tmux-mem-cpu-load.plugin.tmux Test to see if the binary already exists. 2023-02-19 21:57:12 -08:00
tmux-mem-cpu-load.plugin.zsh Added License Information 2015-09-30 13:02:36 -07:00

=============================================
            tmux-mem-cpu-load
=============================================
---------------------------------------------
CPU, RAM, and load monitor for use with tmux_
---------------------------------------------

.. image:: https://travis-ci.org/thewtex/tmux-mem-cpu-load.svg
  :target: https://travis-ci.org/thewtex/tmux-mem-cpu-load

.. image:: https://circleci.com/gh/thewtex/tmux-mem-cpu-load.svg?style=svg
  :target: https://circleci.com/gh/thewtex/tmux-mem-cpu-load
  
.. image:: https://github.com/thewtex/tmux-mem-cpu-load/actions/workflows/main.yml/badge.svg
   :target: https://github.com/thewtex/tmux-mem-cpu-load/actions/workflows/main.yml

Description
===========

A simple, lightweight program provided for system monitoring in the *status*
line of **tmux**.

The memory monitor displays the used and available memory.

The CPU usage monitor outputs a percent CPU usage over all processors. It also
displays a textual bar graph of the current percent usage.

The system load average is also displayed.

Example output::

  2885/7987MB [|||||     ]  51.2% 2.11 2.35 2.44

   ^    ^          ^         ^     ^    ^    ^
   |    |          |         |     |    |    |
   1    2          3         4     5    6    7

1. Currently used memory.
2. Available memory.
3. CPU usage bar graph.
4. CPU usage percentage.
5. Load average for the past minute.
6. Load average for the past 5 minutes.
7. Load average for the past 15 minutes.

For `terminals with 256 color support`_, graded colors can be displayed by
passing the **--colors** flag.


Installation
============

Dependencies
------------

Currently, Linux, Mac OSX, FreeBSD, OpenBSD, and NetBSD are supported.

Building
~~~~~~~~

* >= CMake_ -3.5
* C++ compiler with C++11 support (e.g. gcc/g++ >= 4.6)

Download
--------

There are links to the source code at the `project homepage`_.

Build
-----

::

  cd <source dir>
  cmake .
  make

Install
-------

::

  su -
  make install
  logout

Build and Install Using tpm_
-----------------------------

Include the plugin in your ``.tmux.conf``, the same file you'll set the
configuration in, below.

::

  set -g @plugin 'thewtex/tmux-mem-cpu-load'

Install with Package Managers
-----------------------------

* Gentoo: ``emerge tmux-mem-cpu-load``
* Homebrew: ``brew install tmux-mem-cpu-load``

Build and Install Using Antigen_
--------------------------------

Include the bundle in your ``.zshrc``

::

  antigen bundle thewtex/tmux-mem-cpu-load

Configuring tmux_
=================

Edit ``$HOME/.tmux.conf`` to display the program's output in *status-left* or
*status-right*.  For example::

  set -g status-interval 2
  set -g status-left "#S #[fg=green,bg=black]#(tmux-mem-cpu-load --colors --interval 2)#[default]"
  set -g status-left-length 60

If you installed using tpm, you must specify the full path to the
``tmux-mem-cpu-load`` script, like below::

  set -g status-right "#[fg=green]#($TMUX_PLUGIN_MANAGER_PATH/tmux-mem-cpu-load/tmux-mem-cpu-load --colors --powerline-right --interval 2)#[default]"

Note that the *interval* argument to `tmux-mem-cpu-load` should be the same number
of seconds that *status-interval* is set at.

Another optional argument is the number of bars in the bar graph, which
defaults to 10.  This can, for instance, be set to the number of cores in a
multi-core system.

The *colors* option will add graded colors for each of the measures.

The full usage::

  Usage: tmux-mem-cpu-load [OPTIONS]

  Available options:
  -h, --help
           Prints this help message
  -c, --colors
          Use tmux colors in output
  -p, --powerline-left
	  Use powerline left symbols throughout the output, enables --colors
  -v, --vertical-graph
	  Use vertical bar chart for CPU graph
  -q, --powerline-right
	  Use powerline right symbols throughout the output, enables --colors
  -i <value>, --interval <value>
          Set tmux status refresh interval in seconds. Default: 1 second
  -g <value>, --graph-lines <value>
          Set how many lines should be drawn in a graph. Default: 10
  -m <value>, --mem-mode <value>
        Set memory display mode. 0: Default, 1: Free memory, 2: Usage percent.
  -t <value>, --cpu-mode <value>
        Set cpu % display mode. 0: Default max 100%, 1: Max 100% * number of threads.
  -a <value>, --averages-count <value>
        Set how many load-averages should be drawn. Default: 3



Authors
=======

Matt McCormick (thewtex) <matt@mmmccormick.com>

Contributions from:

* cousine <iam@cousine.me>
* Jasper Lievisse Adriaanse <jasper@humppa.nl>
* Justin Crawford <justinc@pci-online.net>
* krieiter <krieiter@gmail.com>
* Mark Palmeri <mlp6@duke.edu>
* `Pawel 'l0ner' Soltys`_ <pwslts@gmail.com>
* Travil Heller <trav.heller@gmail.com>
* Tony Narlock <tony@git-pull.com>
* Compilenix <Compilenix@compilenix.org>
* jodavies <jodavies1010@gmail.com>
* `@nhdaly`_ (Nathan Daly) <nhdaly@gmail.com>
* bensuperpc <bensuperpc@gmail.com>

.. _tmux: http://tmux.sourceforge.net/
.. _CMake: http://www.cmake.org
.. _`project homepage`: http://github.com/thewtex/tmux-mem-cpu-load
.. _`tpm`: http://github.com/tmux-plugins/tpm
.. _`Antigen`: https://github.com/zsh-users/antigen
.. _`terminals with 256 color support`: http://misc.flogisoft.com/bash/tip_colors_and_formatting#terminals_compatibility
.. _`Pawel 'l0ner' Soltys` : http://l0ner.github.io/
.. _`@nhdaly` : http://github.com/nhdaly