Esempio n. 1
0
def createWorkloadSkewGraphs(benchmark, mem, read_pct, noAntiCache, hstoreData, hstoreDataApprox, mysqlData, memcachedData):
    fig = plot.figure()
    ax1 = fig.add_subplot(111)
    
    # The x-axis is going to be the skew amount
    x_values = set()
    for d in hstoreData:
        x_values.add(d["skew"])
    x_values = map(float, sorted(x_values, reverse=True))
    x_labels = map(str, x_values)
    #x_labels = ['90/10']*(len(x_values)+1)
#    x_labels = {"1.5", "1.25", "1", "0.75", "0.5"}
    print("x_values = %s", x_values)
    print("x_labels = %s", x_labels)
     
    datasets = (hstoreData, hstoreDataApprox, noAntiCache, mysqlData, memcachedData)
    labels = (OPT_LABEL_HSTORE, OPT_LABEL_HSTORE_APPROX, OPT_LABEL_NO_ANTICACHE, OPT_LABEL_MYSQL, OPT_LABEL_MEMCACHED)

    # For each read_pct, get the y-axis max so that they're all
    # on the same scale
    y_maxes = { }
    for i in xrange(len(datasets)):
        for d in datasets[i]:
            if d["read_pct"] != read_pct: continue
            y_max = y_maxes.get(d["read_pct"], None)
            y_maxes[d["read_pct"]] = max(y_max, d["tps"])
        ## FOR
    ## FOR
    LOG.info("mem=%s / read_pct=%s\n%s", mem, read_pct, pformat(y_maxes))

    if mem == 1:  # configure params for 1 extra line
        datasets = (noAntiCache, hstoreData, hstoreDataApprox, mysqlData, memcachedData)
        labels = (OPT_LABEL_NO_ANTICACHE, OPT_LABEL_HSTORE, OPT_LABEL_HSTORE_APPROX, OPT_LABEL_MYSQL, OPT_LABEL_MEMCACHED)
    else:
        datasets = (hstoreData, hstoreDataApprox, mysqlData, memcachedData)
        labels = (OPT_LABEL_HSTORE, OPT_LABEL_HSTORE_APPROX, OPT_LABEL_MYSQL, OPT_LABEL_MEMCACHED)

    for i in xrange(len(datasets)):
        y_values = [None]*len(x_values)
        for d in datasets[i]:
            if d["mem"] != mem or d["read_pct"] != read_pct: continue
            offset = x_values.index(d["skew"])
            y_values[offset] = d["tps"]
        ## FOR
        LOG.info("%s y_values = %s", labels[i], y_values)

        if mem == 1 and i == 0:
            ax1.plot(x_values, y_values,
                     label=labels[i],
                     color='#8D38C9',
                     linewidth=OPT_LINE_WIDTH,
                     marker='v',
                     markersize=OPT_MARKER_SIZE,
            )
        elif mem == 1:
            ax1.plot(x_values, y_values,
                     label=labels[i],
                     color=OPT_COLORS[i-1],
                     linewidth=OPT_LINE_WIDTH,
                     marker=OPT_MARKERS[i-1],
                     markersize=OPT_MARKER_SIZE,
                     )
        else:
            ax1.plot(x_values, y_values,
                     label=labels[i],
                     color=OPT_COLORS[i],
                     linewidth=OPT_LINE_WIDTH,
                     marker=OPT_MARKERS[i],
                     markersize=OPT_MARKER_SIZE,
                     )
    ## FOR
    
    # GRID
    axes = ax1.get_axes()
    if read_pct == 100:
        axes.set_ylim(0, 140000)
    elif read_pct == 90:
        axes.set_ylim(0, 140000)
    elif read_pct == 50:
        axes.set_ylim(0, 45000)
        
    graphutil.makeGrid(ax1)
    axes.set_xlim(.4, 1.6)


    # LEGEND
    fp = FontProperties(family=OPT_FONT_NAME, size=OPT_LEGEND_FONT_SIZE)
    num_col = 4
    if mem == 1:
        num_col = 3
    ax1.legend(labels,
                prop=fp,
                bbox_to_anchor=(0.0, 1.1, 1.0, 0.10),
                loc=1,
                ncol=num_col,
                mode="expand",
                shadow=OPT_LEGEND_SHADOW,
                borderaxespad=0.0,
    )
    #ax1.legend(loc='center', shadow=OPT_LEGEND_SHADOW, prop=fp)
    
    # Y-AXIS
    fp = FontProperties(family=OPT_FONT_NAME+' Condensed', size=OPT_YLABEL_FONT_SIZE, weight=OPT_LABEL_WEIGHT)
    ax1.set_ylabel(OPT_Y_LABEL_THROUGHPUT, fontproperties=fp)
    ax1.yaxis.set_major_locator(MaxNLocator(5))
    ax1.minorticks_on()
    for tick in ax1.yaxis.get_major_ticks():
        tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE)
        tick.label.set_fontname(OPT_FONT_NAME)
    
    # X-AXIS
    fp = FontProperties(family=OPT_FONT_NAME+' Condensed', size=OPT_XLABEL_FONT_SIZE, weight=OPT_LABEL_WEIGHT)
    ax1.set_xlabel(OPT_X_LABEL_WORKLOAD_SKEW, fontproperties=fp)
    ax1.xaxis.set_major_locator(MaxNLocator(len(x_values)))
    xlim = ax1.get_xlim()[::-1]
    xlim = (xlim[0], xlim[1])
    ax1.set_xlim(xlim)
    ax1.minorticks_off()
    ax1.set_xticklabels(x_labels)
    ax1.set_xticks(x_values)
    print(x_labels)
    pprint(ax1.xaxis.get_majorticklocs())
    for tick in ax1.xaxis.get_major_ticks():
        tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE)
        tick.label.set_fontname(OPT_FONT_NAME)
    ## FOR
    
    return (fig)
Esempio n. 2
0
def createTableStatsGraph(benchmark, data):
    x = data["stats_x_values"]
    accessrate = data["stats_access_rate_y_values"]
    proportional = data["stats_proportional_y_values"]
    even = data["stats_even_y_values"]
    uratio = data["stats_uratio_y_values"]

    y = np.row_stack((accessrate, proportional, even, uratio))   
    
    # this call to 'cumsum' (cumulative sum), passing in your y data, 
    # is necessary to avoid having to manually order the datasets
    y_stack = np.cumsum(y, axis=0)

    # GRAPH
    fig = plot.figure()
    ax1 = fig.add_subplot(111)
    
    ax1.plot(x, accessrate,
             color=OPT_COLORS[0],
             linewidth=2.0,
             label="Access Rate Eviction",
    )
    ax1.plot(x, proportional,
             color=OPT_COLORS[1],
             linewidth=1.5,
             label="Proportional Eviction"
    )
    ax1.plot(x, even,
             color=OPT_COLORS[2],
             linewidth=2.5,
             label="Even Eviction"
    )
    ax1.plot(x, uratio,
             color=OPT_COLORS[3],
             linewidth=1.5,
             label="Uneviction Ratio Eviction"
    )
    
    # GRID
    axes = ax1.get_axes()
    axes.set_ylim(0, None)
    axes.yaxis.grid(True, linestyle='-', which='major', color='0.85') # color='lightgrey', alpha=0.5)
    axes.set_axisbelow(True)
    graphutil.makeGrid(ax1)
    
    # Y-AXIS
    ax1.set_ylabel(OPT_Y_LABEL_MEMORY, name=OPT_FONT_NAME, size=OPT_YLABEL_FONT_SIZE)
    ax1.yaxis.set_major_locator(MaxNLocator(5))
    ax1.minorticks_on()
    for tick in ax1.yaxis.get_major_ticks():
        tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE)
        tick.label.set_fontname(OPT_FONT_NAME)
    
    # X-AXIS
    ax1.set_xlabel(OPT_X_LABEL_TIME, name=OPT_FONT_NAME, size=OPT_XLABEL_FONT_SIZE)
    ax1.xaxis.set_major_locator(MaxNLocator(6))
    xLabels = map(lambda x: "%d" % (x / 1000), ax1.get_xticks())
    ax1.set_xticklabels(xLabels)
    for tick in ax1.xaxis.get_major_ticks():
        tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE)
        tick.label.set_fontname(OPT_FONT_NAME)

    # LEGEND
    fp = FontProperties(family=OPT_FONT_NAME, size=OPT_LEGEND_FONT_SIZE)
    ax1.legend(loc='upper left', shadow=OPT_LEGEND_SHADOW, prop=fp)
        
    # Evictions
    if len(data["evictions"]) > 0:
        # addEvictionLines(data["evictions"], y_max)
        pass
    else:
        LOG.warn("Missing eviction history for '%s'" % benchmark)
    
    return (fig)
Esempio n. 3
0
def createTPCCThroughputGraph(hstoreData,hstoreApproxTpccData, mysqlData, memcachedData):
    fig = plot.figure()
    ax1 = fig.add_subplot(111)

    LOG.info(hstoreData)

    x_labels = ['1', '2', '4', '8']
    x_values = [1, 2, 3, 4]
    LOG.debug("x_values = %s", x_values)
    LOG.debug("x_labels = %s", x_labels)
    
    datasets = (hstoreData, hstoreApproxTpccData, mysqlData, memcachedData)
    labels = (OPT_LABEL_HSTORE, OPT_LABEL_HSTORE_APPROX, OPT_LABEL_MYSQL, OPT_LABEL_MEMCACHED)

    for i in xrange(len(datasets)):
        y_values = [None]*len(x_values)
        y_values = datasets[i]
        ## FOR
        LOG.info("%s y_values = %s", labels[i], y_values)
        
        ax1.plot(x_values, y_values,
                 label=labels[i],
                 color=OPT_COLORS[i],
                 linewidth=OPT_LINE_WIDTH,
                 marker=OPT_MARKERS[i],
                 markersize=OPT_MARKER_SIZE,
                 )
    ## FOR


    # LEGEND
    fp = FontProperties(family=OPT_FONT_NAME, size=OPT_LEGEND_FONT_SIZE)
    ax1.legend(#[p[0] for p in bars],
               labels,
               prop=fp,
               bbox_to_anchor=(0.0, 1.02, 1.0, 0.10),
               loc=1,
               ncol=len(datasets),
               mode="expand",
               shadow=OPT_LEGEND_SHADOW,
               borderaxespad=0.0,
               )
    #ax1.legend(loc='center', shadow=OPT_LEGEND_SHADOW, prop=fp)

    graphutil.makeGrid(ax1)

    # Y-AXIS
    fp = FontProperties(family=OPT_FONT_NAME+' Condensed', size=OPT_YLABEL_FONT_SIZE, weight=OPT_LABEL_WEIGHT)
    ax1.set_ylabel(OPT_Y_LABEL_THROUGHPUT, fontproperties=fp)
    ax1.yaxis.set_major_locator(MaxNLocator(5))
    ax1.minorticks_on()
    ylim = (0, 50000)
    ax1.set_ylim(ylim)
    for tick in ax1.yaxis.get_major_ticks():
        tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE)
        tick.label.set_fontname(OPT_FONT_NAME)
    
    # X-AXIS
    fp = FontProperties(family=OPT_FONT_NAME+' Condensed', size=OPT_XLABEL_FONT_SIZE, weight=OPT_LABEL_WEIGHT)
    ax1.set_xlabel(OPT_X_LABEL_DATA_SIZE, fontproperties=fp)
#    ax1.xaxis.set_major_locator(MaxNLocator(len(x_values)))
#    xlim = ax1.get_xlim()[::-1]
#    xlim = (xlim[0]-1, xlim[1]+1)
    xlim = (0.75, 4.25)
    ax1.set_xlim(xlim)
    ax1.minorticks_off()
    ax1.set_xticklabels(x_labels)
    ax1.set_xticks(x_values)
    for tick in ax1.xaxis.get_major_ticks():
        tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE)
        tick.label.set_fontname(OPT_FONT_NAME)
    ## FOR
    
    return (fig)
Esempio n. 4
0
def createThroughputGraph(benchmark, data):
    y_max = max(data["y_values"])
    
    # INIT
    fig = plot.figure()
    ax1 = fig.add_subplot(111)
    
    # Throughout
    ax1.plot(data["x_values"], data["y_values"],
                color=OPT_COLORS[0],
                linewidth=3.5,
                marker='',
    )
    
