Wifi usability: Add link probe results and rx link speed into usability

stats

As title indicates.

Bug: 113262380

Test: frameworks/base/wifi/tests/runtests.sh

Change-Id: Idfa70d314f2938ea42a8b308c7d74e274af7c3cb
Signed-off-by: Mingguang Xu <mingguangxu@google.com>
This commit is contained in:
Mingguang Xu
2019-01-24 23:00:10 -08:00
parent eacd0d7ff6
commit bed0885e92
4 changed files with 84 additions and 3 deletions

View File

@@ -4924,8 +4924,16 @@ package android.net.wifi {
method public int describeContents();
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator<android.net.wifi.WifiUsabilityStatsEntry> CREATOR;
field public static final int PROBE_STATUS_FAILURE = 3; // 0x3
field public static final int PROBE_STATUS_NO_PROBE = 1; // 0x1
field public static final int PROBE_STATUS_SUCCESS = 2; // 0x2
field public static final int PROBE_STATUS_UNKNOWN = 0; // 0x0
field public final int linkSpeedMbps;
field public final int probeElapsedTimeMsSinceLastUpdate;
field public final int probeMcsRateSinceLastUpdate;
field public final int probeStatusSinceLastUpdate;
field public final int rssi;
field public final int rxLinkSpeedMbps;
field public final long timeStampMs;
field public final long totalBackgroundScanTimeMs;
field public final long totalBeaconRx;

View File

@@ -1754,6 +1754,21 @@ message WifiLinkLayerUsageStats {
}
message WifiUsabilityStatsEntry {
// Status codes for link probe status
enum LinkProbeStatus {
// Link probe status is unknown
PROBE_STATUS_UNKNOWN = 0;
// Link probe is not triggered
PROBE_STATUS_NO_PROBE = 1;
// Link probe is triggered and the result is success
PROBE_STATUS_SUCCESS = 2;
// Link probe is triggered and the result is failure
PROBE_STATUS_FAILURE = 3;
}
// Absolute milliseconds from device boot when these stats were sampled
optional int64 time_stamp_ms = 1;
@@ -1826,6 +1841,18 @@ message WifiUsabilityStatsEntry {
// Prediction horizon (in second) of Wifi usability score provided by external
// system app
optional int32 prediction_horizon_sec = 23;
// The link probe status since last stats update
optional LinkProbeStatus probe_status_since_last_update = 24;
// The elapsed time of the most recent link probe since last stats update;
optional int32 probe_elapsed_time_ms_since_last_update = 25;
// The MCS rate of the most recent link probe since last stats update
optional int32 probe_mcs_rate_since_last_update = 26;
// Rx link speed at the sample time in Mbps
optional int32 rx_link_speed_mbps = 27;
}
message WifiUsabilityStats {

View File

@@ -16,10 +16,14 @@
package android.net.wifi;
import android.annotation.IntDef;
import android.annotation.SystemApi;
import android.os.Parcel;
import android.os.Parcelable;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/**
* This class makes a subset of
* com.android.server.wifi.nano.WifiMetricsProto.WifiUsabilityStatsEntry parcelable.
@@ -28,6 +32,24 @@ import android.os.Parcelable;
*/
@SystemApi
public final class WifiUsabilityStatsEntry implements Parcelable {
/** {@hide} */
@Retention(RetentionPolicy.SOURCE)
@IntDef(prefix = {"PROBE_STATUS_"}, value = {
PROBE_STATUS_UNKNOWN,
PROBE_STATUS_NO_PROBE,
PROBE_STATUS_SUCCESS,
PROBE_STATUS_FAILURE})
public @interface ProbeStatus {}
/** Link probe status is unknown */
public static final int PROBE_STATUS_UNKNOWN = 0;
/** Link probe is not triggered */
public static final int PROBE_STATUS_NO_PROBE = 1;
/** Link probe is triggered and the result is success */
public static final int PROBE_STATUS_SUCCESS = 2;
/** Link probe is triggered and the result is failure */
public static final int PROBE_STATUS_FAILURE = 3;
/** Absolute milliseconds from device boot when these stats were sampled */
public final long timeStampMs;
/** The RSSI (in dBm) at the sample time */
@@ -68,6 +90,14 @@ public final class WifiUsabilityStatsEntry implements Parcelable {
public final long totalRadioOnFreqTimeMs;
/** The total number of beacons received from the last radio chip reset */
public final long totalBeaconRx;
/** The status of link probe since last stats update */
public final int probeStatusSinceLastUpdate;
/** The elapsed time of the most recent link probe since last stats update */
public final int probeElapsedTimeMsSinceLastUpdate;
/** The MCS rate of the most recent link probe since last stats update */
public final int probeMcsRateSinceLastUpdate;
/** Rx link speed at the sample time in Mbps */
public final int rxLinkSpeedMbps;
/** Constructor function {@hide} */
public WifiUsabilityStatsEntry(long timeStampMs, int rssi,
@@ -76,7 +106,9 @@ public final class WifiUsabilityStatsEntry implements Parcelable {
long totalRadioTxTimeMs, long totalRadioRxTimeMs, long totalScanTimeMs,
long totalNanScanTimeMs, long totalBackgroundScanTimeMs, long totalRoamScanTimeMs,
long totalPnoScanTimeMs, long totalHotspot2ScanTimeMs, long totalCcaBusyFreqTimeMs,
long totalRadioOnFreqTimeMs, long totalBeaconRx) {
long totalRadioOnFreqTimeMs, long totalBeaconRx,
@ProbeStatus int probeStatusSinceLastUpdate, int probeElapsedTimeMsSinceLastUpdate,
int probeMcsRateSinceLastUpdate, int rxLinkSpeedMbps) {
this.timeStampMs = timeStampMs;
this.rssi = rssi;
this.linkSpeedMbps = linkSpeedMbps;
@@ -96,6 +128,10 @@ public final class WifiUsabilityStatsEntry implements Parcelable {
this.totalCcaBusyFreqTimeMs = totalCcaBusyFreqTimeMs;
this.totalRadioOnFreqTimeMs = totalRadioOnFreqTimeMs;
this.totalBeaconRx = totalBeaconRx;
this.probeStatusSinceLastUpdate = probeStatusSinceLastUpdate;
this.probeElapsedTimeMsSinceLastUpdate = probeElapsedTimeMsSinceLastUpdate;
this.probeMcsRateSinceLastUpdate = probeMcsRateSinceLastUpdate;
this.rxLinkSpeedMbps = rxLinkSpeedMbps;
}
/** Implement the Parcelable interface */
@@ -124,6 +160,10 @@ public final class WifiUsabilityStatsEntry implements Parcelable {
dest.writeLong(totalCcaBusyFreqTimeMs);
dest.writeLong(totalRadioOnFreqTimeMs);
dest.writeLong(totalBeaconRx);
dest.writeInt(probeStatusSinceLastUpdate);
dest.writeInt(probeElapsedTimeMsSinceLastUpdate);
dest.writeInt(probeMcsRateSinceLastUpdate);
dest.writeInt(rxLinkSpeedMbps);
}
/** Implement the Parcelable interface */
@@ -137,7 +177,8 @@ public final class WifiUsabilityStatsEntry implements Parcelable {
in.readLong(), in.readLong(), in.readLong(),
in.readLong(), in.readLong(), in.readLong(),
in.readLong(), in.readLong(), in.readLong(),
in.readLong(), in.readLong()
in.readLong(), in.readLong(), in.readInt(),
in.readInt(), in.readInt(), in.readInt()
);
}

View File

@@ -74,7 +74,7 @@ public class WifiUsabilityStatsEntryTest {
private static WifiUsabilityStatsEntry createResult() {
return new WifiUsabilityStatsEntry(
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22
);
}
@@ -100,5 +100,10 @@ public class WifiUsabilityStatsEntryTest {
assertEquals(expected.totalCcaBusyFreqTimeMs, actual.totalCcaBusyFreqTimeMs);
assertEquals(expected.totalRadioOnFreqTimeMs, actual.totalRadioOnFreqTimeMs);
assertEquals(expected.totalBeaconRx, actual.totalBeaconRx);
assertEquals(expected.probeStatusSinceLastUpdate, actual.probeStatusSinceLastUpdate);
assertEquals(expected.probeElapsedTimeMsSinceLastUpdate,
actual.probeElapsedTimeMsSinceLastUpdate);
assertEquals(expected.probeMcsRateSinceLastUpdate, actual.probeMcsRateSinceLastUpdate);
assertEquals(expected.rxLinkSpeedMbps, actual.rxLinkSpeedMbps);
}
}