ttyplot

Realtime terminal plotter
git clone git://git.sgregoratto.me/ttyplot
Log | Files | Refs | README | LICENSE

commit f397b20b15940e63194eb27b6df245b1c64a417a
parent 5b6acecebbeacc09d5d9fe6e64c0058ca5e5e518
Author: Antoni Sawicki <tenox@google.com>
Date:   Wed, 24 Jul 2019 17:14:50 -0700

usage() and readme changes

Diffstat:
MREADME.md | 40++++++++++++++--------------------------
Mttyplot.c | 18+++++++++---------
2 files changed, 23 insertions(+), 35 deletions(-)

diff --git a/README.md b/README.md @@ -95,19 +95,14 @@ network/disk throughput examples ================================ ttyplot supports two line plot for in/out or read/write -### local network throughput for all interfaces combined from sar -``` -sar -n DEV 1 | gawk '{ if($6 ~ /rxkB/) { print iin/1000; print out/1000; iin=0; out=0; fflush(); } iin=iin+$6; out=out+$7; }' | ttyplot -2 -u "MB/s" -``` - -### snmp network throughput for an interface using [ttg](https://github.com/tenox7/ttg) +### snmp network throughput for an interface using snmpdelta ``` -ttg -i 10 -u Mb 10.23.73.254 public 9 | gawk '{ print $5,$8; fflush(); }' | ttyplot -2 -u Mb/s +snmpdelta -v 2c -c public -Cp 10 10.23.73.254 1.3.6.1.2.1.2.2.1.{10,16}.9 | gawk '{ print $NF/1000/1000/10; fflush(); }' | ttyplot -2 -t "interface 9 throughput" -u Mb/s ``` -### snmp network throughput for an interface using snmpdelta +### local network throughput for all interfaces combined from sar ``` -snmpdelta -v 2c -c public -Cp 10 10.23.73.254 1.3.6.1.2.1.2.2.1.{10,16}.9 | gawk '{ print $NF/1000/1000/10; fflush(); }' | ttyplot -2 -t "interface 9 throughput" -u Mb/s +sar -n DEV 1 | gawk '{ if($6 ~ /rxkB/) { print iin/1000; print out/1000; iin=0; out=0; fflush(); } iin=iin+$6; out=out+$7; }' | ttyplot -2 -u "MB/s" ``` ### disk throughput from iostat @@ -122,7 +117,7 @@ iostat -xmy 1 nvme0n1 | stdbuf -o0 tr -s " " | stdbuf -o0 cut -d " " -f 4,5 | tt rate calculator for counters ============================ -ttyplot also supports "counter" style metrics, calculating "rate" by measureing time difference between samples +ttyplot also supports *counter* style metrics, calculating *rate* by measured time difference between samples ### snmp network throughput for an interface using snmpget ``` @@ -148,23 +143,16 @@ options ======= ``` -ttyplot [-2] [-r] [-c plotchar] [-e errchar] [-s softmax] [-m hardmax] [-t title] [-u unit] - --2 read two values and draw two plots, the second one is in reverse video - --r calculate counter rate and divide by measured sample interval - --c character to use for plot line, eg @ # % . etc - --e character to use for plot error line when value exceeds max (default: e) - --s softmax is an initial maximum value that can grow if data input has larger value - --m hardmax is a hard maximum value, if exceeded error line will be drawn (see -e) - --t title of the plot + ttyplot [-2] [-r] [-c plotchar] [-s scale] [-m max] [-t title] [-u unit] --u unit displayed beside vertical bar + -2 read two values and draw two plots, the second one is in reverse video + -r rate of a counter (divide value by measured sample interval) + -c character to use for plot line, eg @ # % . etc + -e character to use for plot error line when value exceeds hardmax (default: e) + -s minimum/initial scale of the plot (can go above if data input has larger value) + -m maximum value, if exceeded draws error line (see -e), plot scale is fixed + -t title of the plot + -u unit displayed beside vertical bar ``` &nbsp; diff --git a/ttyplot.c b/ttyplot.c @@ -35,15 +35,15 @@ #endif void usage() { - printf("Usage:\n ttyplot [-2] [-r] [-c plotchar] [-s softmax] [-m hardmax] [-t title] [-u unit]\n\n" - "-2 read two values and draw two plots, the second one is in reverse video\n" - "-r calculate counter rate and divide by measured sample interval\n" - "-c character to use for plot line, eg @ # %% . etc\n" - "-e character to use for plot error line when value exceeds hardmax (default: e)\n" - "-s softmax is an initial maximum value that can grow if data input has larger value\n" - "-m hardmax is a hard maximum value, if exceeded error line will be drawn (see -e)\n" - "-t title of the plot\n" - "-u unit displayed beside vertical bar\n\n"); + printf("Usage:\n ttyplot [-2] [-r] [-c plotchar] [-s scale] [-m max] [-t title] [-u unit]\n\n" + " -2 read two values and draw two plots, the second one is in reverse video\n" + " -r rate of a counter (divide value by measured sample interval)\n" + " -c character to use for plot line, eg @ # %% . etc\n" + " -e character to use for plot error line when value exceeds hardmax (default: e)\n" + " -s minimum/initial scale of the plot (can go above if data input has larger value)\n" + " -m maximum value, if exceeded draws error line (see -e), plot scale is fixed\n" + " -t title of the plot\n" + " -u unit displayed beside vertical bar\n\n"); exit(0); }