Search code examples
androidandroid-layoutandroid-studio-3.0systracehierarchyviewer

How to measure layout performance effectively and easily?


Due to this article Hierarchy Viewer is deprecated. Now you can use Layout Inspector for analyzing your layout. But Layout Inspector does not measure. You can look for alerts due to layout performance by using systrace but it does not show you how to view layout hierarchy tree and looking at layout, measure and draw time. In Hierarchy Viewer you could do that. But now you seem to code something with Window.OnFrameMetricsAvailableListener.

I don't want to code anything for measuring layout performance. This article show us that we can use dmtracedump. But honestly I don't know how to do that for drawing such a tree view:

enter image description here

So can you tell me a way to measure layout hierarchy performance without any coding? Maybe an explanation how to call dmtracedump for doing so?

Or is dmtracedump just for displaying a trace file in human readable form? So how to create the trace file?


Solution

  • Finally I found out that Android Studio 3.2 Preview Version has an improved Profiler where you can capture the whole Method Stack. There you can find the View methods called measure(), layout () and draw().