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

Commit f7f1eeda authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "[libui/sf] Add total buffer size tracing to SF" into qt-dev

parents 38c6856b 45de5baa
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -60,6 +60,15 @@ GraphicBufferAllocator::GraphicBufferAllocator() : mMapper(GraphicBufferMapper::

GraphicBufferAllocator::~GraphicBufferAllocator() {}

size_t GraphicBufferAllocator::getTotalSize() const {
    Mutex::Autolock _l(sLock);
    size_t total = 0;
    for (size_t i = 0; i < sAllocList.size(); ++i) {
        total += sAllocList.valueAt(i).size;
    }
    return total;
}

void GraphicBufferAllocator::dump(std::string& result) const {
    Mutex::Autolock _l(sLock);
    KeyedVector<buffer_handle_t, alloc_rec_t>& list(sAllocList);
+2 −0
Original line number Diff line number Diff line
@@ -49,6 +49,8 @@ public:

    status_t free(buffer_handle_t handle);

    size_t getTotalSize() const;

    void dump(std::string& res) const;
    static void dumpToSystemLog();

+6 −0
Original line number Diff line number Diff line
@@ -2093,6 +2093,12 @@ void SurfaceFlinger::postComposition()
    if (mLumaSampling && mRegionSamplingThread) {
        mRegionSamplingThread->notifyNewContent();
    }

    // Even though ATRACE_INT64 already checks if tracing is enabled, it doesn't prevent the
    // side-effect of getTotalSize(), so we check that again here
    if (ATRACE_ENABLED()) {
        ATRACE_INT64("Total Buffer Size", GraphicBufferAllocator::get().getTotalSize());
    }
}

void SurfaceFlinger::computeLayerBounds() {