示例#1
0
def plot(path):
    table = dataextract.readCSVTable(path)

    # Take only the little endian results
    #~ table = dataextract.select(table, [(1, "le")])
    # Express buffer size in kB
    table = [(r[0], r[1], r[2]/1024, r[3]) for r in table]
    # Express throughput in GB/s
    #~ table = [(r[0], r[1], r[2], r[3]/1024.) for r in table]
    groups = dataextract.groupBy(table, [0, 1])

    datasets = []
    keys = groups.keys()
    keys.sort(labelCmp)
    for key in keys:
        data = dataextract.selectStatsConfPlot(groups[key], [2], 3)
        label = ("Buffer Size (kB)", "%s %s" % (LABEL_MAP[key[0]], LABEL_MAP[key[1]]))
        #~ label = ("Buffer Size (kB)", LABEL_MAP[key[0]])
        print label
        data.insert(0, label)
        datasets.append(data)
        print data

    #~ data = dataextract.selectStatsConfPlot(table, [0, 1, 2], 3)
    #~ print data
    
    options = {
            "key": "bottom right",
            "errorbars": [1],
            "xrange": "[0:]",
            "yrange": "[0:]",
            #~ "ylabel": "Write Throughput (GB/s)",
            #~ "ylabel": "Fill Byte Throughput (MB/s)",
            "ylabel": "Fill Int Throughput (MB/s)",
            "xformat": "%.0f",
            #~ "xtics": "1024",
            "yformat": "%.0f",
    }
    stupidplot.gnuplotTable(datasets, "out.eps", options)
                output.append(current_results)
            current_results = [[xaxis_column, str(row_type)]]
            last_type = row_type
        current_results.append((r[xaxis_index], r[yaxis_index]))

    if current_results is not None:
        output.append(current_results)
    
    return output


if __name__ == "__main__":
    input_path = sys.argv[1]

    # Load the CSV data
    table = dataextract.readCSVTable(input_path)

    # Load the data into SQLite
    connection = sqlite3.connect(":memory:")
    dataextract.sqlFromTable(connection, "results", table)
    c = connection.cursor()

    charsets = []
    for r in connection.execute("select distinct charset from results"):
        charsets.append(r[0])

    for charset in charsets:
        output = xaxis(c, "string_length", "chars_per_us", charset=charset)
        average_out = []
        for table in output:
            average_table = [table[0]]