Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add syscall count benchmark for 002_hello.ts #820

Merged
merged 8 commits into from
Sep 25, 2018

Conversation

kevinkassimo
Copy link
Contributor

Uses strace. Specially handling interleaving syscall report cases (<unfinished> and <resumed>, keep only one of them) and skipping +++ exited with 0 +++ lines

syscall_count

Copy link
Member

@ry ry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be great : )

lambda line: "<... unfinished>" not in line and # <unfinished> and <resume> repeats same syscall
"+++ exited with" not in line, # lines labelling exit
[deno_path, "tests/002_hello.ts", "--reload"])
return syscall_count_map
Copy link
Member

@ry ry Sep 24, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the parsing of strace is becoming more complex, I think you should store a trace

strace deno tests/001_hello.js >& tools/testdata/strace1.txt

And then check that you get the correct value in benchmark_test.py. This will be much more robust and debuggable than just testing > 1.

Copy link
Contributor Author

@kevinkassimo kevinkassimo Sep 25, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just noticed that strace has an option -c that generates a nice call summary. However, summaries show the same program calling syscalls different times and with slightly different orders. For example, in my testing, futex is called with either 3 or 4 times and varies across runs. Dunno if same program would even have a slightly different set of syscalls running each time (I suspect that certain packages might actually do such things)

Copy link
Member

@ry ry Sep 25, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The syscalls are definitely not going to be constant - there's a lot of complexity in deno. Using the -c option sounds great - store the output into //tools/testdata/strace_summary.txt and check that you can parse it independently of the benchmark.

Copy link
Contributor Author

@kevinkassimo kevinkassimo Sep 25, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just want to clarify, the purpose of this file is to ensure that we can do parsing correctly, right? For example, if we have a table saved in strace_summary.txt that looks like

calls     name
=============
4         futex
2         mmap

then would validate in our benchmark test that the our parsing logic would give us exactly 6 for total syscall count. Am I understanding correctly?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

let r = strace_parse("tools/testdata/systrace_count.txt");
assert r['futex'] == 4
assert r['mmap'] == 2

try:
http_server.spawn()
except:
"Warning: another http_server instance is running"

# The list of the tuples of the benchmark name and arguments
benchmarks = [("hello", ["tests/002_hello.ts", "--reload"]),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this isn't part of your commit, but could you rename benchmarks to exec_time_benchmarks ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem

Copy link
Member

@ry ry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!
I've been reloading updates of https://denoland.github.io/deno/ all day : )

@ry ry merged commit d957f8e into denoland:master Sep 25, 2018
@kevinkassimo kevinkassimo deleted the benchmark/syscall_count branch December 27, 2019 07:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants