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

Enable custom profiling interval via CLI flag (#357) #437

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

omarjatoi
Copy link

@omarjatoi omarjatoi commented Oct 12, 2024

Issue: #357 (guest profiler support originally added in #301)

This PR adds the ability to pass a profiling interval to Viceroy, e.g. --profile=guest,/tmp/path,25 will set the profiling sample interval to 25 ms.

Open question(s):

  1. It looks like wasmtime will parse the time including units, e.g. --profile=guest,/some/path,25ms. This PR assumes milliseconds by default. I can either add a small parse_duration helper function or use the humantime crate (used by wasmtime, so already an implicit project dependency) to stay consistent with wasmtime. Thoughts?
    EDIT: I've added support for humantime, but if this is not preferable I'm happy to revert the latest change.
  2. In Viceroy, the default sampling interval is set to be 0.05 ms (50 microseconds). The default interval in wasmtime appears to be 10 ms. Should Viceroy's default be changed?
  3. Current CLI tests do not test anything related to profiling, I'm not sure how valuable those tests would be but I can certainly try to write something to cover the functionality/changes in this PR.

Add match case for when interval is None, and when one exists
also update `profile_guest()`, ignore interval in that function
Pass `None` for profiling interval in tests
ExecuteCtx::new takes an additional argument now, namely the profiling interval.
- Should be allowed to pass interval as `100ms` or `100` and default to milliseconds
@omarjatoi omarjatoi marked this pull request as ready for review October 25, 2024 20:05
@omarjatoi
Copy link
Author

Hi @katef, I moved this from draft to 'ready for review'. Please let me know if this looks alright!

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.

1 participant