示例#1
0
 def plot_workmem_exectime(self, output):
     gp = self.init_gnuplot()
     gp('set output "{0}"'.format(output))
     gp.ylabel("Time [s]")
     gp('set yrange [0:*]')
     gp('set key right top')
     nrow = self.conn.execute("select count(*) from iotrace").fetchone()[0]
     gds = []
     query = ("select workmem, avg(exectime) from measurement "
              "group by workmem order by workmem")
     gds.extend(query2gds(self.conn, query, title = "Execution time", **self.plotprefdict))
     if nrow:
         query = ("select workmem, avg({y})/1000000000 from measurement, iotrace "
                  "where measurement.id = iotrace.id "
                  "group by workmem order by workmem")
         gds.extend(query2gds(self.conn, query.format(y = "readio_nsec"),
                               title = "Read I/O cost", **self.plotprefdict))
         gds.extend(query2gds(self.conn, query.format(y = "writeio_nsec"),
                               title = "Write I/O cost", **self.plotprefdict))
         gds.extend(query2gds(self.conn, query.format(y = "readio_nsec + writeio_nsec"),
                               title = "I/O cost", **self.plotprefdict))
         query = ("select workmem, avg(exectime - (readio_nsec + writeio_nsec) / 1000000000) "
                  "from measurement, iotrace where measurement.id = iotrace.id "
                  "group by workmem order by workmem")
         gds.extend(query2gds(self.conn, query, title = "CPU cost", **self.plotprefdict))
     gp.plot(*gds)
     sys.stdout.write("output {0}\n".format(output))
     gp.close()
示例#2
0
def plot_iosize_spec(dbpath, terminaltype = "png"):
    "draw iosize-spec graph"
    conn = sqlite3.connect(dbpath)
    fpath = os.path.dirname(dbpath) + "/" + os.path.splitext(dbpath)[0].rsplit('_', 1)[1]
    gp, plotprefdict = init_gnuplot(terminaltype)
    nthreadlistlist = [[r[0] for r in
                        conn.execute("select distinct nthread from {0}".format(tbl))]
                       for tbl in tables]
    gp.xlabel("I/O size [B]")
    gp('set format x "%.0s%cB"')
    for col in cols:
        gp('set title "{0}"'.format(col["title"]))
        ylabel = ' '.join([col["name"], col["unit"]]) if col["unit"] else col["name"]
        gp.ylabel(ylabel)
        if col["name"] in ("mb_per_sec", "usec_per_io"): gp('set key left top')
        else: gp('set key right top')
        figpath = "{0}_{1}_xiosize.{2}".format(fpath, col["name"], terminaltype)
        gp('set output "{0}"'.format(figpath))
        gds = []
        for tbl, nth in zip(tables, nthreadlistlist):
            query = ("select iosize,avg({0}) from {1} where nthread={{nthread}} "
                     "group by iosize,nthread".format(col["name"], tbl))
            gds.extend(query2gds(conn, query, nthread = nth,
                                 title = "{0} {1} = {{{1}}}".format(tbl, "nthread"),
                                 with_ = "linespoints"))
        sys.stdout.write('draw : {0}\n'.format(figpath))
        gp.plot(*gds)
    gp.close()
    conn.close()
def plot_iosize_spec(dbpath, terminaltype = "png"):
    "draw iosize-spec graph"
    conn = sqlite3.connect(dbpath)
    conn.enable_load_extension(True)
    conn.load_extension(os.path.expanduser("~/common/libsqlitefunctions.so"))
    fpath = os.path.dirname(dbpath) + "/" + os.path.splitext(dbpath)[0].rsplit('_', 1)[1]
    gp, plotprefdict = init_gnuplot(terminaltype)

    gp.xlabel("I/O size [B]")
    gp('set format x "%.0b%B"')
    gp('set key outside right')
    for tbl in tables:
        nthreadslist = [r[0] for r in conn.execute("select distinct nthreads from {0}".format(tbl))]
        gp('set title "{0}"'.format(tbl.title()))
        for col in cols:
            gp('set ylabel "{0}" offset 1'.format(col["ylabel"]))
            if col["name"] in ("mb_per_sec", "usec_per_io"): gp('set key left top')
            else: gp('set key right top')
            figpath = "{0}_{1}_{2}_xiosize.{3}".format(fpath, tbl, col["name"], terminaltype)
            gp('set output "{0}"'.format(figpath))
            query = ("select iosize,avg({0}),stdev({0}) "
                     "from {1} where nthreads={{nthreads}} "
                     "group by iosize,nthreads".format(col["name"], tbl))
            gds = query2gds(conn, query, nthreads = nthreadslist,
                            title = "nthreads = {nthreads}", **plotprefdict)
            sys.stdout.write('draw : {0}\n'.format(figpath))
            gp.plot(*gds)
    gp.close()
    conn.close()
