summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKai Shi <kaishi@google.com>2019-07-19 09:40:55 -0700
committerKai Shi <kaishi@google.com>2019-07-22 13:40:13 -0700
commitfa0ca0bc40a1a7ba0c3701384a756d29ef54c38f (patch)
tree3e7fd7d1dd703cbea553d9648f81f8e8fbc3e884 /tests
parent4a900f532c60f039103ac32320b63c18fd98741e (diff)
Wifi: add per-band Tx and Rx speed histogram in WifiMetrics and add
rxLinkSpeed in logLinkMetrics() of WifiScoreReport Bug: 137886569 Test: unit test with frameworks/opt/net/wifi/tests/wifitests/runtest.sh and manual test Change-Id: Id57ad91e84cd68de558b21d568037bfc5a250966
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java55
1 files changed, 55 insertions, 0 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java b/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
index e45906a85..7e086d4ce 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
@@ -2577,6 +2577,45 @@ public class WifiMetricsTest {
}
/**
+ * Verify that Tx and Rx per-band LinkSpeedCounts are correctly logged in metrics
+ */
+ @Test
+ public void testTxRxLinkSpeedBandCounts() throws Exception {
+ when(mFacade.getIntegerSetting(eq(mContext),
+ eq(Settings.Global.WIFI_LINK_SPEED_METRICS_ENABLED), anyInt())).thenReturn(1);
+ mWifiMetrics.loadSettings();
+ for (int i = 0; i < NUM_LINK_SPEED_LEVELS_TO_INCREMENT; i++) {
+ for (int j = 0; j <= i; j++) {
+ mWifiMetrics.incrementTxLinkSpeedBandCount(
+ WifiMetrics.MIN_LINK_SPEED_MBPS + i, RSSI_POLL_FREQUENCY);
+ mWifiMetrics.incrementRxLinkSpeedBandCount(
+ WifiMetrics.MIN_LINK_SPEED_MBPS + i + 1, RSSI_POLL_FREQUENCY);
+ }
+ }
+ dumpProtoAndDeserialize();
+ assertEquals(0, mDecodedProto.txLinkSpeedCount2G.length);
+ assertEquals(0, mDecodedProto.rxLinkSpeedCount2G.length);
+ assertEquals(NUM_LINK_SPEED_LEVELS_TO_INCREMENT,
+ mDecodedProto.txLinkSpeedCount5GLow.length);
+ assertEquals(NUM_LINK_SPEED_LEVELS_TO_INCREMENT,
+ mDecodedProto.rxLinkSpeedCount5GLow.length);
+ assertEquals(0, mDecodedProto.txLinkSpeedCount5GMid.length);
+ assertEquals(0, mDecodedProto.rxLinkSpeedCount5GMid.length);
+ assertEquals(0, mDecodedProto.txLinkSpeedCount5GHigh.length);
+ assertEquals(0, mDecodedProto.rxLinkSpeedCount5GHigh.length);
+ for (int i = 0; i < NUM_LINK_SPEED_LEVELS_TO_INCREMENT; i++) {
+ assertEquals("Incorrect Tx link speed", WifiMetrics.MIN_LINK_SPEED_MBPS + i,
+ mDecodedProto.txLinkSpeedCount5GLow[i].key);
+ assertEquals("Incorrect Rx link speed", WifiMetrics.MIN_LINK_SPEED_MBPS + i + 1,
+ mDecodedProto.rxLinkSpeedCount5GLow[i].key);
+ assertEquals("Incorrect count of Tx link speed",
+ i + 1, mDecodedProto.txLinkSpeedCount5GLow[i].count);
+ assertEquals("Incorrect count of Rx link speed",
+ i + 1, mDecodedProto.rxLinkSpeedCount5GLow[i].count);
+ }
+ }
+
+ /**
* Verify that LinkSpeedCounts is not logged when disabled in settings
*/
@Test
@@ -2588,11 +2627,19 @@ public class WifiMetricsTest {
for (int j = 0; j <= i; j++) {
mWifiMetrics.incrementLinkSpeedCount(
WifiMetrics.MIN_LINK_SPEED_MBPS + i, TEST_RSSI_LEVEL);
+ mWifiMetrics.incrementTxLinkSpeedBandCount(
+ WifiMetrics.MIN_LINK_SPEED_MBPS - i, RSSI_POLL_FREQUENCY);
+ mWifiMetrics.incrementRxLinkSpeedBandCount(
+ WifiMetrics.MIN_LINK_SPEED_MBPS - i, RSSI_POLL_FREQUENCY);
}
}
dumpProtoAndDeserialize();
assertEquals("LinkSpeedCounts should not be logged when disabled in settings",
0, mDecodedProto.linkSpeedCounts.length);
+ assertEquals("Tx LinkSpeedCounts should not be logged when disabled in settings",
+ 0, mDecodedProto.txLinkSpeedCount5GLow.length);
+ assertEquals("Rx LinkSpeedCounts should not be logged when disabled in settings",
+ 0, mDecodedProto.rxLinkSpeedCount5GLow.length);
}
/**
@@ -2608,6 +2655,10 @@ public class WifiMetricsTest {
for (int i = 1; i < NUM_OUT_OF_BOUND_ENTRIES; i++) {
mWifiMetrics.incrementLinkSpeedCount(
WifiMetrics.MIN_LINK_SPEED_MBPS - i, MIN_RSSI_LEVEL);
+ mWifiMetrics.incrementTxLinkSpeedBandCount(
+ WifiMetrics.MIN_LINK_SPEED_MBPS - i, RSSI_POLL_FREQUENCY);
+ mWifiMetrics.incrementRxLinkSpeedBandCount(
+ WifiMetrics.MIN_LINK_SPEED_MBPS - i, RSSI_POLL_FREQUENCY);
}
for (int i = 1; i < NUM_OUT_OF_BOUND_ENTRIES; i++) {
mWifiMetrics.incrementLinkSpeedCount(
@@ -2620,6 +2671,10 @@ public class WifiMetricsTest {
dumpProtoAndDeserialize();
assertEquals("LinkSpeedCounts should not be logged for out of bound values",
0, mDecodedProto.linkSpeedCounts.length);
+ assertEquals("Tx LinkSpeedCounts should not be logged for out of bound values",
+ 0, mDecodedProto.txLinkSpeedCount5GLow.length);
+ assertEquals("Rx LinkSpeedCounts should not be logged for out of bound values",
+ 0, mDecodedProto.rxLinkSpeedCount5GLow.length);
}
private int nextRandInt() {