Exemplo n.º 1
0
def on_quitting():
    total = global_stats.aggregated_stats(full_request_history=True)
    for k, v in total.__dict__.iteritems():
        if k.startswith("_"):
            break
        else:
            print "{}: {}".format(k, total.__dict__[k])
Exemplo n.º 2
0
def print_percentile_stats_extra(stats):
    print("Percentage of the requests completed within given times")
    print((" %-" + str(STATS_NAME_WIDTH) + "s %8s %6s %6s %6s %6s %6s %6s %6s %6s %6s") % (
    'Name', '# reqs', '50%', '66%', '75%', '80%', '90%', '95%', '98%', '99%', '100%'))
    print("-" * (80 + STATS_NAME_WIDTH))
    for key in sorted(six.iterkeys(stats)):
        r = stats[key]
        if r.response_times:
            print(r.percentile())
    print("-" * (80 + STATS_NAME_WIDTH))

    total_stats = global_stats.aggregated_stats()
    if total_stats.response_times:
        print(total_stats.percentile())
    print("")
Exemplo n.º 3
0
def on_quitting():
    requests_csv = global_stats.aggregated_stats()
    if not os.path.exists('results'):
        os.makedirs('results')
    timestamp = time.strftime("%Y%m%d-%H%M%S")
    with open('results/%s.csv' % (timestamp), 'w') as csvfile:
        fieldnames = ['enpoint', 'median_response_time', 'num_requests']
        writer = csv.DictWriter(csvfile, fieldnames=fieldnames)
        writer.writeheader()
        for key, value in requests_csv.stats.entries.items():
            writer.writerow({
                'enpoint': ' '.join(key),
                'median_response_time': value.median_response_time,
                'num_requests': value.num_requests
            })
Exemplo n.º 4
0
def on_quitting():
    aggregated_stats = global_stats.aggregated_stats("Total").get_stripped_report()

    f = open('stats.json','w')
    f.write(str(aggregated_stats))
    f.close()