timeToInitialDisplayMs: 시스템이 시작 인텐트를 수신한 시점부터 대상 Activity의 첫 번째 프레임을 렌더링하는 시점까지 걸린 시간입니다.
timeToFullDisplayMs: 시스템이 시작 인텐트를 수신한 시점부터 reportFullyDrawn() 메서드를 사용하여 앱이 완전히 그려진 시점까지 걸린 시간입니다. reportFullyDrawn() 호출 후(또는 해당 호출 포함) 첫 번째 프레임의 렌더링이 완료되면 측정이 중지됩니다. 이 측정은 Android 10(API 수준 29) 및 이전 버전에서는 사용하지 못할 수도 있습니다.
StartupTimingMetric은 시작 반복에서 최솟값, 중앙값, 최댓값을 출력합니다. 시작 개선을 평가하려면 중앙값에 집중해야 합니다. 중앙값으로 일반적인 시작 시간 추정치를 가장 잘 알 수 있기 때문입니다. 앱 시작 시간에 기여하는 요소에 관한 자세한 내용은 앱 시작 시간을 참고하세요.
그림 2.StartupTimingMetric 결과
FrameTimingMetric
FrameTimingMetric은 벤치마크에서 생성된 프레임의 타이밍 정보(예: 스크롤 또는 애니메이션)를 캡처하고 다음 값을 출력합니다.
frameOverrunMs: 주어진 프레임이 기한을 넘긴 시간입니다.
양수는 드롭된 프레임과 눈에 보이는 버벅거림/끊김 현상을 나타냅니다.
음수는 프레임이 기한보다 얼마나 빠른지 나타냅니다.
참고: 이 기능은 Android 12(API 수준 31) 및 이후 버전에서만 사용할 수 있습니다.
frameDurationCpuMs: CPU에서 UI 스레드와 RenderThread에서 프레임이 생성되는 데 걸린 시간입니다.
TraceSectionMetric은 트레이스 섹션이 제공된 sectionName과 일치하는 횟수와 소요된 시간을 캡처합니다. 시간의 경우 최소 시간, 중앙값, 최대 시간을 밀리초 단위로 출력합니다. 트레이스 섹션은 trace(sectionName) 함수 호출로 정의되거나 Trace.beginSection(sectionName) 및 Trace.endSection() 사이의 코드 또는 비동기 변형으로 정의됩니다. 이 섹션은 측정 중에 캡처된 트레이스 섹션의 첫 번째 인스턴스를 항상 선택합니다. 기본적으로 패키지의 트레이스 섹션만 출력합니다. 패키지 외부의 프로세스를 포함하려면 targetPackageOnly = false를 설정하세요.
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2025-08-27(UTC)
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-08-27(UTC)"],[],[],null,["Metrics are the main type of information extracted from your benchmarks. They\nare passed to the [`measureRepeated`](/reference/kotlin/androidx/benchmark/macro/junit4/MacrobenchmarkRule#measureRepeated(kotlin.String,kotlin.collections.List,androidx.benchmark.macro.CompilationMode,androidx.benchmark.macro.StartupMode,kotlin.Int,kotlin.Function1,kotlin.Function1))\nfunction as a `List`, which lets you specify\nmultiple measured metrics at once. At least one type of metric is required for\nthe benchmark to run.\n\nThe following code snippet captures frame timing and custom trace section\nmetrics: \n\nKotlin \n\n```kotlin\nbenchmarkRule.measureRepeated(\n packageName = TARGET_PACKAGE,\n metrics = listOf(\n FrameTimingMetric(),\n TraceSectionMetric(\"RV CreateView\"),\n TraceSectionMetric(\"RV OnBindView\"),\n ),\n iterations = 5,\n // ...\n)\n```\n\nJava \n\n```java\nbenchmarkRule.measureRepeated(\n TARGET_PACKAGE, // packageName\n Arrays.asList( // metrics\n new StartupTimingMetric(),\n new TraceSectionMetric(\"RV CreateView\"),\n new TraceSectionMetric(\"RV OnBindView\"),\n ),\n 5, // Iterations\n // ...\n);\n```\n\nIn this example, [`RV CreateView`](https://cs.android.com/search?q=TRACE_CREATE_VIEW_TAG&sq=&ss=androidx%2Fplatform%2Fframeworks%2Fsupport)\nand [`RV OnBindView`](https://cs.android.com/search?q=TRACE_BIND_VIEW_TAG)\nare the IDs of traceable blocks that are defined in\n[`RecyclerView`](/reference/androidx/recyclerview/widget/RecyclerView). The\n[source code for the `createViewHolder()`](https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:recyclerview/recyclerview/src/main/java/androidx/recyclerview/widget/RecyclerView.java;l=7950-7964)\nmethod is an example of how you can define traceable blocks within your own\ncode.\n\n[`StartupTimingMetric`](#startup-timing), [`TraceSectionMetric`](#trace-section), [`FrameTimingMetric`](#frame-timing),\nand [`PowerMetric`](#power), are covered in detail later in this document.\nFor a full list of metrics, check out subclasses of [`Metric`](/reference/kotlin/androidx/benchmark/macro/Metric).\n\nBenchmark results are output to Android Studio, as shown in figure 1.\nIf multiple metrics are defined, all of them are combined in the output.\n**Figure 1.** Results of `TraceSectionMetric` and `FrameTimingMetric`.\n\nStartupTimingMetric\n\n[`StartupTimingMetric`](/reference/kotlin/androidx/benchmark/macro/StartupTimingMetric)\ncaptures app startup timing metrics with the following values:\n\n- `timeToInitialDisplayMs`: The amount of time from when the system receives a launch intent to when it renders the first frame of the destination [`Activity`](/reference/android/app/Activity).\n- `timeToFullDisplayMs`: The amount of time from when the system receives a launch intent to when the app reports fully drawn using the [`reportFullyDrawn()`](/reference/android/app/Activity#reportFullyDrawn()) method. The measurement stops at the completion of rendering the first frame after---or containing---the `reportFullyDrawn()` call. This measurement might not be available on Android 10 (API level 29) and earlier.\n\n`StartupTimingMetric` outputs the min, median, and max values from the startup\niterations. To assess startup improvement you should focus on median values,\nsince they provide the best estimate of the typical startup time. For more\ninformation about what contributes to app startup time, see [App startup\ntime](/topic/performance/vitals/launch-time).\n**Figure 2.** `StartupTimingMetric` results.\n\nFrameTimingMetric\n\n[`FrameTimingMetric`](/reference/kotlin/androidx/benchmark/macro/FrameTimingMetric)\ncaptures timing information from frames produced by a benchmark, such as a\nscrolling or animation, and outputs the following values:\n\n- `frameOverrunMs`: the amount of time a given frame misses its deadline by. Positive numbers indicate a dropped frame and visible jank or stutter. Negative numbers indicate how much faster a frame is than the deadline. Note: This is available only on Android 12 (API level 31) and higher.\n- `frameDurationCpuMs`: the amount of time the frame takes to be produced on the CPU on both the UI thread and the `RenderThread`.\n\nThese measurements are collected in a distribution of 50th, 90th, 95th, and 99th\npercentile.\n\nFor more information on how to identify and improve slow frames, see\n[Slow rendering](/topic/performance/vitals/render).\n**Figure 3.** `FrameTimingMetric` results.\n\nTraceSectionMetric **Experimental:** This class is experimental.\n\n[`TraceSectionMetric`](/reference/kotlin/androidx/benchmark/macro/TraceSectionMetric)\ncaptures the number of times a trace section matching the provided `sectionName`\noccurs and the amount of time it takes. For the time, it outputs the minimum,\nmedian, and maximum times in milliseconds. The trace section is defined either\nby the function call\n[`trace(sectionName)`](/reference/kotlin/androidx/tracing/package-summary#trace(kotlin.String,kotlin.Function0))\nor the code between\n[`Trace.beginSection(sectionName)`](/reference/kotlin/androidx/tracing/Trace#beginSection(java.lang.String))\nand\n[`Trace.endSection()`](/reference/kotlin/androidx/tracing/Trace#endSection()) or\ntheir async variants. It always selects the first instance of a trace section\ncaptured during a measurement. It only outputs trace sections from your package\nby default; to include processes outside your package, set\n`targetPackageOnly = false`.\n\nFor more information about tracing, see [Overview of system\ntracing](/topic/performance/tracing) and [Define custom\nevents](/topic/performance/tracing/custom-events).\n**Figure 4.** `TraceSectionMetric` results.\n\nPowerMetric **Experimental:** This class is experimental.\n\n[`PowerMetric`](/reference/kotlin/androidx/benchmark/macro/PowerMetric) captures\nthe change in power or energy over the duration of your test for the provided\n[power categories](/reference/kotlin/androidx/benchmark/macro/PowerCategory).\nEach selected category is broken down into its measurable subcomponents, and\nunselected categories are added to the \"unselected\" metric.\n\nThese metrics measure\nsystem-wide consumption, not the consumption on a per-app basis, and are limited\nto Pixel 6, Pixel 6 Pro, and later devices:\n\n- `power\u003ccategory\u003eUw`: the amount of power consumed over the duration of your test in this category.\n- `energy\u003ccategory\u003eUws`: the amount of energy transferred per unit of time for the duration of your test in this category.\n\nCategories include the following:\n\n- `CPU`\n- `DISPLAY`\n- `GPU`\n- `GPS`\n- `MEMORY`\n- `MACHINE_LEARNING`\n- `NETWORK`\n- `UNCATEGORIZED`\n\nWith some categories, like `CPU`, it might be difficult to separate work done by\nother processes from work done by your own app. To minimize the interference,\nremove or restrict unnecessary apps and accounts.\n**Figure 5.** `PowerMetric` results.\n\nRecommended for you\n\n- Note: link text is displayed when JavaScript is off\n- [Create Baseline Profiles {:#creating-profile-rules}](/topic/performance/baselineprofiles/create-baselineprofile)\n- [Writing a Macrobenchmark](/topic/performance/benchmarking/macrobenchmark-overview)\n- [App startup analysis and optimization {:#app-startup-analysis-optimization}](/topic/performance/appstartup/analysis-optimization)"]]