#    if len(data["memory"]) > 0:
#        memoryX = map(lambda x: x[0], data["memory"])
#        memoryY = map(lambda x: (x[1] / float(1024)), data["memory"]) # MB
#        ax2 = ax1.twinx()
#        ax2.plot(memoryX, memoryY,
#                    marker='s',
#                    markersize=2.0,
#                    color=OPT_COLORS[1],
#        )
#        ax2.set_ylabel(OPT_Y_LABEL_THROUGHPUT, name=OPT_FONT_NAME, size=OPT_XLABEL_FONT_SIZE)
#        for tick in ax2.yaxis.get_major_ticks():
#            tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE)
#            tick.label.set_fontname(OPT_FONT_NAME)
#    else:
#        LOG.warn("Missing memory stats for '%s'" % benchmark)
    
    # Evictions
    if len(data["evictions"]) > 0:
        addEvictionLines(ax1, data["evictions"], 50000)
        LOG.info("Adding eviction lines.")
    else:
        LOG.warn("Missing eviction history for '%s'" % benchmark)
    
    # GRID
    axes = ax1.get_axes()
    axes.set_ylim(0, 50000)
    axes.yaxis.grid(True, linestyle='-', which='major', color='0.85') # color='lightgrey', alpha=0.5)
    axes.set_axisbelow(True)
    graphutil.makeGrid(ax1)
    
    # Y-AXIS
    ax1.set_ylabel(OPT_Y_LABEL_THROUGHPUT, name=OPT_FONT_NAME, size=OPT_YLABEL_FONT_SIZE, weight='bold')
    ax1.yaxis.set_major_locator(MaxNLocator(5))
    ax1.minorticks_on()
    for tick in ax1.yaxis.get_major_ticks():
        tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE)
        tick.label.set_fontname(OPT_FONT_NAME)
    
    # X-AXIS
    ax1.set_xlabel(OPT_X_LABEL_TIME, name=OPT_FONT_NAME, size=OPT_XLABEL_FONT_SIZE, weight='bold')
    ax1.set_xlim(0, 300000)
    ax1.xaxis.set_major_locator(MaxNLocator(6))
    xLabels = map(lambda x: "%d" % (x / 1000), ax1.get_xticks())
    ax1.set_xticklabels(xLabels)
    for tick in ax1.xaxis.get_major_ticks():
        tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE)
        tick.label.set_fontname(OPT_FONT_NAME)
    
    
    return (fig)
def plotMemoryAndThroughput(benchmark, data):
    x_max = max(data["x_values"])
    y_max = max(data["y_values"])

    tmp = y_max
    order = 1

    while tmp > 10: 
        order = order * 10
        tmp = tmp / 10;
    
    y_max_range = math.ceil(tmp) * order
    
    x = map(lambda x: x[0], data["memory"])
    inMemory = map(lambda x: x[1], data["memory"]) # In-Memory Data
    anticache = map(lambda x: x[2], data["memory"]) # Anti-Cache Data
    y = np.row_stack((inMemory, anticache))   
    
    # this call to 'cumsum' (cumulative sum), passing in your y data, 
    # is necessary to avoid having to manually order the datasets
    y_stack = np.cumsum(y, axis=0)


    fig = plot.figure()
    fig.set_figheight(10)
    ax1=fig.add_subplot(2,1,1)
   
  #  f, axarr = plot.subplots(2, sharex=True)
   

    ax1.fill_between(x, 0, y_stack[0,:],
                     color=OPT_COLORS[0],
                     alpha=0.5,
                     label="XXX",
    )
    ax1.fill_between(x, y_stack[0,:], y_stack[1,:],
                     color=OPT_COLORS[1],
                     alpha=0.5,
                     label="YYY",
    )
    ax1.plot(x, map(lambda x: sum(x[1:]), data["memory"]),
             color=OPT_COLORS[1],
             linewidth=3,
             label="Anti-Cache Data"
    )
    ax1.plot(x, inMemory,
             color=OPT_COLORS[0],
             linewidth=3,
             label="In-Memory Data",
    )
    
    # GRID
    #mem_max = max((data["memory"])[1])
    print data["memory"]
    mem_max = max(inMemory)
    mem_max = mem_max + max(anticache)
    print mem_max
    tmp = mem_max
    order = 1

    #while tmp > 10: 
    #    order = order * 10
    #    tmp = tmp / 10;
    #    print tmp
    
    mem_max_range = mem_max + mem_max*0.30
    print mem_max_range
    axes = ax1.get_axes()
    axes.set_ylim(0, mem_max_range)
    axes.yaxis.grid(True, linestyle='-', which='major', color='0.85') # color='lightgrey', alpha=0.5)
    axes.set_axisbelow(True)
    graphutil.makeGrid(ax1)

    head = data["run_head"]
    info = data["run_info"]
    # generate title string
    # 0   1         2    3          4                5            6              7             
    # run benchmark tier partitions blocking_clients client_hosts client_threads scaling_factor
    # 8          9              10           11      12    13
    # block_size blocks_evicted threshold_mb runtime merge skew
    title_str="%s %s: %s %s %s %s: %s %s: %s" % (info[2], head[12], info[12], info[3], info[4], head[10], info[10], head[13], info[13])
    
    # Y-AXIS
    
    ax1.set_title(title_str)
    ax1.set_ylabel("Memory (MB)", name=OPT_FONT_NAME, size=OPT_YLABEL_FONT_SIZE)
    yLabels = map(lambda y: "%d" % (y / 1000), ax1.get_yticks())
    #ax1.set_yticklabels(yLabels)
    ax1.yaxis.set_major_locator(MultipleLocator(250))
    ax1.minorticks_on()
    for tick in ax1.yaxis.get_major_ticks():
        tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE)
        tick.label.set_fontname(OPT_FONT_NAME)
    
    # X-AXIS
    #ax1.set_xlabel(OPT_X_LABEL_TIME, name=OPT_FONT_NAME, size=OPT_XLABEL_FONT_SIZE)
    ax1.xaxis.set_major_locator(MaxNLocator(6))
    xLabels = map(lambda x: "%d" % (x / 1000), ax1.get_xticks())
    ax1.set_xticklabels(xLabels)
    for tick in ax1.xaxis.get_major_ticks():
        tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE)
        tick.label.set_fontname(OPT_FONT_NAME)

    # LEGEND
    fp = FontProperties(family=OPT_FONT_NAME, size=OPT_LEGEND_FONT_SIZE)
    ax1.legend(loc='upper left', shadow=OPT_LEGEND_SHADOW, prop=fp)
        
    # Evictions
    if len(data["evictions"]) > 0:
        # addEvictionLines(data["evictions"], y_max)
        pass
    else:
        LOG.warn("Missing eviction history for '%s'" % benchmark)

    ax2 = fig.add_subplot(2,1,2)
    
    # Throughout
    ax2.plot(data["x_values"], data["y_values"],
                color=OPT_COLORS[0],
                linewidth=3.5,
                marker='',
    ) 

    if len(data["evictions"]) > 0:
        addEvictionLines(ax1, data["evictions"], mem_max_range)
        #LOG.info("Adding eviction lines.")
        pass
    else:
        LOG.warn("Missing eviction history for '%s'" % benchmark)

    axes = ax2.get_axes()
    axes.set_ylim(0, y_max_range)
    axes.yaxis.grid(True, linestyle='-', which='major', color='0.85')
    axes.set_axisbelow(True)
    graphutil.makeGrid(ax2)
    
    ax2.set_ylabel(OPT_Y_LABEL_THROUGHPUT, name=OPT_FONT_NAME, size=OPT_YLABEL_FONT_SIZE)
    ax2.yaxis.set_major_locator(MaxNLocator(5))
    ax2.minorticks_on()
    for tick in ax2.yaxis.get_major_ticks():
        tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE)
        tick.label.set_fontname(OPT_FONT_NAME)
    
    # X-AXIS
    ax2.set_xlabel(OPT_X_LABEL_TIME, name=OPT_FONT_NAME, size=OPT_XLABEL_FONT_SIZE)
    ax2.set_xlim(0, x_max)
    ax2.xaxis.set_major_locator(MaxNLocator(6))
    xLabels = map(lambda x: "%d" % (x / 1000), ax2.get_xticks())
    ax2.set_xticklabels(xLabels)
    for tick in ax2.xaxis.get_major_ticks():
        tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE)
        tick.label.set_fontname(OPT_FONT_NAME)
    
    plot.tight_layout()
    return fig
Esempio n. 6
0
def createEvictGraph(colMap, construct, write, fetch, tuplemerge, blockmerge):
    fig = plot.figure()
    ax1 = fig.add_subplot(111)
    
    datasets = (construct, write, fetch, blockmerge, tuplemerge)
    labels = ("construct", "write", "fetch", "block\nmerge", "tuple\nmerge")
    
    x_values = (1, 2, 4, 8, 16)
    x_values = map(int, sorted(x_values, reverse=False))
    x_labels = map(str, x_values)
    
    print("x_values = %s", x_values)
    print("x_labels = %s", x_labels)
        
    ind = np.arange(5)    # the x locations for the groups
    width = 0.35
    offset = width/2
    
    y1 = []
    for row in construct:
        y1.append(row[colMap["1"]])
        y1.append(row[colMap["2"]])
        y1.append(row[colMap["4"]])
        y1.append(row[colMap["8"]])
        y1.append(row[colMap["16"]])
    
    y2 = []
    for row in write:
        y2.append(row[colMap["1"]])
        y2.append(row[colMap["2"]])
        y2.append(row[colMap["4"]])
        y2.append(row[colMap["8"]])
        y2.append(row[colMap["16"]])

    y3 = []
    for row in fetch:
        y3.append(row[colMap["1"]])
        y3.append(row[colMap["2"]])
        y3.append(row[colMap["4"]])
        y3.append(row[colMap["8"]])
        y3.append(row[colMap["16"]])
    
    y4 = []
    for row in blockmerge:
        y4.append(row[colMap["1"]])
        y4.append(row[colMap["2"]])
        y4.append(row[colMap["4"]])
        y4.append(row[colMap["8"]])
        y4.append(row[colMap["16"]])

    y5 = []
    for row in tuplemerge:
        y5.append(row[colMap["1"]])
        y5.append(row[colMap["2"]])
        y5.append(row[colMap["4"]])
        y5.append(row[colMap["8"]])
        y5.append(row[colMap["16"]])

    y6 = []
    for i in range(len(x_values)):
        y6.append(y1[i]+y2[i])

    y7 = []
    for i in range(len(x_values)):
        y7.append(y6[i]+y3[i])
    
    plt1 = ax1.bar(ind-offset, y1, width, align='center', color=OPT_COLORS[0], bottom=0)
    ptt2 = ax1.bar(ind-offset, y2, width, align='center', color=OPT_COLORS[1], bottom=y1)
    ptt3 = ax1.bar(ind-offset, y3, width, align='center', color=OPT_COLORS[2], bottom=y6)
    ptt4 = ax1.bar(ind-offset, y4, width, align='center', color=OPT_COLORS[3], bottom=y7)
    ptt8 = ax1.bar(ind+offset, y5, width, align='center', color='#FFFF00', bottom=y7)


    plt5 = ax1.bar(ind+offset, y1, width, align='center', color=OPT_COLORS[0], bottom=0)
    ptt6 = ax1.bar(ind+offset, y2, width, align='center', color=OPT_COLORS[1], bottom=y1)
    ptt7 = ax1.bar(ind+offset, y3, width, align='center', color=OPT_COLORS[2], bottom=y6)


    ## FOR

    axes = ax1.get_axes()
    graphutil.makeGrid(ax1)
    axes.set_ylim(0, 700)

    # LEGEND
    fp = FontProperties(family=OPT_FONT_NAME, size=OPT_LEGEND_FONT_SIZE)
    ax1.legend(labels,
               prop=fp,
               bbox_to_anchor=(0.0, 1.02, 1.0, 0.10),
               loc=1,
               ncol=len(datasets),
               mode="expand",
               shadow=OPT_LEGEND_SHADOW,
               borderaxespad=0.0,
               )
    #ax1.legend(loc='center', shadow=OPT_LEGEND_SHADOW, prop=fp)
    
    # Y-AXIS
    fp = FontProperties(family=OPT_FONT_NAME+' Condensed', size=OPT_YLABEL_FONT_SIZE, weight=OPT_LABEL_WEIGHT)
    ax1.set_ylabel(OPT_Y_LABEL_TIME_MS, fontproperties=fp)
    ax1.yaxis.set_major_locator(MaxNLocator(5))
    ax1.minorticks_on()
    for tick in ax1.yaxis.get_major_ticks():
        tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE)
        tick.label.set_fontname(OPT_FONT_NAME)

    # X-AXIS
    fp = FontProperties(family=OPT_FONT_NAME+' Condensed', size=OPT_XLABEL_FONT_SIZE, weight=OPT_LABEL_WEIGHT)
    ax1.set_xlabel(OPT_X_LABEL_BLOCK_SIZE_MB, fontproperties=fp)
    ax1.minorticks_off()

    ax1.set_xticks(ind)
    ax1.set_xticklabels( x_labels )

#    # X-AXIS
#    fp = FontProperties(family=OPT_FONT_NAME+' Condensed', size=OPT_XLABEL_FONT_SIZE, weight=OPT_LABEL_WEIGHT)
#    ax1.set_xlabel(OPT_X_LABEL_BLOCK_SIZE_MB, fontproperties=fp)
#    ax1.xaxis.set_major_locator(MaxNLocator(len(x_values)))
##    xlim = ax1.get_xlim()[::-1]
##    xlim = (xlim[0], xlim[1])
##    ax1.set_xlim(xlim)
#    ax1.minorticks_off()
#    ax1.set_xticklabels(x_labels)
#    ax1.set_xticks(x_values)
#    print(x_labels)
#    pprint(ax1.xaxis.get_majorticklocs())
#    for tick in ax1.xaxis.get_major_ticks():
#        tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE)
#        tick.label.set_fontname(OPT_FONT_NAME)
#    ## FOR

    return (fig)
