mitmproxy/test/helper_tools/bench.py

24 lines
540 B
Python
Raw Normal View History

2015-05-30 00:03:28 +00:00
import requests
import time
2015-01-09 15:40:26 +00:00
n = 100
url = "http://192.168.1.1/"
proxy = "http://192.168.1.115:8080/"
start = time.time()
for _ in range(n):
2015-05-30 00:03:28 +00:00
requests.get(url, allow_redirects=False, proxies=dict(http=proxy))
print(".", end="")
t_mitmproxy = time.time() - start
2015-01-09 15:40:26 +00:00
print("\r\nTotal time with mitmproxy: {}".format(t_mitmproxy))
start = time.time()
for _ in range(n):
2015-05-30 00:03:28 +00:00
requests.get(url, allow_redirects=False)
print(".", end="")
t_without = time.time() - start
2015-01-09 15:40:26 +00:00
2015-05-30 00:03:28 +00:00
print("\r\nTotal time without mitmproxy: {}".format(t_without))