def plot_nthread_spec(dbpath, terminaltype = "png"):
    "draw nthread-spec graph"
    conn = sqlite3.connect(dbpath)
    conn.enable_load_extension(True)
    conn.load_extension(os.path.expanduser("~/common/libsqlitefunctions.so"))
    fpath = os.path.dirname(dbpath) + "/" + os.path.splitext(dbpath)[0].rsplit('_', 1)[1]
    gp, plotprefdict = init_gnuplot(terminaltype)


    gp.xlabel("nthreads")
    gp('set key outside right width -6')
    for tbl in tables:
        iosizelist = [r[0] for r
                      in conn.execute("select distinct iosize from {0} where iosize >= 4096 and iosize < 1000000".format(tbl))]
        #gp('set title "{0}"'.format(tbl.title()))
        for col in cols:
            gp('set ylabel "{0}" offset 1'.format(col["ylabel"]))
            if col["name"] == "usec_per_io": gp('set key left top')
            else: gp('set key right top')
            figpath = "{0}_{1}_{2}_xnthreads.{3}".format(fpath, tbl, col["name"], terminaltype)
            gp('set output "{0}"'.format(figpath))
            query = ("select nthreads,avg({0}),stdev({0})"
                     " from {1} where iosize={{iosize}} "
                     "group by iosize,nthreads".format(col["name"], tbl))
            gds = query2gds(conn, query, iosize = iosizelist,
                            title = "I/O size = {iosize}", **plotprefdict)
            sys.stdout.write('draw : {0}\n'.format(figpath))
            gp.plot(*gds)
    gp.close()
    conn.close()
示例#5
0
def plot_nthread_spec(dbpath, terminaltype = "png"):
    "draw nthread-spec graph"
    conn = sqlite3.connect(dbpath)
    fpath = os.path.dirname(dbpath) + "/" + os.path.splitext(dbpath)[0].rsplit('_', 1)[1]
    gp, plotprefdict = init_gnuplot(terminaltype)
    iosizelistlist = [[r[0] for r in
                       conn.execute("select distinct iosize from {0}".format(tbl))]
                      for tbl in tables]
    gp.xlabel("nthreads")
    for col in cols:
        gp('set ylabel "{0}" offset 1'.format(col["ylabel"]))
        if col["name"] == "usec_per_io": gp('set key left top')
        else: gp('set key right top')
        figpath = "{0}_{1}_xnthreads.{2}".format(fpath, col["name"], terminaltype)
        gp('set output "{0}"'.format(figpath))
        gds = []
        for tbl, ios in zip(tables, iosizelistlist):
            query = ("select nthreads,avg({0}) from {1} where iosize={{iosize}} "
                     "group by iosize,nthreads".format(col["name"], tbl))
            gds.extend(query2gds(conn, query, iosize = ios,
                                 title = "{0} {1} = {{{1}}}".format(tbl, "iosize"),
                                 **plotprefdict))
        sys.stdout.write('draw : {0}\n'.format(figpath))
        gp.plot(*gds)
    gp.close()
示例#6
0
def plot_iosize_spec(dbpath, terminaltype = "png"):
    "draw iosize-spec graph"
    conn = sqlite3.connect(dbpath)
    fpath = os.path.dirname(dbpath) + "/" + os.path.splitext(dbpath)[0].rsplit('_', 1)[1]
    gp, plotprefdict = init_gnuplot(terminaltype)
    nthreadslistlist = [[r[0] for r in
                        conn.execute("select distinct nthreads from {0}".format(tbl))]
                       for tbl in tables]
    gp.xlabel("I/O size [B]")
    gp('set format x "%.0s%cB"')
    for col in cols:
        gp('set ylabel "{0}" offset 1'.format(col["ylabel"]))
        if col["name"] in ("mb_per_sec", "usec_per_io"): gp('set key left top')
        else: gp('set key right top')
        figpath = "{0}_{1}_xiosize.{2}".format(fpath, col["name"], terminaltype)
        gp('set output "{0}"'.format(figpath))
        gds = []
        for tbl, nth in zip(tables, nthreadslistlist):
            query = ("select iosize,avg({0}) from {1} where nthreads={{nthreads}} "
                     "group by iosize,nthreads".format(col["name"], tbl))
            gds.extend(query2gds(conn, query, nthreads = nth,
                                 title = "{0} {1} = {{{1}}}".format(tbl, "nthreads"),
                                 with_ = "linespoints"))
        sys.stdout.write('draw : {0}\n'.format(figpath))
        gp.plot(*gds)
    gp.close()
    conn.close()
示例#7
0
def plot_nthread_spec(dbpath, terminaltype = "png"):
    "draw nthread-spec graph"
    conn = sqlite3.connect(dbpath)
    fpath = os.path.dirname(dbpath) + "/" + os.path.splitext(dbpath)[0].rsplit('_', 1)[1]
    gp, plotprefdict = init_gnuplot(terminaltype)
    iosizelistlist = [[r[0] for r in
                       conn.execute("select distinct iosize from {0}".format(tbl))]
                      for tbl in tables]
    gp.xlabel("nthread")
    for col in cols:
        gp('set title "{0}"'.format(col["title"]))
        ylabel = ' '.join([col["name"], col["unit"]]) if col["unit"] else col["name"]
        gp.ylabel(ylabel)
        if col["name"] == "usec_per_io": gp('set key left top')
        else: gp('set key right top')
        figpath = "{0}_{1}_xnthread.{2}".format(fpath, col["name"], terminaltype)
        gp('set output "{0}"'.format(figpath))
        gds = []
        for tbl, ios in zip(tables, iosizelistlist):
            query = ("select nthread,avg({0}) from {1} where iosize={{iosize}} "
                     "group by iosize,nthread".format(col["name"], tbl))
            gds.extend(query2gds(conn, query, iosize = ios,
                                 title = "{0} {1} = {{{1}}}".format(tbl, "iosize"),
                                 **plotprefdict))
        sys.stdout.write('draw : {0}\n'.format(figpath))
        gp.plot(*gds)
    gp.close()
示例#8
0
 def plot_workmem_io(self, output):
     gp = self.init_gnuplot()
     nrow = self.conn.execute("select count(*) from io").fetchone()[0]
     if not nrow: return
     gp('set output "{0}"'.format(output))
     gp.ylabel("Total I/O size [MB]")
     gp('set yrange [0:*]')
     gp('set key right center')
     query = ("select workmem, avg({y} * exectime) from measurement, io "
              "where measurement.id = io.id "
              "group by workmem order by workmem")
     gdr = query2gds(self.conn, query.format(y = "average_readmb"),
                      title = "Read", **self.plotprefdict)[0]
     gdw = query2gds(self.conn, query.format(y = "average_writemb"),
                      title = "Write", **self.plotprefdict)[0]
     gp.plot(gdr, gdw)
     sys.stdout.write("output {0}\n".format(output))
     gp.close()
