summaryrefslogtreecommitdiff
path: root/graphics/java/android
diff options
context:
space:
mode:
author John Reck <jreck@google.com> 2019-10-09 13:41:18 -0700
committer John Reck <jreck@google.com> 2019-10-09 13:42:43 -0700
commit183e1380cef0f63610497abed01e16036a2ea2d4 (patch)
tree6be42299bdadf7fae5aaf58f787070123c6371aa /graphics/java/android
parent3441faa0453907f8713ebccfa33049c2e99e4fe6 (diff)
Improve dumping of display list memory usage
The first step of improving is measuring. So measure better. Bug: 138856108 Test: dump Change-Id: I076b904a1f0dfb209622c76bcb8778a10cd2b7db
Diffstat (limited to 'graphics/java/android')
-rw-r--r--graphics/java/android/graphics/RenderNode.java20
1 files changed, 18 insertions, 2 deletions
diff --git a/graphics/java/android/graphics/RenderNode.java b/graphics/java/android/graphics/RenderNode.java
index 0e635c774c84..17e3b4465130 100644
--- a/graphics/java/android/graphics/RenderNode.java
+++ b/graphics/java/android/graphics/RenderNode.java
@@ -1380,7 +1380,22 @@ public final class RenderNode {
* @return Approximate memory usage in bytes.
*/
public @BytesLong long computeApproximateMemoryUsage() {
- return nGetDebugSize(mNativeRenderNode);
+ return nGetUsageSize(mNativeRenderNode);
+ }
+
+ /**
+ * Gets the approximate amount of memory allocated for the RenderNode for debug purposes.
+ * Does not include the memory allocated by any child RenderNodes nor any bitmaps, only the
+ * memory allocated for this RenderNode and any data it owns.
+ *
+ * The difference between this and {@link #computeApproximateMemoryUsage()} is this includes
+ * memory allocated but not used. In particular structures such as DisplayLists are similar
+ * to things like ArrayLists - they need to resize as commands are added to them. As such,
+ * memory used can be less than memory allocated.
+ *
+ * @hide */
+ public @BytesLong long computeApproximateMemoryAllocated() {
+ return nGetAllocatedSize(mNativeRenderNode);
}
/**
@@ -1485,7 +1500,8 @@ public final class RenderNode {
private static native void nOutput(long renderNode);
- private static native int nGetDebugSize(long renderNode);
+ private static native int nGetUsageSize(long renderNode);
+ private static native int nGetAllocatedSize(long renderNode);
private static native void nRequestPositionUpdates(long renderNode,
PositionUpdateListener callback);