Search in sources :

Example 1 with IpConnectivityEvent

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

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 2 with IpConnectivityEvent

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

the class IpConnectivityEventBuilder method serialize.

public static byte[] serialize(int dropped, List<IpConnectivityEvent> events) throws IOException {
    final IpConnectivityLog log = new IpConnectivityLog();
    log.events = events.toArray(new IpConnectivityEvent[events.size()]);
    log.droppedEvents = dropped;
    if ((log.events.length > 0) || (dropped > 0)) {
        // Only write version number if log has some information at all.
        log.version = IpConnectivityMetrics.VERSION;
    }
    return IpConnectivityLog.toByteArray(log);
}
Also used : IpConnectivityEvent(com.android.server.connectivity.metrics.IpConnectivityLogClass.IpConnectivityEvent) IpConnectivityLog(com.android.server.connectivity.metrics.IpConnectivityLogClass.IpConnectivityLog)

Example 3 with IpConnectivityEvent

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

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 4 with IpConnectivityEvent

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

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 5 with IpConnectivityEvent

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

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)

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