示例#9
0
def draw_bucket(dbpath, terminaltype = "png"):
    conn = sqlite3.connect(dbpath)
    gp = gpinit(terminaltype)
    dirname = os.path.dirname(os.path.abspath(dbpath))
    output = "{0}/bucketscan.{1}".format(dirname, terminaltype)
    gp('set output "{0}"'.format(output))
    gp('set key inside left top')
    gp.xlabel("work\_mem [byte]")
    gp('set ylabel "# of bucket scan"')
    gp('set y2label "# of partition * # of bucket"')
    gp('set format x "%.0b%B"')
    gp('set logscale x 2')
    gp('set ytics nomirror')
    gp('set grid xtics noytics noy2tics')
    gp('set yrange[0:*]')
    y2max = conn.execute("select max(nbatch * nbucket) from bucketinfo").fetchone()[0]
    y2max = ceiltop(y2max)
    gp('set y2range[0:{0}]'.format(y2max))
    gp('set y2tics {0}'.format(y2max / 10))
    if slide:
        if "eps" == terminaltype:
            gp('set termoption font "Times-Roman,28"')
            plotprefdict = {"with_" : "points lt 1 lw 6" }
        elif "png" == terminaltype:
            gp('set termoption font "Times-Roman,18"')
            plotprefdict = {"with_" : "points lw 2"}
    else:
        plotprefdict = {"with_" : "points" }
    query = "select workmem, {0} from bucketinfo order by workmem"
    gds = []
    datalist = query2data(conn, query.format("sum"))
    gds.append(Gnuplot.Data(datalist[0], datalist[1], [v / 4 for v in datalist[0]],
                            title = "nbucketscan", axes = "x1y1",
                            with_ = 'boxes lc rgb "blue" fs solid border lc rgb "black"'))
    gds.extend(query2gds(conn, query.format("nbatch * nbucket"),
                         title = "npartition * nbucket", axes = "x1y2", **plotprefdict))
    gp.plot(*gds)
    sys.stdout.write("output {0}\n".format(output))
    gp.close()
    conn.close()
def plot_iosize_spec(dbpath, terminaltype="png"):
    "draw iosize-spec graph"
    conn = sqlite3.connect(dbpath)
    conn.enable_load_extension(True)
    conn.load_extension(os.path.expanduser("~/common/libsqlitefunctions.so"))
    fpath = os.path.dirname(dbpath) + "/" + os.path.splitext(dbpath)[0].rsplit(
        '_', 1)[1]
    gp, plotprefdict = init_gnuplot(terminaltype)

    gp.xlabel("I/O size [B]")
    gp('set format x "%.0b%B"')
    gp('set key outside right')
    for tbl in tables:
        nthreadslist = [
            r[0] for r in conn.execute(
                "select distinct nthreads from {0}".format(tbl))
        ]
        gp('set title "{0}"'.format(tbl.title()))
        for col in cols:
            gp('set ylabel "{0}" offset 1'.format(col["ylabel"]))
            if col["name"] in ("mb_per_sec", "usec_per_io"):
                gp('set key left top')
            else:
                gp('set key right top')
            figpath = "{0}_{1}_{2}_xiosize.{3}".format(fpath, tbl, col["name"],
                                                       terminaltype)
            gp('set output "{0}"'.format(figpath))
            query = ("select iosize,avg({0}),stdev({0}) "
                     "from {1} where nthreads={{nthreads}} "
                     "group by iosize,nthreads".format(col["name"], tbl))
            gds = query2gds(conn,
                            query,
                            nthreads=nthreadslist,
                            title="nthreads = {nthreads}",
                            **plotprefdict)
            sys.stdout.write('draw : {0}\n'.format(figpath))
            gp.plot(*gds)
    gp.close()
    conn.close()
