From 04012eb3e692202b25095f7afc1eda40b63e3e0f Mon Sep 17 00:00:00 2001 From: xshu Date: Wed, 16 May 2018 15:41:19 -0700 Subject: Separates RSSI poll histogram by channel frequency Putting RSSI poll for each frequency into a different histogram. Will be merging the histograms that have similar properties in the metric aggregation code. (i.e. combine frequencies from 5150 - 5250 into a single histogram because they have similar max power usage) Bug: 79864669 Test: compile, unit tests Manual test: flash connect to "Google Guest" and wait 15s Connect to "Boingo GOolge Open" and wait 15s adb shell dumpsys wifi verify that histograms are dumped out for 2 different channel frequencies: mWifiLogProto.rssiPollCount: Printing counts for [-127, 0] {"5540":[{"-57":1},{"-54":1},{"-53":2},{"-52":3},{"-51":1}],"5640":[{"-49":5},{"-48":9},{"-47":3},{"-45":1}]} Change-Id: I1a4ec8ea23f4641905b5ea82fdc0100c3d55d92e --- .../src/com/android/server/wifi/WifiMetricsTest.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java b/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java index 9682750d2..2a60a1096 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java @@ -232,6 +232,7 @@ public class WifiMetricsTest { private static final int NUM_LAST_RESORT_WATCHDOG_TRIGGERS_WITH_BAD_OTHER = 10; private static final int NUM_LAST_RESORT_WATCHDOG_SUCCESSES = 5; private static final int WATCHDOG_TOTAL_CONNECTION_FAILURE_COUNT_AFTER_TRIGGER = 6; + private static final int RSSI_POLL_FREQUENCY = 5150; private static final int NUM_RSSI_LEVELS_TO_INCREMENT = 20; private static final int FIRST_RSSI_LEVEL = -80; private static final int NUM_OPEN_NETWORK_SCAN_RESULTS = 1; @@ -490,15 +491,16 @@ public class WifiMetricsTest { } for (int i = 0; i < NUM_RSSI_LEVELS_TO_INCREMENT; i++) { for (int j = 0; j <= i; j++) { - mWifiMetrics.incrementRssiPollRssiCount(MIN_RSSI_LEVEL + i); + mWifiMetrics.incrementRssiPollRssiCount(RSSI_POLL_FREQUENCY, MIN_RSSI_LEVEL + i); } } for (int i = 1; i < NUM_OUT_OF_BOUND_ENTRIES; i++) { - mWifiMetrics.incrementRssiPollRssiCount(MIN_RSSI_LEVEL - i); + mWifiMetrics.incrementRssiPollRssiCount(RSSI_POLL_FREQUENCY, MIN_RSSI_LEVEL - i); } for (int i = 1; i < NUM_OUT_OF_BOUND_ENTRIES; i++) { - mWifiMetrics.incrementRssiPollRssiCount(MAX_RSSI_LEVEL + i); + mWifiMetrics.incrementRssiPollRssiCount(RSSI_POLL_FREQUENCY, MAX_RSSI_LEVEL + i); } + // Test alert-reason clamping. mWifiMetrics.incrementAlertReasonCount(WifiLoggerHal.WIFI_ALERT_REASON_MIN - 1); mWifiMetrics.incrementAlertReasonCount(WifiLoggerHal.WIFI_ALERT_REASON_MAX + 1); @@ -813,6 +815,8 @@ public class WifiMetricsTest { assertEquals(TEST_RECORD_DURATION_SEC, mDecodedProto.recordDurationSec); for (int i = 0; i < NUM_RSSI_LEVELS_TO_INCREMENT; i++) { + assertEquals(RSSI_POLL_FREQUENCY, + mDecodedProto.rssiPollRssiCount[i].frequency); assertEquals(MIN_RSSI_LEVEL + i, mDecodedProto.rssiPollRssiCount[i].rssi); assertEquals(i + 1, mDecodedProto.rssiPollRssiCount[i].count); } @@ -1817,7 +1821,7 @@ public class WifiMetricsTest { if (!dontDeserializeBeforePoll) { dumpProtoAndDeserialize(); } - mWifiMetrics.incrementRssiPollRssiCount(scanRssi + rssiDelta); + mWifiMetrics.incrementRssiPollRssiCount(RSSI_POLL_FREQUENCY, scanRssi + rssiDelta); } /** -- cgit v1.2.3