summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas De Marchi <lucas.demarchi@intel.com>2013-08-16 00:47:36 -0300
committerLucas De Marchi <lucas.demarchi@intel.com>2013-09-25 02:03:17 -0300
commit3cdd70349ef5cff684ff482ac2ff8efef4717af9 (patch)
treea2f14a89bee761ade964fb86f4d11d557645ccbc
parent003cd0020d5a4d3a6c5fe002c7d427221cd794fb (diff)
downloadkmod-3cdd70349ef5cff684ff482ac2ff8efef4717af9.tar.gz
parse-depmod: Allow to plot all at once
-rwxr-xr-xscripts/parse-depmod48
1 files changed, 28 insertions, 20 deletions
diff --git a/scripts/parse-depmod b/scripts/parse-depmod
index 3ff8a8b..4753969 100755
--- a/scripts/parse-depmod
+++ b/scripts/parse-depmod
@@ -1,7 +1,7 @@
#!/usr/bin/python
import sys
-
+import os.path
def parse_table(f):
curr = 0
@@ -36,23 +36,31 @@ def add_at(ax, t, loc=2):
ax.add_artist(_at)
return _at
-fig = plt.figure()
-
-with open(sys.argv[1]) as f:
- for i in range(0, 3):
- x, y = parse_table(f)
- fit = np.polyfit(x, y, 1)
- fit_fn = np.poly1d(fit)
-
- ax = fig.add_subplot(2, 2, i, axisbg='#f6f6f6')
- ax.plot(x, y, 'b', x, fit_fn(x), 'r')
- ax.set_xlabel('bucket')
- ax.set_ylabel('entries')
- ax.axis('tight')
- add_at(ax, 'mean=%.2f\nstddev=%.2f' % (np.mean(y), np.std(y)))
- ax.grid(True)
-
-fig.suptitle('Hash distribution on buckets', weight='bold', size='large')
-fig.tight_layout()
-plt.subplots_adjust(top=0.9)
+
+figs = []
+for fn in sys.argv[1:]:
+ fig = plt.figure()
+ figs += [fig]
+
+ with open(fn) as f:
+ for i in range(0, 3):
+ x, y = parse_table(f)
+ fit = np.polyfit(x, y, 1)
+ fit_fn = np.poly1d(fit)
+
+ ax = fig.add_subplot(2, 2, i, axisbg='#f6f6f6')
+ ax.plot(x, y, 'b', x, fit_fn(x), 'r')
+ ax.set_xlabel('bucket')
+ ax.set_ylabel('entries')
+ ax.axis('tight')
+ add_at(ax, 'mean=%.2f\nstddev=%.2f' % (np.mean(y), np.std(y)))
+ ax.grid(True)
+
+ tit = os.path.splitext(os.path.basename(fn))[0]
+ fig.suptitle('Hash distribution on buckets: %s' % tit, weight='bold',
+ size='large')
+ fig.tight_layout()
+ fig.subplots_adjust(top=0.9)
+
+
plt.show()