summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorAhmed ElArabawy <arabawy@google.com>2020-04-10 16:19:53 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2020-04-10 16:19:53 +0000
commitb69b89ff86db7b3e9f4263e7bb7fb48dba69832a (patch)
tree10897465a14cc73742db6bffd63e2e2b7f29e4e8 /service
parentf975a91351d1ef7c7838ac46751c2b4298235447 (diff)
parent427cd448103907a947fb09c26ba3ce93cb4dd40b (diff)
Merge "Add metrics for initial partial scan feature" into rvc-dev
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/WifiConnectivityManager.java18
-rw-r--r--service/java/com/android/server/wifi/WifiMetrics.java65
-rw-r--r--service/proto/src/metrics.proto22
3 files changed, 104 insertions, 1 deletions
diff --git a/service/java/com/android/server/wifi/WifiConnectivityManager.java b/service/java/com/android/server/wifi/WifiConnectivityManager.java
index 3d2f3c58a..030121efd 100644
--- a/service/java/com/android/server/wifi/WifiConnectivityManager.java
+++ b/service/java/com/android/server/wifi/WifiConnectivityManager.java
@@ -182,6 +182,11 @@ public class WifiConnectivityManager {
private boolean mPnoScanStarted = false;
private boolean mPeriodicScanTimerSet = false;
private boolean mDelayedPartialScanTimerSet = false;
+
+ // Used for Initial Scan metrics
+ private boolean mFailedInitialPartialScan = false;
+ private int mInitialPartialScanChannelCount;
+
// Device configs
private boolean mWaitForFullBandScanResults = false;
@@ -522,10 +527,20 @@ public class WifiConnectivityManager {
Log.i(TAG, "Connection attempted with the reduced initial scans");
schedulePeriodicScanTimer(
getScheduledSingleScanIntervalMs(mCurrentSingleScanScheduleIndex));
+ mWifiMetrics.reportInitialPartialScan(mInitialPartialScanChannelCount, true);
+ mInitialPartialScanChannelCount = 0;
} else {
Log.i(TAG, "Connection was not attempted, issuing a full scan");
startConnectivityScan(SCAN_IMMEDIATELY);
+ mFailedInitialPartialScan = true;
}
+ } else if (mInitialScanState == INITIAL_SCAN_STATE_COMPLETE) {
+ if (mFailedInitialPartialScan && wasConnectAttempted) {
+ // Initial scan failed, but following full scan succeeded
+ mWifiMetrics.reportInitialPartialScan(mInitialPartialScanChannelCount, false);
+ }
+ mFailedInitialPartialScan = false;
+ mInitialPartialScanChannelCount = 0;
}
}
@@ -1135,6 +1150,7 @@ public class WifiConnectivityManager {
// Hence, we verify state before changing to AWIATING_RESPONSE
if (mInitialScanState == INITIAL_SCAN_STATE_START) {
setInitialScanState(INITIAL_SCAN_STATE_AWAITING_RESPONSE);
+ mWifiMetrics.incrementInitialPartialScanCount();
}
// No scheduling for another scan (until we get the results)
return;
@@ -1239,6 +1255,8 @@ public class WifiConnectivityManager {
isFullBandScan = true;
// Skip the initial scan since no channel history available
setInitialScanState(INITIAL_SCAN_STATE_COMPLETE);
+ } else {
+ mInitialPartialScanChannelCount = settings.channels.length;
}
}
settings.type = WifiScanner.SCAN_TYPE_HIGH_ACCURACY; // always do high accuracy scans.
diff --git a/service/java/com/android/server/wifi/WifiMetrics.java b/service/java/com/android/server/wifi/WifiMetrics.java
index 3f13e99fc..409293f9c 100644
--- a/service/java/com/android/server/wifi/WifiMetrics.java
+++ b/service/java/com/android/server/wifi/WifiMetrics.java
@@ -64,6 +64,7 @@ import com.android.server.wifi.proto.nano.WifiMetricsProto.ConnectToNetworkNotif
import com.android.server.wifi.proto.nano.WifiMetricsProto.DeviceMobilityStatePnoScanStats;
import com.android.server.wifi.proto.nano.WifiMetricsProto.ExperimentValues;
import com.android.server.wifi.proto.nano.WifiMetricsProto.HealthMonitorMetrics;
+import com.android.server.wifi.proto.nano.WifiMetricsProto.InitPartialScanStats;
import com.android.server.wifi.proto.nano.WifiMetricsProto.LinkProbeStats;
import com.android.server.wifi.proto.nano.WifiMetricsProto.LinkProbeStats.ExperimentProbeCounts;
import com.android.server.wifi.proto.nano.WifiMetricsProto.LinkProbeStats.LinkProbeFailureReasonCount;
@@ -463,6 +464,17 @@ public class WifiMetrics {
private final IntHistogram mRxThroughputMbpsHistogramAbove2G =
new IntHistogram(THROUGHPUT_MBPS_BUCKETS);
+ // Init partial scan metrics
+ private int mInitPartialScanTotalCount;
+ private int mInitPartialScanSuccessCount;
+ private int mInitPartialScanFailureCount;
+ private static final int[] INIT_PARTIAL_SCAN_HISTOGRAM_BUCKETS =
+ {1, 3, 5, 10};
+ private final IntHistogram mInitPartialScanSuccessHistogram =
+ new IntHistogram(INIT_PARTIAL_SCAN_HISTOGRAM_BUCKETS);
+ private final IntHistogram mInitPartialScanFailureHistogram =
+ new IntHistogram(INIT_PARTIAL_SCAN_HISTOGRAM_BUCKETS);
+
// Wi-Fi off metrics
private final WifiOffMetrics mWifiOffMetrics = new WifiOffMetrics();
@@ -3515,10 +3527,20 @@ public class WifiMetrics {
+ mTxThroughputMbpsHistogramAbove2G);
pw.println("mRxThroughputMbpsHistogramAbove2G:\n"
+ mRxThroughputMbpsHistogramAbove2G);
+
+ dumpInitPartialScanMetrics(pw);
}
}
}
+ private void dumpInitPartialScanMetrics(PrintWriter pw) {
+ pw.println("mInitPartialScanTotalCount:\n" + mInitPartialScanTotalCount);
+ pw.println("mInitPartialScanSuccessCount:\n" + mInitPartialScanSuccessCount);
+ pw.println("mInitPartialScanFailureCount:\n" + mInitPartialScanFailureCount);
+ pw.println("mInitPartialScanSuccessHistogram:\n" + mInitPartialScanSuccessHistogram);
+ pw.println("mInitPartialScanFailureHistogram:\n" + mInitPartialScanFailureHistogram);
+ }
+
private void printWifiUsabilityStatsEntry(PrintWriter pw, WifiUsabilityStatsEntry entry) {
StringBuilder line = new StringBuilder();
line.append("timestamp_ms=" + entry.timeStampMs);
@@ -3691,6 +3713,32 @@ public class WifiMetrics {
}
/**
+ * Increment initial partial scan count
+ */
+ public void incrementInitialPartialScanCount() {
+ synchronized (mLock) {
+ mInitPartialScanTotalCount++;
+ }
+ }
+
+ /**
+ * Report of initial partial scan
+ * @param channelCount number of channels used in this scan
+ * @param status true if scan resulted in a network connection attempt, false otherwise
+ */
+ public void reportInitialPartialScan(int channelCount, boolean status) {
+ synchronized (mLock) {
+ if (status) {
+ mInitPartialScanSuccessCount++;
+ mInitPartialScanSuccessHistogram.increment(channelCount);
+ } else {
+ mInitPartialScanFailureCount++;
+ mInitPartialScanFailureHistogram.increment(channelCount);
+ }
+ }
+ }
+
+ /**
* Put all metrics that were being tracked separately into mWifiLogProto
*/
private void consolidateProto() {
@@ -4102,6 +4150,16 @@ public class WifiMetrics {
mRxThroughputMbpsHistogram2G.toProto();
mWifiLogProto.throughputMbpsHistogram.rxAbove2G =
mRxThroughputMbpsHistogramAbove2G.toProto();
+
+ InitPartialScanStats initialPartialScanStats = new InitPartialScanStats();
+ initialPartialScanStats.numScans = mInitPartialScanTotalCount;
+ initialPartialScanStats.numSuccessScans = mInitPartialScanSuccessCount;
+ initialPartialScanStats.numFailureScans = mInitPartialScanFailureCount;
+ initialPartialScanStats.successfulScanChannelCountHistogram =
+ mInitPartialScanSuccessHistogram.toProto();
+ initialPartialScanStats.failedScanChannelCountHistogram =
+ mInitPartialScanFailureHistogram.toProto();
+ mWifiLogProto.initPartialScanStats = initialPartialScanStats;
}
}
@@ -4307,7 +4365,12 @@ public class WifiMetrics {
mWifiLogProto.isExternalWifiScorerOn = false;
mWifiOffMetrics.clear();
mSoftApConfigLimitationMetrics.clear();
-
+ //Initial partial scan metrics
+ mInitPartialScanTotalCount = 0;
+ mInitPartialScanSuccessCount = 0;
+ mInitPartialScanFailureCount = 0;
+ mInitPartialScanSuccessHistogram.clear();
+ mInitPartialScanFailureHistogram.clear();
}
}
diff --git a/service/proto/src/metrics.proto b/service/proto/src/metrics.proto
index e0061f44d..04682db21 100644
--- a/service/proto/src/metrics.proto
+++ b/service/proto/src/metrics.proto
@@ -655,6 +655,9 @@ message WifiLog {
// Total number of scan results from 6GHz band
optional int32 num_6g_network_scan_results = 183;
+
+ // Initial partial scan stats
+ optional InitPartialScanStats init_partial_scan_stats = 184;
}
// Information that gets logged for every WiFi connection.
@@ -3122,3 +3125,22 @@ message ThroughputMbpsHistogram {
// Rx histogram above 2G
repeated HistogramBucketInt32 rx_above_2g = 4;
}
+
+// Initial Partial Scan stats
+message InitPartialScanStats {
+ // Total number of partial scans
+ optional int32 num_scans = 1;
+
+ // Number of instances a partial scan results in finding a network
+ optional int32 num_success_scans = 2;
+
+ // Number of instances a patial scan does not result in finding a network
+ // and a follow up full scan finds a network.
+ optional int32 num_failure_scans = 3;
+
+ // Histogram of number of channels used in a successful partial scan
+ repeated HistogramBucketInt32 successful_scan_channel_count_histogram = 4;
+
+ // Histogram of number of channels used in a failed partial scan
+ repeated HistogramBucketInt32 failed_scan_channel_count_histogram = 5;
+}