Partager via


HealthStats Class

Definition

A HealthStats object contains system health data about an application.

[Android.Runtime.Register("android/os/health/HealthStats", ApiSince=24, DoNotGenerateAcw=true)]
public class HealthStats : Java.Lang.Object
[<Android.Runtime.Register("android/os/health/HealthStats", ApiSince=24, DoNotGenerateAcw=true)>]
type HealthStats = class
    inherit Object
Inheritance
HealthStats
Attributes

Remarks

A HealthStats object contains system health data about an application.

<b>Data Types</b><br> Each of the keys references data in one of five data types:

A <b>measurement</b> metric contains a single long value. That value may be a count, a time, or some other type of value. The unit for a measurement (COUNT, MS, etc) will always be in the name of the constant for the key to retrieve it. For example, the android.os.health.UidHealthStats#MEASUREMENT_WIFI_TX_MS UidHealthStats.MEASUREMENT_WIFI_TX_MS value is the number of milliseconds (ms) that were spent transmitting on wifi by an application. The android.os.health.UidHealthStats#MEASUREMENT_MOBILE_RX_PACKETS UidHealthStats.MEASUREMENT_MOBILE_RX_PACKETS measurement is the number of packets received on behalf of an application. The android.os.health.UidHealthStats#MEASUREMENT_TOUCH_USER_ACTIVITY_COUNT UidHealthStats.MEASUREMENT_TOUCH_USER_ACTIVITY_COUNT measurement is the number of times the user touched the screen, causing the screen to stay awake.

A <b>timer</b> metric contains an int count and a long time, measured in milliseconds. Timers track how many times a resource was used, and the total duration for that usage. For example, the android.os.health.UidHealthStats#TIMER_FLASHLIGHT timer tracks how many times the application turned on the flashlight, and for how many milliseconds total it kept it on.

A <b>measurement map</b> metric is a mapping of java.lang.String names to java.lang.Long values. The names typically are application provided names. For example, the android.os.health.PackageHealthStats#MEASUREMENTS_WAKEUP_ALARMS_COUNT PackageHealthStats.MEASUREMENTS_WAKEUP_ALARMS_COUNT measurement map is a mapping of the tag provided to the android.app.AlarmManager when the alarm is scheduled.

A <b>timer map</b> metric is a mapping of java.lang.String names to android.os.health.TimerStat objects. The names are typically application provided names. For example, the android.os.health.UidHealthStats#TIMERS_WAKELOCKS_PARTIAL UidHealthStats.TIMERS_WAKELOCKS_PARTIAL is a mapping of tag provided to the android.os.PowerManager when the wakelock is created to the number of times and for how long each wakelock was active.

Lastly, a <b>health stats</b> metric is a mapping of java.lang.String names to a recursive android.os.health.HealthStats object containing more detailed information. For example, the android.os.health.UidHealthStats#STATS_PACKAGES UidHealthStats.STATS_PACKAGES metric is a mapping of the package names for each of the APKs sharing a uid to the information recorded for that apk. The returned HealthStats objects will each be associated with a different set of constants. For the HealthStats returned for UidHealthStats.STATS_PACKAGES, the keys come from the android.os.health.PackageHealthStats class.

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.

Java documentation for android.os.health.HealthStats.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Constructors

HealthStats(IntPtr, JniHandleOwnership)

Properties

Class

Returns the runtime class of this Object.

(Inherited from Object)
DataType

Get a name representing the contents of this object.

Handle

The handle to the underlying Android instance.

(Inherited from Object)
JniIdentityHashCode (Inherited from Object)
JniPeerMembers
MeasurementKeyCount

Get the number of measurement values in this object.

MeasurementsKeyCount

Get the number of measurement map values in this object.

PeerReference (Inherited from Object)
StatsKeyCount

Get the number of HealthStat map values in this object.

ThresholdClass
ThresholdType
TimerKeyCount

Get the number of timer values in this object.

TimersKeyCount

Get the number of timer map values in this object.

Methods

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
GetMeasurement(Int32)

Get the measurement for the given key.

GetMeasurementKeyAt(Int32)

Get the key for the measurement at the given index.

GetMeasurements(Int32)

Get the measurements map for the given key.

GetMeasurementsKeyAt(Int32)

Get the key for the measurement map at the given index.

GetStats(Int32)

Get the HealthStats map for the given key.

GetStatsKeyAt(Int32)

Get the key for the timer at the given index.

GetTimer(Int32)

Return a TimerStat object for the given key.

GetTimerCount(Int32)

Get the count for the timer for the given key.

GetTimerKeyAt(Int32)

Get the key for the timer at the given index.

GetTimers(Int32)

Get the TimerStat map for the given key.

GetTimersKeyAt(Int32)

Get the key for the timer map at the given index.

GetTimerTime(Int32)

Get the time for the timer for the given key, in milliseconds.

HasMeasurement(Int32)

Return whether this object contains a measurement for the supplied key.

HasMeasurements(Int32)

Return whether this object contains a measurements map for the supplied key.

HasStats(Int32)

Return whether this object contains a HealthStats map for the supplied key.

HasTimer(Int32)

Return whether this object contains a TimerStat for the supplied key.

HasTimers(Int32)

Return whether this object contains a timers map for the supplied key.

JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to