Search in sources :

Example 6 with IpConnectivityLog

use of android.net.metrics.IpConnectivityLog in project android_frameworks_base by DirtyUnicorns.

the class IpConnectivityMetricsTest method testLoggingEvents.

@SmallTest
public void testLoggingEvents() throws Exception {
    IpConnectivityLog logger = new IpConnectivityLog(mMockService);
    assertTrue(logger.log(1, FAKE_EV));
    assertTrue(logger.log(2, FAKE_EV));
    assertTrue(logger.log(3, FAKE_EV));
    List<ConnectivityMetricsEvent> got = verifyEvents(3);
    assertEventsEqual(expectedEvent(1), got.get(0));
    assertEventsEqual(expectedEvent(2), got.get(1));
    assertEventsEqual(expectedEvent(3), got.get(2));
}
Also used : IpConnectivityLog(android.net.metrics.IpConnectivityLog) ConnectivityMetricsEvent(android.net.ConnectivityMetricsEvent) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 7 with IpConnectivityLog

use of android.net.metrics.IpConnectivityLog in project android_frameworks_base by DirtyUnicorns.

the class IpConnectivityMetricsTest method testBufferFlushing.

@SmallTest
public void testBufferFlushing() {
    String output1 = getdump("flush");
    assertEquals("", output1);
    new IpConnectivityLog(mService.impl).log(1, FAKE_EV);
    String output2 = getdump("flush");
    assertFalse("".equals(output2));
    String output3 = getdump("flush");
    assertEquals("", output3);
}
Also used : IpConnectivityLog(android.net.metrics.IpConnectivityLog) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 8 with IpConnectivityLog

use of android.net.metrics.IpConnectivityLog in project android_frameworks_base by DirtyUnicorns.

the class IpConnectivityMetricsTest method testEndToEndLogging.

@SmallTest
public void testEndToEndLogging() {
    IpConnectivityLog logger = new IpConnectivityLog(mService.impl);
    Parcelable[] events = { new IpReachabilityEvent("wlan0", IpReachabilityEvent.NUD_FAILED), new DhcpClientEvent("wlan0", "SomeState", 192), new DefaultNetworkEvent(102, new int[] { 1, 2, 3 }, 101, true, false), new IpManagerEvent("wlan0", IpManagerEvent.PROVISIONING_OK, 5678), new ValidationProbeEvent(120, 40730, ValidationProbeEvent.PROBE_HTTP, 204), new ApfStats(45000, 10, 2, 2, 1, 2, 4, 2048), new RaEvent(2000, 400, 300, -1, 1000, -1) };
    for (int i = 0; i < events.length; i++) {
        logger.log(100 * (i + 1), events[i]);
    }
    String want = joinLines("dropped_events: 0", "events <", "  time_ms: 100", "  transport: 0", "  ip_reachability_event <", "    event_type: 512", "    if_name: \"wlan0\"", "  >", ">", "events <", "  time_ms: 200", "  transport: 0", "  dhcp_event <", "    duration_ms: 192", "    if_name: \"wlan0\"", "    state_transition: \"SomeState\"", "  >", ">", "events <", "  time_ms: 300", "  transport: 0", "  default_network_event <", "    network_id <", "      network_id: 102", "    >", "    previous_network_id <", "      network_id: 101", "    >", "    previous_network_ip_support: 1", "    transport_types: 1", "    transport_types: 2", "    transport_types: 3", "  >", ">", "events <", "  time_ms: 400", "  transport: 0", "  ip_provisioning_event <", "    event_type: 1", "    if_name: \"wlan0\"", "    latency_ms: 5678", "  >", ">", "events <", "  time_ms: 500", "  transport: 0", "  validation_probe_event <", "    latency_ms: 40730", "    network_id <", "      network_id: 120", "    >", "    probe_result: 204", "    probe_type: 1", "  >", ">", "events <", "  time_ms: 600", "  transport: 0", "  apf_statistics <", "    dropped_ras: 2", "    duration_ms: 45000", "    matching_ras: 2", "    max_program_size: 2048", "    parse_errors: 2", "    program_updates: 4", "    received_ras: 10", "    zero_lifetime_ras: 1", "  >", ">", "events <", "  time_ms: 700", "  transport: 0", "  ra_event <", "    dnssl_lifetime: -1", "    prefix_preferred_lifetime: 300", "    prefix_valid_lifetime: 400", "    rdnss_lifetime: 1000", "    route_info_lifetime: -1", "    router_lifetime: 2000", "  >", ">", "version: 2");
    verifySerialization(want, getdump("flush"));
}
Also used : DefaultNetworkEvent(android.net.metrics.DefaultNetworkEvent) RaEvent(android.net.metrics.RaEvent) ApfStats(android.net.metrics.ApfStats) IpConnectivityLog(android.net.metrics.IpConnectivityLog) DhcpClientEvent(android.net.metrics.DhcpClientEvent) IpManagerEvent(android.net.metrics.IpManagerEvent) ValidationProbeEvent(android.net.metrics.ValidationProbeEvent) Parcelable(android.os.Parcelable) IpReachabilityEvent(android.net.metrics.IpReachabilityEvent) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 9 with IpConnectivityLog

use of android.net.metrics.IpConnectivityLog in project android_frameworks_base by DirtyUnicorns.

the class IpConnectivityMetricsTest method testLoggingEventsWithMultipleCallers.

