Search in sources :

Example 1 with Burst

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;
}
Also used : ArrayList(java.util.ArrayList) BurstCategory(com.att.aro.core.packetanalysis.pojo.BurstCategory) BurstAnalysisInfo(com.att.aro.core.packetanalysis.pojo.BurstAnalysisInfo) Burst(com.att.aro.core.packetanalysis.pojo.Burst) EnumMap(java.util.EnumMap) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) EnumMap(java.util.EnumMap)

Example 2 with Burst

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

Example 3 with Burst

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();
}
Also used : Packet(com.att.aro.core.packetreader.pojo.Packet) IPPacket(com.att.aro.core.packetreader.pojo.IPPacket) Burst(com.att.aro.core.packetanalysis.pojo.Burst) PacketInfo(com.att.aro.core.packetanalysis.pojo.PacketInfo) InetAddress(java.net.InetAddress) IPPacket(com.att.aro.core.packetreader.pojo.IPPacket) HashSet(java.util.HashSet)

Example 4 with Burst

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

Example 5 with Burst

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

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