diff options
author | Kevin (Kun) "Kassimo" Qian <kevinkassimo@gmail.com> | 2018-09-24 23:58:18 -0400 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2018-09-24 23:58:18 -0400 |
commit | d957f8ebc24bcbdb94c0c5297c0072aa8d2ebec8 (patch) | |
tree | 46392609e261833733b463eec5a1e16be79cc71a /tools/benchmark_test.py | |
parent | 234d5ea780d8621866da87097c78ec10167cbdc5 (diff) |
Add syscall count benchmark for 002_hello.ts (#820)
* Add syscall count tracking for benchmark
* Add fetch_deps thread benchmark
* Switch to `strace -c` for syscall parsing
* Spawn http_server during benchmark (for fetch)
* Rename `benchmarks` to `exec_time_benchmarks`
* Update app_test.js
Diffstat (limited to 'tools/benchmark_test.py')
-rw-r--r-- | tools/benchmark_test.py | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/tools/benchmark_test.py b/tools/benchmark_test.py index 017314fbb..cdaad1e1f 100644 --- a/tools/benchmark_test.py +++ b/tools/benchmark_test.py @@ -1,10 +1,38 @@ import sys import os -from benchmark import run_thread_count_benchmark +import benchmark + + +def strace_parse_test(): + with open(os.path.join(sys.path[0], "testdata/strace_summary.out"), + "r") as f: + summary = benchmark.strace_parse(f.read()) + # first syscall line + assert summary["munmap"]["calls"] == 60 + assert summary["munmap"]["errors"] == 0 + # line with errors + assert summary["mkdir"]["errors"] == 2 + # last syscall line + assert summary["prlimit64"]["calls"] == 2 + assert summary["prlimit64"]["% time"] == 0 + # summary line + assert summary["total"]["calls"] == 704 + + +def thread_count_test(deno_path): + thread_count_dict = benchmark.run_thread_count_benchmark(deno_path) + assert "set_timeout" in thread_count_dict + assert thread_count_dict["set_timeout"] > 1 + + +def syscall_count_test(deno_path): + syscall_count_dict = benchmark.run_syscall_count_benchmark(deno_path) + assert "hello" in syscall_count_dict + assert syscall_count_dict["hello"] > 1 def benchmark_test(deno_path): + strace_parse_test() if "linux" in sys.platform: - thread_count_dict = run_thread_count_benchmark(deno_path) - assert "set_timeout" in thread_count_dict - assert thread_count_dict["set_timeout"] > 1 + thread_count_test(deno_path) + syscall_count_test(deno_path) |