@SmallTest
public void testLoggingEventsWithMultipleCallers() throws Exception {
    IpConnectivityLog logger = new IpConnectivityLog(mMockService);
    final int nCallers = 10;
    final int nEvents = 10;
    for (int n = 0; n < nCallers; n++) {
        final int i = n;
        new Thread() {

            public void run() {
                for (int j = 0; j < nEvents; j++) {
                    assertTrue(logger.log(i * 100 + j, FAKE_EV));
                }
            }
        }.start();
    }
    List<ConnectivityMetricsEvent> got = verifyEvents(nCallers * nEvents, 100);
    Collections.sort(got, EVENT_COMPARATOR);
    Iterator<ConnectivityMetricsEvent> iter = got.iterator();
    for (int i = 0; i < nCallers; i++) {
        for (int j = 0; j < nEvents; j++) {
            int expectedTimestamp = i * 100 + j;
            assertEventsEqual(expectedEvent(expectedTimestamp), iter.next());
        }
    }
}
Also used : IpConnectivityLog(android.net.metrics.IpConnectivityLog) ConnectivityMetricsEvent(android.net.ConnectivityMetricsEvent) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 10 with IpConnectivityLog

use of android.net.metrics.IpConnectivityLog in project android_frameworks_base by crdroidandroid.

the class IpConnectivityMetricsTest method testEndToEndLogging.

@SmallTest
public void testEndToEndLogging() {
    IpConnectivityLog logger = new IpConnectivityLog(mService.impl);
    Parcelable[] events = { new IpReachabilityEvent("wlan0", IpReachabilityEvent.NUD_FAILED), new DhcpClientEvent("wlan0", "SomeState", 192), new DefaultNetworkEvent(102, new int[] { 1, 2, 3 }, 101, true, false), new IpManagerEvent("wlan0", IpManagerEvent.PROVISIONING_OK, 5678), new ValidationProbeEvent(120, 40730, ValidationProbeEvent.PROBE_HTTP, 204), new ApfStats(45000, 10, 2, 2, 1, 2, 4, 2048), new RaEvent(2000, 400, 300, -1, 1000, -1) };
    for (int i = 0; i < events.length; i++) {
        logger.log(100 * (i + 1), events[i]);
    }
    String want = joinLines("dropped_events: 0", "events <", "  time_ms: 100", "  transport: 0", "  ip_reachability_event <", "    event_type: 512", "    if_name: \"wlan0\"", "  >", ">", "events <", "  time_ms: 200", "  transport: 0", "  dhcp_event <", "    duration_ms: 192", "    if_name: \"wlan0\"", "    state_transition: \"SomeState\"", "  >", ">", "events <", "  time_ms: 300", "  transport: 0", "  default_network_event <", "    network_id <", "      network_id: 102", "    >", "    previous_network_id <", "      network_id: 101", "    >", "    previous_network_ip_support: 1", "    transport_types: 1", "    transport_types: 2", "    transport_types: 3", "  >", ">", "events <", "  time_ms: 400", "  transport: 0", "  ip_provisioning_event <", "    event_type: 1", "    if_name: \"wlan0\"", "    latency_ms: 5678", "  >", ">", "events <", "  time_ms: 500", "  transport: 0", "  validation_probe_event <", "    latency_ms: 40730", "    network_id <", "      network_id: 120", "    >", "    probe_result: 204", "    probe_type: 1", "  >", ">", "events <", "  time_ms: 600", "  transport: 0", "  apf_statistics <", "    dropped_ras: 2", "    duration_ms: 45000", "    matching_ras: 2", "    max_program_size: 2048", "    parse_errors: 2", "    program_updates: 4", "    received_ras: 10", "    zero_lifetime_ras: 1", "  >", ">", "events <", "  time_ms: 700", "  transport: 0", "  ra_event <", "    dnssl_lifetime: -1", "    prefix_preferred_lifetime: 300", "    prefix_valid_lifetime: 400", "    rdnss_lifetime: 1000", "    route_info_lifetime: -1", "    router_lifetime: 2000", "  >", ">", "version: 2");
    verifySerialization(want, getdump("flush"));
}
Also used : DefaultNetworkEvent(android.net.metrics.DefaultNetworkEvent) RaEvent(android.net.metrics.RaEvent) ApfStats(android.net.metrics.ApfStats) IpConnectivityLog(android.net.metrics.IpConnectivityLog) DhcpClientEvent(android.net.metrics.DhcpClientEvent) IpManagerEvent(android.net.metrics.IpManagerEvent) ValidationProbeEvent(android.net.metrics.ValidationProbeEvent) Parcelable(android.os.Parcelable) IpReachabilityEvent(android.net.metrics.IpReachabilityEvent) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Aggregations

IpConnectivityLog (android.net.metrics.IpConnectivityLog)20 SmallTest (android.test.suitebuilder.annotation.SmallTest)15 ConnectivityMetricsEvent (android.net.ConnectivityMetricsEvent)8 ApfProgramEvent (android.net.metrics.ApfProgramEvent)4 ApfStats (android.net.metrics.ApfStats)4 DefaultNetworkEvent (android.net.metrics.DefaultNetworkEvent)4 DhcpClientEvent (android.net.metrics.DhcpClientEvent)4 IpManagerEvent (android.net.metrics.IpManagerEvent)4 IpReachabilityEvent (android.net.metrics.IpReachabilityEvent)4 RaEvent (android.net.metrics.RaEvent)4 ValidationProbeEvent (android.net.metrics.ValidationProbeEvent)4 Parcelable (android.os.Parcelable)4