Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1f50d0aa authored by Eric Miao's avatar Eric Miao
Browse files

Fix inconsistent tracing of bitmap count/memory

Bug: 373408586
Flag: EXEMPT bugfix

Bitmap count/memory usage should be updated regardless of
whether tracing is enabled or not.

Change-Id: Ie98ab19ddbbb2d87d89e70f81bd743d7f377c4f8
parent 21754b02
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -582,20 +582,22 @@ size_t Bitmap::mTotalBitmapBytes = 0;
size_t Bitmap::mTotalBitmapCount = 0;

void Bitmap::traceBitmapCreate() {
    if (ATRACE_ENABLED()) {
    size_t bytes = getAllocationByteCount();
    std::lock_guard lock{mLock};
        mTotalBitmapBytes += getAllocationByteCount();
    mTotalBitmapBytes += bytes;
    mTotalBitmapCount++;
    if (ATRACE_ENABLED()) {
        ATRACE_INT64("Bitmap Memory", mTotalBitmapBytes);
        ATRACE_INT64("Bitmap Count", mTotalBitmapCount);
    }
}

void Bitmap::traceBitmapDelete() {
    if (ATRACE_ENABLED()) {
    size_t bytes = getAllocationByteCount();
    std::lock_guard lock{mLock};
    mTotalBitmapBytes -= getAllocationByteCount();
    mTotalBitmapCount--;
    if (ATRACE_ENABLED()) {
        ATRACE_INT64("Bitmap Memory", mTotalBitmapBytes);
        ATRACE_INT64("Bitmap Count", mTotalBitmapCount);
    }