def plotMemoryAndThroughput(benchmark, data):
    x_max = max(data["x_values"])
    y_max = max(data["y_values"])

    tmp = y_max
    order = 1

    while tmp > 10:
        order = order * 10
        tmp = tmp / 10

    y_max_range = math.ceil(tmp) * order

    x = map(lambda x: x[0], data["memory"])
    inMemory = map(lambda x: x[1], data["memory"])  # In-Memory Data
    anticache = map(lambda x: x[2], data["memory"])  # Anti-Cache Data
    y = np.row_stack((inMemory, anticache))

    # this call to 'cumsum' (cumulative sum), passing in your y data,
    # is necessary to avoid having to manually order the datasets
    y_stack = np.cumsum(y, axis=0)

    fig = plot.figure()
    fig.set_figheight(10)
    ax1 = fig.add_subplot(2, 1, 1)

    #  f, axarr = plot.subplots(2, sharex=True)

    ax1.fill_between(
        x,
        0,
        y_stack[0, :],
        color=OPT_COLORS[0],
        alpha=0.5,
        label="XXX",
    )
    ax1.fill_between(
        x,
        y_stack[0, :],
        y_stack[1, :],
        color=OPT_COLORS[1],
        alpha=0.5,
        label="YYY",
    )
    ax1.plot(x,
             map(lambda x: sum(x[1:]), data["memory"]),
             color=OPT_COLORS[1],
             linewidth=3,
             label="Anti-Cache Data")
    ax1.plot(
        x,
        inMemory,
        color=OPT_COLORS[0],
        linewidth=3,
        label="In-Memory Data",
    )

    # GRID
    mem_max = max(inMemory)
    mem_max_range = mem_max + max(anticache)
    print mem_max_range

    axes = ax1.get_axes()
    axes.set_ylim(0, mem_max_range)
    axes.yaxis.grid(True, linestyle='-', which='major',
                    color='0.85')  # color='lightgrey', alpha=0.5)
    axes.set_axisbelow(True)
    graphutil.makeGrid(ax1)

    head = data["run_head"]
    info = data["run_info"]
    print head
    print info
    # generate title string
    # blocking 2, backing 3, skew 4, clients 6, blocksize 10
    # generate title string
    # 0   1         2    3          4                5            6              7
    # run benchmark tier partitions blocking_clients client_hosts client_threads scaling_factor
    # 8          9              10           11      12
    # block_size blocks_evicted threshold_mb runtime merge
    title_str = "%s %s %s %s: %s" % (info[2], info[3], info[4], head[10],
                                     info[10])

    # Y-AXIS

    ax1.set_title(title_str)
    ax1.set_ylabel("Memory (MB)",
                   name=OPT_FONT_NAME,
                   size=OPT_YLABEL_FONT_SIZE)
    yLabels = map(lambda y: "%d" % (y / 1000), ax1.get_yticks())
    #ax1.set_yticklabels(yLabels)
    ax1.yaxis.set_major_locator(MultipleLocator(250))
    ax1.minorticks_on()
    for tick in ax1.yaxis.get_major_ticks():
        tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE)
        tick.label.set_fontname(OPT_FONT_NAME)

    # X-AXIS
    #ax1.set_xlabel(OPT_X_LABEL_TIME, name=OPT_FONT_NAME, size=OPT_XLABEL_FONT_SIZE)
    ax1.xaxis.set_major_locator(MaxNLocator(6))
    xLabels = map(lambda x: "%d" % (x / 1000), ax1.get_xticks())
    ax1.set_xticklabels(xLabels)
    for tick in ax1.xaxis.get_major_ticks():
        tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE)
        tick.label.set_fontname(OPT_FONT_NAME)

    # LEGEND
    fp = FontProperties(family=OPT_FONT_NAME, size=OPT_LEGEND_FONT_SIZE)
    ax1.legend(loc='upper left', shadow=OPT_LEGEND_SHADOW, prop=fp)

    # Evictions
    if len(data["evictions"]) > 0:
        # addEvictionLines(data["evictions"], y_max)
        pass
    else:
        LOG.warn("Missing eviction history for '%s'" % benchmark)

    ax2 = fig.add_subplot(2, 1, 2)

    # Throughout
    ax2.plot(
        data["x_values"],
        data["y_values"],
        color=OPT_COLORS[0],
        linewidth=3.5,
        marker='',
    )

    if len(data["evictions"]) > 0:
        addEvictionLines(ax1, data["evictions"], y_max_range)
        #LOG.info("Adding eviction lines.")
        pass
    else:
        LOG.warn("Missing eviction history for '%s'" % benchmark)

    axes = ax2.get_axes()
    axes.set_ylim(0, y_max_range)
    axes.yaxis.grid(True, linestyle='-', which='major', color='0.85')
    axes.set_axisbelow(True)
    graphutil.makeGrid(ax2)

    ax2.set_ylabel(OPT_Y_LABEL_THROUGHPUT,
                   name=OPT_FONT_NAME,
                   size=OPT_YLABEL_FONT_SIZE)
    ax2.yaxis.set_major_locator(MaxNLocator(5))
    ax2.minorticks_on()
    for tick in ax2.yaxis.get_major_ticks():
        tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE)
        tick.label.set_fontname(OPT_FONT_NAME)

    # X-AXIS
    ax2.set_xlabel(OPT_X_LABEL_TIME,
                   name=OPT_FONT_NAME,
                   size=OPT_XLABEL_FONT_SIZE)
    ax2.set_xlim(0, x_max)
    ax2.xaxis.set_major_locator(MaxNLocator(6))
    xLabels = map(lambda x: "%d" % (x / 1000), ax2.get_xticks())
    ax2.set_xticklabels(xLabels)
    for tick in ax2.xaxis.get_major_ticks():
        tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE)
        tick.label.set_fontname(OPT_FONT_NAME)

    plot.tight_layout()
    return fig
Esempio n. 8
0
def createTupleSizeGraph(mem, read_pct, tuplesize128, tuplesize256,
                         tuplesize512, tuplesize1024):
    fig = plot.figure()
    ax1 = fig.add_subplot(111)

    # The x-axis is going to be the skew amount
    x_values = set()
    for d in tuplesize1024:
        x_values.add(d["skew"])
    x_values = map(float, sorted(x_values, reverse=True))
    x_labels = map(str, x_values)
    #x_labels = ['90/10']*(len(x_values)+1)
    #    x_labels = {"1.5", "1.25", "1", "0.75", "0.5"}
    print("x_values = %s", x_values)
    print("x_labels = %s", x_labels)

    datasets = (tuplesize128, tuplesize256, tuplesize512, tuplesize1024)
    labels = ("128B", "256B", "512B", "1024B")

    # For each read_pct, get the y-axis max so that they're all
    # on the same scale
    y_maxes = {}
    for i in xrange(len(datasets)):
        for d in datasets[i]:
            if d["read_pct"] != read_pct: continue
            y_max = y_maxes.get(d["read_pct"], None)
            y_maxes[d["read_pct"]] = max(y_max, d["tps"])
    ## FOR
    ## FOR
    LOG.info("mem=%s / read_pct=%s\n%s", mem, read_pct, pformat(y_maxes))

    for i in xrange(len(datasets)):
        y_values = [None] * len(x_values)
        for d in datasets[i]:
            if d["mem"] != mem or d["read_pct"] != read_pct: continue
            offset = x_values.index(d["skew"])
            y_values[offset] = d["tps"]
        ## FOR
        LOG.info("%s y_values = %s", labels[i], y_values)

        ax1.plot(
            x_values,
            y_values,
            label=labels[i],
            color=OPT_COLORS[i],
            linewidth=OPT_LINE_WIDTH,
            marker=OPT_MARKERS[i],
            markersize=OPT_MARKER_SIZE,
        )
    ## FOR

    # GRID
    axes = ax1.get_axes()
    axes.set_ylim(0, y_maxes[read_pct] + 10000)  #  + y_max*0.25)
    graphutil.makeGrid(ax1)
    axes.set_xlim(.4, 1.6)

    # LEGEND
    fp = FontProperties(family=OPT_FONT_NAME, size=OPT_LEGEND_FONT_SIZE)
    ax1.legend(  #[p[0] for p in bars],
        labels,
        prop=fp,
        bbox_to_anchor=(0.0, 1.02, 1.0, 0.10),
        loc=1,
        ncol=len(datasets),
        mode="expand",
        shadow=OPT_LEGEND_SHADOW,
        borderaxespad=0.0,
    )
    #ax1.legend(loc='center', shadow=OPT_LEGEND_SHADOW, prop=fp)

    # Y-AXIS
    fp = FontProperties(family=OPT_FONT_NAME + ' Condensed',
                        size=OPT_YLABEL_FONT_SIZE,
                        weight=OPT_LABEL_WEIGHT)
    ax1.set_ylabel(OPT_Y_LABEL_THROUGHPUT, fontproperties=fp)
    ax1.yaxis.set_major_locator(MaxNLocator(5))
    ax1.minorticks_on()
    for tick in ax1.yaxis.get_major_ticks():
        tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE)
        tick.label.set_fontname(OPT_FONT_NAME)

    # X-AXIS
    fp = FontProperties(family=OPT_FONT_NAME + ' Condensed',
                        size=OPT_XLABEL_FONT_SIZE,
                        weight=OPT_LABEL_WEIGHT)
    ax1.set_xlabel(OPT_X_LABEL_WORKLOAD_SKEW, fontproperties=fp)
    ax1.xaxis.set_major_locator(MaxNLocator(len(x_values)))
    xlim = ax1.get_xlim()[::-1]
    xlim = (xlim[0], xlim[1])
    ax1.set_xlim(xlim)
    ax1.minorticks_off()
    ax1.set_xticklabels(x_labels)
    ax1.set_xticks(x_values)
    print(x_labels)
    pprint(ax1.xaxis.get_majorticklocs())
    for tick in ax1.xaxis.get_major_ticks():
        tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE)
        tick.label.set_fontname(OPT_FONT_NAME)
    ## FOR

    return (fig)
Esempio n. 9
0
def createTPCCThroughputGraph(hstoreData, hstoreApproxTpccData, mysqlData,
                              memcachedData):
    fig = plot.figure()
    ax1 = fig.add_subplot(111)

    LOG.info(hstoreData)

    x_labels = ['1', '2', '4', '8']
    x_values = [1, 2, 3, 4]
    LOG.debug("x_values = %s", x_values)
    LOG.debug("x_labels = %s", x_labels)

    datasets = (hstoreData, hstoreApproxTpccData, mysqlData, memcachedData)
    labels = (OPT_LABEL_HSTORE, OPT_LABEL_HSTORE_APPROX, OPT_LABEL_MYSQL,
              OPT_LABEL_MEMCACHED)

    for i in xrange(len(datasets)):
        y_values = [None] * len(x_values)
        y_values = datasets[i]
        ## FOR
        LOG.info("%s y_values = %s", labels[i], y_values)

        ax1.plot(
            x_values,
            y_values,
            label=labels[i],
            color=OPT_COLORS[i],
            linewidth=OPT_LINE_WIDTH,
            marker=OPT_MARKERS[i],
            markersize=OPT_MARKER_SIZE,
        )
    ## FOR

    # LEGEND
    fp = FontProperties(family=OPT_FONT_NAME, size=OPT_LEGEND_FONT_SIZE)
    ax1.legend(  #[p[0] for p in bars],
        labels,
        prop=fp,
        bbox_to_anchor=(0.0, 1.02, 1.0, 0.10),
        loc=1,
        ncol=len(datasets),
        mode="expand",
        shadow=OPT_LEGEND_SHADOW,
        borderaxespad=0.0,
    )
    #ax1.legend(loc='center', shadow=OPT_LEGEND_SHADOW, prop=fp)

    graphutil.makeGrid(ax1)

    # Y-AXIS
    fp = FontProperties(family=OPT_FONT_NAME + ' Condensed',
                        size=OPT_YLABEL_FONT_SIZE,
                        weight=OPT_LABEL_WEIGHT)
    ax1.set_ylabel(OPT_Y_LABEL_THROUGHPUT, fontproperties=fp)
    ax1.yaxis.set_major_locator(MaxNLocator(5))
    ax1.minorticks_on()
    ylim = (0, 50000)
    ax1.set_ylim(ylim)
    for tick in ax1.yaxis.get_major_ticks():
        tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE)
        tick.label.set_fontname(OPT_FONT_NAME)

    # X-AXIS
    fp = FontProperties(family=OPT_FONT_NAME + ' Condensed',
                        size=OPT_XLABEL_FONT_SIZE,
                        weight=OPT_LABEL_WEIGHT)
    ax1.set_xlabel(OPT_X_LABEL_DATA_SIZE, fontproperties=fp)
    #    ax1.xaxis.set_major_locator(MaxNLocator(len(x_values)))
    #    xlim = ax1.get_xlim()[::-1]
    #    xlim = (xlim[0]-1, xlim[1]+1)
    xlim = (0.75, 4.25)
    ax1.set_xlim(xlim)
    ax1.minorticks_off()
    ax1.set_xticklabels(x_labels)
    ax1.set_xticks(x_values)
    for tick in ax1.xaxis.get_major_ticks():
        tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE)
        tick.label.set_fontname(OPT_FONT_NAME)
    ## FOR

    return (fig)