def plot_nthread_spec(dbpath, terminaltype="png"):
    "draw nthread-spec graph"
    conn = sqlite3.connect(dbpath)
    conn.enable_load_extension(True)
    conn.load_extension(os.path.expanduser("~/common/libsqlitefunctions.so"))
    fpath = os.path.dirname(dbpath) + "/" + os.path.splitext(dbpath)[0].rsplit(
        '_', 1)[1]
    gp, plotprefdict = init_gnuplot(terminaltype)

    gp.xlabel("nthreads")
    gp('set key outside right width -6')
    for tbl in tables:
        iosizelist = [
            r[0] for r in conn.execute(
                "select distinct iosize from {0} where iosize >= 4096 and iosize < 1000000"
                .format(tbl))
        ]
        #gp('set title "{0}"'.format(tbl.title()))
        for col in cols:
            gp('set ylabel "{0}" offset 1'.format(col["ylabel"]))
            if col["name"] == "usec_per_io": gp('set key left top')
            else: gp('set key right top')
            figpath = "{0}_{1}_{2}_xnthreads.{3}".format(
                fpath, tbl, col["name"], terminaltype)
            gp('set output "{0}"'.format(figpath))
            query = ("select nthreads,avg({0}),stdev({0})"
                     " from {1} where iosize={{iosize}} "
                     "group by iosize,nthreads".format(col["name"], tbl))
            gds = query2gds(conn,
                            query,
                            iosize=iosizelist,
                            title="I/O size = {iosize}",
                            **plotprefdict)
            sys.stdout.write('draw : {0}\n'.format(figpath))
            gp.plot(*gds)
    gp.close()
    conn.close()
        "mbps": "(MB/s)",
        "iops": "",
        "latency": "(us)"
    }
    tables = ["random_read"]
    fpath = os.path.dirname(dbpath) + "/" + os.path.splitext(dbpath)[0].rsplit(
        '_', 1)[1]

    gp = pu.gpinit(terminaltype)
    gp('set logscale x')
    #draw iosize-spec graph
    gp.xlabel("fsize (B)")
    for col in cols:
        gp('set title "{0}"'.format(col))
        gp.ylabel("{0} {1}".format(col, units[col]))
        if col == "mbps" or col == "latency":
            gp('set key left top')
        else:
            gp('set key right top')
        figpath = "{0}_{1}.{2}".format(fpath, col, terminaltype)
        gp('set output "{0}"'.format(figpath))
        gds = []
        for tbl in tables:
            query = "select fsize,{0} from {1}".format(col, tbl)
            gds.extend(pu.query2gds(conn, query, with_="linespoints"))
        sys.stdout.write('draw : {0}\n'.format(figpath))
        gp.plot(*gds)

    gp.close()
    conn.close()
    gp.xlabel("nlu")
    for col in cols:
        gp('set title "{0} iosize = {1}"'.format(col, iosize))
        gp.ylabel(col)
        if col == "mbps" or col == "iops":
            gp('set key left top')
        else:
            gp('set key right top')
        figpath = "{0}_xnlu.{1}".format(col, terminaltype)
        gp('set output "{0}"'.format(figpath))
        gds = []
        for tbl, nth in zip(tables, nthreadlistlist):
            query = ("select nlu,{0} from {1} where nthread={{nthread}} and iosize={2}"
                     .format(col, tbl, iosize))
            gds.extend(pu.query2gds(conn, query, nthread = nth,
                                    title = "{0} {1} = {{{1}}}".format(tbl, "nlu"),
                                    with_ = "linespoints"))
        sys.stdout.write('draw : {0}\n'.format(figpath))
        gp.plot(*gds)

    #draw nthread-spec graph
    gp('set logscale x')
    distinctsql = "select distinct nlu from {0} where iosize={1}"
    nlulistlist = [[r[0] for r in conn.execute(distinctsql.format(tbl, iosize))]
                   for tbl in tables]
    gp.xlabel("nthread")
    for col in cols:
        gp('set title "{0} iosize = {1}"'.format(col, iosize))
        gp.ylabel(col)
        if col == "mbps" or col == "latency":
            gp('set key left top')
        gp.ylabel(col)
        if col == "mbps" or col == "iops":
            gp('set key left top')
        else:
            gp('set key right top')
        figpath = "{0}_xnlu.{1}".format(col, terminaltype)
        gp('set output "{0}"'.format(figpath))
        gds = []
        for tbl, nth in zip(tables, nthreadlistlist):
            query = (
                "select nlu,{0} from {1} where nthread={{nthread}} and iosize={2}"
                .format(col, tbl, iosize))
            gds.extend(
                pu.query2gds(conn,
                             query,
                             nthread=nth,
                             title="{0} {1} = {{{1}}}".format(tbl, "nlu"),
                             with_="linespoints"))
        sys.stdout.write('draw : {0}\n'.format(figpath))
        gp.plot(*gds)

    #draw nthread-spec graph
    gp('set logscale x')
    distinctsql = "select distinct nlu from {0} where iosize={1}"
    nlulistlist = [[
        r[0] for r in conn.execute(distinctsql.format(tbl, iosize))
    ] for tbl in tables]
    gp.xlabel("nthread")
    for col in cols:
        gp('set title "{0} iosize = {1}"'.format(col, iosize))
        gp.ylabel(col)
