
import sys, pickle

from matplotlib import pyplot
import numpy

from compare import select

def main():
    fig = pyplot.figure()
    ax = fig.add_subplot(111)

    data = []
    for fname in sys.argv[1:]:
        stats, samples = select(
            pickle.load(file(fname)), 'vfreebusy', 1, 'urlopen time')
        data.append(samples)
        if data:
            assert len(samples) == len(data[0])

    bars = []
    color = iter('rgbcmy').next
    w = 1.0 / len(data)
    xs = numpy.arange(len(data[0]))
    for i, s in enumerate(data):
        bars.append(ax.bar(xs + i * w, s, width=w, color=color())[0])

    ax.set_xlabel('sample #')
    ax.set_ylabel('seconds')
    ax.legend(bars, sys.argv[1:])
    pyplot.show()    


import sys, pickle

from matplotlib import pyplot
import numpy

from compare import select

def main():
    fig = pyplot.figure()
    ax = fig.add_subplot(111)

    data = []
    for fname in sys.argv[1:]:
        fname, bench, param, stat = fname.split(',')
        stats, samples = select(
            pickle.load(file(fname)), bench, param, stat)
        data.append(samples)
        if data:
            assert len(samples) == len(data[0])

    bars = []
    color = iter('rgbcmy').next
    w = 1.0 / len(data)
    xs = numpy.arange(len(data[0]))
    for i, s in enumerate(data):
        bars.append(ax.bar(xs + i * w, s, width=w, color=color())[0])

    ax.set_xlabel('sample #')
    ax.set_ylabel('seconds')
    ax.legend(bars, sys.argv[1:])
    pyplot.show()    

Make the bench/param/stat a commandline parameter
Make the bench/param/stat a commandline parameter

git-svn-id: 81e381228600e5752b80483efd2b45b26c451ea2@6150 e27351fd-9f3e-4f54-a53b-843176b1656c

  
  import sys, pickle
  
  from matplotlib import pyplot
  import numpy
  
  from compare import select
  
  def main():
      fig = pyplot.figure()
      ax = fig.add_subplot(111)
  
      data = []
      for fname in sys.argv[1:]:
+         fname, bench, param, stat = fname.split(',')
          stats, samples = select(
-             pickle.load(file(fname)), 'vfreebusy', 1, 'urlopen time')
+             pickle.load(file(fname)), bench, param, stat)
          data.append(samples)
          if data:
              assert len(samples) == len(data[0])
  
      bars = []
      color = iter('rgbcmy').next
      w = 1.0 / len(data)
      xs = numpy.arange(len(data[0]))
      for i, s in enumerate(data):
          bars.append(ax.bar(xs + i * w, s, width=w, color=color())[0])
  
      ax.set_xlabel('sample #')
      ax.set_ylabel('seconds')
      ax.legend(bars, sys.argv[1:])
      pyplot.show()    
  
Make the bench/param/stat a commandline parameter
## Code Before:

import sys, pickle

from matplotlib import pyplot
import numpy

from compare import select

def main():
    fig = pyplot.figure()
    ax = fig.add_subplot(111)

    data = []
    for fname in sys.argv[1:]:
        stats, samples = select(
            pickle.load(file(fname)), 'vfreebusy', 1, 'urlopen time')
        data.append(samples)
        if data:
            assert len(samples) == len(data[0])

    bars = []
    color = iter('rgbcmy').next
    w = 1.0 / len(data)
    xs = numpy.arange(len(data[0]))
    for i, s in enumerate(data):
        bars.append(ax.bar(xs + i * w, s, width=w, color=color())[0])

    ax.set_xlabel('sample #')
    ax.set_ylabel('seconds')
    ax.legend(bars, sys.argv[1:])
    pyplot.show()    

## Instruction:
Make the bench/param/stat a commandline parameter
## Code After:

import sys, pickle

from matplotlib import pyplot
import numpy

from compare import select

def main():
    fig = pyplot.figure()
    ax = fig.add_subplot(111)

    data = []
    for fname in sys.argv[1:]:
        fname, bench, param, stat = fname.split(',')
        stats, samples = select(
            pickle.load(file(fname)), bench, param, stat)
        data.append(samples)
        if data:
            assert len(samples) == len(data[0])

    bars = []
    color = iter('rgbcmy').next
    w = 1.0 / len(data)
    xs = numpy.arange(len(data[0]))
    for i, s in enumerate(data):
        bars.append(ax.bar(xs + i * w, s, width=w, color=color())[0])

    ax.set_xlabel('sample #')
    ax.set_ylabel('seconds')
    ax.legend(bars, sys.argv[1:])
    pyplot.show()    
