-
Notifications
You must be signed in to change notification settings - Fork 98
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
feat: implement ExperimentalInternetComputer.countInstructions(comp)
#381
Conversation
src/ExperimentalInternetComputer.mo
Outdated
/// NB: Currently, the only available counter is `0`, | ||
/// measuring executed wasm instructions. | ||
/// (see [Performance Counter](https://internetcomputer.org/docs/current/references/ic-interface-spec#system-api-performance-counter)) | ||
public func measureCounter(counter : Nat32) : (comp : () -> ()) -> Nat64 { |
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 think we can hardcode 0 here, and change the name to measureCycleCounter
? If we ever get another counter type, we probably want to give it a more meaningful name anyway, instead of relying on a number type.
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.
It it even cycles though? I think it's just instructions.
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.
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.
It's instructions indeed.
ExperimentalInternetComputer.measureCounter(counter)(comp)
ExperimentalInternetComputer.countInstructions(comp)
Implement basic
ExperimentalInternetComputer.countInstructions(comp)
, hiding the limitations of IC performance counters (reset to 0 after each entrypoint, invariant within blocks) by restricting measurements to local, synchronous computations.cf. dfinity/motoko#3294