alexcrichton requested pchickey for a review on PR #11865.
alexcrichton opened PR #11865 from alexcrichton:multi-engine-profiling to bytecodealliance:main:
Both the perfmap and jitdump protocols for profiling JITs require that there's a single file with metadata per-process. This has the unfortunate side effect of if there are multiple engines in the same process there's no real way for them to coordinate when writing out records to this file. In an attempt to at least try to synchronize this commit updates these two implementations to issue a single
writesyscall with the full contents of the record to a file opened inO_APPENDmode.If all the stars align and a partial write doesn't happen then that means we're doing our best effort to cooperate with other engines in the same process. If a partial write happens the decision in this PR is to go ahead and retry the rest of the write (using the
write_allhelper). This is a tradeoff where it makes the single-engine use case more robust (partial writes are handled correctly) but the multi-engine use case will produce corrupt files. It doesn't feel like a great tradeoff to say that profiling can't be done in Wasmtime when a partial write would happen for this niche use case of multiple engines, hence the direction of this tradeoff.Closes #11862
<!--
Please make sure you include the following information:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
alexcrichton requested wasmtime-core-reviewers for a review on PR #11865.
alexcrichton submitted PR review.
alexcrichton created PR review comment:
I ended up deleting this method since it's not used in Wasmtime at all and opted to expose a
fileandfile_mutaccessor in case anyone externally is using this and still wants to be able to write.
pchickey submitted PR review.
alexcrichton merged PR #11865.
Last updated: Dec 06 2025 at 06:05 UTC