Loading core/java/android/os/health/HealthStats.java +4 −0 Original line number Diff line number Diff line Loading @@ -83,6 +83,10 @@ import java.util.Map; * returned for UidHealthStats.STATS_PACKAGES, the keys come from the * {@link android.os.health.PackageHealthStats} class. * * <p> * The keys that are available are subject to change, depending on what a particular * device or software version is capable of recording. Applications must handle the absence of * data without crashing. */ public class HealthStats { // Header fields Loading core/java/android/os/health/PidHealthStats.java +38 −0 Original line number Diff line number Diff line Loading @@ -20,18 +20,56 @@ package android.os.health; * Keys for {@link HealthStats} returned from * {@link HealthStats#getStats(int) HealthStats.getStats(int)} with the * {@link UidHealthStats#STATS_PIDS UidHealthStats.STATS_PIDS} key. * <p> * The values coming from PidHealthStats are a little bit different from * the other HealthStats values. These values are not aggregate or historical * values, but instead live values from when the snapshot is taken. These * tend to be more useful in debugging rogue processes than in gathering * aggregate metrics across the fleet of devices. */ public final class PidHealthStats { private PidHealthStats() { } /** * Key for a measurement of the current nesting depth of wakelocks for this process. * That is to say, the number of times a nested wakelock has been started but not * stopped. A high number here indicates an improperly paired wakelock acquire/release * combination. * <p> * More details on the individual wake locks is available * by getting the {@link UidHealthStats#TIMERS_WAKELOCKS_FULL}, * {@link UidHealthStats#TIMERS_WAKELOCKS_PARTIAL}, * {@link UidHealthStats#TIMERS_WAKELOCKS_WINDOW} * and {@link UidHealthStats#TIMERS_WAKELOCKS_DRAW} keys. */ @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT) public static final int MEASUREMENT_WAKE_NESTING_COUNT = HealthKeys.BASE_PID + 1; /** * Key for a measurement of the total number of milleseconds that this process * has held a wake lock. * <p> * More details on the individual wake locks is available * by getting the {@link UidHealthStats#TIMERS_WAKELOCKS_FULL}, * {@link UidHealthStats#TIMERS_WAKELOCKS_PARTIAL}, * {@link UidHealthStats#TIMERS_WAKELOCKS_WINDOW} * and {@link UidHealthStats#TIMERS_WAKELOCKS_DRAW} keys. */ @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT) public static final int MEASUREMENT_WAKE_SUM_MS = HealthKeys.BASE_PID + 2; /** * Key for a measurement of the time in the {@link android.os.SystemClock#elapsedRealtime} * timebase that a wakelock was first acquired in this process. * <p> * More details on the individual wake locks is available * by getting the {@link UidHealthStats#TIMERS_WAKELOCKS_FULL}, * {@link UidHealthStats#TIMERS_WAKELOCKS_PARTIAL}, * {@link UidHealthStats#TIMERS_WAKELOCKS_WINDOW} * and {@link UidHealthStats#TIMERS_WAKELOCKS_DRAW} keys. */ @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT) public static final int MEASUREMENT_WAKE_START_MS = HealthKeys.BASE_PID + 3; Loading core/java/android/os/health/ProcessHealthStats.java +21 −0 Original line number Diff line number Diff line Loading @@ -26,21 +26,42 @@ public final class ProcessHealthStats { private ProcessHealthStats() { } /** * Key for a measurement of number of millseconds the CPU spent running in user space * for this process. */ @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT) public static final int MEASUREMENT_USER_TIME_MS = HealthKeys.BASE_PROCESS + 1; /** * Key for a measurement of number of millseconds the CPU spent running in kernel space * for this process. */ @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT) public static final int MEASUREMENT_SYSTEM_TIME_MS = HealthKeys.BASE_PROCESS + 2; /** * Key for a measurement of the number of times this process was started for any reason. */ @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT) public static final int MEASUREMENT_STARTS_COUNT = HealthKeys.BASE_PROCESS + 3; /** * Key for a measurement of the number of crashes that happened in this process. */ @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT) public static final int MEASUREMENT_CRASHES_COUNT = HealthKeys.BASE_PROCESS + 4; /** * Key for a measurement of the number of ANRs that happened in this process. */ @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT) public static final int MEASUREMENT_ANR_COUNT = HealthKeys.BASE_PROCESS + 5; /** * Key for a measurement of the number of milliseconds this process spent with * an activity in the foreground. */ @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT) public static final int MEASUREMENT_FOREGROUND_MS = HealthKeys.BASE_PROCESS + 6; Loading core/java/android/os/health/ServiceHealthStats.java +11 −0 Original line number Diff line number Diff line Loading @@ -26,9 +26,20 @@ public final class ServiceHealthStats { private ServiceHealthStats() { } /** * Key for a measurement of the number of times this service was started due to calls to * {@link android.content.Context#startService startService()}, including re-launches * after crashes. */ @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT) public static final int MEASUREMENT_START_SERVICE_COUNT = HealthKeys.BASE_SERVICE + 1; /** * Key for a measurement of the total number of times this service was started * due to calls to {@link android.content.Context#startService startService()} * or {@link android.content.Context#bindService bindService()} including re-launches * after crashes. */ @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT) public static final int MEASUREMENT_LAUNCH_COUNT = HealthKeys.BASE_SERVICE + 2; Loading core/java/android/os/health/SystemHealthManager.java +5 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,11 @@ import com.android.internal.app.IBatteryStats; /** * Provides access to data about how various system resources are used by applications. * @more * <p> * If you are going to be using this class to log your application's resource usage, * please consider the amount of resources (battery, network, etc) that will be used * by the logging itself. It can be substantial. * <p> * <b>Battery Usage</b><br> * The statistics related to power (battery) usage are recorded since the device * was last unplugged. It is expected that applications schedule more work to do Loading Loading
core/java/android/os/health/HealthStats.java +4 −0 Original line number Diff line number Diff line Loading @@ -83,6 +83,10 @@ import java.util.Map; * returned for UidHealthStats.STATS_PACKAGES, the keys come from the * {@link android.os.health.PackageHealthStats} class. * * <p> * The keys that are available are subject to change, depending on what a particular * device or software version is capable of recording. Applications must handle the absence of * data without crashing. */ public class HealthStats { // Header fields Loading
core/java/android/os/health/PidHealthStats.java +38 −0 Original line number Diff line number Diff line Loading @@ -20,18 +20,56 @@ package android.os.health; * Keys for {@link HealthStats} returned from * {@link HealthStats#getStats(int) HealthStats.getStats(int)} with the * {@link UidHealthStats#STATS_PIDS UidHealthStats.STATS_PIDS} key. * <p> * The values coming from PidHealthStats are a little bit different from * the other HealthStats values. These values are not aggregate or historical * values, but instead live values from when the snapshot is taken. These * tend to be more useful in debugging rogue processes than in gathering * aggregate metrics across the fleet of devices. */ public final class PidHealthStats { private PidHealthStats() { } /** * Key for a measurement of the current nesting depth of wakelocks for this process. * That is to say, the number of times a nested wakelock has been started but not * stopped. A high number here indicates an improperly paired wakelock acquire/release * combination. * <p> * More details on the individual wake locks is available * by getting the {@link UidHealthStats#TIMERS_WAKELOCKS_FULL}, * {@link UidHealthStats#TIMERS_WAKELOCKS_PARTIAL}, * {@link UidHealthStats#TIMERS_WAKELOCKS_WINDOW} * and {@link UidHealthStats#TIMERS_WAKELOCKS_DRAW} keys. */ @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT) public static final int MEASUREMENT_WAKE_NESTING_COUNT = HealthKeys.BASE_PID + 1; /** * Key for a measurement of the total number of milleseconds that this process * has held a wake lock. * <p> * More details on the individual wake locks is available * by getting the {@link UidHealthStats#TIMERS_WAKELOCKS_FULL}, * {@link UidHealthStats#TIMERS_WAKELOCKS_PARTIAL}, * {@link UidHealthStats#TIMERS_WAKELOCKS_WINDOW} * and {@link UidHealthStats#TIMERS_WAKELOCKS_DRAW} keys. */ @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT) public static final int MEASUREMENT_WAKE_SUM_MS = HealthKeys.BASE_PID + 2; /** * Key for a measurement of the time in the {@link android.os.SystemClock#elapsedRealtime} * timebase that a wakelock was first acquired in this process. * <p> * More details on the individual wake locks is available * by getting the {@link UidHealthStats#TIMERS_WAKELOCKS_FULL}, * {@link UidHealthStats#TIMERS_WAKELOCKS_PARTIAL}, * {@link UidHealthStats#TIMERS_WAKELOCKS_WINDOW} * and {@link UidHealthStats#TIMERS_WAKELOCKS_DRAW} keys. */ @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT) public static final int MEASUREMENT_WAKE_START_MS = HealthKeys.BASE_PID + 3; Loading
core/java/android/os/health/ProcessHealthStats.java +21 −0 Original line number Diff line number Diff line Loading @@ -26,21 +26,42 @@ public final class ProcessHealthStats { private ProcessHealthStats() { } /** * Key for a measurement of number of millseconds the CPU spent running in user space * for this process. */ @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT) public static final int MEASUREMENT_USER_TIME_MS = HealthKeys.BASE_PROCESS + 1; /** * Key for a measurement of number of millseconds the CPU spent running in kernel space * for this process. */ @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT) public static final int MEASUREMENT_SYSTEM_TIME_MS = HealthKeys.BASE_PROCESS + 2; /** * Key for a measurement of the number of times this process was started for any reason. */ @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT) public static final int MEASUREMENT_STARTS_COUNT = HealthKeys.BASE_PROCESS + 3; /** * Key for a measurement of the number of crashes that happened in this process. */ @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT) public static final int MEASUREMENT_CRASHES_COUNT = HealthKeys.BASE_PROCESS + 4; /** * Key for a measurement of the number of ANRs that happened in this process. */ @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT) public static final int MEASUREMENT_ANR_COUNT = HealthKeys.BASE_PROCESS + 5; /** * Key for a measurement of the number of milliseconds this process spent with * an activity in the foreground. */ @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT) public static final int MEASUREMENT_FOREGROUND_MS = HealthKeys.BASE_PROCESS + 6; Loading
core/java/android/os/health/ServiceHealthStats.java +11 −0 Original line number Diff line number Diff line Loading @@ -26,9 +26,20 @@ public final class ServiceHealthStats { private ServiceHealthStats() { } /** * Key for a measurement of the number of times this service was started due to calls to * {@link android.content.Context#startService startService()}, including re-launches * after crashes. */ @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT) public static final int MEASUREMENT_START_SERVICE_COUNT = HealthKeys.BASE_SERVICE + 1; /** * Key for a measurement of the total number of times this service was started * due to calls to {@link android.content.Context#startService startService()} * or {@link android.content.Context#bindService bindService()} including re-launches * after crashes. */ @HealthKeys.Constant(type=HealthKeys.TYPE_MEASUREMENT) public static final int MEASUREMENT_LAUNCH_COUNT = HealthKeys.BASE_SERVICE + 2; Loading
core/java/android/os/health/SystemHealthManager.java +5 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,11 @@ import com.android.internal.app.IBatteryStats; /** * Provides access to data about how various system resources are used by applications. * @more * <p> * If you are going to be using this class to log your application's resource usage, * please consider the amount of resources (battery, network, etc) that will be used * by the logging itself. It can be substantial. * <p> * <b>Battery Usage</b><br> * The statistics related to power (battery) usage are recorded since the device * was last unplugged. It is expected that applications schedule more work to do Loading