use of com.att.aro.core.packetanalysis.pojo.Burst in project VideoOptimzer by attdevsupport.
the class BurstCollectionAnalysisImpl method analyzeBurstStat.
/**
* Method to assign the states for all the bursts.
*
* @param analyzeBeginTime
* @param analyseEndTime
* @return
*/
private List<BurstAnalysisInfo> analyzeBurstStat(List<Burst> burstCollection) {
Map<BurstCategory, Double> burstCategoryToEnergy = new EnumMap<BurstCategory, Double>(BurstCategory.class);
Map<BurstCategory, Long> burstCategoryToPayload = new EnumMap<BurstCategory, Long>(BurstCategory.class);
Map<BurstCategory, Double> burstCategoryToActive = new EnumMap<BurstCategory, Double>(BurstCategory.class);
List<BurstAnalysisInfo> burstAnalysisInfo = new ArrayList<BurstAnalysisInfo>();
long totalPayload = 0;
double totalAct = 0.0;
double totalEnergy = 0.0;
for (Burst aBurst : burstCollection) {
BurstCategory category = aBurst.getBurstCategory();
double energy = aBurst.getEnergy();
totalEnergy += energy;
Double catEnergy = burstCategoryToEnergy.get(category);
double catEnergygValue = catEnergy != null ? catEnergy.doubleValue() : 0.0;
catEnergygValue += energy;
burstCategoryToEnergy.put(category, catEnergygValue);
int bPayLoadLength = getPayloadLength(aBurst, false);
totalPayload += bPayLoadLength;
Long payload = burstCategoryToPayload.get(category);
long payLoadValue = payload != null ? payload.longValue() : 0L;
payLoadValue += bPayLoadLength;
burstCategoryToPayload.put(category, payLoadValue);
double activeTime = aBurst.getActiveTime();
totalAct += activeTime;
Double catAct = burstCategoryToActive.get(category);
catEnergygValue = catAct != null ? catAct.doubleValue() : 0.0;
catEnergygValue += activeTime;
burstCategoryToActive.put(category, catEnergygValue);
}
for (Map.Entry<BurstCategory, Double> entry : burstCategoryToEnergy.entrySet()) {
BurstCategory categ = entry.getKey();
long catPayload = burstCategoryToPayload.get(categ);
double catEnergy = burstCategoryToEnergy.get(categ);
double catActive = burstCategoryToActive.get(categ);
Double jpkb = catPayload > 0 ? catEnergy / (catPayload * 8 / 1000.0f) : null;
burstAnalysisInfo.add(new BurstAnalysisInfo(categ, catPayload, totalPayload > 0 ? (((double) catPayload / totalPayload) * 100.0) : 0, catEnergy, totalEnergy > 0.0 ? ((catEnergy / totalEnergy) * 100.0) : 0.0, catActive, totalAct > 0.0 ? ((catActive / totalAct) * 100.0) : 0.0, jpkb));
}
return burstAnalysisInfo;
}
use of com.att.aro.core.packetanalysis.pojo.Burst in project VideoOptimzer by attdevsupport.
the class ScreenRotationImpl method runTest.
@Override
public AbstractBestPracticeResult runTest(PacketAnalyzerResult tracedata) {
ScreenRotationResult result = new ScreenRotationResult();
// assuming it is passed for now
boolean passScreenRotation = true;
double screenRotationBurstTime = 0.0;
for (Burst burst : tracedata.getBurstCollectionAnalysisData().getBurstCollection()) {
if (burst.getBurstCategory() == BurstCategory.SCREEN_ROTATION) {
// screen rotation trigger network activity => fail
passScreenRotation = false;
screenRotationBurstTime = burst.getBeginTime();
break;
}
}
result.setScreenRotationBurstTime(screenRotationBurstTime);
if (passScreenRotation) {
result.setResultType(BPResultType.PASS);
result.setResultText(textResultPass);
} else {
result.setResultType(BPResultType.FAIL);
result.setResultText(textResults);
}
result.setResultExcelText(result.getResultType().getDescription());
result.setScreenRotationBurstTime(screenRotationBurstTime);
result.setAboutText(aboutText);
result.setDetailTitle(detailTitle);
result.setLearnMoreUrl(learnMoreUrl);
result.setOverviewTitle(overviewTitle);
result.setExportAllScreenRotationDescPass(exportAllScreenRotationDescPass);
result.setExportAllScreenRotationFailed(exportAllScreenRotationFailed);
return result;
}
use of com.att.aro.core.packetanalysis.pojo.Burst in project VideoOptimzer by attdevsupport.
the class PeriodicTransferImpl method determinePeriodicity.
/**
* Determine periodicity
*
* @param hostList
* @param objList
* @param ipList
*/
private void determinePeriodicity(Set<String> hostList, Set<String> objList, Set<InetAddress> ipList, List<Burst> burstCollection, Profile profile, List<Session> sessionlist) {
Set<String> hostPeriodicInfoSet = new HashSet<String>();
for (int i = 0; i < burstCollection.size(); i++) {
Burst burst = burstCollection.get(i);
if (burst.getBurstInfos() != BurstCategory.CLIENT_APP) {
continue;
}
if (isCloseSpacedBurst(i, burst, profile.getCloseSpacedBurstThreshold(), burstCollection)) {
continue;
}
Packet beginPacket = burst.getBeginPacket().getPacket();
if (beginPacket instanceof IPPacket) {
IPPacket iPkt = (IPPacket) beginPacket;
InetAddress iAddr = iPkt.getDestinationIPAddress();
if (isIpInIpList(ipList, hostPeriodicInfoSet, burst, iAddr)) {
periodicCount++;
continue;
}
iAddr = iPkt.getSourceIPAddress();
if (isIpInIpList(ipList, hostPeriodicInfoSet, burst, iAddr)) {
periodicCount++;
continue;
}
}
PacketInfo firstUplinkPayloadPacket = null;
for (PacketInfo pInfo : burst.getPackets()) {
if (pInfo.getDir() == PacketDirection.UPLINK && pInfo.getPayloadLen() > 0) {
firstUplinkPayloadPacket = pInfo;
break;
}
}
periodicCount += findPeriodicalBursts(hostPeriodicInfoSet, hostList, objList, burst, firstUplinkPayloadPacket, sessionlist);
}
diffPeriodicCount = hostPeriodicInfoSet.size();
}
use of com.att.aro.core.packetanalysis.pojo.Burst in project VideoOptimzer by attdevsupport.
the class PeriodicTransferImpl method calculatePeriodicRepeatTime.
private void calculatePeriodicRepeatTime(List<Burst> burstCollection) {
int burstSize = burstCollection.size();
Burst lastPeriodicalBurst = null;
periodicCount = 0;
double minimumRepeatTime = Double.MAX_VALUE;
PacketInfo packetId = null;
for (int i = 0; i < burstSize; i++) {
Burst burst = burstCollection.get(i);
if (burst.getBurstCategory() == BurstCategory.PERIODICAL) {
if (periodicCount != 0) {
double time = burst.getBeginTime() - ((lastPeriodicalBurst != null) ? lastPeriodicalBurst.getBeginTime() : 0);
if (time < minimumRepeatTime) {
minimumRepeatTime = time;
packetId = burst.getFirstUplinkDataPacket();
if (packetId == null) {
packetId = burst.getBeginPacket();
}
}
}
lastPeriodicalBurst = burst;
periodicCount++;
}
}
if (minimumRepeatTime != Double.MAX_VALUE && this.periodicCount >= 3) {
minimumPeriodicRepeatTime = minimumRepeatTime;
}
}
use of com.att.aro.core.packetanalysis.pojo.Burst in project VideoOptimzer by attdevsupport.
the class UnnecessaryConnectionImpl method validateUnnecessaryConnections.
/**
* To Validate the simultaneous TCP connections
*/
private void validateUnnecessaryConnections(List<Burst> burstCollection) {
int setCount = 0;
int maxCount = 0;
Burst maxBurst = null;
for (int i = 0; i < burstCollection.size(); ++i) {
Burst burstInfo = burstCollection.get(i);
if (burstInfo.getBurstCategory() == BurstCategory.USER_INPUT || burstInfo.getBurstCategory() == BurstCategory.SCREEN_ROTATION) {
continue;
}
double startTime = burstInfo.getBeginTime();
double endTime = startTime + 60.0;
int count = 1;
double totalSize = 0;
for (int j = i + 1; j < burstCollection.size() && burstCollection.get(j).getEndTime() <= endTime; ++j) {
if (burstCollection.get(j).getBurstCategory() != BurstCategory.USER_INPUT || burstInfo.getBurstCategory() == BurstCategory.SCREEN_ROTATION) {
++count;
totalSize += burstCollection.get(j).getBurstBytes();
}
}
// Checking for 4 burts within 60 sec
if (count >= 4) {
ucEntryList.add(new UnnecessaryConnectionEntry(startTime, endTime, count, totalSize / 1024));
++setCount;
if (count > maxCount) {
maxCount = count;
maxBurst = burstInfo;
}
i = i + count;
}
}
tightlyCoupledBurstCount = setCount;
if (maxBurst != null) {
tightlyCoupledBurstTime = maxBurst.getBeginTime();
}
}
Aggregations