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

Dump Memory Usage with SIGUSR1 #10182

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Dump Memory Usage with SIGUSR1 #10182

wants to merge 4 commits into from

Conversation

Ashod
Copy link
Contributor

@Ashod Ashod commented Oct 7, 2024

  • wsd: avoid unnecessary temporary strings
  • wsd: support reading unknown-sized files
  • wsd: dump the smaps summary on USR1

@Ashod Ashod changed the title private/ash/misc2 Dump Memory Usage with SIGUSR1 Oct 7, 2024
@Ashod Ashod requested a review from caolanm October 7, 2024 01:20
kit/Kit.cpp Outdated

std::string smap;
if (const ssize_t size = FileUtil::readFile("/proc/self/smaps_rollup", smap); size <= 0)
oss << "\n smaps_rollup: <unavilable>";
Copy link
Contributor

Choose a reason for hiding this comment

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

s/unavilable/unavailable FWIW

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 swear it was fixed, evidently in a different branch. Thanks for the catch!

@mmeeks
Copy link
Contributor

mmeeks commented Oct 7, 2024

I wonder - we should prolly also dump the prometheus metrics on USR1 =) that's a nice set of strings that may help us. But quite possibly we should just trigger a callback that does that once at idle in the admin thread: set a global std::atomic and check for & clear it in the idle loop in the admin poll that servers those metrics normally.

Change-Id: I0cf1c6c7058d518ad134bd8099079f2fc6e22837
Signed-off-by: Ashod Nakashian <[email protected]>
Procfs doesn't report the size of on-demand
files (for obvious reasons). This leads to
failure to read such files, since stat(2)
reports their size as 0.

We also refactor the read loop, which
retries as necessary, so it can be re-used
elsewhere.

Change-Id: Ibebb8aa62d39331537199cfddd7ae085824f353b
Signed-off-by: Ashod Nakashian <[email protected]>
To get memory statistics, we dump smaps_rollup
in dumpState, which is invoked on SIGUSR1.

Change-Id: Ic38aa4f265a2b9ccb06eb6c4b6ba3d10b7dc6b7a
Signed-off-by: Ashod Nakashian <[email protected]>
@Ashod
Copy link
Contributor Author

Ashod commented Oct 8, 2024

I wonder - we should prolly also dump the prometheus metrics on USR1 =) that's a nice set of strings that may help us.

Good idea. Done: d7e1ecf

Change-Id: I51a2dd80bca4aa33a2829f7e8baf87034a654f61
Signed-off-by: Ashod Nakashian <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: To Test
Development

Successfully merging this pull request may close these issues.

3 participants