summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKai Shi <kaishi@google.com>2020-03-23 11:26:51 -0700
committerKai Shi <kaishi@google.com>2020-03-28 21:23:13 -0700
commit5bfeb1ada4d6a12be7df6b72a6ad3fa002a799e3 (patch)
treeac2b41a4235ebf2d90fd71816a44726789ebd024 /tests
parent776f77aa028f52fc08c51da38b502014938850ce (diff)
Add channelUtilization and throughput in metrics
Add channel utilization and Tx and Rx throughput in WifiMetrics. Also change default Tx PER to 5%. Test: atest com.android.server.wifi Test: run adb command "adb shell dumpsys wifi" and check the printed messages of wifiMetrics. Bug: 152226996 Change-Id: I4b4a1d92aed9b9d9cc652d47ce60abc597583c81
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiDataStallTest.java7
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java78
2 files changed, 84 insertions, 1 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiDataStallTest.java b/tests/wifitests/src/com/android/server/wifi/WifiDataStallTest.java
index bb8c74d60..cfe1ee8af 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiDataStallTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiDataStallTest.java
@@ -204,17 +204,21 @@ public class WifiDataStallTest extends WifiBaseTest {
}
/**
- * Verify throughtput when Rx link speed is unavailable
+ * Verify throughtput when Rx link speed is unavailable.
+ * Also verify the logging of channel utilization and throughput.
*/
@Test
public void verifyThroughputNoRxLinkSpeed() throws Exception {
mWifiDataStall.checkDataStallAndThroughputSufficiency(null, mNewLlStats, mWifiInfo);
+ verify(mWifiMetrics).incrementChannelUtilizationCount(10, 5850);
+ verify(mWifiMetrics).incrementThroughputKbpsCount(50_000, 150_000, 5850);
assertEquals(50_000, mWifiDataStall.getTxThroughputKbps());
assertEquals(150_000, mWifiDataStall.getRxThroughputKbps());
when(mWifiInfo.getRxLinkSpeedMbps()).thenReturn(-1);
mWifiDataStall.checkDataStallAndThroughputSufficiency(mOldLlStats, mNewLlStats, mWifiInfo);
assertEquals(960, mWifiDataStall.getTxThroughputKbps());
assertEquals(-1, mWifiDataStall.getRxThroughputKbps());
+ verify(mWifiMetrics).incrementThroughputKbpsCount(960, -1, 5850);
}
/**
@@ -226,6 +230,7 @@ public class WifiDataStallTest extends WifiBaseTest {
assertEquals(WifiIsUnusableEvent.TYPE_UNKNOWN, mWifiDataStall
.checkDataStallAndThroughputSufficiency(mOldLlStats, mNewLlStats, mWifiInfo));
+ verify(mWifiMetrics).incrementThroughputKbpsCount(960, 9609, 5850);
verifyUpdateWifiIsUnusableLinkLayerStats();
when(mClock.getElapsedSinceBootMillis()).thenReturn(
10L + DeviceConfigFacade.DEFAULT_DATA_STALL_DURATION_MS);
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java b/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
index 315a17bc1..841a1326e 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
@@ -4564,4 +4564,82 @@ public class WifiMetricsTest extends WifiBaseTest {
mDecodedProto.softApConfigLimitationMetrics.maxClientSettingWhenReachHistogram);
}
+ /**
+ * Test the logging of channel utilization
+ */
+ @Test
+ public void testChannelUtilization() throws Exception {
+ mWifiMetrics.incrementChannelUtilizationCount(180, 2412);
+ mWifiMetrics.incrementChannelUtilizationCount(150, 2412);
+ mWifiMetrics.incrementChannelUtilizationCount(230, 2412);
+ mWifiMetrics.incrementChannelUtilizationCount(20, 5510);
+ mWifiMetrics.incrementChannelUtilizationCount(50, 5510);
+
+ dumpProtoAndDeserialize();
+
+ HistogramBucketInt32[] expected2GHistogram = {
+ buildHistogramBucketInt32(150, 175, 1),
+ buildHistogramBucketInt32(175, 200, 1),
+ buildHistogramBucketInt32(225, Integer.MAX_VALUE, 1),
+ };
+
+ HistogramBucketInt32[] expectedAbove2GHistogram = {
+ buildHistogramBucketInt32(Integer.MIN_VALUE, 25, 1),
+ buildHistogramBucketInt32(50, 75, 1),
+ };
+
+ assertHistogramBucketsEqual(expected2GHistogram,
+ mDecodedProto.channelUtilizationHistogram.utilization2G);
+ assertHistogramBucketsEqual(expectedAbove2GHistogram,
+ mDecodedProto.channelUtilizationHistogram.utilizationAbove2G);
+ }
+
+ /**
+ * Test the logging of Tx and Rx throughput
+ */
+ @Test
+ public void testThroughput() throws Exception {
+ mWifiMetrics.incrementThroughputKbpsCount(500, 800, 2412);
+ mWifiMetrics.incrementThroughputKbpsCount(5_000, 4_000, 2412);
+ mWifiMetrics.incrementThroughputKbpsCount(54_000, 48_000, 2412);
+ mWifiMetrics.incrementThroughputKbpsCount(50_000, 49_000, 5510);
+ mWifiMetrics.incrementThroughputKbpsCount(801_000, 790_000, 5510);
+ mWifiMetrics.incrementThroughputKbpsCount(1100_000, 1200_000, 5510);
+ mWifiMetrics.incrementThroughputKbpsCount(1599_000, 1800_000, 6120);
+ dumpProtoAndDeserialize();
+
+ HistogramBucketInt32[] expectedTx2GHistogramMbps = {
+ buildHistogramBucketInt32(Integer.MIN_VALUE, 1, 1),
+ buildHistogramBucketInt32(5, 10, 1),
+ buildHistogramBucketInt32(50, 100, 1),
+ };
+
+ HistogramBucketInt32[] expectedRx2GHistogramMbps = {
+ buildHistogramBucketInt32(Integer.MIN_VALUE, 1, 1),
+ buildHistogramBucketInt32(1, 5, 1),
+ buildHistogramBucketInt32(25, 50, 1),
+ };
+
+ HistogramBucketInt32[] expectedTxAbove2GHistogramMbps = {
+ buildHistogramBucketInt32(50, 100, 1),
+ buildHistogramBucketInt32(800, 1200, 2),
+ buildHistogramBucketInt32(1200, 1600, 1),
+ };
+
+ HistogramBucketInt32[] expectedRxAbove2GHistogramMbps = {
+ buildHistogramBucketInt32(25, 50, 1),
+ buildHistogramBucketInt32(600, 800, 1),
+ buildHistogramBucketInt32(1200, 1600, 1),
+ buildHistogramBucketInt32(1600, Integer.MAX_VALUE, 1),
+ };
+
+ assertHistogramBucketsEqual(expectedTx2GHistogramMbps,
+ mDecodedProto.throughputMbpsHistogram.tx2G);
+ assertHistogramBucketsEqual(expectedTxAbove2GHistogramMbps,
+ mDecodedProto.throughputMbpsHistogram.txAbove2G);
+ assertHistogramBucketsEqual(expectedRx2GHistogramMbps,
+ mDecodedProto.throughputMbpsHistogram.rx2G);
+ assertHistogramBucketsEqual(expectedRxAbove2GHistogramMbps,
+ mDecodedProto.throughputMbpsHistogram.rxAbove2G);
+ }
}