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

Track time spent in each wasm instance env call #427

Merged
merged 6 commits into from
Oct 17, 2023

Conversation

kulakowski
Copy link
Contributor

Additionally, this further tidies the interface between the host and the wasm instance env. In particular, reducer calls are explicitly started and stopped, and the wasm instance env becomes responsible for its own instrumentation.

Description of Changes

API and ABI

  • This is a breaking change to the module ABI
  • This is a breaking change to the module API
  • This is a breaking change to the ClientAPI
  • This is a breaking change to the SDK API

If the API is breaking, please state below what will break

Expected complexity level and risk

2: This moderately changes some of the plumbing between the host and instance.

How complicated do you think these changes are? Grade on a scale from 1 to 5,
where 1 is a trivial change, and 5 is a deep-reaching and complex change.

This complexity rating applies not only to the complexity apparent in the diff,
but also to its interactions with existing and future code.

If you answered more than a 2, explain what is complex about the PR,
and what other components it interacts with in potentially concerning ways.

@@ -0,0 +1,69 @@
use std::time::{Duration, Instant};
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The span stuff is rough and ready, happy to do whatever with it once we agree this is all the right direction.

}

/// Call the function `f` with the name `func`.
/// The function `f` is provided with the callers environment and the host's memory.
///
/// One of `cvt`, `cvt_ret`, or `cvt_noret` should be used in the implementation of any
Copy link
Contributor Author

Choose a reason for hiding this comment

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

What do you think of this structure?

Copy link
Contributor

Choose a reason for hiding this comment

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

This seems like an improvement; I'm a fan.

@kulakowski kulakowski force-pushed the george/wasm-instance-env-time branch 2 times, most recently from e0e5a29 to 064564d Compare October 16, 2023 16:54
@kulakowski kulakowski marked this pull request as ready for review October 16, 2023 17:10
Copy link
Contributor

@gefjon gefjon left a comment

Choose a reason for hiding this comment

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

This looks good. I've left a few doc/comment related comments and suggestions, but I think the code itself is ready for the big time.

crates/core/src/host/wasm_common/instrumentation.rs Outdated Show resolved Hide resolved
Comment on lines +631 to +630
log::debug!(
"Long running reducer {func_ident:?} took {:?} to execute, with the following wasm_instance_env call times: {:?}",
timings.total_duration,
timings.wasm_instance_env_call_times
);
Copy link
Contributor

Choose a reason for hiding this comment

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

Ideally I think we should change this message so that it only tries to print the wasm_instance_env_call_times if we're collecting that data. I'm not concerned about that; maybe just a TODO comment?

}

/// Call the function `f` with the name `func`.
/// The function `f` is provided with the callers environment and the host's memory.
///
/// One of `cvt`, `cvt_ret`, or `cvt_noret` should be used in the implementation of any
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems like an improvement; I'm a fan.

kulakowski and others added 3 commits October 17, 2023 09:35
Additionally, this further tidies the interface between the
host and the wasm instance env. In particular, reducer calls
are explicitly started and stopped, and the wasm instance env
becomes responsible for its own instrumentation.
Co-authored-by: Phoebe Goldman <phoebe@clockworklabs.io>
Signed-off-by: George Kulakowski <george.kulakowski@gmail.com>
@kulakowski kulakowski force-pushed the george/wasm-instance-env-time branch from 6adcb3a to afff6e8 Compare October 17, 2023 15:56
kulakowski and others added 3 commits October 17, 2023 08:56
Co-authored-by: Phoebe Goldman <phoebe@clockworklabs.io>
Signed-off-by: George Kulakowski <george.kulakowski@gmail.com>
@kulakowski kulakowski merged commit b9bfe2c into master Oct 17, 2023
5 checks passed
@kulakowski kulakowski deleted the george/wasm-instance-env-time branch October 17, 2023 16:30
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.

2 participants