-
Notifications
You must be signed in to change notification settings - Fork 59
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
[FEATURE REQUEST] Support more profilers with fastly compute serve
#1103
Comments
Could you make this work by writing a wrapper script that invokes viceroy under your profiler of choice, and passing that to the CLI via |
For the record, I tested this and it does work:
Then:
|
That's a great proof of concept, thanks! I don't think shell-script wrappers really address the UX points I was raising, but I do think this is a good way to prototype the necessary functionality. For Linux #!/bin/sh
perf record -k mono viceroy --profile jitdump "$@"
perf inject --jit --input perf.data --output perf.jit.data
echo 'now run `perf report --input perf.jit.data`' |
Until this is implemented, this can be achieved via #1186 . |
#1186 is great but note that if you do something like |
@jameysharp good point. I wonder if we should include some scripts together with the CLI and direct people to use |
Is your feature request related to a problem? Please describe.
The
fastly compute serve --profile-guest
option works on all platforms and doesn't require installing any additional software, so it's a great default choice for profiling, but it has some limitations compared to native profilers like Linuxperf
or Intel VTune. Viceroy supports these other profilers via its--profile
option but the Fastly CLI doesn't expose those alternatives when invoking Viceroy withfastly compute serve
.Describe the solution you'd like
Add an option to
fastly compute serve
that causes it to pass e.g.--profile=jitdump
to Viceroy. Currently Viceroy also supportsperfmap
andvtune
variants.It would be preferable to also wrap Viceroy in the appropriate profiler. For example, profiling with VTune means running
vtune -run-pass-thru=--no-altstack -collect hotspots viceroy --profile=vtune
instead of just runningviceroy
.When using Linux
perf
injitdump
mode, after recording the profile withperf record
, the user has to additionally run something likeperf inject --jit --input perf.data --output perf.jit.data
. It would be nice to do this for them. It would also be nice to haveperf record
write to a temporary file and haveperf inject
output to theperf.data
name thatperf report
expects to read from.The user may want to pass additional options to the profiler so it would be good to have an option for that.
Describe alternatives you've considered
Adding support for passing through uninterpreted arguments to Viceroy, as suggested in #1047, might work here too. However, that means the user has to wrap the profiler around the Fastly CLI and ensure that it profiles child processes as well, which not only makes the user experience more complex but will add a bunch of data they don't care about to the profile.
In the future, Wasmtime and Viceroy may gain support for more profilers. It would be nice if we didn't need to change the Fastly CLI to support new profilers, which would suggest making the profiler name be an uninterpreted string. We could probably define some way for Viceroy to tell the CLI what profilers it supports and perhaps how to invoke them, or make Viceroy re-spawn itself under the appropriate profiler.
Additional context
The Wasmtime book documents Wasmtime's support for external profilers, specifically perf and VTune. There's also documentation on using Samply with Wasmtime which relies on the same
perfmap
profiling mode thatperf
can use.The text was updated successfully, but these errors were encountered: