示例#1
0
              ([2 ** 13], [2 ** 12], nthreads),
              ([2 ** 16], [2 ** 10], nthreads))
'''

if __name__ == "__main__":
    if len(sys.argv) != 2:
        sys.stdout.write("Usage : {0} fpath\n".format(sys.argv[0]))
        sys.exit(0)
    fpath = sys.argv[1]
    bname = os.path.splitext(os.path.basename(fpath))[0]
    opathprefix = "/data/local/keisuke/{0}/{1}".format(
        time.strftime("%Y%m%d%H%M%S", time.gmtime()), bname)
    os.mkdir(outdir)
    dbpath = "{0}/readspec_{1}.db".format(outdir, bname)

    rbench = iobench.readbenchmarker(opathprefix)

    # sequential read
    sys.stdout.write("sequential read\n")
    rbench.cmd = "./sequentialread {0} {{0}} {{1}} {{2}}".format(fpath)
    seqrecorder = iobench.iobenchrecorder(dbpath, "sequential_read",
                                          rbench.varnames, rbench.resnames,
                                          rbench.run)
    for p in parameters:
        iosizes, iterates, nthreads = p
        assert max(iosizes) * max(iterates) * max(nthreads) <= iomax, "excessive io size"
        seqrecorder.allmeasure(itertools.product(iosizes, iterates, nthreads))

    # random read
    sys.stdout.write("random read\n")
    rbench.cmd = "./randomread {0} {{0}} {{1}} {{2}}".format(fpath)
示例#2
0
nthreads = [2 ** i for i in range(11)]
parameters = (([2 ** 9], [2 ** 15], nthreads),
              ([2 ** 13], [2 ** 12], nthreads),
              ([2 ** 16], [2 ** 10], nthreads))
'''

if __name__ == "__main__":
    if len(sys.argv) != 2:
        sys.stdout.write("Usage : {0} fpath\n".format(sys.argv[0]))
        sys.exit(0)
    outdir = "/data/local/keisuke/{0}".format(
        time.strftime("%Y%m%d%H%M%S", time.gmtime()))
    os.mkdir(outdir)

    fpath = sys.argv[1]
    bname = os.path.splitext(os.path.basename(fpath))[0]
    dbpath = "{0}/readspec_{1}.db".format(outdir, bname)
    rbench = iobench.readbenchmarker(fpath, outdir, statflg = True)
    rbench.varnames.append("fsize")
    rbench.setcmdtemplate("{0} {1} {{0}} {{1}} {{2}} {{3}}")

    # random read
    sys.stdout.write("random read\n")
    prgdir = os.path.abspath(os.path.dirname(__file__) + "/../") + "/"
    rbench.setcmd(prgdir + "randomread")
    randrecorder = iobench.iobenchrecorder(dbpath, "random_read",
                                           rbench.varnames, rbench.resnames,
                                           rbench.run)
    for p in parameters:
        randrecorder.allmeasure(itertools.product(*p))