-
Notifications
You must be signed in to change notification settings - Fork 730
add bh_print_vm to dump memory consumption information #1734
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
Conversation
09ce776 to
4b23a9f
Compare
| * @return 0 if success, -1 otherwise | ||
| */ | ||
| int | ||
| os_dumps_proc_mem_info(char *out, unsigned int size); |
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.
[minor] could we use size_t -like type for the size variable?
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.
Also, I think we could probably make the API more verbose - having char * type as a return value doesn't tell implementation and the user how the data should be structured (so on windows we might have different format, on linux there will be a different format).
I'd suggest using a well-defined structure that's being returned here so:
- implementers know exactly what sort of data needs to be returned
- users of that method know what to expect
- we can have a consistent formatting defined in a common layer, rather than have different formatting for each system
- If we ever want to emit metrics from WAMR or generate statistics, we can't rely on unstructured text.
This is just a suggestion - if returning an unstructured blob from this function is really what we want, that's fine, just wanted to raise the concern and make sure we're making a conscious decision.
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 am thinking that os_dumps_proc_mem_info should return some kind of memory usage reports of the current process. The developer should not be worried about how the memory data is structured or how different every platform is. It doesn't limit the output format and the output items.
for now, only support posix platforms.
wenyongh
left a comment
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.
LGTM
…odealliance#1734) Only support Posix platforms currently, read memory consumption info from file "/proc/self/status".
Only support Posix platforms currently, read memory consumption info from file "/proc/self/status".
Only support Posix platforms currently, read memory consumption info from file "/proc/self/status".
…odealliance#1734) Only support Posix platforms currently, read memory consumption info from file "/proc/self/status".
No description provided.