use of com.att.aro.core.packetanalysis.pojo.PacketInfo in project VideoOptimzer by attdevsupport.
the class TimeRangeAnalysisDialog method hasDataAfterFiltering.
private boolean hasDataAfterFiltering(AnalysisFilter filter) {
List<PacketInfo> packetsInfoBeforeFilter = currentTraceResult.getTraceresult().getAllpackets();
PacketAnalyzerImpl packetAnalyzerImpl = (PacketAnalyzerImpl) ((MainFrame) parent).getController().getAROService().getAnalyzer();
List<PacketInfo> packetsInfoAfterFilter = packetAnalyzerImpl.filterPackets(filter, packetsInfoBeforeFilter);
return packetsInfoAfterFilter.size() > 0;
}
use of com.att.aro.core.packetanalysis.pojo.PacketInfo 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);
}
}
use of com.att.aro.core.packetanalysis.pojo.PacketInfo in project VideoOptimzer by attdevsupport.
the class BurstCollectionAnalysisImpl method analyze.
@Override
public BurstCollectionAnalysisData analyze(List<PacketInfo> packets, Profile profile, Map<Integer, Integer> packetSizeToCountMap, List<RrcStateRange> rrcstaterangelist, List<UserEvent> usereventlist, List<CpuActivity> cpuactivitylist, List<Session> sessionlist) {
BurstCollectionAnalysisData data = new BurstCollectionAnalysisData();
Set<Integer> mss = calculateMssLargerPacketSizeSet(packetSizeToCountMap);
List<Burst> burstCollection = groupIntoBursts(packets, profile, mss, rrcstaterangelist);
data.setBurstCollection(burstCollection);
if (!burstCollection.isEmpty()) {
int longBurstCount = analyzeBursts(burstCollection, usereventlist, cpuactivitylist, profile);
data.setLongBurstCount(longBurstCount);
double totalEnergy = computeBurstEnergyRadioResource(rrcstaterangelist, burstCollection, profile);
data.setTotalEnergy(totalEnergy);
List<BurstAnalysisInfo> burstAnalysisInfo = analyzeBurstStat(burstCollection);
data.setBurstAnalysisInfo(burstAnalysisInfo);
PacketInfo shortestPacket = findShortestPeriodPacketInfo(burstCollection);
data.setShortestPeriodPacketInfo(shortestPacket);
}
return data;
}
use of com.att.aro.core.packetanalysis.pojo.PacketInfo in project VideoOptimzer by attdevsupport.
the class BurstCollectionAnalysisImpl method findShortestPeriodPacketInfo.
/**
* Method to find the different periodic connection and periodic duration.
*/
private PacketInfo findShortestPeriodPacketInfo(List<Burst> burstCollection) {
int burstSize = burstCollection.size();
Burst lastPeriodicalBurst = null;
int periodicPacketCounter = 0;
double minRepeatTime = Double.MAX_VALUE;
PacketInfo pktId = null;
double time = 0;
for (int i = 0; i < burstSize; i++) {
Burst burst = burstCollection.get(i);
if (burst.getBurstCategory() == BurstCategory.PERIODICAL) {
if (periodicPacketCounter != 0) {
time = burst.getBeginTime() - ((lastPeriodicalBurst != null) ? lastPeriodicalBurst.getBeginTime() : 0);
if (time < minRepeatTime) {
minRepeatTime = time;
pktId = burst.getFirstUplinkDataPacket();
if (null == pktId) {
pktId = burst.getBeginPacket();
}
}
}
periodicPacketCounter++;
lastPeriodicalBurst = burst;
}
}
return pktId;
}
use of com.att.aro.core.packetanalysis.pojo.PacketInfo in project VideoOptimzer by attdevsupport.
the class BurstCollectionAnalysisImpl method groupIntoBursts.
/**
* Groups packets into Burst Collections
* @return
*/
private List<Burst> groupIntoBursts(List<PacketInfo> packets, Profile profile, Set<Integer> mss, List<RrcStateRange> rrcstaterangelist) {
List<Burst> burstCollection;
// Validate that there are packets
if (packets == null || packets.isEmpty()) {
burstCollection = Collections.emptyList();
return burstCollection;
}
ArrayList<Burst> result = new ArrayList<Burst>();
double burstThresh = profile.getBurstTh();
double longBurstThresh = profile.getLongBurstTh();
List<PacketInfo> burstPackets = new ArrayList<PacketInfo>();
// Step 1: Build bursts using burst time threshold
PacketInfo lastPacket = null;
for (PacketInfo packet : packets) {
if ((lastPacket == null || (packet.getTimeStamp() - lastPacket.getTimeStamp() > burstThresh && !mss.contains(lastPacket.getPayloadLen()))) && (!burstPackets.isEmpty())) {
result.add(new Burst(burstPackets));
burstPackets.clear();
}
burstPackets.add(packet);
lastPacket = packet;
}
result.add(new Burst(burstPackets));
// Step 2: Remove promotion delays and merge bursts if possible
Map<PacketInfo, Double> timestampList = normalizeCore(packets, rrcstaterangelist);
List<Burst> newBurstColl = new ArrayList<Burst>(result.size());
int size = result.size();
Burst newBurst = result.get(0);
for (int i = 0; i < size - 1; i++) {
Burst bnext = result.get(i + 1);
double time1 = timestampList.get(newBurst.getEndPacket());
double time2 = timestampList.get(bnext.getBeginPacket());
if ((time2 - time1) < burstThresh) {
newBurst.merge(bnext);
} else {
newBurstColl.add(newBurst);
newBurst = bnext;
}
}
newBurstColl.add(newBurst);
burstCollection = newBurstColl;
// determine short/long IBTs
size = burstCollection.size();
for (int i = 0; i < size; i++) {
Burst aBurst = burstCollection.get(i);
// assert (aBurst.getEndTime() >= aBurst.getBeginTime());
if (i < size - 1) {
double ibt = burstCollection.get(i + 1).getBeginTime() - aBurst.getEndTime();
// assert (ibt >= burstThresh);
aBurst.setbLong((ibt > longBurstThresh));
} else {
aBurst.setbLong(true);
}
}
return burstCollection;
}
Aggregations