-
Notifications
You must be signed in to change notification settings - Fork 35
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
⏱️ At a hostcall to get the amount of vcpu time that has passed in the guest, in milliseconds #412
Conversation
crates/adapter/src/fastly/core.rs
Outdated
@@ -268,6 +268,24 @@ pub mod fastly_abi { | |||
} | |||
} | |||
|
|||
pub mod fastly_vcpu { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
drive-by feedback: might be worth thinking whether to use a more generic module name where we can add other bits of introspection. E.g.: fastly_introspect
or fastly_meta
or similar...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I can imagine a lot of additional introspection we might want to add over time, on other aspects of the guest behavior.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went with fastly_compute_runtime
, which I like as a general future module for getting or setting or otherwise looking at the behavior of a session itself.
7ff327a
to
596e5eb
Compare
Co-authored-by: Cameron Walters (cee-dub) <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me! ✨ Just the question about the adapter wasm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you rerun make adapter
after merging main so that this includes both the vcpu hostcall and the inspect hostcall?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup! Rerunning it now shows me no changes with this PR.
This is a proposed extension, to help customers diagnose where their code is spending time.
One explicit thing to mention is that while this hostcall limits itself to vcpu time (and thus does not count any time spent blocking on IO, for example), it is based on a time passing rather than cycles, WASM instruction count, or any other timer that is independent of the underlying processor(s) running the code. Thus, the values found should only really be compared to other values captured in the exact same run.