Skip to content

Commit

Permalink
fix: accomodate weighttp option and output
Browse files Browse the repository at this point in the history
  • Loading branch information
JackyYin committed Sep 14, 2021
1 parent 3b0aeac commit 09783cb
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/scripts/benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def weighttp(url, n_threads, n_connections, n_requests, keep_alive):
'-t %(n_threads)d ' \
'-c %(n_connections)d ' \
'-n %(n_requests)d ' \
'-q ' \
'%(url)s 2> /dev/null' % locals()

clearstderrline()
Expand Down Expand Up @@ -149,11 +150,6 @@ def log(self, keep_alive, n_connections, rps, kbps, _2xx, _3xx, _4xx, _5xx):


if __name__ == '__main__':
if not weighttp_has_json_output():
print('This script requires a special version of weighttp which supports JSON')
print('output. Get it at http://github.com/lpereira/weighttp')
sys.exit(1)

plot = cmdlineboolarg('--plot')
xkcd = cmdlineboolarg('--xkcd')
n_threads = cmdlineintarg('--threads', 2)
Expand Down Expand Up @@ -181,7 +177,7 @@ def log(self, keep_alive, n_connections, rps, kbps, _2xx, _3xx, _4xx, _5xx):
status = results['status_codes']

output.log(keep_alive, n_connections, results['reqs_per_sec'],
results['kbyte_per_sec'], status['2xx'], status['3xx'],
results['kBps_per_sec'], status['2xx'], status['3xx'],
status['4xx'], status['5xx'])
sleepwithstatus('Waiting for keepalive connection timeout', keep_alive_timeout * 1.1)

Expand Down

0 comments on commit 09783cb

Please sign in to comment.