Esempio n. 10
0
def createWorkloadSkewGraphs(benchmark, mem, read_pct, hstoreData, mysqlData, memcachedData):
    fig = plot.figure()
    ax1 = fig.add_subplot(111)
    
    # The x-axis is going to be the skew amount
    x_values = set()
    for d in hstoreData:
        x_values.add(d["hot_access"])
    x_values = map(int, sorted(x_values, reverse=True))
    # x_labels = map(str, x_values)
    #x_labels = ['90/10']*(len(x_values)+1)
    x_labels = [''] + map(lambda x: "%d/%d" % (x, 100-x), reversed(x_values))
    LOG.debug("x_values = %s", x_values)
    LOG.debug("x_labels = %s", x_labels)
    
    datasets = (hstoreData, mysqlData, memcachedData)
    labels = (OPT_LABEL_HSTORE, OPT_LABEL_MYSQL, OPT_LABEL_MEMCACHED)

    # For each read_pct, get the y-axis max so that they're all
    # on the same scale
    y_maxes = { }
    for i in xrange(len(datasets)):
        for d in datasets[i]:
            if d["read_pct"] != read_pct: continue
            y_max = y_maxes.get(d["read_pct"], None)
            y_maxes[d["read_pct"]] = max(y_max, d["tps"])
        ## FOR
    ## FOR
    LOG.info("mem=%s / read_pct=%s\n%s", mem, read_pct, pformat(y_maxes))
    
    for i in xrange(len(datasets)):
        y_values = [None]*len(x_values)
        for d in datasets[i]:
            if d["mem"] != mem or d["read_pct"] != read_pct: continue
            offset = x_values.index(d["hot_access"])
            y_values[offset] = d["tps"]
        ## FOR
        LOG.info("%s y_values = %s", labels[i], y_values)
            
        ax1.plot(x_values, y_values,
                 label=labels[i],
                 color=OPT_COLORS[i],
                 linewidth=OPT_LINE_WIDTH,
                 marker=OPT_MARKERS[i],
                 markersize=OPT_MARKER_SIZE,
        )
    ## FOR
    
    # GRID
    axes = ax1.get_axes()
    axes.set_ylim(0, y_maxes[read_pct]+10000) #  + y_max*0.25)
    graphutil.makeGrid(ax1)
    axes.set_xlim(min(x_values), max(x_values))
    
    # LEGEND
    fp = FontProperties(family=OPT_FONT_NAME, size=OPT_LEGEND_FONT_SIZE)
    ax1.legend(#[p[0] for p in bars],
                labels,
                prop=fp,
                bbox_to_anchor=(0.0, 1.02, 1.0, 0.10),
                loc=1,
                ncol=len(datasets),
                mode="expand",
                shadow=OPT_LEGEND_SHADOW,
                borderaxespad=0.0,
    )
    #ax1.legend(loc='center', shadow=OPT_LEGEND_SHADOW, prop=fp)
    
    # Y-AXIS
    fp = FontProperties(family=OPT_FONT_NAME+' Condensed', size=OPT_YLABEL_FONT_SIZE, weight=OPT_LABEL_WEIGHT)
    ax1.set_ylabel(OPT_Y_LABEL_THROUGHPUT, fontproperties=fp)
    ax1.yaxis.set_major_locator(MaxNLocator(5))
    ax1.minorticks_on()
    for tick in ax1.yaxis.get_major_ticks():
        tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE)
        tick.label.set_fontname(OPT_FONT_NAME)
    
    # X-AXIS
    fp = FontProperties(family=OPT_FONT_NAME+' Condensed', size=OPT_XLABEL_FONT_SIZE, weight=OPT_LABEL_WEIGHT)
    ax1.set_xlabel(OPT_X_LABEL_WORKLOAD_SKEW, fontproperties=fp)
    ax1.xaxis.set_major_locator(MaxNLocator(len(x_values)))
    xlim = ax1.get_xlim()[::-1]
    xlim = (xlim[0]+1, xlim[1]-1)
    ax1.set_xlim(xlim)
    ax1.minorticks_off()
    ax1.set_xticklabels(x_labels)
    #pprint(ax1.xaxis.get_majorticklocs())
    for tick in ax1.xaxis.get_major_ticks():
        tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE)
        tick.label.set_fontname(OPT_FONT_NAME)
    ## FOR
    
    return (fig)
Esempio n. 11
0
def createIndexGraph(colMap, hashData, treeData):
    fig = plot.figure()
    ax1 = fig.add_subplot(111)

    datasets = (hashData, treeData)
    labels = ("hash index", "tree index")

    x_values = (1, 2, 3, 4, 5, 6, 7, 8)
    x_values = map(int, sorted(x_values))
    x_labels = map(str, x_values)

    ind = np.arange(8)  # the x locations for the groups
    width = 0.35
    offset = width / 2

    print("x_values = %s", x_values)
    print("x_labels = %s", x_labels)

    for i in xrange(len(datasets)):

        y_values = [None] * len(x_values)
        for row in datasets[i]:
            y_values[0] = row[colMap["1"]]
            y_values[1] = row[colMap["2"]]
            y_values[2] = row[colMap["3"]]
            y_values[3] = row[colMap["4"]]
            y_values[4] = row[colMap["5"]]
            y_values[5] = row[colMap["6"]]
            y_values[6] = row[colMap["7"]]
            y_values[7] = row[colMap["8"]]

        print(y_values)
        ax1.bar(ind - offset,
                y_values,
                width,
                align='center',
                color=OPT_COLORS[i + 1])
        offset = 0 - offset
    ## FOR

    axes = ax1.get_axes()
    graphutil.makeGrid(ax1)
    axes.set_ylim(0, 225)

    # LEGEND
    fp = FontProperties(family=OPT_FONT_NAME, size=OPT_LEGEND_FONT_SIZE)
    ax1.legend(
        labels,
        prop=fp,
        bbox_to_anchor=(0.0, 1.02, 1.0, 0.10),
        loc=1,
        ncol=len(datasets),
        mode="expand",
        shadow=OPT_LEGEND_SHADOW,
        borderaxespad=0.0,
    )
    #ax1.legend(loc='center', shadow=OPT_LEGEND_SHADOW, prop=fp)

    # Y-AXIS
    fp = FontProperties(family=OPT_FONT_NAME + ' Condensed',
                        size=OPT_YLABEL_FONT_SIZE,
                        weight=OPT_LABEL_WEIGHT)
    ax1.set_ylabel(OPT_Y_LABEL_TIME_MS, fontproperties=fp)
    ax1.yaxis.set_major_locator(MaxNLocator(8))
    ax1.minorticks_on()
    for tick in ax1.yaxis.get_major_ticks():
        tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE)
        tick.label.set_fontname(OPT_FONT_NAME)

        # X-AXIS
        fp = FontProperties(family=OPT_FONT_NAME + ' Condensed',
                            size=OPT_XLABEL_FONT_SIZE,
                            weight=OPT_LABEL_WEIGHT)
        ax1.set_xlabel(OPT_X_LABEL_NUM_INDEXES, fontproperties=fp)
        ax1.minorticks_off()

        ax1.set_xticks(ind)
        ax1.set_xticklabels(x_labels)

        return (fig)
Esempio n. 12
0
def createReadRatioThroughputGraph(benchmark, data):
    print benchmark
    
    # The x-axis is going to be the read ratio %
    x_values = set()
    for d in data:
        x_values.add(d["read_pct"])
    x_values = map(int, sorted(x_values, reverse=True))
    LOG.info("x_values = %s", x_values)
    
    # Then we will have a separate line for each memory size 
    y_values = { }
    for d in data:
        mem = d["mem"]
        if not mem in y_values:
            y_values[mem] = [ ]
        # We don't want to use mcsplit values other than for mem 2.0
        if "mcsplit" in d:
            if mem != 2 and d["mcsplit"] > 0: continue
        y_values[mem].append((int(d["read_pct"]), d["tps"]))
    #pprint(y_values)
    
    # GRAPH
    fig = plot.figure()
    ax1 = fig.add_subplot(111)
    
    # Throughput Lines
    line_idx = 0
    y_max = None
    for mem in sorted(y_values.iterkeys(), reverse=True):
        # Make sure that we have a y_value for all x_values
        missing = set(x_values) - set(map(lambda x: x[0], y_values[mem]))
        if missing:
            LOG.info("MISSING: %s ==> X_VALUES=%s / FOUND=%s", missing, x_values, y_values[mem])
            for x in missing:
                y_values[mem].append((x, 0))
        
        LOG.debug("mem = %s", mem)
        y_values[mem] = map(lambda x: x[-1], sorted(y_values[mem], key=lambda y: y[0], reverse=True))
        print "y_values = ", y_values[mem]
        try:
            ax1.plot(x_values, y_values[mem],
                     label="%.1f" % mem,
                     color=OPT_COLORS[line_idx],
                     linewidth=2.0,
                     marker=OPT_MARKERS[line_idx],
                     markersize=7.0
            )
        except:
            print "mem =", mem
            print "x_values =", x_values
            print "y_values =", y_values[mem]
            raise
        line_idx += 1
    ## FOR
    
    # GRID
    axes = ax1.get_axes()
    axes.set_ylim(0, None) # y_max + y_max*0.25)
    axes.yaxis.grid(True, linestyle='-', which='major', color='0.85') # color='lightgrey', alpha=0.5)
    axes.set_axisbelow(True)
    graphutil.makeGrid(ax1)
    
    # LEGEND
    fp = FontProperties(family=OPT_FONT_NAME, size=OPT_LEGEND_FONT_SIZE)
    ax1.legend(loc='upper right', shadow=OPT_LEGEND_SHADOW, prop=fp)
    
    # Y-AXIS
    ax1.set_ylabel(OPT_Y_LABEL_THROUGHPUT, name=OPT_FONT_NAME, size=OPT_YLABEL_FONT_SIZE)
    ax1.yaxis.set_major_locator(MaxNLocator(5))
    ax1.minorticks_on()
    for tick in ax1.yaxis.get_major_ticks():
        tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE)
        tick.label.set_fontname(OPT_FONT_NAME)
    
    # X-AXIS
    ax1.set_xlim(ax1.get_xlim()[::-1])
    ax1.set_xlabel(OPT_X_LABEL_READ_RATIO, name=OPT_FONT_NAME, size=OPT_XLABEL_FONT_SIZE)
    # ax1.xaxis.set_major_locator(MaxNLocator(6))
    xLabels = map(lambda x: "%d%%" % x, ax1.get_xticks())
    ax1.set_xticklabels(xLabels)
    for tick in ax1.xaxis.get_major_ticks():
        tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE)
        tick.label.set_fontname(OPT_FONT_NAME)
    
    return (fig)
