From 7a44d3fab050e1aca22317a604a68016c79f5925 Mon Sep 17 00:00:00 2001 From: Etan Cohen Date: Thu, 29 Jun 2017 13:26:35 -0700 Subject: [AWARE] Add metrics for data-path session duration NPD (NAN data-path) session duration metrics: measured from a successful completion (confirm) to termination notification. Bug: 26565416 Test: unit tests passing Change-Id: I30d7a8417789789662e9252fcafbd626a9377d23 --- .../server/wifi/aware/WifiAwareDataPathStateManagerTest.java | 4 ++++ .../com/android/server/wifi/aware/WifiAwareMetricsTest.java | 10 ++++++++++ 2 files changed, 14 insertions(+) (limited to 'tests') diff --git a/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareDataPathStateManagerTest.java b/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareDataPathStateManagerTest.java index 8d70f97e3..0ddf765d7 100644 --- a/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareDataPathStateManagerTest.java +++ b/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareDataPathStateManagerTest.java @@ -712,7 +712,9 @@ public class WifiAwareDataPathStateManagerTest { mMockLooper.dispatchAll(); inOrder.verify(mMockNative).endDataPath(transactionId.capture(), eq(ndpId)); mDut.onEndDataPathResponse(transactionId.getValue(), true, 0); + mDut.onDataPathEndNotification(ndpId); mMockLooper.dispatchAll(); + inOrderM.verify(mAwareMetricsMock).recordNdpSessionDuration(anyLong()); } verifyNoMoreInteractions(mMockNative, mMockCm, mAwareMetricsMock); @@ -809,7 +811,9 @@ public class WifiAwareDataPathStateManagerTest { mMockLooper.dispatchAll(); inOrder.verify(mMockNative).endDataPath(transactionId.capture(), eq(ndpId)); mDut.onEndDataPathResponse(transactionId.getValue(), true, 0); + mDut.onDataPathEndNotification(ndpId); mMockLooper.dispatchAll(); + inOrderM.verify(mAwareMetricsMock).recordNdpSessionDuration(anyLong()); } verifyNoMoreInteractions(mMockNative, mMockCm, mAwareMetricsMock); diff --git a/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareMetricsTest.java b/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareMetricsTest.java index 10db1a7b3..8cd1e1097 100644 --- a/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareMetricsTest.java +++ b/tests/wifitests/src/com/android/server/wifi/aware/WifiAwareMetricsTest.java @@ -425,6 +425,13 @@ public class WifiAwareMetricsTest { mDut.recordNdpStatus(NanStatusType.INTERNAL_FAILURE, false, 0); mDut.recordNdpStatus(NanStatusType.NO_RESOURCES_AVAILABLE, false, 0); + // and some durations + setTime(150); + mDut.recordNdpSessionDuration(7); // 143ms + mDut.recordNdpSessionDuration(10); // 140ms + mDut.recordNdpSessionDuration(25); // 125ms + mDut.recordNdpSessionDuration(140); // 10ms + //verify log = mDut.consolidateProto(); @@ -453,6 +460,9 @@ public class WifiAwareMetricsTest { validateProtoHistBucket("Creation[1]", log.histogramNdpCreationTimeMs[1], 2, 3, 1); validateProtoHistBucket("Creation[2]", log.histogramNdpCreationTimeMs[2], 3, 4, 1); validateProtoHistBucket("Creation[3]", log.histogramNdpCreationTimeMs[3], 10, 20, 2); + + validateProtoHistBucket("Duration[0]", log.histogramNdpSessionDurationMs[0], 10, 20, 1); + validateProtoHistBucket("Duration[1]", log.histogramNdpSessionDurationMs[1], 100, 200, 3); } /** -- cgit v1.2.3