示例#15
0
        sys.exit(1)

    conn = sqlite3.connect(dbpath)
    cols = ["elapsed", "mbps", "iops", "latency"]
    units = {"elapsed": "(us)", "mbps": "(MB/s)", "iops": "", "latency": "(us)"}
    tables = ["random_read"]
    fpath = os.path.dirname(dbpath) + "/" + os.path.splitext(dbpath)[0].rsplit("_", 1)[1]

    gp = pu.gpinit(terminaltype)
    gp("set logscale x")
    # draw iosize-spec graph
    gp.xlabel("fsize (B)")
    for col in cols:
        gp('set title "{0}"'.format(col))
        gp.ylabel("{0} {1}".format(col, units[col]))
        if col == "mbps" or col == "latency":
            gp("set key left top")
        else:
            gp("set key right top")
        figpath = "{0}_{1}.{2}".format(fpath, col, terminaltype)
        gp('set output "{0}"'.format(figpath))
        gds = []
        for tbl in tables:
            query = "select fsize,{0} from {1}".format(col, tbl)
            gds.extend(pu.query2gds(conn, query, with_="linespoints"))
        sys.stdout.write("draw : {0}\n".format(figpath))
        gp.plot(*gds)

    gp.close()
    conn.close()
示例#16
0
    fpath = os.path.dirname(dbpath) + "/" + os.path.splitext(os.path.basename(dbpath))[0]

    gp = pu.gpinit(terminaltype)
    gp('set grid')
    gp('set logscale x')

    #draw access_size-latency graph
    alloc_nodeslist = [[r[0] for r in
                        conn.execute("select distinct alloc_node from {0}".format(tbl))]
                       for tbl in tables]
    gp('set title "latency"')
    gp.xlabel("access\_size (KB)")
    for col in cols:
        gp.ylabel("{0} ({1})".format(col["name"].replace("_", "\\_"),
                                     col["unit"].replace("_", "\\_")))
        gp('set key left top')
        figpath = "{0}_{1}.{2}".format(fpath, col["name"], terminaltype)
        gp('set output "{0}"'.format(figpath))
        gds = []
        for tbl, nodes in zip(tables, alloc_nodeslist):
            query = ("select access_size/1024,avg({0}) from {1} "
                     "where alloc_node={{alloc_node}} group by access_size"
                     .format(col["name"], tbl))
            gds.extend(pu.query2gds(conn, query, alloc_node = nodes,
                                     title = "alloc\_node = {alloc_node}",
                                     with_ = "linespoints"))
        sys.stdout.write('draw : {0}\n'.format(figpath))
        gp.plot(*gds)
    gp.close()
    conn.close()
示例#17
0
    #draw access_size-latency graph
    alloc_nodeslist = [[
        r[0] for r in conn.execute(
            "select distinct alloc_node from {0}".format(tbl))
    ] for tbl in tables]
    gp('set title "latency"')
    gp.xlabel("access\_size (KB)")
    for col in cols:
        gp.ylabel("{0} ({1})".format(col["name"].replace("_", "\\_"),
                                     col["unit"].replace("_", "\\_")))
        gp('set key left top')
        figpath = "{0}_{1}.{2}".format(fpath, col["name"], terminaltype)
        gp('set output "{0}"'.format(figpath))
        gds = []
        for tbl, nodes in zip(tables, alloc_nodeslist):
            query = (
                "select access_size/1024,avg({0}) from {1} "
                "where alloc_node={{alloc_node}} group by access_size".format(
                    col["name"], tbl))
            gds.extend(
                pu.query2gds(conn,
                             query,
                             alloc_node=nodes,
                             title="alloc\_node = {alloc_node}",
                             with_="linespoints"))
        sys.stdout.write('draw : {0}\n'.format(figpath))
        gp.plot(*gds)
    gp.close()
    conn.close()