From 9b51393b6ddaec52298cdcf8e800312f41f809fd Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Tue, 8 May 2018 11:00:20 +1200 Subject: benchmark: keep track of requests/responses seen by proxy --- test/bench/benchmark.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test/bench') 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() -- cgit v1.2.3 From 1b0eed19d1429b291349bcd92c19bb6f41cf867a Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Tue, 8 May 2018 11:08:37 +1200 Subject: benchmarks: quick-run scripts for mitmproxy and mitmdump --- test/bench/run | 4 ---- test/bench/run-mitmdump | 4 ++++ test/bench/run-mitmproxy | 4 ++++ 3 files changed, 8 insertions(+), 4 deletions(-) delete mode 100755 test/bench/run create mode 100755 test/bench/run-mitmdump create mode 100755 test/bench/run-mitmproxy (limited to 'test/bench') diff --git a/test/bench/run b/test/bench/run deleted file mode 100755 index 9925b578..00000000 --- a/test/bench/run +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -mkdir -p results -mitmdump -p0 -q --set benchmark_save_path=./results/mitmdump -s ./benchmark.py \ No newline at end of file diff --git a/test/bench/run-mitmdump b/test/bench/run-mitmdump new file mode 100755 index 00000000..9925b578 --- /dev/null +++ b/test/bench/run-mitmdump @@ -0,0 +1,4 @@ +#!/bin/sh + +mkdir -p results +mitmdump -p0 -q --set benchmark_save_path=./results/mitmdump -s ./benchmark.py \ No newline at end of file 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 -- cgit v1.2.3