Skip to content

[scudo] Use variable instead of recomputing. #106647

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

Merged
merged 1 commit into from
Sep 4, 2024

Conversation

cferris1000
Copy link
Contributor

@cferris1000 cferris1000 commented Aug 30, 2024

In the get fragmentation functions, there is already a variable that computes the
in use bytes, so use that instead of recomputing it.

In the getStats() function, there is already a variable that
computes the in use bytes, so use that instead of recomputing it.
@llvmbot
Copy link
Member

llvmbot commented Aug 30, 2024

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

Author: Christopher Ferris (cferris1000)

Changes

In the getStats() function, there is already a variable that computes the in use bytes, so use that instead of recomputing it.


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

2 Files Affected:

  • (modified) compiler-rt/lib/scudo/standalone/primary32.h (+1-1)
  • (modified) compiler-rt/lib/scudo/standalone/primary64.h (+1-1)
diff --git a/compiler-rt/lib/scudo/standalone/primary32.h b/compiler-rt/lib/scudo/standalone/primary32.h
index ebfb8dfe0a31f4..87264471be2c1a 100644
--- a/compiler-rt/lib/scudo/standalone/primary32.h
+++ b/compiler-rt/lib/scudo/standalone/primary32.h
@@ -940,7 +940,7 @@ template <typename Config> class SizeClassAllocator32 {
 
     uptr Integral;
     uptr Fractional;
-    computePercentage(BlockSize * InUseBlocks, InUsePages * PageSize, &Integral,
+    computePercentage(BlockSize * InUseBlocks, InUseBytes, &Integral,
                       &Fractional);
     Str->append("  %02zu (%6zu): inuse/total blocks: %6zu/%6zu inuse/total "
                 "pages: %6zu/%6zu inuse bytes: %6zuK util: %3zu.%02zu%%\n",
diff --git a/compiler-rt/lib/scudo/standalone/primary64.h b/compiler-rt/lib/scudo/standalone/primary64.h
index 8436f33c2fdcfc..ffcc22fea0c6ea 100644
--- a/compiler-rt/lib/scudo/standalone/primary64.h
+++ b/compiler-rt/lib/scudo/standalone/primary64.h
@@ -1185,7 +1185,7 @@ template <typename Config> class SizeClassAllocator64 {
 
     uptr Integral;
     uptr Fractional;
-    computePercentage(BlockSize * InUseBlocks, InUsePages * PageSize, &Integral,
+    computePercentage(BlockSize * InUseBlocks, InUseBytes, &Integral,
                       &Fractional);
     Str->append("  %02zu (%6zu): inuse/total blocks: %6zu/%6zu inuse/total "
                 "pages: %6zu/%6zu inuse bytes: %6zuK util: %3zu.%02zu%%\n",

@cferris1000
Copy link
Contributor Author

Ping.

@cferris1000 cferris1000 merged commit 1ff8657 into llvm:main Sep 4, 2024
11 checks passed
@cferris1000 cferris1000 deleted the stat_change branch September 4, 2024 21:12
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.

4 participants