use of com.att.aro.ui.model.diagnostic.TCPUDPFlowsTableModel in project VideoOptimzer by attdevsupport.
the class GraphPanel method filterFlowTable.
// In 4.1.1, the method called refreshGraph()
public void filterFlowTable() {
AROTraceData filteredSessionTraceData = getTraceData();
double filteredStartTime = 0.0;
double filteredEndTime = 0.0;
double filteredDuration = filteredSessionTraceData.getAnalyzerResult().getTraceresult().getTraceDuration();
List<Session> tcpsessionsList = new ArrayList<Session>();
if (getTraceData() == null) {
return;
} else {
TCPUDPFlowsTableModel model = (TCPUDPFlowsTableModel) parent.getJTCPFlowsTable().getModel();
Map<String, Session> subSessionMap = model.getSessionMap();
Map<String, Boolean> subcheckboxMap = model.getCheckboxMap();
for (Map.Entry<String, Boolean> entry : subcheckboxMap.entrySet()) {
if (entry.getValue()) {
tcpsessionsList.add(subSessionMap.get(entry.getKey()));
}
}
filteredSessionTraceData.getAnalyzerResult().setSessionlist(tcpsessionsList);
}
List<PacketInfo> packetsForSelectedSession = new ArrayList<PacketInfo>();
for (Session tcpSession : tcpsessionsList) {
if (tcpSession.getTcpPackets() != null) {
packetsForSelectedSession.addAll(tcpSession.getTcpPackets());
}
}
// when generating graph, make sure session is ordered by time stamp
Collections.sort(packetsForSelectedSession, new Comparator<PacketInfo>() {
@Override
public int compare(PacketInfo p1, PacketInfo p2) {
return (int) (p1.getTimeStamp() * 1000 - p2.getTimeStamp() * 1000);
}
});
boolean selectedAllPackets = false;
// Adding the TCP packets to the trace for getting redoing the analysis
if (packetsForSelectedSession.size() > 0) {
if (tcpsessionsList.size() == getAllTcpSessions()) {
// For select all use all exiting packets
filteredSessionTraceData.getAnalyzerResult().getTraceresult().setAllpackets(getAllPackets());
selectedAllPackets = true;
} else {
// Collections.sort(packetsForSelectedSession);//?
filteredSessionTraceData.getAnalyzerResult().getTraceresult().setAllpackets(packetsForSelectedSession);
}
}
if (selectedAllPackets) {
filteredStartTime = -0.01;
filteredEndTime = filteredDuration;
} else {
int index = 0;
for (Session tcpSession : tcpsessionsList) {
if (tcpSession.getTcpPackets().size() != 0) {
if (index == 0) {
filteredStartTime = tcpSession.getTcpPackets().get(0).getTimeStamp();
filteredEndTime = tcpSession.getTcpPackets().get(0).getTimeStamp();
}
if (filteredStartTime > tcpSession.getTcpPackets().get(0).getTimeStamp()) {
filteredStartTime = tcpSession.getTcpPackets().get(0).getTimeStamp();
}
if (filteredEndTime < tcpSession.getTcpPackets().get(0).getTimeStamp()) {
filteredEndTime = tcpSession.getTcpPackets().get(0).getTimeStamp();
}
index++;
}
}
if (index == 0) {
filteredStartTime = 0.0;
filteredEndTime = 0.0;
}
}
// for Analysis data particular time of the graph, some number is not clear..
if (filteredStartTime > 0) {
// adjust the time line axis number
filteredStartTime = filteredStartTime - 2;
if (filteredStartTime < 0) {
filteredStartTime = -0.01;
}
}
if (filteredStartTime < 0) {
filteredStartTime = -0.01;
}
if (!selectedAllPackets) {
if (filteredEndTime > 0) {
// adjust the time line axis number
filteredEndTime = filteredEndTime + 15;
}
if (filteredEndTime > filteredDuration) {
filteredEndTime = filteredDuration;
}
}
this.startTime = filteredStartTime;
this.endTime = filteredEndTime;
if (getTraceData() != null) {
TimeRange timeRange = new TimeRange(filteredStartTime, filteredEndTime);
AnalysisFilter filter = filteredSessionTraceData.getAnalyzerResult().getFilter();
filter.setTimeRange(timeRange);
filteredSessionTraceData.getAnalyzerResult().setFilter(filter);
Statistic stat = ContextAware.getAROConfigContext().getBean(IPacketAnalyzer.class).getStatistic(packetsForSelectedSession);
long totaltemp = 0;
for (Session byteCountSession : tcpsessionsList) {
totaltemp += byteCountSession.getBytesTransferred();
}
stat.setTotalByte(totaltemp);
AbstractRrcStateMachine statemachine = ContextAware.getAROConfigContext().getBean(IRrcStateMachineFactory.class).create(packetsForSelectedSession, filteredSessionTraceData.getAnalyzerResult().getProfile(), stat.getPacketDuration(), filteredDuration, stat.getTotalByte(), timeRange);
BurstCollectionAnalysisData burstcollectiondata = new BurstCollectionAnalysisData();
if (stat.getTotalByte() > 0) {
burstcollectiondata = ContextAware.getAROConfigContext().getBean(IBurstCollectionAnalysis.class).analyze(packetsForSelectedSession, filteredSessionTraceData.getAnalyzerResult().getProfile(), stat.getPacketSizeToCountMap(), statemachine.getStaterangelist(), filteredSessionTraceData.getAnalyzerResult().getTraceresult().getUserEvents(), filteredSessionTraceData.getAnalyzerResult().getTraceresult().getCpuActivityList().getCpuActivities(), tcpsessionsList);
}
filteredSessionTraceData.getAnalyzerResult().getStatistic().setTotalByte(stat.getTotalByte());
filteredSessionTraceData.getAnalyzerResult().setStatemachine(statemachine);
filteredSessionTraceData.getAnalyzerResult().setBurstCollectionAnalysisData(burstcollectiondata);
refresh(filteredSessionTraceData);
}
}
Aggregations