Home | History | Annotate | Download | only in health
      1 /*
      2  * Copyright (C) 2016 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 package android.os.health;
     18 
     19 /**
     20  * Keys for {@link HealthStats} returned from
     21  * {@link HealthStats#getStats(int) HealthStats.getStats(int)} with the
     22  * {@link UidHealthStats#STATS_PIDS UidHealthStats.STATS_PIDS} key.
     23  * <p>
     24  * The values coming from PidHealthStats are a little bit different from
     25  * the other HealthStats values.  These values are not aggregate or historical
     26  * values, but instead live values from when the snapshot is taken.  These
     27  * tend to be more useful in debugging rogue processes than in gathering
     28  * aggregate metrics across the fleet of devices.
     29  */
     30 public final class PidHealthStats {
     31 
     32     private PidHealthStats() {
     33     }
     34 
     35     /**
     36      * Key for a measurement of the current nesting depth of wakelocks for this process.
     37      * That is to say, the number of times a nested wakelock has been started but not
     38      * stopped.  A high number here indicates an improperly paired wakelock acquire/release
     39      * combination.
     40      * <p>
     41      * More details on the individual wake locks is available
     42      * by getting the {@link UidHealthStats#TIMERS_WAKELOCKS_FULL},
     43      * {@link UidHealthStats#TIMERS_WAKELOCKS_PARTIAL},
     44      * {@link UidHealthStats#TIMERS_WAKELOCKS_WINDOW}
     45      * and {@link UidHealthStats#TIMERS_WAKELOCKS_DRAW} keys.
     46      */
     47     @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT)
     48     public static final int MEASUREMENT_WAKE_NESTING_COUNT = HealthKeys.BASE_PID + 1;
     49 
     50     /**
     51      * Key for a measurement of the total number of milleseconds that this process
     52      * has held a wake lock.
     53      * <p>
     54      * More details on the individual wake locks is available
     55      * by getting the {@link UidHealthStats#TIMERS_WAKELOCKS_FULL},
     56      * {@link UidHealthStats#TIMERS_WAKELOCKS_PARTIAL},
     57      * {@link UidHealthStats#TIMERS_WAKELOCKS_WINDOW}
     58      * and {@link UidHealthStats#TIMERS_WAKELOCKS_DRAW} keys.
     59      */
     60     @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT)
     61     public static final int MEASUREMENT_WAKE_SUM_MS = HealthKeys.BASE_PID + 2;
     62 
     63     /**
     64      * Key for a measurement of the time in the {@link android.os.SystemClock#elapsedRealtime}
     65      * timebase that a wakelock was first acquired in this process.
     66      * <p>
     67      * More details on the individual wake locks is available
     68      * by getting the {@link UidHealthStats#TIMERS_WAKELOCKS_FULL},
     69      * {@link UidHealthStats#TIMERS_WAKELOCKS_PARTIAL},
     70      * {@link UidHealthStats#TIMERS_WAKELOCKS_WINDOW}
     71      * and {@link UidHealthStats#TIMERS_WAKELOCKS_DRAW} keys.
     72      */
     73     @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT)
     74     public static final int MEASUREMENT_WAKE_START_MS = HealthKeys.BASE_PID + 3;
     75 
     76     /**
     77      * @hide
     78      */
     79     public static final HealthKeys.Constants CONSTANTS = new HealthKeys.Constants(PidHealthStats.class);
     80 }
     81