def constructImage(self):
        line = Line()
        line.xValues = range(5)
        line.yValues = [2, 3, 5, 7, 9]
        line.label = "A Line"

        linePlot1 = Plot()
        linePlot1.title = "Small Legend"
        linePlot1.add(line)
        linePlot1.hasLegend()
        linePlot1.legendLabelSize = 10

        linePlot2 = Plot()
        linePlot2.title = "Large Legend"
        linePlot2.add(line)
        linePlot2.hasLegend()
        linePlot2.legendLabelSize = 30

        linePlot3 = Plot()
        linePlot3.title = "Inherited from Layout"
        linePlot3.add(line)
        linePlot3.hasLegend()

        layout = PlotLayout()
        layout.width = 2
        layout.addPlot(linePlot1)
        layout.addPlot(linePlot2)
        layout.addPlot(linePlot3)
        layout.legendLabelSize = 15

        layout.save(self.imageName)
    def constructImage(self):
        line = Line()
        line.xValues = range(5)
        line.yValues = [2,3,5,7,9]
        line.label = "A Line"

        linePlot1 = Plot()
        linePlot1.title = "Small Legend"
        linePlot1.add(line)
        linePlot1.hasLegend()
        linePlot1.legendLabelSize = 10

        linePlot2 = Plot()
        linePlot2.title = "Large Legend"
        linePlot2.add(line)
        linePlot2.hasLegend()
        linePlot2.legendLabelSize = 30

        linePlot3 = Plot()
        linePlot3.title = "Inherited from Layout"
        linePlot3.add(line)
        linePlot3.hasLegend()

        layout = PlotLayout()
        layout.width = 2
        layout.addPlot(linePlot1)
        layout.addPlot(linePlot2)
        layout.addPlot(linePlot3)
        layout.legendLabelSize = 15

        layout.save(self.imageName)
示例#3
0
def main():

    output_graph = sys.argv[1]

    plot = Plot()
    plot.hasLegend(location='lower right')
    plot.xLabel = 'Per-client throughput (Mbps)'  # Change this
    plot.yLabel = 'CDF'
    plot.xLimits = (0, 50)
    plot.yLimits = (0, 1)
    plot.legendLabelSize = FONT_SIZE
    plot.xTickLabelSize = FONT_SIZE - 2
    plot.yTickLabelSize = FONT_SIZE - 2
    plot.axesLabelSize = FONT_SIZE
    
    for csv_file in sys.argv[2:]:
        
        cdf_table = _make_cdf(csv_file)
        
        line = Line()
        line.xValues = [x for (x, _) in cdf_table]
        line.yValues = [y for (_, y) in cdf_table]
        line.color = colors.pop(0)
        line.lineStyle = line_styles.pop(0)
        
        # Extract the filename
        line.label = capitalize( csv_file.split('/')[-2].replace('.csv', '') )
        plot.add(line)
        
    plot.save(output_graph)
示例#4
0
def latency(output_graph_filename, csv_file_dir_list):
    """
    Plots three graphs side-by-side. First, redis performance; second, pkt-in
    latency; third, pkt-out latency.
    
    """
    layout = PlotLayout()
    redis_plot = Plot()
    pkt_in_plot = Plot()
    flow_mod_plot = Plot()

    redis_plot.yLabel = 'CDF'
    flow_mod_plot.hasLegend(location='lower right')
    flow_mod_plot.legendLabelSize = 12
        
    redis_plot.xLabel = '(a) Query completion time (ms)'
    pkt_in_plot.xLabel = '(b) Switch processing time for ingress (ms)'
    flow_mod_plot.xLabel = '(c) Switch processing time for egress (ms)'
    
    for csv_dir in csv_file_dir_list:
        
        color = colors.pop(0)
        line_style = line_styles.pop(0)
        line_label = csv_dir.split('/')[-2]
        attr_dict = {'color': color, 'label': capitalize(line_label), 
                     'yLimits': (0, 1), 'lineStyle': line_style}
        
        redis_line = get_line_from_csv(os.path.join(csv_dir, 'async_redis_latency.csv'), 
                                       xLimits=(0,400), **attr_dict) 
        pkt_in_line = get_line_from_csv(os.path.join(csv_dir, 'pkt_in_durations.csv'), 
                                        xLimits=(0,140), **attr_dict) 
        flow_mod_line = get_line_from_csv(os.path.join(csv_dir, 'flow_mod_durations.csv'), 
                                          xLimits=(0,140), **attr_dict)         
        redis_plot.add(redis_line)
        pkt_in_plot.add(pkt_in_line)
        flow_mod_plot.add(flow_mod_line)

    
    layout.addPlot(redis_plot)
    layout.addPlot(pkt_in_plot)
    layout.addPlot(flow_mod_plot)
    layout.width = 3
    layout.setPlotDimensions(4.5,4.5*0.618)
    
    layout.save('data/graphs/' + output_graph_filename + '.pdf')
    print 'Done.'