13 Commits

Author SHA1 Message Date
Alexis Hildebrandt
b44d0152c4 Allow numeric colors in bmonrc 2017-10-03 11:22:24 +02:00
Fredrik Fornwall
14db0bff4c Avoid trying to include <values.h> on Android
The <values.h> header file is not present on Android, and the project
builds there without it.
2017-02-09 07:15:05 -08:00
Baptiste Jonglez
a3d894000b Use a monotonic clock instead of a realtime clock
Using a realtime clock is a bad idea: it is affected by any kind of time
change, which can happen when the administrator modifies the system time,
or more simply when a laptop suspends to RAM and then wakes up from sleep.

With the current approach of using a realtime clock:

- if the system time jumps forward (e.g. when resuming after a
  suspend-to-RAM), bmon would take 100% CPU and display random graph data
  extremely fast, until it "catches up" with the new time.

- if the system time jumps backwards, bmon would freeze until *time*
  "catches up" to the point it was before.  bmon then (incorrectly)
  displays a spike in the graph, because lots of packets have been
  sent/received since the last update.

Instead of using gettimeofday(), switch to clock_gettime() with
CLOCK_MONOTONIC on systems that support it.  OS X does not provide
clock_gettime(), so this commit also adds a Mach-specific implementation.

This change has been tested on Linux 4.1 with glibc and musl, and on
FreeBSD 10.0-RELEASE-p12.
2016-11-12 19:29:39 +01:00
blastmaster
e47a376f70 fix make distcheck error
* add layout.h in include/Makefile.am
2016-07-19 22:57:53 +02:00
blastmaster
828b5b5368 enabling colors for bmon
This commit enables colors in bmon. It adds configuration options to
let the user decide, which colors should be used. Therefor the graph_rx and graph_tx
layouts are introduced and applied respectively.

* Add graph_rx, graph_tx and layout_cfg fields.
* Setting default colors if colorized output is enabled.
* draw_table accept additional layout parameter and apply the given layout for
  the table graph.
* Apply layouts for rx, tx graph and header and statusbar.
* Add include/layout.h, which provides functions to parse, color and attribute
  strings and set the layout.
* Adding a default layout-config example in examples/bmon.conf.

[Edit: Based on original work by eri!, #PR23]
2016-07-19 22:57:37 +02:00
Thomas Graf
4efaa8ce9e curses: Add ability to reset statistics
Press 'r' in curses mode to reset a statistic counter to
start counting from 0 again. This does NOT reset the
counter from the source itself but merely emulates a
counter reset. If you restart bmon, the counter will be
back to its total value.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
2016-01-29 12:11:44 +01:00
Thomas Graf
a36136ec4d Annotate unused variables
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2014-08-25 01:07:19 +02:00
Žilvinas Valinskas
ee98b9ea30 osx: fix remaining compiler warnings
Signed-off-by: Žilvinas Valinskas <zilvinas.valinskas@gmail.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2014-06-02 15:03:26 +02:00
Žilvinas Valinskas
be69e1c337 osx: use <float.h> instead of <values.h>
Signed-off-by: Žilvinas Valinskas <zilvinas.valinskas@gmail.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2014-06-02 15:02:56 +02:00
Thomas Graf
46ec101b00 Add -b / --use-bit option to display rates in bit/s instead of bytes/s
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2014-05-08 15:16:38 +02:00
Thomas Graf
509d64bd18 module: Support auto enabling and enforce single registration of module
Enforces a single registration of a module with a subsystem.
module_register() now returns -EBUSY if module is already
registered.

Adds support for BMON_MODULE_AUTO to flag modules that should
be autoloaded upon the first call to module_set(). Loading
will succeed if the probe() function succeeds.
2013-07-13 13:05:20 +02:00
Thomas Graf
d3ebae78ad List headers noninst to make them part of the distribution 2013-07-05 15:25:19 +02:00
Thomas Graf
3be703f67d Initial import 2013-07-05 15:11:46 +02:00