-
Notifications
You must be signed in to change notification settings - Fork 42
add memusage stat to os_provider and use it in benchmarks #1149
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
src/provider/provider_os_memory.c
Outdated
| atomic_fetch_add_explicit(&os_provider->stats.allocated_memory, size, | ||
| memory_order_relaxed); | ||
|
|
||
| size_t allocated = atomic_load_explicit( |
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.
Why do you need to load os_provider->stats.allocated_memory again, instead of using the result of the atomic_fetch_add_explicit on the line above?
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.
done
1d11852 to
8950beb
Compare
9dfb5ed to
0d7e960
Compare
benchmark/benchmark.hpp
Outdated
| memused.resize(state.threads()); | ||
| for (int i = 0; i < state.threads(); i++) { | ||
| memused[i] = 0; | ||
| } |
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.
| memused.resize(state.threads()); | |
| for (int i = 0; i < state.threads(); i++) { | |
| memused[i] = 0; | |
| } | |
| memused.assign(state.threads(), 0); |
or
| memused.resize(state.threads()); | |
| for (int i = 0; i < state.threads(); i++) { | |
| memused[i] = 0; | |
| } | |
| memused.resize(state.threads()); | |
| std::fill(memused.begin(), memused.end(), 0); | |
| size_t current_memory_allocated = 0; | ||
| for (int i = 0; i < state.threads(); i++) { | ||
| current_memory_allocated += memused[i]; | ||
| } |
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.
| size_t current_memory_allocated = 0; | |
| for (int i = 0; i < state.threads(); i++) { | |
| current_memory_allocated += memused[i]; | |
| } | |
| size_t current_memory_allocated = 0; | |
| for (const auto &used : memused) { | |
| current_memory_allocated += used; | |
| } |
45bdf01 to
2504e25
Compare
add memusage stat to os_provider and use it in benchmarks
Description
Checklist