diff options
author | Dmitry Sharshakov <sh7dm@outlook.com> | 2019-04-16 20:57:05 +0300 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2019-04-16 13:57:05 -0400 |
commit | 0c463582206881b6461742633a67f51632db614e (patch) | |
tree | ca51d8f32d586d77cd607c9fd50c242eb8f5ea3d /tools/benchmark_test.py | |
parent | 97f0fe7437ad4277afbdabf6cac214a40b637cd1 (diff) |
Add max memory benchmark (#2061)
Diffstat (limited to 'tools/benchmark_test.py')
-rwxr-xr-x[-rw-r--r--] | tools/benchmark_test.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tools/benchmark_test.py b/tools/benchmark_test.py index b2c4aa9a6..bc3ce8a71 100644..100755 --- a/tools/benchmark_test.py +++ b/tools/benchmark_test.py @@ -1,7 +1,9 @@ +#!/usr/bin/env python # Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. import sys import os import benchmark +from util import build_path, executable_suffix def strace_parse_test(): @@ -20,6 +22,12 @@ def strace_parse_test(): assert summary["total"]["calls"] == 704 +def max_mem_parse_test(): + with open(os.path.join(sys.path[0], "testdata/time.out"), "r") as f: + data = f.read() + assert benchmark.find_max_mem_in_bytes(data) == 120380 * 1024 + + def binary_size_test(build_dir): binary_size_dict = benchmark.get_binary_sizes(build_dir) assert binary_size_dict["deno"] > 0 @@ -43,6 +51,24 @@ def syscall_count_test(deno_path): def benchmark_test(build_dir, deno_path): strace_parse_test() binary_size_test(build_dir) + max_mem_parse_test() if "linux" in sys.platform: thread_count_test(deno_path) syscall_count_test(deno_path) + + +# This test assumes tools/http_server.py is running in the background. +def main(): + if len(sys.argv) == 2: + build_dir = sys.argv[1] + elif len(sys.argv) == 1: + build_dir = build_path() + else: + print "Usage: tools/benchmark_test.py [build_dir]" + sys.exit(1) + deno_exe = os.path.join(build_dir, "deno" + executable_suffix) + benchmark_test(build_dir, deno_exe) + + +if __name__ == '__main__': + main() |