• 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 /** Interface for Android UI jank tracking. */
8 public interface JankTracker {
9     /**
10      * Starts tracking UI jank for a specific use scenario (e.g. Tab switcher, Omnibox, etc.),
11      * calling this method more than once without calling {@code finishTrackingScenario} won't do
12      * anything.
13      * @param scenario A value from {@link JankScenario} that specifies a use scenario.
14      */
startTrackingScenario(@ankScenario int scenario)15     void startTrackingScenario(@JankScenario int scenario);
16 
17     /**
18      * Finishes tracking UI jank for a use scenario (e.g. Tab switcher, Omnibox, etc.). Histograms
19      * for that scenario (e.g. Android.Jank.FrameDuration.Omnibox) are recorded immediately after
20      * calling this method. Calling this method without calling {@code startTrackingScenario}
21      * beforehand won't do anything.
22      * @param scenario A value from {@link JankScenario} that specifies a use scenario.
23      * @param endScenarioTime A value that determines the maximum frame metric (based on vsync time)
24      *         that should be included.
25      */
finishTrackingScenario(@ankScenario int scenario, long endScenarioTimeNs)26     void finishTrackingScenario(@JankScenario int scenario, long endScenarioTimeNs);
27 
finishTrackingScenario(@ankScenario int scenario)28     void finishTrackingScenario(@JankScenario int scenario);
29 
30     /** To be called when the jank tracker should stop listening to changes. */
destroy()31     void destroy();
32 }
33