sbm

simple bandwidth monitor
git clone git://git.2f30.org/sbm.git
Log | Files | Refs | LICENSE

commit 35489d061d485ec182346adf89cb2327bbc3647b
parent ff0ec4bc82f98c29938dd4666fa16bf63420ba51
Author: sin <sin@2f30.org>
Date:   Tue Feb 23 13:23:47 +0000

Add sbm-plot

Simple script that uses gnuplot to generate graphs.

Diffstat:
Makefile | 4+++-
sbm-plot | 17+++++++++++++++++
2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile @@ -18,16 +18,18 @@ sbm.o: arg.h install: all mkdir -p $(DESTDIR)$(PREFIX)/bin cp -f $(BIN) $(DESTDIR)$(PREFIX)/bin + cp -f sbm-plot $(DESTDIR)$(PREFIX)/bin mkdir -p $(DESTDIR)$(MANPREFIX)/man1 cp -f $(BIN).1 $(DESTDIR)$(MANPREFIX)/man1 uninstall: rm -f $(DESTDIR)$(PREFIX)/bin/$(BIN) + rm -f $(DESTDIR)$(PREFIX)/bin/sbm-plot rm -f $(DESTDIR)$(MANPREFIX)/man1/$(BIN).1 dist: clean mkdir -p sbm-$(VERSION) - cp Makefile arg.h sbm.1 sbm.c sbm-$(VERSION) + cp Makefile arg.h sbm-plot sbm.1 sbm.c sbm-$(VERSION) tar -cf sbm-$(VERSION).tar sbm-$(VERSION) gzip sbm-$(VERSION).tar rm -rf sbm-$(VERSION) diff --git a/sbm-plot b/sbm-plot @@ -0,0 +1,17 @@ +#!/bin/sh + +tmp=`mktemp` +while read line; do + echo "$line" >> "$tmp" +done < /dev/stdin +DATAFILE="$tmp" gnuplot << 'EOF' +set term png x040418 xffba00 +set autoscale +set grid +set xlabel "time" +set ylabel "Mbps" +datafile=system("echo $DATAFILE") +plot datafile using ($1/1000/1000) with lines title "RX Mbps", \ + datafile using ($2/1000/1000) with lines title "TX Mbps" +EOF +rm -f "$tmp"