diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2018-01-14 10:46:48 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2018-01-14 10:46:48 -0500 |
commit | 6770aa96c984342c10485e347106f51ff60a136f (patch) | |
tree | 49f8f4a13d4bf631871f7d5188a0a8baf146d25a /scripts/graphstats.py | |
parent | 896c31fd05c6bd549df05363bc5104a32db5a7bb (diff) | |
download | kutter-6770aa96c984342c10485e347106f51ff60a136f.tar.gz kutter-6770aa96c984342c10485e347106f51ff60a136f.tar.xz kutter-6770aa96c984342c10485e347106f51ff60a136f.zip |
graphstats: Use alpha transparency when plotting the stats
Use an alpha transparency on each of the stats, so that it is possible
to see how the values overlap.
Also, always enable the "awake time" stat - just use a lower alpha
transparency for it.
Also, explicitly set the graph size as some version of matplotlib have
a different default.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'scripts/graphstats.py')
-rwxr-xr-x | scripts/graphstats.py | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/scripts/graphstats.py b/scripts/graphstats.py index 6e24aabb..db55e97e 100755 --- a/scripts/graphstats.py +++ b/scripts/graphstats.py @@ -69,7 +69,7 @@ def find_print_restarts(data): for sampletime in samples if not stall} return sample_resets -def plot_mcu(data, maxbw, outname, graph_awake=False): +def plot_mcu(data, maxbw, outname): # Generate data for plot basetime = lasttime = data[0]['#sampletime'] lastbw = float(data[0]['bytes_write']) + float(data[0]['bytes_retransmit']) @@ -110,16 +110,16 @@ def plot_mcu(data, maxbw, outname, graph_awake=False): ax1.set_title("MCU bandwidth and load utilization") ax1.set_xlabel('Time') ax1.set_ylabel('Usage (%)') - if graph_awake: - ax1.plot_date(times, awake, 'b', label='Awake time') - ax1.plot_date(times, bwdeltas, 'g', label='Bandwidth') - ax1.plot_date(times, loads, 'r', label='MCU load') - ax1.plot_date(times, hostbuffers, 'c', label='Host buffer') + ax1.plot_date(times, bwdeltas, 'g', label='Bandwidth', alpha=0.8) + ax1.plot_date(times, loads, 'r', label='MCU load', alpha=0.8) + ax1.plot_date(times, hostbuffers, 'c', label='Host buffer', alpha=0.8) + ax1.plot_date(times, awake, 'y', label='Awake time', alpha=0.6) fontP = matplotlib.font_manager.FontProperties() fontP.set_size('x-small') ax1.legend(loc='best', prop=fontP) ax1.xaxis.set_major_formatter(matplotlib.dates.DateFormatter('%H:%M')) ax1.grid(True) + fig.set_size_inches(8, 6) fig.savefig(outname) def plot_frequency(data, outname): @@ -160,8 +160,6 @@ def plot_frequency(data, outname): def main(): usage = "%prog [options] <logfile> <outname>" opts = optparse.OptionParser(usage) - opts.add_option("-a", "--awake", action="store_true", - help="graph mcu awake time") opts.add_option("-f", "--frequency", action="store_true", help="graph mcu frequency") options, args = opts.parse_args() @@ -174,7 +172,7 @@ def main(): if options.frequency: plot_frequency(data, outname) return - plot_mcu(data, MAXBANDWIDTH, outname, graph_awake=options.awake) + plot_mcu(data, MAXBANDWIDTH, outname) if __name__ == '__main__': main() |