1 // Copyright 2023 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef BASE_ANDROID_JANK_METRIC_UMA_RECORDER_H_
6 #define BASE_ANDROID_JANK_METRIC_UMA_RECORDER_H_
8 #include "base/android/jni_android.h"
9 #include "base/base_export.h"
10 #include "base/feature_list.h"
12 namespace base::android {
14 // These values are persisted to logs. Entries should not be renumbered and
15 // numeric values should never be reused.
16 enum class FrameJankStatus {
19 kMaxValue = kNonJanky,
22 // These values are persisted to logs. Entries should not be renumbered and
23 // numeric values should never be reused.
24 enum class JankScenario {
25 PERIODIC_REPORTING = 1,
30 OPEN_LINK_IN_NEW_TAB = 6,
31 START_SURFACE_HOMEPAGE = 7,
32 START_SURFACE_TAB_SWITCHER = 8,
34 WEBVIEW_SCROLLING = 10,
35 // This value should always be last and is not persisted to logs, exposed only
37 MAX_VALUE = WEBVIEW_SCROLLING + 1
40 // Resolves the above name to a histogram value.
41 BASE_EXPORT const char* GetAndroidFrameTimelineJankHistogramName(
42 JankScenario scenario);
43 // Resolves the above name to a histogram value.
44 BASE_EXPORT const char* GetAndroidFrameTimelineDurationHistogramName(
45 JankScenario scenario);
47 BASE_EXPORT void RecordJankMetrics(
49 const base::android::JavaParamRef<jlongArray>& java_durations_ns,
50 const base::android::JavaParamRef<jbooleanArray>& java_jank_status,
51 jlong java_reporting_interval_start_time,
52 jlong java_reporting_interval_duration,
53 jint java_scenario_enum);
54 } // namespace base::android
55 #endif // BASE_ANDROID_JANK_METRIC_UMA_RECORDER_H_