Search in sources :

Example 1 with HttpData

use of com.android.tools.idea.monitor.ui.network.model.HttpData in project android by JetBrains.

the class NetworkProfilerVisualTest method createComponentsList.

@Override
protected List<Animatable> createComponentsList() {
    long startTimeUs = myDataStore.getLatestTimeUs();
    Range timeCurrentRangeUs = new Range(startTimeUs - RangeScrollbar.DEFAULT_VIEW_LENGTH_US, startTimeUs);
    AnimatedTimeRange animatedTimeRange = new AnimatedTimeRange(timeCurrentRangeUs, 0);
    EventDispatcher<ProfilerEventListener> dummyDispatcher = EventDispatcher.create(ProfilerEventListener.class);
    mySegment = new NetworkSegment(timeCurrentRangeUs, myDataStore, dummyDispatcher);
    myDetailedView = new NetworkDetailedView();
    myDetailedView.setVisible(false);
    generateNetworkCaptureData(startTimeUs);
    myCaptureSegment = new NetworkCaptureSegment(timeCurrentRangeUs, new TestNetworkCaptureModel(), httpData -> myDetailedView.setVisible(true), dummyDispatcher);
    myRadioSegment = new NetworkRadioSegment(timeCurrentRangeUs, myDataStore, dummyDispatcher);
    List<Animatable> animatables = new ArrayList<>();
    animatables.add(animatedTimeRange);
    mySegment.createComponentsList(animatables);
    myCaptureSegment.createComponentsList(animatables);
    myRadioSegment.createComponentsList(animatables);
    animatables.add(myCaptureSegment);
    return animatables;
}
Also used : AnimatedTimeRange(com.android.tools.adtui.AnimatedTimeRange) NetworkCaptureModel(com.android.tools.idea.monitor.ui.network.model.NetworkCaptureModel) Range(com.android.tools.adtui.model.Range) NetworkSegment(com.android.tools.idea.monitor.ui.network.view.NetworkSegment) EventDispatcher(com.intellij.util.EventDispatcher) Animatable(com.android.tools.adtui.Animatable) AnimatedTimeRange(com.android.tools.adtui.AnimatedTimeRange) ProfilerEventListener(com.android.tools.idea.monitor.tool.ProfilerEventListener) RangeScrollbar(com.android.tools.adtui.RangeScrollbar) NetworkDetailedView(com.android.tools.idea.monitor.ui.network.view.NetworkDetailedView) ArrayList(java.util.ArrayList) java.awt(java.awt) VisualTest(com.android.tools.adtui.visualtests.VisualTest) HttpData(com.android.tools.idea.monitor.ui.network.model.HttpData) List(java.util.List) NonNull(com.android.annotations.NonNull) NetworkRadioSegment(com.android.tools.idea.monitor.ui.network.view.NetworkRadioSegment) NotNull(org.jetbrains.annotations.NotNull) SeriesDataStore(com.android.tools.datastore.SeriesDataStore) NetworkCaptureSegment(com.android.tools.idea.monitor.ui.network.view.NetworkCaptureSegment) javax.swing(javax.swing) ArrayList(java.util.ArrayList) NetworkCaptureSegment(com.android.tools.idea.monitor.ui.network.view.NetworkCaptureSegment) NetworkDetailedView(com.android.tools.idea.monitor.ui.network.view.NetworkDetailedView) Range(com.android.tools.adtui.model.Range) AnimatedTimeRange(com.android.tools.adtui.AnimatedTimeRange) Animatable(com.android.tools.adtui.Animatable) NetworkSegment(com.android.tools.idea.monitor.ui.network.view.NetworkSegment) ProfilerEventListener(com.android.tools.idea.monitor.tool.ProfilerEventListener) NetworkRadioSegment(com.android.tools.idea.monitor.ui.network.view.NetworkRadioSegment)

Example 2 with HttpData

use of com.android.tools.idea.monitor.ui.network.model.HttpData in project android by JetBrains.

the class NetworkCaptureSegment method animate.

@Override
public void animate(float frameLength) {
    myDataList = myModel.getData(myTimeCurrentRangeUs);
    // TODO: currently we recreate charts from scratch, instead consider reusing charts
    myCharts.clear();
    for (HttpData data : myDataList) {
        DefaultDataSeries<NetworkState> series = new DefaultDataSeries<>();
        series.add(0, NetworkState.NONE);
        series.add(data.getStartTimeUs(), NetworkState.SENDING);
        if (data.getDownloadingTimeUs() > 0) {
            series.add(data.getDownloadingTimeUs(), NetworkState.RECEIVING);
        }
        if (data.getEndTimeUs() > 0) {
            series.add(data.getEndTimeUs(), NetworkState.NONE);
        }
        StateChart<NetworkState> chart = new StateChart<>(NETWORK_STATE_COLORS);
        chart.addSeries(new RangedSeries<>(myTimeCurrentRangeUs, series));
        chart.animate(frameLength);
        myCharts.add(chart);
    }
}
Also used : DefaultDataSeries(com.android.tools.adtui.model.DefaultDataSeries) HttpData(com.android.tools.idea.monitor.ui.network.model.HttpData) StateChart(com.android.tools.adtui.chart.StateChart)

Example 3 with HttpData

use of com.android.tools.idea.monitor.ui.network.model.HttpData in project android by JetBrains.

the class NetworkProfilerVisualTest method generateNetworkCaptureData.

private void generateNetworkCaptureData(long startTimeUs) {
    long endTimeUs = startTimeUs + 20000000;
    myCaptureData = new ArrayList<>();
    for (int i = 0; i < CAPTURE_DATA_SIZE; ++i) {
        long start = random(startTimeUs, endTimeUs);
        long download = random(start, endTimeUs);
        long end = random(download, endTimeUs);
        HttpData data = new HttpData();
        data.setStartTimeUs(start);
        data.setDownloadingTimeUs(download);
        data.setEndTimeUs(end);
        data.setUrl("www.fake.url/" + i);
        myCaptureData.add(data);
    }
}
Also used : HttpData(com.android.tools.idea.monitor.ui.network.model.HttpData)

Aggregations

HttpData (com.android.tools.idea.monitor.ui.network.model.HttpData)3 NonNull (com.android.annotations.NonNull)1 Animatable (com.android.tools.adtui.Animatable)1 AnimatedTimeRange (com.android.tools.adtui.AnimatedTimeRange)1 RangeScrollbar (com.android.tools.adtui.RangeScrollbar)1 StateChart (com.android.tools.adtui.chart.StateChart)1 DefaultDataSeries (com.android.tools.adtui.model.DefaultDataSeries)1 Range (com.android.tools.adtui.model.Range)1 VisualTest (com.android.tools.adtui.visualtests.VisualTest)1 SeriesDataStore (com.android.tools.datastore.SeriesDataStore)1 ProfilerEventListener (com.android.tools.idea.monitor.tool.ProfilerEventListener)1 NetworkCaptureModel (com.android.tools.idea.monitor.ui.network.model.NetworkCaptureModel)1 NetworkCaptureSegment (com.android.tools.idea.monitor.ui.network.view.NetworkCaptureSegment)1 NetworkDetailedView (com.android.tools.idea.monitor.ui.network.view.NetworkDetailedView)1 NetworkRadioSegment (com.android.tools.idea.monitor.ui.network.view.NetworkRadioSegment)1 NetworkSegment (com.android.tools.idea.monitor.ui.network.view.NetworkSegment)1 EventDispatcher (com.intellij.util.EventDispatcher)1 java.awt (java.awt)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1