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

feat: implement ExperimentalInternetComputer.countInstructions(comp) #381

Merged
merged 3 commits into from
Jun 6, 2022

Conversation

crusso
Copy link
Contributor

@crusso crusso commented Jun 6, 2022

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

@crusso crusso requested review from chenyan-dfinity and ggreif June 6, 2022 15:46
@crusso crusso changed the base branch from master to next-moc June 6, 2022 15:46
/// 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 {
Copy link
Contributor

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.

Copy link
Contributor Author

@crusso crusso Jun 6, 2022

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's instructions indeed.

@crusso crusso changed the title feat: implement ExperimentalInternetComputer.measureCounter(counter)(comp) feat: implement ExperimentalInternetComputer.countInstructions(comp) Jun 6, 2022
@crusso crusso merged commit 3045d02 into next-moc Jun 6, 2022
@crusso crusso deleted the claudio/measure branch June 6, 2022 18:40
ggreif added a commit that referenced this pull request Jun 7, 2022
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.

3 participants