1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-25 15:29:32 -05:00

Fix bug in strace parser (#3720)

Co-authored-by: @kt3k
This commit is contained in:
Ry Dahl 2020-01-20 09:49:18 -05:00 committed by GitHub
parent 7f80f9db3f
commit e83658138b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 52 additions and 0 deletions

View file

@ -89,6 +89,10 @@ def strace_parse(summary_text):
summary = {}
# clear empty lines
lines = list(filter(lambda x: x and x != "\n", summary_text.split("\n")))
# Filter out non-relevant lines. See the error log at
# https://github.com/denoland/deno/pull/3715/checks?check_run_id=397365887
# This is checked in tools/testdata/strace_summary2.out
lines = [x for x in lines if x.find("detached ...") == -1]
if len(lines) < 4:
return {} # malformed summary
lines, total_line = lines[2:-2], lines[-1]

View file

@ -24,6 +24,17 @@ class TestBenchmark(DenoTestCase):
# summary line
assert summary["total"]["calls"] == 704
def test_strace_parse2(self):
with open(
os.path.join(sys.path[0], "testdata/strace_summary2.out"),
"r") as f:
summary = benchmark.strace_parse(f.read())
# first syscall line
assert summary["futex"]["calls"] == 449
assert summary["futex"]["errors"] == 94
# summary line
assert summary["total"]["calls"] == 821
def test_max_mem_parse(self):
with open(os.path.join(sys.path[0], "testdata/time.out"), "r") as f:
data = f.read()

37
tools/testdata/strace_summary2.out vendored Normal file
View file

@ -0,0 +1,37 @@
17697 ????( <detached ...>
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
63.19 0.030363 68 449 94 futex
34.70 0.016672 16672 1 epoll_wait
1.58 0.000761 6 129 mprotect
0.40 0.000193 3 58 madvise
0.11 0.000055 3 17 brk
0.01 0.000003 0 32 mmap
0.00 0.000000 0 20 1 read
0.00 0.000000 0 1 write
0.00 0.000000 0 14 open
0.00 0.000000 0 17 close
0.00 0.000000 0 10 fstat
0.00 0.000000 0 10 munmap
0.00 0.000000 0 5 rt_sigaction
0.00 0.000000 0 1 rt_sigprocmask
0.00 0.000000 0 4 4 ioctl
0.00 0.000000 0 8 8 access
0.00 0.000000 0 6 sched_yield
0.00 0.000000 0 3 clone
0.00 0.000000 0 1 execve
0.00 0.000000 0 3 fcntl
0.00 0.000000 0 5 getcwd
0.00 0.000000 0 2 getrlimit
0.00 0.000000 0 9 sigaltstack
0.00 0.000000 0 3 prctl
0.00 0.000000 0 1 arch_prctl
0.00 0.000000 0 3 sched_getaffinity
0.00 0.000000 0 1 set_tid_address
0.00 0.000000 0 1 epoll_ctl
0.00 0.000000 0 4 set_robust_list
0.00 0.000000 0 1 epoll_create1
0.00 0.000000 0 1 pipe2
0.00 0.000000 0 1 getrandom
------ ----------- ----------- --------- --------- ----------------
100.00 0.048047 821 107 total