traceSection

inline fun <T> traceSection(sectionName: String, block: () -> T): T

Runs block inside an Android trace section.

try/finally is required so Trace.endSection is always called, even when block throws. Without this, begin/end calls can become unbalanced and later work appears in the wrong section.