1713fec85b8612256211f09c62b8958a99fe5b9dbJoe Onorato/*
2713fec85b8612256211f09c62b8958a99fe5b9dbJoe Onorato * Copyright (C) 2016 The Android Open Source Project
3713fec85b8612256211f09c62b8958a99fe5b9dbJoe Onorato *
4713fec85b8612256211f09c62b8958a99fe5b9dbJoe Onorato * Licensed under the Apache License, Version 2.0 (the "License");
5713fec85b8612256211f09c62b8958a99fe5b9dbJoe Onorato * you may not use this file except in compliance with the License.
6713fec85b8612256211f09c62b8958a99fe5b9dbJoe Onorato * You may obtain a copy of the License at
7713fec85b8612256211f09c62b8958a99fe5b9dbJoe Onorato *
8713fec85b8612256211f09c62b8958a99fe5b9dbJoe Onorato *      http://www.apache.org/licenses/LICENSE-2.0
9713fec85b8612256211f09c62b8958a99fe5b9dbJoe Onorato *
10713fec85b8612256211f09c62b8958a99fe5b9dbJoe Onorato * Unless required by applicable law or agreed to in writing, software
11713fec85b8612256211f09c62b8958a99fe5b9dbJoe Onorato * distributed under the License is distributed on an "AS IS" BASIS,
12713fec85b8612256211f09c62b8958a99fe5b9dbJoe Onorato * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13713fec85b8612256211f09c62b8958a99fe5b9dbJoe Onorato * See the License for the specific language governing permissions and
14713fec85b8612256211f09c62b8958a99fe5b9dbJoe Onorato * limitations under the License.
15713fec85b8612256211f09c62b8958a99fe5b9dbJoe Onorato */
16713fec85b8612256211f09c62b8958a99fe5b9dbJoe Onorato
17713fec85b8612256211f09c62b8958a99fe5b9dbJoe Onoratopackage android.os.health;
18713fec85b8612256211f09c62b8958a99fe5b9dbJoe Onorato
19713fec85b8612256211f09c62b8958a99fe5b9dbJoe Onorato/**
20713fec85b8612256211f09c62b8958a99fe5b9dbJoe Onorato * Keys for {@link HealthStats} returned from
21713fec85b8612256211f09c62b8958a99fe5b9dbJoe Onorato * {@link HealthStats#getStats(int) HealthStats.getStats(int)} with the
22713fec85b8612256211f09c62b8958a99fe5b9dbJoe Onorato * {@link UidHealthStats#STATS_PIDS UidHealthStats.STATS_PIDS} key.
23181cada18a9feab90627ab27070bc00c29ec337aJoe Onorato * <p>
24181cada18a9feab90627ab27070bc00c29ec337aJoe Onorato * The values coming from PidHealthStats are a little bit different from
25181cada18a9feab90627ab27070bc00c29ec337aJoe Onorato * the other HealthStats values.  These values are not aggregate or historical
26181cada18a9feab90627ab27070bc00c29ec337aJoe Onorato * values, but instead live values from when the snapshot is taken.  These
27181cada18a9feab90627ab27070bc00c29ec337aJoe Onorato * tend to be more useful in debugging rogue processes than in gathering
28181cada18a9feab90627ab27070bc00c29ec337aJoe Onorato * aggregate metrics across the fleet of devices.
29713fec85b8612256211f09c62b8958a99fe5b9dbJoe Onorato */
30713fec85b8612256211f09c62b8958a99fe5b9dbJoe Onoratopublic final class PidHealthStats {
31713fec85b8612256211f09c62b8958a99fe5b9dbJoe Onorato
32713fec85b8612256211f09c62b8958a99fe5b9dbJoe Onorato    private PidHealthStats() {
33713fec85b8612256211f09c62b8958a99fe5b9dbJoe Onorato    }
34713fec85b8612256211f09c62b8958a99fe5b9dbJoe Onorato
35181cada18a9feab90627ab27070bc00c29ec337aJoe Onorato    /**
36181cada18a9feab90627ab27070bc00c29ec337aJoe Onorato     * Key for a measurement of the current nesting depth of wakelocks for this process.
37181cada18a9feab90627ab27070bc00c29ec337aJoe Onorato     * That is to say, the number of times a nested wakelock has been started but not
38181cada18a9feab90627ab27070bc00c29ec337aJoe Onorato     * stopped.  A high number here indicates an improperly paired wakelock acquire/release
39181cada18a9feab90627ab27070bc00c29ec337aJoe Onorato     * combination.
40181cada18a9feab90627ab27070bc00c29ec337aJoe Onorato     * <p>
41181cada18a9feab90627ab27070bc00c29ec337aJoe Onorato     * More details on the individual wake locks is available
42181cada18a9feab90627ab27070bc00c29ec337aJoe Onorato     * by getting the {@link UidHealthStats#TIMERS_WAKELOCKS_FULL},
43181cada18a9feab90627ab27070bc00c29ec337aJoe Onorato     * {@link UidHealthStats#TIMERS_WAKELOCKS_PARTIAL},
44181cada18a9feab90627ab27070bc00c29ec337aJoe Onorato     * {@link UidHealthStats#TIMERS_WAKELOCKS_WINDOW}
45181cada18a9feab90627ab27070bc00c29ec337aJoe Onorato     * and {@link UidHealthStats#TIMERS_WAKELOCKS_DRAW} keys.
46181cada18a9feab90627ab27070bc00c29ec337aJoe Onorato     */
47713fec85b8612256211f09c62b8958a99fe5b9dbJoe Onorato    @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT)
48713fec85b8612256211f09c62b8958a99fe5b9dbJoe Onorato    public static final int MEASUREMENT_WAKE_NESTING_COUNT = HealthKeys.BASE_PID + 1;
49713fec85b8612256211f09c62b8958a99fe5b9dbJoe Onorato
50181cada18a9feab90627ab27070bc00c29ec337aJoe Onorato    /**
51181cada18a9feab90627ab27070bc00c29ec337aJoe Onorato     * Key for a measurement of the total number of milleseconds that this process
52181cada18a9feab90627ab27070bc00c29ec337aJoe Onorato     * has held a wake lock.
53181cada18a9feab90627ab27070bc00c29ec337aJoe Onorato     * <p>
54181cada18a9feab90627ab27070bc00c29ec337aJoe Onorato     * More details on the individual wake locks is available
55181cada18a9feab90627ab27070bc00c29ec337aJoe Onorato     * by getting the {@link UidHealthStats#TIMERS_WAKELOCKS_FULL},
56181cada18a9feab90627ab27070bc00c29ec337aJoe Onorato     * {@link UidHealthStats#TIMERS_WAKELOCKS_PARTIAL},
57181cada18a9feab90627ab27070bc00c29ec337aJoe Onorato     * {@link UidHealthStats#TIMERS_WAKELOCKS_WINDOW}
58181cada18a9feab90627ab27070bc00c29ec337aJoe Onorato     * and {@link UidHealthStats#TIMERS_WAKELOCKS_DRAW} keys.
59181cada18a9feab90627ab27070bc00c29ec337aJoe Onorato     */
60713fec85b8612256211f09c62b8958a99fe5b9dbJoe Onorato    @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT)
61713fec85b8612256211f09c62b8958a99fe5b9dbJoe Onorato    public static final int MEASUREMENT_WAKE_SUM_MS = HealthKeys.BASE_PID + 2;
62713fec85b8612256211f09c62b8958a99fe5b9dbJoe Onorato
63181cada18a9feab90627ab27070bc00c29ec337aJoe Onorato    /**
64181cada18a9feab90627ab27070bc00c29ec337aJoe Onorato     * Key for a measurement of the time in the {@link android.os.SystemClock#elapsedRealtime}
65181cada18a9feab90627ab27070bc00c29ec337aJoe Onorato     * timebase that a wakelock was first acquired in this process.
66181cada18a9feab90627ab27070bc00c29ec337aJoe Onorato     * <p>
67181cada18a9feab90627ab27070bc00c29ec337aJoe Onorato     * More details on the individual wake locks is available
68181cada18a9feab90627ab27070bc00c29ec337aJoe Onorato     * by getting the {@link UidHealthStats#TIMERS_WAKELOCKS_FULL},
69181cada18a9feab90627ab27070bc00c29ec337aJoe Onorato     * {@link UidHealthStats#TIMERS_WAKELOCKS_PARTIAL},
70181cada18a9feab90627ab27070bc00c29ec337aJoe Onorato     * {@link UidHealthStats#TIMERS_WAKELOCKS_WINDOW}
71181cada18a9feab90627ab27070bc00c29ec337aJoe Onorato     * and {@link UidHealthStats#TIMERS_WAKELOCKS_DRAW} keys.
72181cada18a9feab90627ab27070bc00c29ec337aJoe Onorato     */
73713fec85b8612256211f09c62b8958a99fe5b9dbJoe Onorato    @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT)
74713fec85b8612256211f09c62b8958a99fe5b9dbJoe Onorato    public static final int MEASUREMENT_WAKE_START_MS = HealthKeys.BASE_PID + 3;
75713fec85b8612256211f09c62b8958a99fe5b9dbJoe Onorato
76713fec85b8612256211f09c62b8958a99fe5b9dbJoe Onorato    /**
77713fec85b8612256211f09c62b8958a99fe5b9dbJoe Onorato     * @hide
78713fec85b8612256211f09c62b8958a99fe5b9dbJoe Onorato     */
79713fec85b8612256211f09c62b8958a99fe5b9dbJoe Onorato    public static final HealthKeys.Constants CONSTANTS = new HealthKeys.Constants(PidHealthStats.class);
80713fec85b8612256211f09c62b8958a99fe5b9dbJoe Onorato}
81