Esempio n. 13
0
def createThroughputGraph(benchmark,
                          memorySizes,
                          read_pct,
                          hstoreData,
                          mysqlData,
                          memcachedData,
                          y_max=None,
                          linestyles=None,
                          linewidths=None,
                          linecolors=None,
                          markersizes=None,
                          markerfacecolors=None):
    datasets = (hstoreData, mysqlData, memcachedData)
    labels = (OPT_LABEL_HSTORE, OPT_LABEL_MYSQL, OPT_LABEL_MEMCACHED)

    # Per Memory Size
    if linestyles is None: linestyles = [OPT_LINE_STYLE] * len(memorySizes)
    if linewidths is None: linewidths = [OPT_LINE_WIDTH] * len(memorySizes)
    if markersizes is None: markersizes = [OPT_MARKER_SIZE] * len(memorySizes)
    if linecolors is None: linecolors = [OPT_COLORS] * len(memorySizes)
    if markerfacecolors is None: markerfacecolors = linecolors

    fig = plot.figure()
    ax1 = fig.add_subplot(111)

    x_values = []
    x_labels = []
    for d in hstoreData:
        delta = 0  #  d["throughputs"][0][0]
        labelDelta = 0
        for r in d["throughputs"]:
            x_values.append(r[0] - delta)
            x_labels.append(str(x_values[-1] + labelDelta))
        break
    assert x_values

    for memIdx in xrange(len(memorySizes)):
        mem = memorySizes[memIdx]
        for dataIdx in xrange(len(datasets)):
            y_values = [None] * len(x_values)
            for d in datasets[dataIdx]:
                if d["mem"] != mem or d["read_pct"] != read_pct: continue
                y_values = []
                #print benchmark, labels[dataIdx]
                #pprint(d["throughputs"])
                if dataIdx == 0:
                    for i in xrange(len(x_values)):
                        tps = d["throughputs"][i][-1]
                        y_values.append(tps)
                else:
                    for i in xrange(len(x_values) * 2):
                        if i % 2 != 0: continue
                        tps = d["throughputs"][i][-1]
                        y_values.append(tps)
                break
            ## FOR
            y_max = max(y_max, max(y_values))

            marker = OPT_MARKERS[dataIdx] if markersizes[memIdx] else None
            ax1.plot(
                x_values,
                y_values,
                color=linecolors[memIdx][dataIdx],
                linewidth=linewidths[memIdx],
                linestyle=linestyles[memIdx],
                marker=marker,
                markeredgecolor='black',  #linecolors[memIdx][dataIdx],
                markersize=markersizes[memIdx],
                markerfacecolor=markerfacecolors[memIdx][dataIdx],
                label=labels[dataIdx])
        ## FOR
    ## FOR
    LOG.debug("y_max = %d", y_max)

    # GRID
    graphutil.makeGrid(ax1)

    # AXES
    axes = ax1.get_axes()
    axes.set_ylim(0, y_max + 10000)
    axes.set_xlim(10, None)

    # LEGEND
    fp = FontProperties(family=OPT_FONT_NAME, size=OPT_LEGEND_FONT_SIZE)
    ax1.legend(  #[p[0] for p in bars],
        labels,
        prop=fp,
        bbox_to_anchor=(0.0, 1.02, 1.0, 0.10),
        loc=1,
        ncol=len(datasets),
        mode="expand",
        shadow=OPT_LEGEND_SHADOW,
        borderaxespad=0.0,
    )

    # Y-AXIS
    fp = FontProperties(family=OPT_FONT_NAME + ' Condensed',
                        size=OPT_YLABEL_FONT_SIZE,
                        weight=OPT_LABEL_WEIGHT)
    ax1.set_ylabel(OPT_Y_LABEL_THROUGHPUT, fontproperties=fp)
    ax1.yaxis.set_major_locator(MaxNLocator(5))
    ax1.minorticks_on()
    for tick in ax1.yaxis.get_major_ticks():
        tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE)
        tick.label.set_fontname(OPT_FONT_NAME)

    # X-AXIS
    fp = FontProperties(family=OPT_FONT_NAME + ' Condensed',
                        size=OPT_XLABEL_FONT_SIZE,
                        weight=OPT_LABEL_WEIGHT)
    ax1.set_xlabel(OPT_X_LABEL_TIME, fontproperties=fp)
    ax1.xaxis.set_major_locator(MaxNLocator(6))
    ax1.set_xticklabels(x_labels)
    #xLabels = map(lambda x: "%d" % (x / 1000), ax1.get_xticks())
    for tick in ax1.xaxis.get_major_ticks():
        tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE)
        tick.label.set_fontname(OPT_FONT_NAME)

    return (fig, y_max)
Esempio n. 14
0
def createThroughputGraph(benchmark, data):           
    x = data["x_values"]
    proportional = data["y_values-throughput-prop"]
    even = data["y_values-throughput-even"]
    uratio = data["y_values-throughput-uratio"]
    accessrate = data["y_values-throughput-arate"]
    
    y = np.row_stack((proportional, even,uratio,accessrate))   
    
    # this call to 'cumsum' (cumulative sum), passing in your y data, 
    # is necessary to avoid having to manually order the datasets
    y_stack = np.cumsum(y, axis=0)

    # GRAPH
    fig = plot.figure()
    ax1 = fig.add_subplot(111)
    
    ax1.plot(x, accessrate,
             color=OPT_COLORS[0],
             linewidth=1.5,
             label="Access Rate Eviction Throughput",
    )
    ax1.plot(x, proportional,
             color=OPT_COLORS[1],
             linewidth=1.5,
             label="Proportional Eviction Throughput"
    )
    ax1.plot(x, even,
             color=OPT_COLORS[2],
             linewidth=1.5,
             label="Even Eviction Throughput"
    )
    ax1.plot(x, uratio,
             color=OPT_COLORS[3],
             linewidth=1.5,
             label="Unevcition Ratio Throughput"
    )

    # GRID
    axes = ax1.get_axes()
    axes.yaxis.grid(True, linestyle='-', which='major', color='0.85') # color='lightgrey', alpha=0.5)
    axes.set_axisbelow(True)
    graphutil.makeGrid(ax1)
    
    # Y-AXIS
    ax1.set_ylabel(OPT_Y_LABEL_THROUGHPUT, name=OPT_FONT_NAME, size=OPT_YLABEL_FONT_SIZE, weight='bold')
    ax1.yaxis.set_major_locator(MaxNLocator(5))
    ax1.minorticks_on()
    for tick in ax1.yaxis.get_major_ticks():
        tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE)
        tick.label.set_fontname(OPT_FONT_NAME)
    
    # X-AXIS
    ax1.set_xlabel(OPT_X_LABEL_TIME, name=OPT_FONT_NAME, size=OPT_XLABEL_FONT_SIZE, weight='bold')
    ax1.xaxis.set_major_locator(MaxNLocator(6))
    xLabels = map(lambda x: "%d" % (x / 1000), ax1.get_xticks())
    ax1.set_xticklabels(xLabels)
    for tick in ax1.xaxis.get_major_ticks():
        tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE)
        tick.label.set_fontname(OPT_FONT_NAME)

    # LEGEND
    fp = FontProperties(family=OPT_FONT_NAME, size=OPT_LEGEND_FONT_SIZE)
    ax1.legend(loc='upper left', shadow=OPT_LEGEND_SHADOW, prop=fp)
          
    return (fig)
Esempio n. 15
0
def createMergeStrategyGraph(mem, read_pct, mergeTuple, mergeBlock):
    fig = plot.figure()
    ax1 = fig.add_subplot(111)
    
    datasets = (mergeTuple, mergeBlock)
    labels = ("tuple-merge", "block-merge")
       
    # The x-axis is going to be the skew amount
    x_values = set()
    for d in mergeTuple:
        x_values.add(d["skew"])
    x_values = map(float, sorted(x_values, reverse=True))
    x_labels = map(str, x_values)
    
    for i in xrange(len(datasets)):
        y_values = [None]*len(x_values)
        for d in datasets[i]:
            if d["mem"] != mem or d["read_pct"] != read_pct: continue
            offset = x_values.index(d["skew"])
            y_values[offset] = d["tps"]
        ## FOR
        LOG.info("%s y_values = %s", labels[i], y_values)
        
        ax1.plot(x_values, y_values,
                 label=labels[i],
                 color=OPT_COLORS[i],
                 linewidth=OPT_LINE_WIDTH,
                 marker=OPT_MARKERS[i],
                 markersize=OPT_MARKER_SIZE,
                 )
    ## FOR

    
    # GRID
    axes = ax1.get_axes()
    axes.set_ylim(0, 120000) #  + y_max*0.25)
    graphutil.makeGrid(ax1)
    axes.set_xlim(.4, 1.6)
    
    # LEGEND
    fp = FontProperties(family=OPT_FONT_NAME, size=OPT_LEGEND_FONT_SIZE)
    ax1.legend(#[p[0] for p in bars],
               labels,
               prop=fp,
               bbox_to_anchor=(0.0, 1.02, 1.0, 0.10),
               loc=1,
               ncol=len(datasets),
               mode="expand",
               shadow=OPT_LEGEND_SHADOW,
               borderaxespad=0.0,
               )
    #ax1.legend(loc='center', shadow=OPT_LEGEND_SHADOW, prop=fp)

    # Y-AXIS
    fp = FontProperties(family=OPT_FONT_NAME+' Condensed', size=OPT_YLABEL_FONT_SIZE, weight=OPT_LABEL_WEIGHT)
    ax1.set_ylabel(OPT_Y_LABEL_THROUGHPUT, fontproperties=fp)
    ax1.yaxis.set_major_locator(MaxNLocator(5))
    ax1.minorticks_on()
    for tick in ax1.yaxis.get_major_ticks():
        tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE)
        tick.label.set_fontname(OPT_FONT_NAME)

    # X-AXIS
    fp = FontProperties(family=OPT_FONT_NAME+' Condensed', size=OPT_XLABEL_FONT_SIZE, weight=OPT_LABEL_WEIGHT)
    ax1.set_xlabel(OPT_X_LABEL_WORKLOAD_SKEW, fontproperties=fp)
    ax1.xaxis.set_major_locator(MaxNLocator(len(x_values)))
    xlim = ax1.get_xlim()[::-1]
    xlim = (xlim[0], xlim[1])
    ax1.set_xlim(xlim)
    ax1.minorticks_off()
    ax1.set_xticklabels(x_labels)
    ax1.set_xticks(x_values)
    print(x_labels)
    pprint(ax1.xaxis.get_majorticklocs())
    for tick in ax1.xaxis.get_major_ticks():
        tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE)
        tick.label.set_fontname(OPT_FONT_NAME)
    ## FOR

    return (fig)
Esempio n. 16
0
def createWorkloadSkewGraphs(benchmark, mem, read_pct, noAntiCache, hstoreData,
                             hstoreDataApprox, mysqlData, memcachedData):
    fig = plot.figure()
    ax1 = fig.add_subplot(111)

    # The x-axis is going to be the skew amount
    x_values = set()
    for d in hstoreData:
        x_values.add(d["skew"])
    x_values = map(float, sorted(x_values, reverse=True))
    x_labels = map(str, x_values)
    #x_labels = ['90/10']*(len(x_values)+1)
    #    x_labels = {"1.5", "1.25", "1", "0.75", "0.5"}
    print("x_values = %s", x_values)
    print("x_labels = %s", x_labels)

    datasets = (hstoreData, hstoreDataApprox, noAntiCache, mysqlData,
                memcachedData)
    labels = (OPT_LABEL_HSTORE, OPT_LABEL_HSTORE_APPROX,
              OPT_LABEL_NO_ANTICACHE, OPT_LABEL_MYSQL, OPT_LABEL_MEMCACHED)

    # For each read_pct, get the y-axis max so that they're all
    # on the same scale
    y_maxes = {}
    for i in xrange(len(datasets)):
        for d in datasets[i]:
            if d["read_pct"] != read_pct: continue
            y_max = y_maxes.get(d["read_pct"], None)
            y_maxes[d["read_pct"]] = max(y_max, d["tps"])
        ## FOR
    ## FOR
    LOG.info("mem=%s / read_pct=%s\n%s", mem, read_pct, pformat(y_maxes))

    if mem == 1:  # configure params for 1 extra line
        datasets = (noAntiCache, hstoreData, hstoreDataApprox, mysqlData,
                    memcachedData)
        labels = (OPT_LABEL_NO_ANTICACHE, OPT_LABEL_HSTORE,
                  OPT_LABEL_HSTORE_APPROX, OPT_LABEL_MYSQL,
                  OPT_LABEL_MEMCACHED)
    else:
        datasets = (hstoreData, hstoreDataApprox, mysqlData, memcachedData)
        labels = (OPT_LABEL_HSTORE, OPT_LABEL_HSTORE_APPROX, OPT_LABEL_MYSQL,
                  OPT_LABEL_MEMCACHED)

    for i in xrange(len(datasets)):
        y_values = [None] * len(x_values)
        for d in datasets[i]:
            if d["mem"] != mem or d["read_pct"] != read_pct: continue
            offset = x_values.index(d["skew"])
            y_values[offset] = d["tps"]
        ## FOR
        LOG.info("%s y_values = %s", labels[i], y_values)

        if mem == 1 and i == 0:
            ax1.plot(
                x_values,
                y_values,
                label=labels[i],
                color='#8D38C9',
                linewidth=OPT_LINE_WIDTH,
                marker='v',
                markersize=OPT_MARKER_SIZE,
            )
        elif mem == 1:
            ax1.plot(
                x_values,
                y_values,
                label=labels[i],
                color=OPT_COLORS[i - 1],
                linewidth=OPT_LINE_WIDTH,
                marker=OPT_MARKERS[i - 1],
                markersize=OPT_MARKER_SIZE,
            )
        else:
            ax1.plot(
                x_values,
                y_values,
                label=labels[i],
                color=OPT_COLORS[i],
                linewidth=OPT_LINE_WIDTH,
                marker=OPT_MARKERS[i],
                markersize=OPT_MARKER_SIZE,
            )
    ## FOR

    # GRID
    axes = ax1.get_axes()
    if read_pct == 100:
        axes.set_ylim(0, 140000)
    elif read_pct == 90:
        axes.set_ylim(0, 140000)
    elif read_pct == 50:
        axes.set_ylim(0, 45000)

    graphutil.makeGrid(ax1)
    axes.set_xlim(.4, 1.6)

    # LEGEND
    fp = FontProperties(family=OPT_FONT_NAME, size=OPT_LEGEND_FONT_SIZE)
    num_col = 4
    if mem == 1:
        num_col = 3
    ax1.legend(
        labels,
        prop=fp,
        bbox_to_anchor=(0.0, 1.1, 1.0, 0.10),
        loc=1,
        ncol=num_col,
        mode="expand",
        shadow=OPT_LEGEND_SHADOW,
        borderaxespad=0.0,
    )
    #ax1.legend(loc='center', shadow=OPT_LEGEND_SHADOW, prop=fp)

    # Y-AXIS
    fp = FontProperties(family=OPT_FONT_NAME + ' Condensed',
                        size=OPT_YLABEL_FONT_SIZE,
                        weight=OPT_LABEL_WEIGHT)
    ax1.set_ylabel(OPT_Y_LABEL_THROUGHPUT, fontproperties=fp)
    ax1.yaxis.set_major_locator(MaxNLocator(5))
    ax1.minorticks_on()
    for tick in ax1.yaxis.get_major_ticks():
        tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE)
        tick.label.set_fontname(OPT_FONT_NAME)

    # X-AXIS
    fp = FontProperties(family=OPT_FONT_NAME + ' Condensed',
                        size=OPT_XLABEL_FONT_SIZE,
                        weight=OPT_LABEL_WEIGHT)
    ax1.set_xlabel(OPT_X_LABEL_WORKLOAD_SKEW, fontproperties=fp)
    ax1.xaxis.set_major_locator(MaxNLocator(len(x_values)))
    xlim = ax1.get_xlim()[::-1]
    xlim = (xlim[0], xlim[1])
    ax1.set_xlim(xlim)
    ax1.minorticks_off()
    ax1.set_xticklabels(x_labels)
    ax1.set_xticks(x_values)
    print(x_labels)
    pprint(ax1.xaxis.get_majorticklocs())
    for tick in ax1.xaxis.get_major_ticks():
        tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE)
        tick.label.set_fontname(OPT_FONT_NAME)
    ## FOR

    return (fig)
