diff options
author | Rob Austein <sra@hactrn.net> | 2011-10-26 01:38:56 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2011-10-26 01:38:56 +0000 |
commit | 2ff0819e857219d0a41f74422248631191636324 (patch) | |
tree | 89019e4eef659c283d25b5f8c64dc42fe977a339 /scripts | |
parent | b603eff69488017e1b3532a9bfed61176fa6fdc6 (diff) |
Individual graph files, for inclusion in pdflatex documents. This is
an experiment, we might need to go the epstopdf route, but this way we
get color for free, so it's worth a try.
svn path=/trunk/; revision=4064
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/analyze-rcynic-history.py | 38 |
1 files changed, 29 insertions, 9 deletions
diff --git a/scripts/analyze-rcynic-history.py b/scripts/analyze-rcynic-history.py index c4182db7..0a31237b 100644 --- a/scripts/analyze-rcynic-history.py +++ b/scripts/analyze-rcynic-history.py @@ -23,6 +23,8 @@ show_summary = True show_sessions = True show_plot = True plot_all_hosts = False +plot_to_one = True +plot_to_many = True import mailbox, sys, urlparse, os, getopt, datetime, subprocess @@ -243,18 +245,36 @@ def plotter(f, hostnames, field, logscale = False): f.write("%s %s\n" % (plotline[0], plotline[i].rstrip("%"))) f.write("e\n") +def plot_many(hostnames, fields): + for field in fields: + for logscale in (False, True): + gnuplot = subprocess.Popen(("gnuplot",), stdin = subprocess.PIPE) + gnuplot.stdin.write("set terminal pdf\n") + gnuplot.stdin.write("set output '%s-%s.pdf'\n" % (field, "log" if logscale else "linear")) + plotter(gnuplot.stdin, hostnames, field, logscale = logscale) + gnuplot.stdin.close() + gnuplot.wait() + +def plot_one(hostnames, fields): + gnuplot = subprocess.Popen(("gnuplot",), stdin = subprocess.PIPE) + gnuplot.stdin.write("set terminal pdf\n") + gnuplot.stdin.write("set output 'analyze-rcynic-history.pdf'\n") + for field in fields: + if field not in ("scaled_elapsed", "hostname"): + plotter(gnuplot.stdin, hostnames, field, logscale = False) + plotter(gnuplot.stdin, hostnames, field, logscale = True) + gnuplot.stdin.close() + gnuplot.wait() + if show_plot: if plot_all_hosts: - hostnames = tuple(sorted(summary.hostnames)) + hostnames = sorted(summary.hostnames) else: hostnames = ("rpki.apnic.net", "rpki.ripe.net", "repository.lacnic.net", "rpki.afrinic.net", "arin.rpki.net", "rgnet.rpki.net", "rpki.surfnet.nl", "rpki.antd.nist.gov") - gnuplot = subprocess.Popen(("gnuplot",), stdin = subprocess.PIPE) - gnuplot.stdin.write("set terminal pdf; set output 'analyze-rcynic-history.pdf'\n") - for fmt in Host.format: - if fmt.attr not in ("scaled_elapsed", "hostname"): - plotter(gnuplot.stdin, hostnames, fmt.attr, logscale = False) - plotter(gnuplot.stdin, hostnames, fmt.attr, logscale = True) - gnuplot.stdin.close() - gnuplot.wait() + fields = [fmt.attr for fmt in Host.format if fmt.attr not in ("scaled_elapsed", "hostname")] + if plot_to_one: + plot_one(hostnames, fields) + if plot_to_many: + plot_many(hostnames, fields) |