项目作者: numerodix

项目描述 :
A terminal based bandwidth monitor
高级语言: C++
项目地址: git://github.com/numerodix/bandwit.git
创建时间: 2020-04-01T11:55:31Z
项目社区:https://github.com/numerodix/bandwit

开源协议:MIT License

下载


bandwit

bandwit is a terminal based bandwidth monitor that runs on Linux and BSD.

bandwit

The defining characteristic of bandwit is that it runs inline in your terminal,
without taking over the whole terminal screen like curses programs do.

Keyboard controls

  • Enter - Move the cursor one line down, enlarging the bandwit screen by
    one line.

  • r - Switch to viewing bytes received.

  • t - Switch to viewing bytes transmitted.

  • c - Toggle between a linear, log10, and log2 scale.

  • s - Toggle between aggregating by average or by sum.

  • ArrowUp / ArrowDown - Increase/decrease the aggregation window where one column
    represents either:

    • One second.

    • One minute.

    • One hour.

    • One day.

  • ArrowLeft / ArrowRight - Scroll through historical data.

  • q - Quit the program.

Data sources

In Linux there are lots of places to get this information:

  • /sys/class/net/<iface>/statistics/{r,t}x_bytes is the most convenient as
    it’s a file with literally just the number we want in it.
  • /proc/net/dev requires finding the right line and parsing the right
    integers.
  • ip -statistics link show dev <iface> requires finding the right lines and
    parsing the right integers.

In BSD there is only one way I know that doesn’t require linking against system
libraries:

  • netstat -ibn requires finding the right line and parsing the right
    integers.

Portability

  • Written using C++17.