Esempio n. 17
0
def createLinkedListGraph(colMap, noLru, single, double):
    fig = plot.figure()
    ax1 = fig.add_subplot(111)
    
    datasets = (noLru, single, double)
    labels = ("none", "single", "double")
    
    x_values = (1.5, 1.25, 1.0, .75, .5)
    x_values = map(float, sorted(x_values, reverse=True))
    x_labels = map(str, x_values)

    print("x_values = %s", x_values)
    print("x_labels = %s", x_labels)
    
    for i in xrange(len(datasets)):
        
        y_values = [None]*len(x_values)
        for row in datasets[i]:
            y_values[0] = row[colMap["1.5"]]
            y_values[1] = row[colMap["1.25"]]
            y_values[2] = row[colMap["1.0"]]
            y_values[3] = row[colMap["0.75"]]
            y_values[4] = row[colMap["0.5"]]
        
        print(y_values)
        ax1.plot(x_values, y_values,
                 label=labels[i],
                 color=OPT_COLORS[i],
                 linewidth=OPT_LINE_WIDTH,
                 marker=OPT_MARKERS[i],
                 markersize=OPT_MARKER_SIZE,
                 )
    ## FOR
    
    # GRID
    axes = ax1.get_axes()
    axes.set_ylim(0, 100000) #  + y_max*0.25)
    graphutil.makeGrid(ax1)
    axes.set_xlim(.4, 1.6)

    # LEGEND
            # LEGEND
    fp = FontProperties(family=OPT_FONT_NAME, size=OPT_LEGEND_FONT_SIZE)
    ax1.legend(
               labels,
               prop=fp,
               bbox_to_anchor=(0.0, 1.02, 1.0, 0.10),
               loc=1,
               ncol=len(datasets),
               mode="expand",
               shadow=OPT_LEGEND_SHADOW,
               borderaxespad=0.0,
               )
    #ax1.legend(loc='center', shadow=OPT_LEGEND_SHADOW, prop=fp)
    
    # Y-AXIS
    fp = FontProperties(family=OPT_FONT_NAME+' Condensed', size=OPT_YLABEL_FONT_SIZE, weight=OPT_LABEL_WEIGHT)
    ax1.set_ylabel(OPT_Y_LABEL_TIME_MS, fontproperties=fp)
    ax1.yaxis.set_major_locator(MaxNLocator(5))
    ax1.minorticks_on()
    for tick in ax1.yaxis.get_major_ticks():
        tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE)
        tick.label.set_fontname(OPT_FONT_NAME)
    
    # X-AXIS
    fp = FontProperties(family=OPT_FONT_NAME+' Condensed', size=OPT_XLABEL_FONT_SIZE, weight=OPT_LABEL_WEIGHT)
    ax1.set_xlabel(OPT_X_LABEL_WORKLOAD_SKEW, fontproperties=fp)
    ax1.xaxis.set_major_locator(MaxNLocator(len(x_values)))
    xlim = ax1.get_xlim()[::-1]
    xlim = (xlim[0], xlim[1])
    ax1.set_xlim(xlim)
    ax1.minorticks_off()
    ax1.set_xticklabels(x_labels)
    ax1.set_xticks(x_values)
    print(x_labels)
    pprint(ax1.xaxis.get_majorticklocs())
    for tick in ax1.xaxis.get_major_ticks():
        tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE)
        tick.label.set_fontname(OPT_FONT_NAME)
    ## FOR

    return (fig)
Esempio n. 18
0
def createMergeStrategyGraph(mem, read_pct, mergeTuple, mergeBlock):
    fig = plot.figure()
    ax1 = fig.add_subplot(111)

    datasets = (mergeTuple, mergeBlock)
    labels = ("tuple-merge", "block-merge")

    # The x-axis is going to be the skew amount
    x_values = set()
    for d in mergeTuple:
        x_values.add(d["skew"])
    x_values = map(float, sorted(x_values, reverse=True))
    x_labels = map(str, x_values)

    for i in xrange(len(datasets)):
        y_values = [None] * len(x_values)
        for d in datasets[i]:
            if d["mem"] != mem or d["read_pct"] != read_pct: continue
            offset = x_values.index(d["skew"])
            y_values[offset] = d["tps"]
        ## FOR
        LOG.info("%s y_values = %s", labels[i], y_values)

        ax1.plot(
            x_values,
            y_values,
            label=labels[i],
            color=OPT_COLORS[i],
            linewidth=OPT_LINE_WIDTH,
            marker=OPT_MARKERS[i],
            markersize=OPT_MARKER_SIZE,
        )
    ## FOR

    # GRID
    axes = ax1.get_axes()
    axes.set_ylim(0, 120000)  #  + y_max*0.25)
    graphutil.makeGrid(ax1)
    axes.set_xlim(.4, 1.6)

    # LEGEND
    fp = FontProperties(family=OPT_FONT_NAME, size=OPT_LEGEND_FONT_SIZE)
    ax1.legend(  #[p[0] for p in bars],
        labels,
        prop=fp,
        bbox_to_anchor=(0.0, 1.02, 1.0, 0.10),
        loc=1,
        ncol=len(datasets),
        mode="expand",
        shadow=OPT_LEGEND_SHADOW,
        borderaxespad=0.0,
    )
    #ax1.legend(loc='center', shadow=OPT_LEGEND_SHADOW, prop=fp)

    # Y-AXIS
    fp = FontProperties(family=OPT_FONT_NAME + ' Condensed',
                        size=OPT_YLABEL_FONT_SIZE,
                        weight=OPT_LABEL_WEIGHT)
    ax1.set_ylabel(OPT_Y_LABEL_THROUGHPUT, fontproperties=fp)
    ax1.yaxis.set_major_locator(MaxNLocator(5))
    ax1.minorticks_on()
    for tick in ax1.yaxis.get_major_ticks():
        tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE)
        tick.label.set_fontname(OPT_FONT_NAME)

    # X-AXIS
    fp = FontProperties(family=OPT_FONT_NAME + ' Condensed',
                        size=OPT_XLABEL_FONT_SIZE,
                        weight=OPT_LABEL_WEIGHT)
    ax1.set_xlabel(OPT_X_LABEL_WORKLOAD_SKEW, fontproperties=fp)
    ax1.xaxis.set_major_locator(MaxNLocator(len(x_values)))
    xlim = ax1.get_xlim()[::-1]
    xlim = (xlim[0], xlim[1])
    ax1.set_xlim(xlim)
    ax1.minorticks_off()
    ax1.set_xticklabels(x_labels)
    ax1.set_xticks(x_values)
    print(x_labels)
    pprint(ax1.xaxis.get_majorticklocs())
    for tick in ax1.xaxis.get_major_ticks():
        tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE)
        tick.label.set_fontname(OPT_FONT_NAME)
    ## FOR

    return (fig)
Esempio n. 19
0
def createIndexGraph(colMap, hashData, treeData):
	fig = plot.figure()
	ax1 = fig.add_subplot(111)

	datasets = (hashData, treeData)
	labels = ("hash index", "tree index")

	x_values = (1, 2, 3, 4, 5, 6, 7, 8)
	x_values = map(int, sorted(x_values))
	x_labels = map(str, x_values)

	ind = np.arange(8)    # the x locations for the groups
	width = 0.35
	offset = width/2

	print("x_values = %s", x_values)
	print("x_labels = %s", x_labels)

	for i in xrange(len(datasets)):

		y_values = [None]*len(x_values)
		for row in datasets[i]:
			y_values[0] = row[colMap["1"]]
			y_values[1] = row[colMap["2"]]
			y_values[2] = row[colMap["3"]]
			y_values[3] = row[colMap["4"]]
			y_values[4] = row[colMap["5"]]
			y_values[5] = row[colMap["6"]]
			y_values[6] = row[colMap["7"]]
			y_values[7] = row[colMap["8"]]


		print(y_values)
		ax1.bar(ind-offset, y_values, width, align='center', color=OPT_COLORS[i+1])
		offset = 0 - offset
	## FOR

	axes = ax1.get_axes()
        graphutil.makeGrid(ax1)
	axes.set_ylim(0, 225)

	# LEGEND
	fp = FontProperties(family=OPT_FONT_NAME, size=OPT_LEGEND_FONT_SIZE)
	ax1.legend(
	labels,
	prop=fp,
	bbox_to_anchor=(0.0, 1.02, 1.0, 0.10),
	loc=1,
	ncol=len(datasets),
	mode="expand",
	shadow=OPT_LEGEND_SHADOW,
	borderaxespad=0.0,
	)
	#ax1.legend(loc='center', shadow=OPT_LEGEND_SHADOW, prop=fp)

	# Y-AXIS
	fp = FontProperties(family=OPT_FONT_NAME+' Condensed', size=OPT_YLABEL_FONT_SIZE, weight=OPT_LABEL_WEIGHT)
	ax1.set_ylabel(OPT_Y_LABEL_TIME_MS, fontproperties=fp)
	ax1.yaxis.set_major_locator(MaxNLocator(8))
	ax1.minorticks_on()
	for tick in ax1.yaxis.get_major_ticks():
		tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE)
		tick.label.set_fontname(OPT_FONT_NAME)

		# X-AXIS
		fp = FontProperties(family=OPT_FONT_NAME+' Condensed', size=OPT_XLABEL_FONT_SIZE, weight=OPT_LABEL_WEIGHT)
		ax1.set_xlabel(OPT_X_LABEL_NUM_INDEXES, fontproperties=fp)
		ax1.minorticks_off()

		ax1.set_xticks(ind)
		ax1.set_xticklabels( x_labels )

		return (fig)
Esempio n. 20
0
def createLinkedListGraph(colMap, noLru, single, double):
    fig = plot.figure()
    ax1 = fig.add_subplot(111)

    datasets = (noLru, single, double)
    labels = ("none", "single", "double")

    x_values = (1.5, 1.25, 1.0, .75, .5)
    x_values = map(float, sorted(x_values, reverse=True))
    x_labels = map(str, x_values)

    print("x_values = %s", x_values)
    print("x_labels = %s", x_labels)

    for i in xrange(len(datasets)):

        y_values = [None] * len(x_values)
        for row in datasets[i]:
            y_values[0] = row[colMap["1.5"]]
            y_values[1] = row[colMap["1.25"]]
            y_values[2] = row[colMap["1.0"]]
            y_values[3] = row[colMap["0.75"]]
            y_values[4] = row[colMap["0.5"]]

        print(y_values)
        ax1.plot(
            x_values,
            y_values,
            label=labels[i],
            color=OPT_COLORS[i],
            linewidth=OPT_LINE_WIDTH,
            marker=OPT_MARKERS[i],
            markersize=OPT_MARKER_SIZE,
        )
    ## FOR

    # GRID
    axes = ax1.get_axes()
    axes.set_ylim(0, 100000)  #  + y_max*0.25)
    graphutil.makeGrid(ax1)
    axes.set_xlim(.4, 1.6)

    # LEGEND
    # LEGEND
    fp = FontProperties(family=OPT_FONT_NAME, size=OPT_LEGEND_FONT_SIZE)
    ax1.legend(
        labels,
        prop=fp,
        bbox_to_anchor=(0.0, 1.02, 1.0, 0.10),
        loc=1,
        ncol=len(datasets),
        mode="expand",
        shadow=OPT_LEGEND_SHADOW,
        borderaxespad=0.0,
    )
    #ax1.legend(loc='center', shadow=OPT_LEGEND_SHADOW, prop=fp)

    # Y-AXIS
    fp = FontProperties(family=OPT_FONT_NAME + ' Condensed',
                        size=OPT_YLABEL_FONT_SIZE,
                        weight=OPT_LABEL_WEIGHT)
    ax1.set_ylabel(OPT_Y_LABEL_TIME_MS, fontproperties=fp)
    ax1.yaxis.set_major_locator(MaxNLocator(5))
    ax1.minorticks_on()
    for tick in ax1.yaxis.get_major_ticks():
        tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE)
        tick.label.set_fontname(OPT_FONT_NAME)

    # X-AXIS
    fp = FontProperties(family=OPT_FONT_NAME + ' Condensed',
                        size=OPT_XLABEL_FONT_SIZE,
                        weight=OPT_LABEL_WEIGHT)
    ax1.set_xlabel(OPT_X_LABEL_WORKLOAD_SKEW, fontproperties=fp)
    ax1.xaxis.set_major_locator(MaxNLocator(len(x_values)))
    xlim = ax1.get_xlim()[::-1]
    xlim = (xlim[0], xlim[1])
    ax1.set_xlim(xlim)
    ax1.minorticks_off()
    ax1.set_xticklabels(x_labels)
    ax1.set_xticks(x_values)
    print(x_labels)
    pprint(ax1.xaxis.get_majorticklocs())
    for tick in ax1.xaxis.get_major_ticks():
        tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE)
        tick.label.set_fontname(OPT_FONT_NAME)
    ## FOR

    return (fig)
