コード例 #1
0
ファイル: plots.py プロジェクト: puria/chainspace
def plot_shard_scaling(results1, results2, outfile):
    parsed_results1 = parse_shard_results(results1)
    if results2 != None:
        parsed_results2 = parse_shard_results(results2)

    pyplot.xlabel('Number of shards')
    pyplot.ylabel('Average transactions / second')
    pyplot.grid(True)

    pyplot.errorbar(
        range(2,
              len(parsed_results1) + 2),
        [i[0] for i in parsed_results1],
        [i[1] for i in parsed_results1],
        marker='o',
        #color='black',
    )
    if results2 != None:
        pyplot.errorbar(
            range(2,
                  len(parsed_results2) + 2),
            [i[0] for i in parsed_results2],
            [i[1] for i in parsed_results2],
            marker='o',
            #color='black',
        )

    pyplot.savefig(outfile)
    pyplot.close()
コード例 #2
0
def plot_shard_scaling3(results1, results2, outfile):
    parsed_results1 = parse_shard_results(results1)
    parsed_results2 = parse_shard_results(results2)
    pyplot.xlabel('Number of shards')
    pyplot.ylabel('Transactions / second')
    pyplot.grid(True)

    pyplot.errorbar([i for i in range(2,
                                      len(parsed_results1) + 2)],
                    [i[0] for i in parsed_results1],
                    [0 for i in parsed_results1],
                    marker='o',
                    color='C0',
                    label='Without defenses')

    pyplot.errorbar([i - 0.01 for i in range(2,
                                             len(parsed_results1) + 2)],
                    [i[0] for i in parsed_results1],
                    [i[1] for i in parsed_results1],
                    color='C0',
                    fmt='')

    pyplot.errorbar([i for i in range(2,
                                      len(parsed_results2) + 2)],
                    [i[0] for i in parsed_results2],
                    [0 for i in parsed_results2],
                    marker='s',
                    color='C1',
                    label='With defenses')

    pyplot.errorbar([i + 0.01 for i in range(2,
                                             len(parsed_results2) + 2)],
                    [i[0] for i in parsed_results2],
                    [i[1] for i in parsed_results2],
                    color='C1',
                    fmt='')

    pyplot.locator_params(nbins=len(parsed_results1))
    pyplot.legend(loc=4)
    pyplot.savefig(outfile)
    pyplot.close()
コード例 #3
0
def plot_shard_scaling2(results1, results2, outfile):
    parsed_results1 = parse_shard_results(results1)
    parsed_results2 = parse_shard_results(results2)
    pyplot.xlabel('Number of shards')
    pyplot.ylabel('Average transactions / second')
    pyplot.grid(True)

    pyplot.errorbar([i for i in range(2,
                                      len(parsed_results1) + 2)],
                    [i[0] for i in parsed_results1],
                    [0 for i in parsed_results1],
                    marker='o',
                    color='C0',
                    label='1 input')

    pyplot.errorbar([i - 0.03 for i in range(2,
                                             len(parsed_results1) + 2)],
                    [i[0] for i in parsed_results1],
                    [i[1] for i in parsed_results1],
                    color='C0',
                    fmt='')

    pyplot.errorbar([i for i in range(2,
                                      len(parsed_results2) + 2)],
                    [i[0] for i in parsed_results2],
                    [0 for i in parsed_results2],
                    marker='s',
                    color='C1',
                    label='2 inputs')

    pyplot.errorbar([i + 0.03 for i in range(2,
                                             len(parsed_results2) + 2)],
                    [i[0] for i in parsed_results2],
                    [i[1] for i in parsed_results2],
                    color='C1',
                    fmt='')

    pyplot.legend(loc=4)
    pyplot.savefig(outfile)
    pyplot.close()
コード例 #4
0
def plot_input_scaling2(results1, results2, outfile):
    parsed_results1 = parse_shard_results(results1)
    parsed_results2 = parse_shard_results(results2)
    pyplot.xlabel('Number of inputs per transaction')
    pyplot.ylabel('Transactions / second')
    pyplot.grid(True)

    pyplot.errorbar([i for i in range(1,
                                      len(parsed_results1) + 1)],
                    [i[0] for i in parsed_results1],
                    [0 for i in parsed_results1],
                    marker='o',
                    color='C0',
                    label='Without defenses')

    pyplot.errorbar([i - 0.03 for i in range(1,
                                             len(parsed_results1) + 1)],
                    [i[0] for i in parsed_results1],
                    [i[1] for i in parsed_results1],
                    color='C0',
                    fmt='')

    pyplot.errorbar([i for i in range(1,
                                      len(parsed_results2) + 1)],
                    [i[0] for i in parsed_results2],
                    [0 for i in parsed_results2],
                    marker='s',
                    color='C1',
                    label='With defenses')

    pyplot.errorbar([i + 0.03 for i in range(1,
                                             len(parsed_results2) + 1)],
                    [i[0] for i in parsed_results2],
                    [i[1] for i in parsed_results2],
                    color='C1',
                    fmt='')

    pyplot.legend(loc=4)
    pyplot.savefig(outfile)
    pyplot.close()
コード例 #5
0
def plot_node_scaling(results, outfile, step):
    parsed_results = parse_shard_results(results)
    pyplot.xlabel('Number of replicas per shard')
    pyplot.ylabel('Average transactions / second')
    pyplot.grid(True)

    pyplot.errorbar(
        range(4, 4 + len(parsed_results) * step, step),
        [i[0] for i in parsed_results],
        [i[1] for i in parsed_results],
        marker='o',
    )

    pyplot.savefig(outfile)
    pyplot.close()
コード例 #6
0
def plot_input_scaling(results, outfile):
    parsed_results = parse_shard_results(results)
    pyplot.xlabel('Number of inputs per transaction')
    pyplot.ylabel('Transactions / second')
    pyplot.grid(True)

    pyplot.errorbar(
        range(1,
              len(parsed_results) + 1),
        [i[0] for i in parsed_results],
        [i[1] for i in parsed_results],
        marker='o',
    )

    pyplot.savefig(outfile)
    pyplot.close()
コード例 #7
0
def plot_bano(results, outfile):
    parsed_results = parse_shard_results(results)
    pyplot.xlabel('Number of dummy inputs per transaction')
    pyplot.ylabel('Transactions / second')
    pyplot.grid(True)

    pyplot.errorbar(
        range(1,
              len(parsed_results) + 1),
        [i[0] for i in parsed_results],
        [i[1] for i in parsed_results],
        marker='o',
    )

    pyplot.locator_params(nbins=len(parsed_results))
    pyplot.savefig(outfile)
    pyplot.close()