aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/graphstats.py
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2017-12-30 18:20:53 -0500
committerKevin O'Connor <kevin@koconnor.net>2017-12-30 18:26:49 -0500
commit7db6fa7bfcc52afbdff27caa83ade3ddd65026f2 (patch)
treeb5775808da2ac11478738babff301f6e5c15d42e /scripts/graphstats.py
parentb05eb1e8e37fb3c3cfb558153cdb2f97a1a3c82c (diff)
downloadkutter-7db6fa7bfcc52afbdff27caa83ade3ddd65026f2.tar.gz
kutter-7db6fa7bfcc52afbdff27caa83ade3ddd65026f2.tar.xz
kutter-7db6fa7bfcc52afbdff27caa83ade3ddd65026f2.zip
graphstats: Fix case where an Xwindows display may not be available
Matplotlib will try to open a display by default - tell it not to do that so that it can run in batch mode on headless machines. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'scripts/graphstats.py')
-rwxr-xr-xscripts/graphstats.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/scripts/graphstats.py b/scripts/graphstats.py
index d037983a..4c656c7a 100755
--- a/scripts/graphstats.py
+++ b/scripts/graphstats.py
@@ -5,7 +5,9 @@
#
# This file may be distributed under the terms of the GNU GPLv3 license.
import optparse, datetime
-import matplotlib.pyplot as plt, matplotlib.dates as mdates
+import matplotlib
+matplotlib.use('Agg')
+import matplotlib.pyplot, matplotlib.dates
MAXBANDWIDTH=25000.
MAXBUFFER=2.
@@ -89,7 +91,7 @@ def plot_mcu(data, maxbw, outname, graph_awake=False):
lastbw = bw
# Build plot
- fig, ax1 = plt.subplots()
+ fig, ax1 = matplotlib.pyplot.subplots()
ax1.set_title("MCU bandwidth and load utilization")
ax1.set_xlabel('Time')
ax1.set_ylabel('Usage (%)')
@@ -99,10 +101,9 @@ def plot_mcu(data, maxbw, outname, graph_awake=False):
ax1.plot_date(times, loads, 'r', label='MCU load')
ax1.plot_date(times, hostbuffers, 'c', label='Host buffer')
ax1.legend(loc='best')
- ax1.xaxis.set_major_formatter(mdates.DateFormatter('%H:%M'))
- #plt.gcf().autofmt_xdate()
+ ax1.xaxis.set_major_formatter(matplotlib.dates.DateFormatter('%H:%M'))
ax1.grid(True)
- plt.savefig(outname)
+ fig.savefig(outname)
def main():
usage = "%prog [options] <logfile> <outname>"