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

[compiler-rt] implement GetRSS for fuchsia. #108649

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

devnexen
Copy link
Member

No description provided.

@llvmbot
Copy link
Collaborator

llvmbot commented Sep 13, 2024

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: David CARLIER (devnexen)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/108649.diff

1 Files Affected:

  • (modified) compiler-rt/lib/sanitizer_common/sanitizer_fuchsia.cpp (+6-1)
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_fuchsia.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_fuchsia.cpp
index a67b2a8725eca8..e0d44260749497 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_fuchsia.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_fuchsia.cpp
@@ -526,7 +526,12 @@ bool GetRandom(void *buffer, uptr length, bool blocking) {
 
 u32 GetNumberOfCPUs() { return zx_system_get_num_cpus(); }
 
-uptr GetRSS() { UNIMPLEMENTED(); }
+uptr GetRSS() {
+  zx_info_task_stats_t i;
+  if (_zx_object_get_info(_zx_process_self(), ZX_INFO_TASK_STATS, &i, sizeof(i), nullptr, nullptr) != ZX_OK)
+    return 0;
+  return i.mem_private_bytes + i.mem_shared_bytes;
+}
 
 void *internal_start_thread(void *(*func)(void *arg), void *arg) { return 0; }
 void internal_join_thread(void *th) {}

Copy link

github-actions bot commented Sep 13, 2024

✅ With the latest revision this PR passed the C/C++ code formatter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants