commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r7694 - gnuradio/branches/developers/eb/gcell/src/apps


From: eb
Subject: [Commit-gnuradio] r7694 - gnuradio/branches/developers/eb/gcell/src/apps
Date: Thu, 14 Feb 2008 16:22:55 -0700 (MST)

Author: eb
Date: 2008-02-14 16:22:54 -0700 (Thu, 14 Feb 2008)
New Revision: 7694

Added:
   gnuradio/branches/developers/eb/gcell/src/apps/plot_speedup.py
Log:
new tool that reads *.summary files and produces plots of speedup

Added: gnuradio/branches/developers/eb/gcell/src/apps/plot_speedup.py
===================================================================
--- gnuradio/branches/developers/eb/gcell/src/apps/plot_speedup.py              
                (rev 0)
+++ gnuradio/branches/developers/eb/gcell/src/apps/plot_speedup.py      
2008-02-14 23:22:54 UTC (rev 7694)
@@ -0,0 +1,94 @@
+#!/usr/bin/env python
+
+from optparse import OptionParser
+from pylab import *
+from pprint import pprint
+import os.path
+
+
+def add_entry(d, nspes, speedup, work_incr):
+    if d.has_key(work_incr):
+        d[work_incr].append((nspes, speedup))
+    else:
+        d[work_incr] = [(nspes, speedup)]
+    
+def parse_file(f):
+    d = {}
+    for line in f:
+        items = [float(x) for x in line.split()]
+        # print "items =", items
+        nspes = items[0]
+        work_incr = int(1e6 * items[1])
+        speedup = items[4]
+        add_entry(d, nspes, speedup, work_incr)
+    return d
+
+
+class plot_data(object):
+    def __init__(self, filenames):
+        self.fig = figure(1, figsize=(8, 6), facecolor='w')
+        self.sp = self.fig.add_subplot(1,1,1)
+        self.sp.set_xlabel("nspes", fontweight="bold")
+        self.sp.set_ylabel("speedup", fontweight="bold")
+        self.sp.grid(True)
+        # print 'rcParams["legend.fontsize"] =', rcParams["legend.fontsize"]
+        rcParams["legend.fontsize"] = 10
+
+
+        self.markers = {
+             10 : 'o',
+             50 : 's',
+            100 : '^',
+            200 : 'D',
+            300 : 'v',
+            400 : '>',
+            500 : 'h'
+            }
+        
+        for f in filenames:
+            d = parse_file(open(f))
+            self.make_plot(d, f, f == filenames[0])
+
+        show()
+
+
+        
+    def make_plot(self, d, filename, first):
+        def style(k):
+            if first:
+                return self.markers[k]
+            else:
+                return 'k' + self.markers[k]
+
+        tag, ext = os.path.splitext(os.path.basename(filename))
+        keys = d.keys()
+        keys.sort()
+        for k in keys:
+            vlist = d[k]         # list of 2-tuples
+            xs = [v[0] for v in vlist]
+            ys = [v[1] for v in vlist]
+            plot(xs, ys, style(k), label="%s %d us" % (tag, k))
+
+        x = legend(loc=2)
+
+def main():
+    usage="%prog: [options] input_filename..."
+    description = "Plots R*.summary files from benchmark_nop.py"
+    parser = OptionParser(usage=usage, description=description)
+
+    (options, args) = parser.parse_args()
+    if len(args) < 1:
+        parser.print_help()
+        raise SystemExit, 1
+
+    filenames = args
+    dc = plot_data(filenames)
+
+
+        
+if __name__ == '__main__':
+    try:
+        main()
+    except KeyboardInterrupt:
+        pass
+


Property changes on: 
gnuradio/branches/developers/eb/gcell/src/apps/plot_speedup.py
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:eol-style
   + native





reply via email to

[Prev in Thread] Current Thread [Next in Thread]