def update_ui_worker():
global main_start, total_seconds, _timeout, hits, workers, status, test_number, total_seconds, test_start, \
test_stop, requests_handled, test_seconds, _tolerance, _url, break_out
while True:
rc = utils.render_result_codes(result_codes, timeout_count, connection_error_count)
if not q.empty() and main_start:
total_seconds = time.time()-main_start
screen.addstr(1, 2, 'PAIN TOLERANCE on %s' % _url, curses.color_pair(3)|curses.A_BOLD)
screen.addstr(3, 2, 'Status: %s ' % status)
screen.addstr(5, 2, 'Trying %s hits with %s workers ' % (hits, workers))
screen.addstr(6, 2, 'Timeout: %s seconds ' % (_timeout,))
screen.addstr(6, 40, 'Tolerance: %s errors ' % (_tolerance,))
screen.addstr(7, 2, 'Active Workers: %s ' % (threading.active_count() - 2))
screen.addstr(7, 40, 'Queue: %s ' % q.qsize())
if test_start is None:
test_seconds = 0
else:
if test_stop is None:
test_seconds = time.time() - test_start
else:
test_seconds = test_stop - test_start
screen.addstr(9, 2, 'Test Seconds: %.2f ' % test_seconds)
screen.addstr(9, 40, 'Requests handled: %s ' % requests_handled)
if result_codes and test_seconds and '200 OK' in result_codes:
screen.addstr(10, 2, 'Requests per second: %.2f ' % (int(result_codes['200 OK']) / test_seconds), )
if durations:
screen.addstr(10, 40, 'Average Request: %.2f seconds ' % (reduce(lambda x, y: x + y, durations) / len(durations)))
screen.addstr(12, 2, rc)
screen.refresh()
time.sleep(0.1)
评论列表
文章目录