import sys, pickle


def main():
    statistics = pickle.load(file(sys.argv[1]))

    if len(sys.argv) == 2:
        print 'Available benchmarks'
        print '\t' + '\n\t'.join(statistics.keys())
        return

    statistics = statistics[sys.argv[2]]

    if len(sys.argv) == 3:
        print 'Available parameters'
        print '\t' + '\n\t'.join(map(str, statistics.keys()))
        return

    statistics = statistics[int(sys.argv[3])]

    if len(sys.argv) == 4:
        print 'Available statistics'
        print '\t' + '\n\t'.join([s.name for s in statistics])
        return

    for stat in statistics:
        if stat.name == sys.argv[4]:
            samples = statistics[stat]
            break

    if len(sys.argv) == 5:
        print 'Samples'
        print '\t' + '\n\t'.join(map(str, samples))
        print 'Commands'
        print '\t' + '\n\t'.join(stat.commands)
        return

    getattr(stat, sys.argv[5])(samples)


import sys, pickle

from benchlib import select

def main():
    if len(sys.argv) < 5:
        print 'Usage: %s <datafile> <benchmark name> <parameter value> <metric> [command]' % (sys.argv[0],)
    else:
        stat, samples = select(pickle.load(file(sys.argv[1])), *sys.argv[2:5])
        if len(sys.argv) == 5:
            print 'Samples'
            print '\t' + '\n\t'.join(map(str, samples))
            print 'Commands'
            print '\t' + '\n\t'.join(stat.commands)
        else:
            getattr(stat, sys.argv[5])(samples)


Use stats.select() instead of re-implementing all of this.
Use stats.select() instead of re-implementing all of this.

This is preparation for being able to squash statistics in different ways.


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