Search in sources :

Example 16 with IpConnectivityEvent

use of com.android.server.connectivity.metrics.IpConnectivityLogClass.IpConnectivityEvent in project android_frameworks_base by DirtyUnicorns.

the class NetdEventListenerServiceTest method testConnectLogging.

@SmallTest
public void testConnectLogging() throws Exception {
    final int OK = 0;
    Thread[] logActions = { // ignored
    connectEventAction(OsConstants.EALREADY, 0, EXAMPLE_IPV4), connectEventAction(OsConstants.EALREADY, 0, EXAMPLE_IPV6), connectEventAction(OsConstants.EINPROGRESS, 0, EXAMPLE_IPV4), connectEventAction(OsConstants.EINPROGRESS, 0, EXAMPLE_IPV6), connectEventAction(OsConstants.EINPROGRESS, 0, EXAMPLE_IPV6), // valid latencies
    connectEventAction(OK, 110, EXAMPLE_IPV4), connectEventAction(OK, 23, EXAMPLE_IPV4), connectEventAction(OK, 45, EXAMPLE_IPV4), connectEventAction(OK, 56, EXAMPLE_IPV4), connectEventAction(OK, 523, EXAMPLE_IPV6), connectEventAction(OK, 214, EXAMPLE_IPV6), connectEventAction(OK, 67, EXAMPLE_IPV6), // errors
    connectEventAction(OsConstants.EPERM, 0, EXAMPLE_IPV4), connectEventAction(OsConstants.EPERM, 0, EXAMPLE_IPV4), connectEventAction(OsConstants.EAGAIN, 0, EXAMPLE_IPV4), connectEventAction(OsConstants.EACCES, 0, EXAMPLE_IPV4), connectEventAction(OsConstants.EACCES, 0, EXAMPLE_IPV4), connectEventAction(OsConstants.EACCES, 0, EXAMPLE_IPV6), connectEventAction(OsConstants.EADDRINUSE, 0, EXAMPLE_IPV4), connectEventAction(OsConstants.ETIMEDOUT, 0, EXAMPLE_IPV4), connectEventAction(OsConstants.ETIMEDOUT, 0, EXAMPLE_IPV6), connectEventAction(OsConstants.ETIMEDOUT, 0, EXAMPLE_IPV6), connectEventAction(OsConstants.ECONNREFUSED, 0, EXAMPLE_IPV4) };
    for (Thread t : logActions) {
        t.start();
    }
    for (Thread t : logActions) {
        t.join();
    }
    List<IpConnectivityEvent> events = new ArrayList<>();
    mNetdEventListenerService.flushStatistics(events);
    IpConnectivityEvent got = events.get(0);
    String want = joinLines("time_ms: 0", "transport: 0", "connect_statistics <", "  connect_count: 12", "  errnos_counters <", "    key: 1", "    value: 2", "  >", "  errnos_counters <", "    key: 11", "    value: 1", "  >", "  errnos_counters <", "    key: 13", "    value: 3", "  >", "  errnos_counters <", "    key: 98", "    value: 1", "  >", "  errnos_counters <", "    key: 110", "    value: 3", "  >", "  errnos_counters <", "    key: 111", "    value: 1", "  >", "  ipv6_addr_count: 6", "  latencies_ms: 23", "  latencies_ms: 45", "  latencies_ms: 56", "  latencies_ms: 67", "  latencies_ms: 110", "  latencies_ms: 214", "  latencies_ms: 523");
    verifyConnectEvent(want, got);
}
Also used : IpConnectivityEvent(com.android.server.connectivity.metrics.IpConnectivityLogClass.IpConnectivityEvent) ArrayList(java.util.ArrayList) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 17 with IpConnectivityEvent

use of com.android.server.connectivity.metrics.IpConnectivityLogClass.IpConnectivityEvent in project android_frameworks_base by AOSPA.

the class IpConnectivityEventBuilder method toProto.

public static List<IpConnectivityEvent> toProto(List<ConnectivityMetricsEvent> eventsIn) {
    final ArrayList<IpConnectivityEvent> eventsOut = new ArrayList<>(eventsIn.size());
    for (ConnectivityMetricsEvent in : eventsIn) {
        final IpConnectivityEvent out = toProto(in);
        if (out == null) {
            continue;
        }
        eventsOut.add(out);
    }
    return eventsOut;
}
Also used : IpConnectivityEvent(com.android.server.connectivity.metrics.IpConnectivityLogClass.IpConnectivityEvent) ArrayList(java.util.ArrayList) ConnectivityMetricsEvent(android.net.ConnectivityMetricsEvent)

Example 18 with IpConnectivityEvent

use of com.android.server.connectivity.metrics.IpConnectivityLogClass.IpConnectivityEvent in project android_frameworks_base by AOSPA.

the class IpConnectivityEventBuilder method toProto.

public static IpConnectivityEvent toProto(ConnectivityMetricsEvent ev) {
    final IpConnectivityEvent out = new IpConnectivityEvent();
    if (!setEvent(out, ev.data)) {
        return null;
    }
    out.timeMs = ev.timestamp;
    return out;
}
Also used : IpConnectivityEvent(com.android.server.connectivity.metrics.IpConnectivityLogClass.IpConnectivityEvent)

Example 19 with IpConnectivityEvent

use of com.android.server.connectivity.metrics.IpConnectivityLogClass.IpConnectivityEvent in project android_frameworks_base by AOSPA.

the class NetdEventListenerService method flushConnectStats.

private IpConnectivityEvent flushConnectStats() {
    IpConnectivityEvent ev = new IpConnectivityEvent();
    ev.connectStatistics = mConnectStats.toProto();
    // TODO: add transport information
    mConnectStats = makeConnectStats();
    return ev;
}
Also used : IpConnectivityEvent(com.android.server.connectivity.metrics.IpConnectivityLogClass.IpConnectivityEvent)

Example 20 with IpConnectivityEvent

use of com.android.server.connectivity.metrics.IpConnectivityLogClass.IpConnectivityEvent in project android_frameworks_base by ResurrectionRemix.

the class NetdEventListenerService method flushConnectStats.

private IpConnectivityEvent flushConnectStats() {
    IpConnectivityEvent ev = new IpConnectivityEvent();
    ev.connectStatistics = mConnectStats.toProto();
    // TODO: add transport information
    mConnectStats = makeConnectStats();
    return ev;
}
Also used : IpConnectivityEvent(com.android.server.connectivity.metrics.IpConnectivityLogClass.IpConnectivityEvent)

Aggregations

IpConnectivityEvent (com.android.server.connectivity.metrics.IpConnectivityLogClass.IpConnectivityEvent)21 ArrayList (java.util.ArrayList)8 ConnectivityMetricsEvent (android.net.ConnectivityMetricsEvent)5 IpConnectivityLog (com.android.server.connectivity.metrics.IpConnectivityLogClass.IpConnectivityLog)4 SmallTest (android.test.suitebuilder.annotation.SmallTest)3