• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
4 
5 package org.chromium.base.jank_tracker;
6 
7 import org.jni_zero.JNINamespace;
8 import org.jni_zero.NativeMethods;
9 
10 /** Sends Android jank metrics to native to be recorded using UMA. */
11 @JNINamespace("base::android")
12 public class JankMetricUMARecorder {
recordJankMetricsToUMA( JankMetrics metric, long reportingIntervalStartTime, long reportingIntervalDuration, @JankScenario int scenario)13     public static void recordJankMetricsToUMA(
14             JankMetrics metric,
15             long reportingIntervalStartTime,
16             long reportingIntervalDuration,
17             @JankScenario int scenario) {
18         if (metric == null) {
19             return;
20         }
21         JankMetricUMARecorderJni.get()
22                 .recordJankMetrics(
23                         metric.durationsNs,
24                         metric.missedVsyncs,
25                         reportingIntervalStartTime,
26                         reportingIntervalDuration,
27                         scenario);
28     }
29 
30     @NativeMethods
31     public interface Natives {
recordJankMetrics( long[] durationsNs, int[] missedVsyncs, long reportingIntervalStartTime, long reportingIntervalDuration, int scenario)32         void recordJankMetrics(
33                 long[] durationsNs,
34                 int[] missedVsyncs,
35                 long reportingIntervalStartTime,
36                 long reportingIntervalDuration,
37                 int scenario);
38     }
39 }
40