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 MemoryUsage for Store #2199

Merged
merged 9 commits into from
Mar 23, 2021
Merged

Conversation

Hywan
Copy link
Contributor

@Hywan Hywan commented Mar 19, 2021

Description

This patch implements loupe::MemoryUsage for wasmer::Store.

Review

  • Add a short description of the the change to the CHANGELOG.md file

@Hywan Hywan changed the title feat: Implement MemoryUsage for Store WIP feat: Implement MemoryUsage for Store Mar 19, 2021
lib/api/Cargo.toml Outdated Show resolved Hide resolved
lib/engine/Cargo.toml Outdated Show resolved Hide resolved
lib/vm/Cargo.toml Outdated Show resolved Hide resolved
@Hywan Hywan force-pushed the feat-memory-usage branch from 4c4e8c6 to 2afed4d Compare March 22, 2021 10:44
@Hywan Hywan changed the title WIP feat: Implement MemoryUsage for Store feat: Implement MemoryUsage for Store Mar 22, 2021
@Hywan
Copy link
Contributor Author

Hywan commented Mar 22, 2021

bors try

bors bot added a commit that referenced this pull request Mar 22, 2021
@bors
Copy link
Contributor

bors bot commented Mar 22, 2021

try

Build failed:

@Hywan Hywan requested a review from jubianchi as a code owner March 22, 2021 14:39
@Hywan
Copy link
Contributor Author

Hywan commented Mar 22, 2021

bors try

bors bot added a commit that referenced this pull request Mar 22, 2021
@bors
Copy link
Contributor

bors bot commented Mar 22, 2021

try

Build failed:

Copy link
Contributor

@MarkMcCaskey MarkMcCaskey left a comment

Choose a reason for hiding this comment

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

Looks good to me other than the fact that we shouldn't merge this upstream until we publish loupe to crates.io 👍

Comment on lines +136 to +141
impl<T: Tunables> MemoryUsage for LimitingTunables<T> {
fn size_of_val(&self, _tracker: &mut dyn MemoryUsageTracker) -> usize {
mem::size_of_val(self)
}
}

Copy link
Contributor

Choose a reason for hiding this comment

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

It's a bit surprising to me that this isn't something the macro can generate. I'm not sure how common of a base case it is, maybe it isn't worth it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's because of the generic here. I need to dig into loupe-derive to see what's going on.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed by wasmerio/loupe#14. I'll update this file in #2200 probably.

Comment on lines +164 to 170
#[derive(Clone, Debug, PartialEq, Eq, Hash, MemoryUsage)]
pub struct Target {
#[loupe(skip)]
triple: Triple,
#[loupe(skip)]
cpu_features: EnumSet<CpuFeature>,
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This might be the same as the thing I mentioned above, not high priority and easy to add later, but might be able to do something like

#[loupe(skip_all)]
pub struct Target {
...
}

To just get the local size and not any of the heap size stuff

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've created wasmerio/loupe#12.

@Hywan
Copy link
Contributor Author

Hywan commented Mar 23, 2021

bors try

bors bot added a commit that referenced this pull request Mar 23, 2021
@bors
Copy link
Contributor

bors bot commented Mar 23, 2021

try

Build failed:

@Hywan
Copy link
Contributor Author

Hywan commented Mar 23, 2021

bors r+

@bors bors bot merged commit af59fcb into wasmerio:master Mar 23, 2021
bors bot added a commit that referenced this pull request Mar 23, 2021
2200: feat: Implement `MemoryUsage` for `Module` r=Hywan a=Hywan

# Description

This patch implements `loupe::MemoryUsage` for `wasmer::Module`.

~This PR includes #2199. To review unique patches: https://github.com/Hywan/wasmer/compare/feat-memory-usage...feat-memory-usage-module?expand=1~

# Review

- [x] Add a short description of the the change to the CHANGELOG.md file


Co-authored-by: Ivan Enderlin <[email protected]>
bors bot added a commit that referenced this pull request Mar 23, 2021
2200: feat: Implement `MemoryUsage` for `Module` r=Hywan a=Hywan

# Description

This patch implements `loupe::MemoryUsage` for `wasmer::Module`.

~This PR includes #2199. To review unique patches: https://github.com/Hywan/wasmer/compare/feat-memory-usage...feat-memory-usage-module?expand=1~

# Review

- [x] Add a short description of the the change to the CHANGELOG.md file


Co-authored-by: Ivan Enderlin <[email protected]>
bors bot added a commit that referenced this pull request Mar 23, 2021
2200: feat: Implement `MemoryUsage` for `Module` r=Hywan a=Hywan

# Description

This patch implements `loupe::MemoryUsage` for `wasmer::Module`.

~This PR includes #2199. To review unique patches: https://github.com/Hywan/wasmer/compare/feat-memory-usage...feat-memory-usage-module?expand=1~

# Review

- [x] Add a short description of the the change to the CHANGELOG.md file


Co-authored-by: Ivan Enderlin <[email protected]>
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