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;
}
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);
}
}
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);
}
}
Aggregations