Search in sources :

Example 21 with Burst

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;
}
Also used : Burst(com.att.aro.core.packetanalysis.pojo.Burst)

Example 22 with Burst

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;
}
Also used : ConnectionClosingResult(com.att.aro.core.bestpractice.pojo.ConnectionClosingResult) Burst(com.att.aro.core.packetanalysis.pojo.Burst) NumberFormat(java.text.NumberFormat)

Aggregations

Burst (com.att.aro.core.packetanalysis.pojo.Burst)22 ArrayList (java.util.ArrayList)11 AbstractBestPracticeResult (com.att.aro.core.bestpractice.pojo.AbstractBestPracticeResult)8 PacketInfo (com.att.aro.core.packetanalysis.pojo.PacketInfo)8 BaseTest (com.att.aro.core.BaseTest)7 Test (org.junit.Test)7 BurstCollectionAnalysisData (com.att.aro.core.packetanalysis.pojo.BurstCollectionAnalysisData)5 BurstCategory (com.att.aro.core.packetanalysis.pojo.BurstCategory)4 PacketAnalyzerResult (com.att.aro.core.packetanalysis.pojo.PacketAnalyzerResult)4 Session (com.att.aro.core.packetanalysis.pojo.Session)3 Packet (com.att.aro.core.packetreader.pojo.Packet)3 InetAddress (java.net.InetAddress)3 Profile3G (com.att.aro.core.configuration.pojo.Profile3G)2 BurstAnalysisInfo (com.att.aro.core.packetanalysis.pojo.BurstAnalysisInfo)2 HttpRequestResponseInfo (com.att.aro.core.packetanalysis.pojo.HttpRequestResponseInfo)2 UnknownHostException (java.net.UnknownHostException)2 Date (java.util.Date)2 EnumMap (java.util.EnumMap)2 HashSet (java.util.HashSet)2 ConnectionClosingResult (com.att.aro.core.bestpractice.pojo.ConnectionClosingResult)1