Esempio n. 21
0
def createMemoryGraph(benchmark, data):
    x = map(lambda x: x[0], data["memory"])
    inMemory = map(lambda x: x[1], data["memory"]) # In-Memory Data
    anticache = map(lambda x: x[2], data["memory"]) # Anti-Cache Data
    y = np.row_stack((inMemory, anticache))   
    
    # this call to 'cumsum' (cumulative sum), passing in your y data, 
    # is necessary to avoid having to manually order the datasets
    y_stack = np.cumsum(y, axis=0)

    # GRAPH
    fig = plot.figure()
    ax1 = fig.add_subplot(111)
    
    ax1.fill_between(x, 0, y_stack[0,:],
                     color=OPT_COLORS[0],
                     alpha=0.5,
                     label="XXX",
    )
    ax1.fill_between(x, y_stack[0,:], y_stack[1,:],
                     color=OPT_COLORS[1],
                     alpha=0.5,
                     label="YYY",
    )
    ax1.plot(x, map(lambda x: sum(x[1:]), data["memory"]),
             color=OPT_COLORS[1],
             linewidth=3,
             label="Anti-Cache Data"
    )
    ax1.plot(x, inMemory,
             color=OPT_COLORS[0],
             linewidth=3,
             label="In-Memory Data",
    )
    
    # GRID
    axes = ax1.get_axes()
    axes.set_ylim(0, 1250)
    axes.yaxis.grid(True, linestyle='-', which='major', color='0.85') # color='lightgrey', alpha=0.5)
    axes.set_axisbelow(True)
    graphutil.makeGrid(ax1)
    
    # Y-AXIS
    ax1.set_ylabel("Memory (MB)", name=OPT_FONT_NAME, size=OPT_YLABEL_FONT_SIZE)
    yLabels = map(lambda y: "%d" % (y / 1000), ax1.get_yticks())
    #ax1.set_yticklabels(yLabels)
    ax1.yaxis.set_major_locator(MultipleLocator(250))
    ax1.minorticks_on()
    for tick in ax1.yaxis.get_major_ticks():
        tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE)
        tick.label.set_fontname(OPT_FONT_NAME)
    
    # X-AXIS
    ax1.set_xlabel(OPT_X_LABEL_TIME, name=OPT_FONT_NAME, size=OPT_XLABEL_FONT_SIZE)
    ax1.xaxis.set_major_locator(MaxNLocator(6))
    xLabels = map(lambda x: "%d" % (x / 1000), ax1.get_xticks())
    ax1.set_xticklabels(xLabels)
    for tick in ax1.xaxis.get_major_ticks():
        tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE)
        tick.label.set_fontname(OPT_FONT_NAME)

    # LEGEND
    fp = FontProperties(family=OPT_FONT_NAME, size=OPT_LEGEND_FONT_SIZE)
    ax1.legend(loc='upper left', shadow=OPT_LEGEND_SHADOW, prop=fp)
        
    # Evictions
    if len(data["evictions"]) > 0:
        # addEvictionLines(data["evictions"], y_max)
        pass
    else:
        LOG.warn("Missing eviction history for '%s'" % benchmark)
    
    return (fig)
Esempio n. 22
0
def createEvictGraph(colMap, construct, write, fetch, tuplemerge, blockmerge):
    fig = plot.figure()
    ax1 = fig.add_subplot(111)

    datasets = (construct, write, fetch, blockmerge, tuplemerge)
    labels = ("construct", "write", "fetch", "block\nmerge", "tuple\nmerge")

    x_values = (1, 2, 4, 8, 16)
    x_values = map(int, sorted(x_values, reverse=False))
    x_labels = map(str, x_values)

    print("x_values = %s", x_values)
    print("x_labels = %s", x_labels)

    ind = np.arange(5)  # the x locations for the groups
    width = 0.35
    offset = width / 2

    y1 = []
    for row in construct:
        y1.append(row[colMap["1"]])
        y1.append(row[colMap["2"]])
        y1.append(row[colMap["4"]])
        y1.append(row[colMap["8"]])
        y1.append(row[colMap["16"]])

    y2 = []
    for row in write:
        y2.append(row[colMap["1"]])
        y2.append(row[colMap["2"]])
        y2.append(row[colMap["4"]])
        y2.append(row[colMap["8"]])
        y2.append(row[colMap["16"]])

    y3 = []
    for row in fetch:
        y3.append(row[colMap["1"]])
        y3.append(row[colMap["2"]])
        y3.append(row[colMap["4"]])
        y3.append(row[colMap["8"]])
        y3.append(row[colMap["16"]])

    y4 = []
    for row in blockmerge:
        y4.append(row[colMap["1"]])
        y4.append(row[colMap["2"]])
        y4.append(row[colMap["4"]])
        y4.append(row[colMap["8"]])
        y4.append(row[colMap["16"]])

    y5 = []
    for row in tuplemerge:
        y5.append(row[colMap["1"]])
        y5.append(row[colMap["2"]])
        y5.append(row[colMap["4"]])
        y5.append(row[colMap["8"]])
        y5.append(row[colMap["16"]])

    y6 = []
    for i in range(len(x_values)):
        y6.append(y1[i] + y2[i])

    y7 = []
    for i in range(len(x_values)):
        y7.append(y6[i] + y3[i])

    plt1 = ax1.bar(ind - offset,
                   y1,
                   width,
                   align='center',
                   color=OPT_COLORS[0],
                   bottom=0)
    ptt2 = ax1.bar(ind - offset,
                   y2,
                   width,
                   align='center',
                   color=OPT_COLORS[1],
                   bottom=y1)
    ptt3 = ax1.bar(ind - offset,
                   y3,
                   width,
                   align='center',
                   color=OPT_COLORS[2],
                   bottom=y6)
    ptt4 = ax1.bar(ind - offset,
                   y4,
                   width,
                   align='center',
                   color=OPT_COLORS[3],
                   bottom=y7)
    ptt8 = ax1.bar(ind + offset,
                   y5,
                   width,
                   align='center',
                   color='#FFFF00',
                   bottom=y7)

    plt5 = ax1.bar(ind + offset,
                   y1,
                   width,
                   align='center',
                   color=OPT_COLORS[0],
                   bottom=0)
    ptt6 = ax1.bar(ind + offset,
                   y2,
                   width,
                   align='center',
                   color=OPT_COLORS[1],
                   bottom=y1)
    ptt7 = ax1.bar(ind + offset,
                   y3,
                   width,
                   align='center',
                   color=OPT_COLORS[2],
                   bottom=y6)

    ## FOR

    axes = ax1.get_axes()
    graphutil.makeGrid(ax1)
    axes.set_ylim(0, 700)

    # LEGEND
    fp = FontProperties(family=OPT_FONT_NAME, size=OPT_LEGEND_FONT_SIZE)
    ax1.legend(
        labels,
        prop=fp,
        bbox_to_anchor=(0.0, 1.02, 1.0, 0.10),
        loc=1,
        ncol=len(datasets),
        mode="expand",
        shadow=OPT_LEGEND_SHADOW,
        borderaxespad=0.0,
    )
    #ax1.legend(loc='center', shadow=OPT_LEGEND_SHADOW, prop=fp)

    # Y-AXIS
    fp = FontProperties(family=OPT_FONT_NAME + ' Condensed',
                        size=OPT_YLABEL_FONT_SIZE,
                        weight=OPT_LABEL_WEIGHT)
    ax1.set_ylabel(OPT_Y_LABEL_TIME_MS, fontproperties=fp)
    ax1.yaxis.set_major_locator(MaxNLocator(5))
    ax1.minorticks_on()
    for tick in ax1.yaxis.get_major_ticks():
        tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE)
        tick.label.set_fontname(OPT_FONT_NAME)

    # X-AXIS
    fp = FontProperties(family=OPT_FONT_NAME + ' Condensed',
                        size=OPT_XLABEL_FONT_SIZE,
                        weight=OPT_LABEL_WEIGHT)
    ax1.set_xlabel(OPT_X_LABEL_BLOCK_SIZE_MB, fontproperties=fp)
    ax1.minorticks_off()

    ax1.set_xticks(ind)
    ax1.set_xticklabels(x_labels)

    #    # X-AXIS
    #    fp = FontProperties(family=OPT_FONT_NAME+' Condensed', size=OPT_XLABEL_FONT_SIZE, weight=OPT_LABEL_WEIGHT)
    #    ax1.set_xlabel(OPT_X_LABEL_BLOCK_SIZE_MB, fontproperties=fp)
    #    ax1.xaxis.set_major_locator(MaxNLocator(len(x_values)))
    ##    xlim = ax1.get_xlim()[::-1]
    ##    xlim = (xlim[0], xlim[1])
    ##    ax1.set_xlim(xlim)
    #    ax1.minorticks_off()
    #    ax1.set_xticklabels(x_labels)
    #    ax1.set_xticks(x_values)
    #    print(x_labels)
    #    pprint(ax1.xaxis.get_majorticklocs())
    #    for tick in ax1.xaxis.get_major_ticks():
    #        tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE)
    #        tick.label.set_fontname(OPT_FONT_NAME)
    #    ## FOR

    return (fig)
def createMemoryGraph(benchmark, data):
    x = map(lambda x: x[0], data["memory"])
    inMemory = map(lambda x: x[1], data["memory"]) # In-Memory Data
    anticache = map(lambda x: x[2], data["memory"]) # Anti-Cache Data
    y = np.row_stack((inMemory, anticache))   
    
    # this call to 'cumsum' (cumulative sum), passing in your y data, 
    # is necessary to avoid having to manually order the datasets
    y_stack = np.cumsum(y, axis=0)

    # GRAPH
    fig = plot.figure()
    ax1 = fig.add_subplot(111)
    
    ax1.fill_between(x, 0, y_stack[0,:],
                     color=OPT_COLORS[0],
                     alpha=0.5,
                     label="XXX",
    )
    ax1.fill_between(x, y_stack[0,:], y_stack[1,:],
                     color=OPT_COLORS[1],
                     alpha=0.5,
                     label="YYY",
    )
    ax1.plot(x, map(lambda x: sum(x[1:]), data["memory"]),
             color=OPT_COLORS[1],
             linewidth=3,
             label="Anti-Cache Data"
    )
    ax1.plot(x, inMemory,
             color=OPT_COLORS[0],
             linewidth=3,
             label="In-Memory Data",
    )
    
    # GRID
    axes = ax1.get_axes()
    axes.set_ylim(0, 1250)
    axes.yaxis.grid(True, linestyle='-', which='major', color='0.85') # color='lightgrey', alpha=0.5)
    axes.set_axisbelow(True)
    graphutil.makeGrid(ax1)
    
    # Y-AXIS
    ax1.set_ylabel("Memory (MB)", name=OPT_FONT_NAME, size=OPT_YLABEL_FONT_SIZE)
    yLabels = map(lambda y: "%d" % (y / 1000), ax1.get_yticks())
    #ax1.set_yticklabels(yLabels)
    ax1.yaxis.set_major_locator(MultipleLocator(250))
    ax1.minorticks_on()
    for tick in ax1.yaxis.get_major_ticks():
        tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE)
        tick.label.set_fontname(OPT_FONT_NAME)
    
    # X-AXIS
    ax1.set_xlabel(OPT_X_LABEL_TIME, name=OPT_FONT_NAME, size=OPT_XLABEL_FONT_SIZE)
    ax1.xaxis.set_major_locator(MaxNLocator(6))
    xLabels = map(lambda x: "%d" % (x / 1000), ax1.get_xticks())
    ax1.set_xticklabels(xLabels)
    for tick in ax1.xaxis.get_major_ticks():
        tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE)
        tick.label.set_fontname(OPT_FONT_NAME)

    # LEGEND
    fp = FontProperties(family=OPT_FONT_NAME, size=OPT_LEGEND_FONT_SIZE)
    ax1.legend(loc='upper left', shadow=OPT_LEGEND_SHADOW, prop=fp)
        
    # Evictions
    if len(data["evictions"]) > 0:
        # addEvictionLines(data["evictions"], y_max)
        pass
    else:
        LOG.warn("Missing eviction history for '%s'" % benchmark)
    
    return (fig)
