use of com.att.aro.core.packetanalysis.pojo.Burst in project VideoOptimzer by attdevsupport.
the class PeriodicTransferImpl method isCloseSpacedBurst.
/**
* If the bursts is close spaced to a burst next to it it will return true, otherwise it will return false.
*
* @param index Index of the burst to be investigated.
* @param burst Collection of bursts.
* @param threshold Close spaced bursts threshold.
*
* @return If the bursts is close spaced to a burst next to it it will return true, otherwise it will return false;.
*/
private boolean isCloseSpacedBurst(int index, Burst burst, double threshold, List<Burst> burstCollection) {
Burst prevBurst;
if (index > 0 && index < burstCollection.size()) {
prevBurst = burstCollection.get(index - 1);
if (burst.getBeginTime() - prevBurst.getEndTime() < threshold) {
return true;
}
}
Burst nextBurst;
if (index < burstCollection.size() - 1) {
nextBurst = burstCollection.get(index + 1);
if (nextBurst.getBeginTime() - burst.getEndTime() < threshold) {
return true;
}
}
return false;
}
use of com.att.aro.core.packetanalysis.pojo.Burst in project VideoOptimzer by attdevsupport.
the class ConnectionClosingImpl method runTest.
@Override
public AbstractBestPracticeResult runTest(PacketAnalyzerResult tracedata) {
double wastedBurstEnergy = 0.0;
boolean conClosingProbPassed = true;
double tcpControlEnergy = 0;
double tcpControlEnergyRatio = 0;
double largestEnergyTime = 0.0;
double maxEnergy = 0.0;
double currentEnergy;
if (tracedata.getBurstCollectionAnalysisData().getTotalEnergy() > 0) {
for (Burst burst : tracedata.getBurstCollectionAnalysisData().getBurstCollection()) {
if (burst.getBurstCategory() == BurstCategory.TCP_PROTOCOL) {
currentEnergy = burst.getEnergy();
wastedBurstEnergy += burst.getEnergy();
if (currentEnergy > maxEnergy) {
maxEnergy = currentEnergy;
largestEnergyTime = burst.getBeginTime();
}
}
}
double percentageWasted = wastedBurstEnergy / tracedata.getBurstCollectionAnalysisData().getTotalEnergy();
conClosingProbPassed = percentageWasted < 0.05;
tcpControlEnergy = wastedBurstEnergy;
tcpControlEnergyRatio = percentageWasted;
}
ConnectionClosingResult result = new ConnectionClosingResult();
if (!conClosingProbPassed) {
// if failed
result.setResultType(BPResultType.FAIL);
NumberFormat nfo = NumberFormat.getInstance();
nfo.setMaximumFractionDigits(1);
String text = MessageFormat.format(textResults, ApplicationConfig.getInstance().getAppShortName(), nfo.format(tcpControlEnergy), nfo.format(tcpControlEnergyRatio * 100));
result.setResultText(text);
result.setResultExcelText(MessageFormat.format(textExcelResults, BPResultType.FAIL.getDescription(), nfo.format(tcpControlEnergy), nfo.format(tcpControlEnergyRatio * 100)));
} else {
result.setResultType(BPResultType.PASS);
result.setResultText(textResultPass);
result.setResultExcelText(BPResultType.PASS.getDescription());
}
result.setWastedBurstEnergy(wastedBurstEnergy);
result.setConClosingProb(conClosingProbPassed);
result.setTcpControlEnergy(tcpControlEnergy);
result.setTcpControlEnergyRatio(tcpControlEnergyRatio);
result.setLargestEnergyTime(largestEnergyTime);
result.setAboutText(aboutText);
result.setDetailTitle(detailTitle);
result.setLearnMoreUrl(learnMoreUrl);
result.setOverviewTitle(overviewTitle);
result.setExportAllConnClosingDesc(exportAllConnClosingDesc);
return result;
}
Aggregations