CPU, RAM, and load monitor for use with tmux
Go to file
Pawel "l0ner" Soltys 72b8493a59 Code Refactoring and NetBSD support.
* Added NetBSD support.
* removed per-platform header files: all the supported platforms were using
  identical header files for cpu, memory and load (except a few differences).
  Since this was unnecessary code duplication I've gathered what was common
  among the platforms, removed duplicates and moved what was left to the
  common/ dir.
* implemented get_cpu_count() function across all platforms. We are using it
  on every platform, yet not on every one this was implemented as a separate
  function.
* removed platform detection through preprocessor from main: we don't need this
  there anymore, since the headers are common for all platforms. CMake will
  handle setting of correct source files for us now.
* Unified used defines for CPU states across all platforms and made linux use
  them. Added some platform detection to cpu.h in order to set them correctly
  across the platforms.
* moved getsysctl.h to common/ dir, since it's used on Net and Free BSD, and
  thus become a common include.
* Unified load_string() across all platforms. Same case as with the header
  files. We can use the same getloadavg() based logic for getting load averages
  on all platforms. *BSD and OS X code was already the pretty much identical.
  Removed duplicated code and made linux adhere to getloadavg() logic.
2015-02-19 21:29:58 +01:00
common Code Refactoring part 2: unified load_string() function on all platforms 2015-02-19 21:26:35 +01:00
freebsd Code Refactoring part 2: unified load_string() function on all platforms 2015-02-19 21:26:35 +01:00
linux Code Refactoring part 2: unified load_string() function on all platforms 2015-02-19 21:26:35 +01:00
netbsd Code Refactornig 2015-02-19 19:47:45 +01:00
openbsd Code Refactoring part 2: unified load_string() function on all platforms 2015-02-19 21:26:35 +01:00
osx Code Refactoring part 2: unified load_string() function on all platforms 2015-02-19 21:26:35 +01:00
.gitignore added cmake generated config.h file to gitignore 2015-01-18 17:24:17 +01:00
.travis.yml Also run an OSX Travis build. 2015-01-26 15:57:36 -05:00
AUTHORS Fix authors name spelling. 2015-01-19 21:59:13 -05:00
CMakeLists.txt Code Refactoring part 2: unified load_string() function on all platforms 2015-02-19 21:26:35 +01: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 suggestion about script that can be used to strip whitespaces 2015-01-20 15:13:39 +01:00

====================================================
               tmux-mem-cpu-load
====================================================
----------------------------------------------------
CPU, RAM memory, 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

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 and OpenBSD are supported.

Building
~~~~~~~~

* >= CMake_ -2.6
* 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


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]"

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
  --colors
          Use tmux colors in output
  -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


Authors
=======

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

Contributions from:

* Justin Crawford <justinc@pci-online.net>
* krieiter <krieiter@gmail.com>
* Mark Palmeri <mlp6@duke.edu>
* `Pawel 'l0ner' Soltys`_ <pwslts@gmail.com>


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