Esempio n. 24
0
def createTupleSizeGraph(mem, read_pct, tuplesize128, tuplesize256, tuplesize512, tuplesize1024):
    fig = plot.figure()
    ax1 = fig.add_subplot(111)
    
    # The x-axis is going to be the skew amount
    x_values = set()
    for d in tuplesize1024:
        x_values.add(d["skew"])
    x_values = map(float, sorted(x_values, reverse=True))
    x_labels = map(str, x_values)
    #x_labels = ['90/10']*(len(x_values)+1)
    #    x_labels = {"1.5", "1.25", "1", "0.75", "0.5"}
    print("x_values = %s", x_values)
    print("x_labels = %s", x_labels)
    
    datasets = (tuplesize128, tuplesize256, tuplesize512, tuplesize1024)
    labels = ("128B", "256B", "512B", "1024B")

    # For each read_pct, get the y-axis max so that they're all
    # on the same scale
    y_maxes = { }
    for i in xrange(len(datasets)):
        for d in datasets[i]:
            if d["read_pct"] != read_pct: continue
            y_max = y_maxes.get(d["read_pct"], None)
            y_maxes[d["read_pct"]] = max(y_max, d["tps"])
    ## FOR
    ## FOR
    LOG.info("mem=%s / read_pct=%s\n%s", mem, read_pct, pformat(y_maxes))
    
    for i in xrange(len(datasets)):
        y_values = [None]*len(x_values)
        for d in datasets[i]:
            if d["mem"] != mem or d["read_pct"] != read_pct: continue
            offset = x_values.index(d["skew"])
            y_values[offset] = d["tps"]
        ## FOR
        LOG.info("%s y_values = %s", labels[i], y_values)
        
        ax1.plot(x_values, y_values,
                 label=labels[i],
                 color=OPT_COLORS[i],
                 linewidth=OPT_LINE_WIDTH,
                 marker=OPT_MARKERS[i],
                 markersize=OPT_MARKER_SIZE,
                 )
    ## FOR
    
    # GRID
    axes = ax1.get_axes()
    axes.set_ylim(0, y_maxes[read_pct]+10000) #  + y_max*0.25)
    graphutil.makeGrid(ax1)
    axes.set_xlim(.4, 1.6)
    
    
    # LEGEND
    fp = FontProperties(family=OPT_FONT_NAME, size=OPT_LEGEND_FONT_SIZE)
    ax1.legend(#[p[0] for p in bars],
               labels,
               prop=fp,
               bbox_to_anchor=(0.0, 1.02, 1.0, 0.10),
               loc=1,
               ncol=len(datasets),
               mode="expand",
               shadow=OPT_LEGEND_SHADOW,
               borderaxespad=0.0,
               )
    #ax1.legend(loc='center', shadow=OPT_LEGEND_SHADOW, prop=fp)
    
    # Y-AXIS
    fp = FontProperties(family=OPT_FONT_NAME+' Condensed', size=OPT_YLABEL_FONT_SIZE, weight=OPT_LABEL_WEIGHT)
    ax1.set_ylabel(OPT_Y_LABEL_THROUGHPUT, fontproperties=fp)
    ax1.yaxis.set_major_locator(MaxNLocator(5))
    ax1.minorticks_on()
    for tick in ax1.yaxis.get_major_ticks():
        tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE)
        tick.label.set_fontname(OPT_FONT_NAME)
    
    # X-AXIS
    fp = FontProperties(family=OPT_FONT_NAME+' Condensed', size=OPT_XLABEL_FONT_SIZE, weight=OPT_LABEL_WEIGHT)
    ax1.set_xlabel(OPT_X_LABEL_WORKLOAD_SKEW, fontproperties=fp)
    ax1.xaxis.set_major_locator(MaxNLocator(len(x_values)))
    xlim = ax1.get_xlim()[::-1]
    xlim = (xlim[0], xlim[1])
    ax1.set_xlim(xlim)
    ax1.minorticks_off()
    ax1.set_xticklabels(x_labels)
    ax1.set_xticks(x_values)
    print(x_labels)
    pprint(ax1.xaxis.get_majorticklocs())
    for tick in ax1.xaxis.get_major_ticks():
        tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE)
        tick.label.set_fontname(OPT_FONT_NAME)
    ## FOR
    
    return (fig)
def createThroughputGraph(benchmark, data):
    y_max = max(data["y_values"])

    tmp = y_max
    order = 1

    while tmp > 10: 
        order = order * 10
        tmp = tmp / 10;
    
    y_max_range = math.ceil(tmp) * order
        
    # INIT
    fig = plot.figure()
    ax1 = fig.add_subplot(111)
    
    # Throughout
    ax1.plot(data["x_values"], data["y_values"],
                color=OPT_COLORS[0],
                linewidth=3.5,
                marker='',
    )
    
#    if len(data["memory"]) > 0:
#        memoryX = map(lambda x: x[0], data["memory"])
#        memoryY = map(lambda x: (x[1] / float(1024)), data["memory"]) # MB
#        ax2 = ax1.twinx()
#        ax2.plot(memoryX, memoryY,
#                    marker='s',
#                    markersize=2.0,
#                    color=OPT_COLORS[1],
#        )
#        ax2.set_ylabel(OPT_Y_LABEL_THROUGHPUT, name=OPT_FONT_NAME, size=OPT_XLABEL_FONT_SIZE)
#        for tick in ax2.yaxis.get_major_ticks():
#            tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE)
#            tick.label.set_fontname(OPT_FONT_NAME)
#    else:
#        LOG.warn("Missing memory stats for '%s'" % benchmark)
    
    # Evictions
    if len(data["evictions"]) > 0:
        addEvictionLines(ax1, data["evictions"], y_max_range)
        LOG.info("Adding eviction lines.")
    else:
        LOG.warn("Missing eviction history for '%s'" % benchmark)
    
    # GRID
    axes = ax1.get_axes()
    axes.set_ylim(0, y_max_range)
    axes.yaxis.grid(True, linestyle='-', which='major', color='0.85') # color='lightgrey', alpha=0.5)
    axes.set_axisbelow(True)
    graphutil.makeGrid(ax1)
    
    # Y-AXIS
    ax1.set_ylabel(OPT_Y_LABEL_THROUGHPUT, name=OPT_FONT_NAME, size=OPT_YLABEL_FONT_SIZE, weight='bold')
    ax1.yaxis.set_major_locator(MaxNLocator(5))
    ax1.minorticks_on()
    for tick in ax1.yaxis.get_major_ticks():
        tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE)
        tick.label.set_fontname(OPT_FONT_NAME)
    
    # X-AXIS
    ax1.set_xlabel(OPT_X_LABEL_TIME, name=OPT_FONT_NAME, size=OPT_XLABEL_FONT_SIZE, weight='bold')
    ax1.set_xlim(0, 600000)
    ax1.xaxis.set_major_locator(MaxNLocator(6))
    xLabels = map(lambda x: "%d" % (x / 1000), ax1.get_xticks())
    ax1.set_xticklabels(xLabels)
    for tick in ax1.xaxis.get_major_ticks():
        tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE)
        tick.label.set_fontname(OPT_FONT_NAME)
    
    
    return (fig)
Esempio n. 26
0
def createThroughputGraph(benchmark, memorySizes, read_pct, hstoreData, mysqlData, memcachedData,
                          y_max=None,
                          linestyles=None,
                          linewidths=None,
                          linecolors=None,
                          markersizes=None,
                          markerfacecolors=None):
    datasets = (hstoreData, mysqlData, memcachedData)
    labels = (OPT_LABEL_HSTORE, OPT_LABEL_MYSQL, OPT_LABEL_MEMCACHED)
    
    # Per Memory Size
    if linestyles is None: linestyles = [OPT_LINE_STYLE]*len(memorySizes)
    if linewidths is None: linewidths = [OPT_LINE_WIDTH]*len(memorySizes)
    if markersizes is None: markersizes = [OPT_MARKER_SIZE]*len(memorySizes)
    if linecolors is None: linecolors = [OPT_COLORS]*len(memorySizes)
    if markerfacecolors is None: markerfacecolors = linecolors
    
    fig = plot.figure()
    ax1 = fig.add_subplot(111)
    
    fp = FontProperties(family=OPT_FONT_NAME, size=20, weight='bold')
    fig.text(0.25, 1.08, "YCSB (20GB Database / 10GB Memory)", fontproperties=fp)
    fp = FontProperties(family=OPT_FONT_NAME, size=16)
    fig.text(0.40, 1.02, "50% Reads / 50% Writes", fontproperties=fp)

    x_values = [ ]
    x_labels = [ ]
    for d in hstoreData:
        delta = 0 #  d["throughputs"][0][0]
        labelDelta = 0
        for r in d["throughputs"]:
            x_values.append(r[0] - delta)
            x_labels.append(str(x_values[-1] + labelDelta))
        break
    assert x_values
    
    for memIdx in xrange(len(memorySizes)):
        mem = memorySizes[memIdx]
        for dataIdx in xrange(len(datasets)):
            y_values = [None] * len(x_values)
            for d in datasets[dataIdx]:
                if d["mem"] != mem or d["read_pct"] != read_pct: continue 
                y_values = [ ]
                #print benchmark, labels[dataIdx]
                #pprint(d["throughputs"])
                if dataIdx == 0:
                    for i in xrange(len(x_values)):
                        tps = d["throughputs"][i][-1]
                        y_values.append(tps)
                else:
                    for i in xrange(len(x_values)*2):
                        if i % 2 != 0: continue
                        tps = d["throughputs"][i][-1]
                        y_values.append(tps)
                break
            ## FOR
            y_max = max(y_max, max(y_values))
            
            marker = OPT_MARKERS[dataIdx] if markersizes[memIdx] else None
            LOG.debug("%s -> %s", labels[dataIdx], y_values)
            ax1.plot(x_values, y_values,
                     color=linecolors[memIdx][dataIdx],
                     linewidth=linewidths[memIdx],
                     linestyle=linestyles[memIdx],
                     marker=marker,
                     markeredgecolor='black',#linecolors[memIdx][dataIdx],
                     markersize=markersizes[memIdx],
                     markerfacecolor=markerfacecolors[memIdx][dataIdx],
                     label=labels[dataIdx]
            )
        ## FOR
    ## FOR
    LOG.debug("y_max = %d", y_max)
    
    # GRID
    graphutil.makeGrid(ax1)

    # AXES
    axes = ax1.get_axes()
    axes.set_ylim(0, y_max+10000)
    axes.set_xlim(10, None)
    
    # LEGEND
    fp = FontProperties(family=OPT_FONT_NAME, size=OPT_LEGEND_FONT_SIZE)
    ax1.legend(#[p[0] for p in bars],
                labels,
                prop=fp,
                bbox_to_anchor=(0.0, 1.02, 1.0, 0.10),
                loc=1,
                ncol=len(datasets),
                mode="expand",
                shadow=OPT_LEGEND_SHADOW,
                borderaxespad=0.0,
    )
    
    # Y-AXIS
    fp = FontProperties(family=OPT_FONT_NAME+' Condensed', size=OPT_YLABEL_FONT_SIZE, weight=OPT_LABEL_WEIGHT)
    ax1.set_ylabel(OPT_Y_LABEL_THROUGHPUT, fontproperties=fp)
    ax1.yaxis.set_major_locator(MaxNLocator(5))
    ax1.minorticks_on()
    for tick in ax1.yaxis.get_major_ticks():
        tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE)
        tick.label.set_fontname(OPT_FONT_NAME)
    
    # X-AXIS
    fp = FontProperties(family=OPT_FONT_NAME+' Condensed', size=OPT_XLABEL_FONT_SIZE, weight=OPT_LABEL_WEIGHT)
    ax1.set_xlabel(OPT_X_LABEL_TIME, fontproperties=fp)
    ax1.xaxis.set_major_locator(MaxNLocator(6))
    ax1.set_xticklabels(x_labels)
    #xLabels = map(lambda x: "%d" % (x / 1000), ax1.get_xticks())
    for tick in ax1.xaxis.get_major_ticks():
        tick.label.set_fontsize(OPT_YTICKS_FONT_SIZE)
        tick.label.set_fontname(OPT_FONT_NAME)
    
    return (fig, y_max)