[compiler-rt] [scudo] Add utilization percentages for stats. (PR #75101)

Christopher Ferris via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 11 13:54:13 PST 2023


================
@@ -112,6 +112,21 @@ template <typename T> inline void shuffle(T *A, u32 N, u32 *RandState) {
   *RandState = State;
 }
 
+inline void computePercentage(uptr Numerator, uptr Denominator, uptr *Integral,
+                              uptr *Fractional) {
+  constexpr uptr Digits = 100;
+  if (Denominator == 0) {
----------------
cferris1000 wrote:

Another case I saw in real life, and I was wondering if I should say 100% when the denominator is 0. Since 0% feels like the wrong value, 100% also seems kind of wrong, but more correct than 0%. My other thought was doing NA, but that seems like it would be very difficult to implement without changing a lot of things.

I would think setting this to 100% seems the least bad and the most correct, but what do you think?

https://github.com/llvm/llvm-project/pull/75101


More information about the llvm-commits mailing list