# # Copyright (c) 2007-2009 Corey Goldberg (corey@goldb.org) # License: GNU GPLv3 # # This file is part of Pylot. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. See the GNU General Public License # for more details. # import time def write_starting_content(handle, test_name): if test_name: handle.write('

Pylot - %s Performance Results

\n' % test_name) else: handle.write('

Pylot - Performance Results

\n') def write_images(handle): handle.write('

Response Time

\n') handle.write('response time graph\n') handle.write('

Throughput

\n') handle.write('throughput graph\n') def write_stats_tables(handle, stats_dict): handle.write('


') handle.write('\n') handle.write('\n') handle.write('\n') handle.write('\n') handle.write('\n') handle.write('\n') handle.write('
Response Time (secs)Throughput (req/sec)
\n') handle.write('\n') handle.write('\n' % ('avg', stats_dict['response_avg'])) handle.write('\n' % ('stdev', stats_dict['response_stdev'])) handle.write('\n' % ('min', stats_dict['response_min'])) handle.write('\n' % ('50th %', stats_dict['response_50pct'])) handle.write('\n' % ('80th %', stats_dict['response_80pct'])) handle.write('\n' % ('90th %', stats_dict['response_90pct'])) handle.write('\n' % ('95th %', stats_dict['response_95pct'])) handle.write('\n' % ('99th %', stats_dict['response_99pct'])) handle.write('\n' % ('max', stats_dict['response_max'])) handle.write('
%s%.3f
%s%.3f
%s%.3f
%s%.3f
%s%.3f
%s%.3f
%s%.3f
%s%.3f
%s%.3f
\n') handle.write('
\n') handle.write('\n') handle.write('\n' % ('avg', stats_dict['throughput_avg'])) handle.write('\n' % ('stdev', stats_dict['throughput_stdev'])) handle.write('\n' % ('min', stats_dict['throughput_min'])) handle.write('\n' % ('50th %', stats_dict['throughput_50pct'])) handle.write('\n' % ('80th %', stats_dict['throughput_80pct'])) handle.write('\n' % ('90th %', stats_dict['throughput_90pct'])) handle.write('\n' % ('95th %', stats_dict['throughput_95pct'])) handle.write('\n' % ('99th %', stats_dict['throughput_99pct'])) handle.write('\n' % ('max', stats_dict['throughput_max'])) handle.write('
%s%.3f
%s%.3f
%s%d
%s%d
%s%d
%s%d
%s%d
%s%d
%s%d
\n') handle.write('
\n') def write_summary_results(handle, summary_dict, workload_dict): handle.write('%s:  %s
\n' % ('report generated', summary_dict['cur_time'])) start_time = time.strftime('%m/%d/%Y %H:%M:%S', time.localtime(workload_dict['start_epoch'])) end_time = time.strftime('%m/%d/%Y %H:%M:%S', time.localtime(workload_dict['start_epoch'] + summary_dict['duration'])) handle.write('test start:  %s
\n' % start_time) handle.write('test finish:  %s
\n' % end_time) handle.write('

Workload Model

') handle.write('\n') handle.write('\n' % ('test duration (secs)', summary_dict['duration'])) handle.write('\n' % ('agents', summary_dict['num_agents'])) handle.write('\n' % ('rampup (secs)', workload_dict['rampup'])) handle.write('\n' % ('interval (millisecs)', workload_dict['interval'])) handle.write('
%s%d
%s%d
%s%d
%s%d
\n') handle.write('

Results Summary

') handle.write('\n') handle.write('\n' % ('requests', summary_dict['req_count'])) handle.write('\n' % ('errors', summary_dict['err_count'])) handle.write('\n' % ('data received (bytes)', summary_dict['bytes_received'])) handle.write('
%s%d
%s%d
%s%d
\n') def write_agent_detail_table(handle, runtime_stats_dict): handle.write('

Agent Details

\n') handle.write('\n') handle.write('\n') for i in range(len(runtime_stats_dict)): agent_num = i + 1 agent_start_time = runtime_stats_dict[i].agent_start_time count = runtime_stats_dict[i].count error_count = runtime_stats_dict[i].error_count total_bytes = runtime_stats_dict[i].total_bytes avg_latency = runtime_stats_dict[i].avg_latency avg_connect_latency = runtime_stats_dict[i].avg_connect_latency handle.write('\n' % (agent_num, agent_start_time, count, error_count, total_bytes, avg_latency, avg_connect_latency)) handle.write('
AgentStart TimeRequestsErrorsBytes ReceivedAvg Response Time (secs)Avg Connect Time (secs)
%d%s%d%d%d%.3f%.3f
\n') def write_timer_group_stats(handle, timer_group_stats): handle.write('


') handle.write('

Timer Groups - Response Times

\n') handle.write('\n') handle.write('\n') for timer_group in timer_group_stats: stat_list = timer_group_stats[timer_group] handle.write('\n' % (timer_group, stat_list[0], stat_list[1], stat_list[2], stat_list[3], stat_list[4], stat_list[5], stat_list[6], stat_list[7], stat_list[8], stat_list[9]) ) handle.write('
Timer GroupCountavgstdevmin50th %80th %90th%95th %99th %max
%s %i %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f
\n') handle.write('


') handle.write('\n') def write_best_worst_requests(handle, best_times, worst_times): handle.write('


') handle.write('

Fastest Responding URLs

\n') handle.write('\n') handle.write('\n') for url in best_times: resp_time = best_times[url] handle.write('\n' % (url, resp_time)) handle.write('
Request URLAvg Response Time (secs)
%s%.3f
\n') handle.write('


') handle.write('

Slowest Responding URLs

\n') handle.write('\n') handle.write('\n') for url in worst_times: resp_time = worst_times[url] handle.write('\n' % (url, resp_time)) handle.write('
Request URLAvg Response Time (secs)
%s%.3f
\n') def write_head_html(handle): handle.write("""\ Pylot - Results """) def write_closing_html(handle): handle.write("""\



""")