diff options
author | Ilias Apalodimas <ilias.apalodimas@linaro.org> | 2017-08-29 12:10:27 +0300 |
---|---|---|
committer | Ilias Apalodimas <ilias.apalodimas@linaro.org> | 2017-08-29 12:10:27 +0300 |
commit | 38bb321e5c2c4e14a08e93a7352c5dafc981321b (patch) | |
tree | 56e6294e265a2633ca724cfdf6f0f475a1e86118 | |
parent | 89374defcf95900902340640dd4a83cbe891b81e (diff) |
title is now configurable
-rwxr-xr-x | tools/rrd_graphs/rrd-plot.py | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/tools/rrd_graphs/rrd-plot.py b/tools/rrd_graphs/rrd-plot.py index 9d3c574..aed3d52 100755 --- a/tools/rrd_graphs/rrd-plot.py +++ b/tools/rrd_graphs/rrd-plot.py @@ -46,24 +46,25 @@ def update_db(pkg_log, rrd_db='ts.rrd'): return ret -def plot_db(start, end, output, rrd_db='ts.rrd'): +def plot_db(start, end, output, title, rrd_db='ts.rrd'): ret = 0 plot_sources = ['DEF:pps=sample_rrd:pps:MAX', 'AREA:pps#00FF00:Packets per second', - 'GPRINT:pps:MAX:Max\: %lf%spps', - 'GPRINT:pps:MIN:Min\: %lf%spps', - 'GPRINT:pps:AVERAGE:Avg\: %lf%spps'] + 'GPRINT:pps:MAX:Max\: %lf%spps', + 'GPRINT:pps:MIN:Min\: %lf%spps', + 'GPRINT:pps:AVERAGE:Avg\: %lf%spps'] plot_sources = [x.replace('sample_rrd', rrd_db) for x in plot_sources] ret = rrdtool.graph(output, "--start", start, "--end", end, - '--slope-mode', - '--title', "Netmap packets per second", + '--slope-mode', + '--watermark', 'Netmap', + '--title', title, "--vertical-label=PPS", - '-w' '1024', '-h', '384', - '--lower-limit', '0', + '-w' '1024', '-h', '384', + '--lower-limit', '0', '--x-grid', 'SECOND:15:MINUTE:1:SECOND:30:0:%T', #GTM:GST:MTM:MST:LTM:LST:LPR:LFM plot_sources) @@ -95,12 +96,18 @@ def main(): plot_file = sys.argv[1] except IndexError: plot_file = 'pkg-gen-stats' + + try: + title = sys.argv[2] + except IndexError: + title = 'Netmap' + print("Plot {} data") . format(plot_file) output = 'graph.png' start, end = get_tstamps(plot_file) create_db(start, end) update_db(plot_file) - plot_db(start,end, output) + plot_db(start,end, output, title) print("Saved {}") . format(output) if __name__ == '__main__': |