diff options
author | Aldo Cortesi <aldo@corte.si> | 2018-05-08 14:53:56 +1200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-08 14:53:56 +1200 |
commit | 8a682d3532ec071f20f4ba0f4700fbcdb7921699 (patch) | |
tree | cc437a95786c34200340e43e39c145f0c5ea5d25 /test/bench | |
parent | 7ec9c5524f64bbceaf52b58696c8c9342a4887dd (diff) | |
parent | 717fbaa99076545d11f554187759005dce1aa67b (diff) | |
download | mitmproxy-8a682d3532ec071f20f4ba0f4700fbcdb7921699.tar.gz mitmproxy-8a682d3532ec071f20f4ba0f4700fbcdb7921699.tar.bz2 mitmproxy-8a682d3532ec071f20f4ba0f4700fbcdb7921699.zip |
Merge pull request #3105 from cortesi/opts
Add deferred options, tweak benchmarks, document done event
Diffstat (limited to 'test/bench')
-rw-r--r-- | test/bench/benchmark.py | 10 | ||||
-rwxr-xr-x | test/bench/run-mitmdump (renamed from test/bench/run) | 0 | ||||
-rwxr-xr-x | test/bench/run-mitmproxy | 4 |
3 files changed, 14 insertions, 0 deletions
diff --git a/test/bench/benchmark.py b/test/bench/benchmark.py index 8d208088..84ec6005 100644 --- a/test/bench/benchmark.py +++ b/test/bench/benchmark.py @@ -11,6 +11,15 @@ class Benchmark: self.pr = cProfile.Profile() self.started = False + self.resps = 0 + self.reqs = 0 + + def request(self, f): + self.reqs += 1 + + def response(self, f): + self.resps += 1 + async def procs(self): ctx.log.error("starting benchmark") backend = await asyncio.create_subprocess_exec("devd", "-q", "-p", "10001", ".") @@ -23,6 +32,7 @@ class Benchmark: ) stdout, _ = await traf.communicate() open(ctx.options.benchmark_save_path + ".bench", mode="wb").write(stdout) + ctx.log.error("Proxy saw %s requests, %s responses" % (self.reqs, self.resps)) ctx.log.error(stdout.decode("ascii")) backend.kill() ctx.master.shutdown() diff --git a/test/bench/run b/test/bench/run-mitmdump index 9925b578..9925b578 100755 --- a/test/bench/run +++ b/test/bench/run-mitmdump diff --git a/test/bench/run-mitmproxy b/test/bench/run-mitmproxy new file mode 100755 index 00000000..4f1f626e --- /dev/null +++ b/test/bench/run-mitmproxy @@ -0,0 +1,4 @@ +#!/bin/sh + +mkdir -p results +mitmproxy -p0 -q --set benchmark_save_path=./results/mitmproxy -s ./benchmark.py
\ No newline at end of file |