Refactor to save / print shmem usage stats using common struct.#610
Refactor to save / print shmem usage stats using common struct.#610
Conversation
This commit refactors shared memory usage stats fields to
drive-off shminfo_usage_stats{} struct entirely. Add
platform_save_usage_stats(), used by platform_shm_print_usage().
This refactoring paves the way for upcoming PR #569 which
is adding more memory-usage stats fields.
✅ Deploy Preview for splinterdb canceled.
|
| size_t shm_total_bytes; // Total size of shared segment allocated initially. | ||
| size_t shm_free_bytes; // Free bytes of memory left (that can be allocated) | ||
| size_t shm_used_bytes; // Used bytes of memory left (that were allocated) | ||
| size_t shm_used_bytes_HWM; // High-water mark of memory used bytes |
There was a problem hiding this comment.
This set of deleted stats-fields are now dropped into common shminfo_usage_stats{} struct; listed below.
| free_bytes = (size - sizeof(shmem_heap)); | ||
| shm->shm_free_bytes = free_bytes; | ||
| shm->shm_used_bytes = 0; | ||
| shm->shm_used_bytes_HWM = 0; |
There was a problem hiding this comment.
The chunk of deleted inline code is now nicely replaced by a single call to platform_save_usage_stats() on L475, below.
| nlarge_frags_inuse_HWM, | ||
| large_frags_found_in_use, | ||
| used_by_large_frags_bytes, | ||
| size_str(used_by_large_frags_bytes)); |
There was a problem hiding this comment.
This messy chunk of deleted code is now all handled cleanly inside expanded fn platform_shm_print_usage_stats(), on L514 below.
|
@rtjohnso - This is the last of the peel-off precursor change sets, paving the ground for reviewing PR #569. I am assigning this to you, optimistically, expecting that the CI-jobs will all succeed. There is no logic change in core shared memory mgmt itself, so I expect CI-jobs will all succeed. If you can take a quick look at this, I can merge this immediatelywhen CI passes. And then will start revamping the large part-3 change-set to prepare PR #569 for review. |
|
Gentle reminder @rtjohnso -- in the hope that this ping via this UI will somehow get through to you. The CI-jobs have succeeded ... and I'm all ready to check this in. Can you give this a quick look, please? |
This commit refactors shared memory usage stats fields to drive-off shminfo_usage_stats{} struct entirely. Add platform_save_usage_stats(), used by platform_shm_print_usage().
This refactoring paves the way for upcoming PR #569 which is adding more memory-usage stats fields.
NOTE To the reviewer:
There is zero logic change here. It's mainly a data structural change, rearranging where the memory-usage stats fields are tracked. They now belong to a common struct, so most of the diffs are to access the new
usage.<field>reference.Minor enhancements in the memory usage stats tracking / printing code is done, for improved understanding of memory usage metrics.