From 5f001750a0ce82a8b3a47ac566117d4de27f3e23 Mon Sep 17 00:00:00 2001 From: Glen Kuhne Date: Thu, 21 Apr 2016 15:24:02 -0700 Subject: WifiLastResortWatchdog metrics Added logging of various metrics to the WifiLastResortWatchdog. These metrics count the number of times the Watchdog triggers, and stats counting the number of networks present at failure time for different failure types. BUG=27856474 Change-Id: If43836b1c33791fefb8000196b231c312161feef --- .../server/wifi/WifiLastResortWatchdog.java | 34 ++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) (limited to 'service/java/com/android/server/wifi/WifiLastResortWatchdog.java') diff --git a/service/java/com/android/server/wifi/WifiLastResortWatchdog.java b/service/java/com/android/server/wifi/WifiLastResortWatchdog.java index adb8771ea..a953404c5 100644 --- a/service/java/com/android/server/wifi/WifiLastResortWatchdog.java +++ b/service/java/com/android/server/wifi/WifiLastResortWatchdog.java @@ -78,6 +78,12 @@ public class WifiLastResortWatchdog { // successfully connecting or a new network (SSID) becomes available to connect to. private boolean mWatchdogAllowedToTrigger = true; + private WifiMetrics mWifiMetrics; + + WifiLastResortWatchdog(WifiMetrics wifiMetrics) { + mWifiMetrics = wifiMetrics; + } + /** * Refreshes recentAvailableNetworks with the latest available networks * Adds new networks, removes old ones that have timed out. Should be called after Wifi @@ -325,11 +331,35 @@ public class WifiLastResortWatchdog { } /** - * Update WifiMetrics with various Watchdog stats (trigger counts, tracked network count) + * Update WifiMetrics with various Watchdog stats (trigger counts, failed network counts) */ private void incrementWifiMetricsTriggerCounts() { if (VDBG) Log.v(TAG, "incrementWifiMetricsTriggerCounts."); - // + mWifiMetrics.incrementNumLastResortWatchdogTriggers(); + mWifiMetrics.addCountToNumLastResortWatchdogAvailableNetworksTotal( + mSsidFailureCount.size()); + // Number of networks over each failure type threshold, present at trigger time + int badAuth = 0; + int badAssoc = 0; + int badDhcp = 0; + for (Map.Entry> entry + : mSsidFailureCount.entrySet()) { + badAuth += (entry.getValue().first.authenticationFailure >= FAILURE_THRESHOLD) ? 1 : 0; + badAssoc += (entry.getValue().first.associationRejection >= FAILURE_THRESHOLD) ? 1 : 0; + badDhcp += (entry.getValue().first.dhcpFailure >= FAILURE_THRESHOLD) ? 1 : 0; + } + if (badAuth > 0) { + mWifiMetrics.addCountToNumLastResortWatchdogBadAuthenticationNetworksTotal(badAuth); + mWifiMetrics.incrementNumLastResortWatchdogTriggersWithBadAuthentication(); + } + if (badAssoc > 0) { + mWifiMetrics.addCountToNumLastResortWatchdogBadAssociationNetworksTotal(badAssoc); + mWifiMetrics.incrementNumLastResortWatchdogTriggersWithBadAssociation(); + } + if (badDhcp > 0) { + mWifiMetrics.addCountToNumLastResortWatchdogBadDhcpNetworksTotal(badDhcp); + mWifiMetrics.incrementNumLastResortWatchdogTriggersWithBadDhcp(); + } } /** -- cgit v1.2.3