[libui/sf] Add total buffer size tracing to SF
Adds a line for "Total Buffer Size" to systrace, corresponding to the
combined size of all buffers allocated in SF's process.
Test: manual, verified that line appears on systrace and matches dumpsys
Bug: 131244853
Change-Id: Ifdd3151516dd5010494c9619281a0f0b71767e9c
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index d5a38e9..6037217 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -2081,6 +2081,12 @@
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() {