Search in sources :

Example 1 with RrcStateRange

use of com.att.aro.core.packetanalysis.pojo.RrcStateRange in project VideoOptimzer by attdevsupport.

the class RrcStateMachineFactoryImpl method runWiFiRRcStatistics.

private RrcStateMachineWiFi runWiFiRRcStatistics(List<RrcStateRange> staterangelist, ProfileWiFi prof, double totalBytes, double packetDuration, double traceDuration) {
    double totalRRCEnergy = 0, wifiActiveTime = 0, wifiActiveEnergy = 0, wifiTailTime = 0;
    double wifiTailEnergy = 0, wifiIdleTime = 0, wifiIdleEnergy = 0;
    for (RrcStateRange rrc : staterangelist) {
        double rrcTimeDiff = rrc.getEndTime() - rrc.getBeginTime();
        double energy = profilefactory.energyWiFi(rrc.getBeginTime(), rrc.getEndTime(), rrc.getState(), prof);
        totalRRCEnergy += energy;
        switch(rrc.getState()) {
            case WIFI_ACTIVE:
                wifiActiveTime += rrcTimeDiff;
                wifiActiveEnergy += energy;
                break;
            case WIFI_TAIL:
                // wifiActiveTime += rrcTimeDiff;
                wifiActiveEnergy += energy;
                wifiTailTime += rrcTimeDiff;
                wifiTailEnergy += energy;
                break;
            case WIFI_IDLE:
                wifiIdleTime += rrcTimeDiff;
                wifiIdleEnergy += energy;
                break;
            default:
                break;
        }
    }
    double bytes = totalBytes;
    double joulesPerKilobyte = bytes != 0 ? totalRRCEnergy / (bytes / 1000.0) : 0.0;
    RrcStateMachineWiFi stmachine = new RrcStateMachineWiFi();
    stmachine.setJoulesPerKilobyte(joulesPerKilobyte);
    stmachine.setPacketsDuration(packetDuration);
    stmachine.setTotalRRCEnergy(totalRRCEnergy);
    stmachine.setTraceDuration(traceDuration);
    stmachine.setWifiActiveEnergy(wifiActiveEnergy);
    stmachine.setWifiActiveTime(wifiActiveTime);
    stmachine.setWifiIdleEnergy(wifiIdleEnergy);
    stmachine.setWifiIdleTime(wifiIdleTime);
    stmachine.setWifiTailTime(wifiTailTime);
    stmachine.setWifiTailEnergy(wifiTailEnergy);
    return stmachine;
}
Also used : RrcStateMachineWiFi(com.att.aro.core.packetanalysis.pojo.RrcStateMachineWiFi) RrcStateRange(com.att.aro.core.packetanalysis.pojo.RrcStateRange)

Example 2 with RrcStateRange

use of com.att.aro.core.packetanalysis.pojo.RrcStateRange in project VideoOptimzer by attdevsupport.

the class RrcStateMachineFactoryImpl method run3GRRcStatistics.

/**
 * 3G RRC state time modification.
 */
private RrcStateMachine3G run3GRRcStatistics(List<RrcStateRange> staterangelist, Profile3G prof3g, double totalBytes, double packetsDuration, double traceDuration) {
    double idleTime = 0, idleEnergy = 0, dchTime = 0, dchEnergy = 0, dchTailTime = 0, dchTailEnergy = 0;
    double fachTime = 0, fachEnergy = 0, fachTailTime = 0;
    double fachTailEnergy = 0, idleToDch = 0, idleToDchTime = 0, idleToDchEnergy = 0, fachToDch = 0;
    double fachToDchTime = 0, fachToDchEnergy = 0;
    RrcStateMachine3G statemachine = new RrcStateMachine3G();
    for (RrcStateRange rrc : staterangelist) {
        double energy = profilefactory.energy3G(rrc.getBeginTime(), rrc.getEndTime(), rrc.getState(), prof3g);
        double duration = rrc.getEndTime() - rrc.getBeginTime();
        switch(rrc.getState()) {
            case STATE_IDLE:
                idleTime += duration;
                idleEnergy += energy;
                break;
            case STATE_DCH:
                dchTime += duration;
                dchEnergy += energy;
                break;
            case TAIL_DCH:
                // dchTime += duration;
                dchTailTime += duration;
                dchEnergy += energy;
                dchTailEnergy += energy;
                break;
            case STATE_FACH:
                fachTime += duration;
                fachEnergy += energy;
                break;
            case TAIL_FACH:
                fachTime += duration;
                fachTailTime += duration;
                fachTailEnergy += energy;
                fachEnergy += energy;
                break;
            case PROMO_IDLE_DCH:
                idleToDch++;
                idleToDchTime += duration;
                idleToDchEnergy += energy;
                break;
            case PROMO_FACH_DCH:
                fachToDch++;
                fachToDchTime += duration;
                fachToDchEnergy += energy;
                break;
            default:
                break;
        }
    }
    double totalRRCEnergy = fachEnergy + dchEnergy + fachToDchEnergy + idleToDchEnergy + idleEnergy;
    double bytes = totalBytes;
    double joulesPerKilobyte = bytes != 0 ? totalRRCEnergy / (bytes / 1000.0) : 0.0;
    statemachine.setDchEnergy(dchEnergy);
    statemachine.setDchTailEnergy(dchTailEnergy);
    statemachine.setDchTailTime(dchTailTime);
    statemachine.setDchTime(dchTime);
    statemachine.setFachEnergy(fachEnergy);
    statemachine.setFachTailEnergy(fachTailEnergy);
    statemachine.setFachTailTime(fachTailTime);
    statemachine.setFachTime(fachTime);
    statemachine.setFachToDch(fachToDch);
    statemachine.setFachToDchEnergy(fachToDchEnergy);
    statemachine.setFachToDchTime(fachToDchTime);
    statemachine.setIdleEnergy(idleEnergy);
    statemachine.setIdleTime(idleTime);
    statemachine.setIdleToDch(idleToDch);
    statemachine.setIdleToDchEnergy(idleToDchEnergy);
    statemachine.setIdleToDchTime(idleToDchTime);
    statemachine.setJoulesPerKilobyte(joulesPerKilobyte);
    statemachine.setPacketsDuration(packetsDuration);
    statemachine.setTotalRRCEnergy(totalRRCEnergy);
    statemachine.setTraceDuration(traceDuration);
    return statemachine;
}
Also used : RrcStateMachine3G(com.att.aro.core.packetanalysis.pojo.RrcStateMachine3G) RrcStateRange(com.att.aro.core.packetanalysis.pojo.RrcStateRange)

Example 3 with RrcStateRange

use of com.att.aro.core.packetanalysis.pojo.RrcStateRange in project VideoOptimzer by attdevsupport.

the class RrcStateMachineFactoryImpl method getRRCStatesForTheTimeRange.

private List<RrcStateRange> getRRCStatesForTheTimeRange(List<RrcStateRange> rrcRanges, double beginTime, double endTime) {
    List<RrcStateRange> filteredRRCStates = new ArrayList<RrcStateRange>();
    boolean stateAdded = false;
    for (RrcStateRange rrcRange : rrcRanges) {
        if (rrcRange.getBeginTime() >= beginTime && rrcRange.getEndTime() <= endTime) {
            filteredRRCStates.add(rrcRange);
        } else if (rrcRange.getBeginTime() <= beginTime && rrcRange.getEndTime() <= endTime && rrcRange.getEndTime() > beginTime) {
            filteredRRCStates.add(new RrcStateRange(beginTime, rrcRange.getEndTime(), rrcRange.getState()));
        } else if (rrcRange.getBeginTime() <= beginTime && rrcRange.getEndTime() >= endTime) {
            filteredRRCStates.add(new RrcStateRange(beginTime, endTime, rrcRange.getState()));
        } else if (rrcRange.getBeginTime() >= beginTime && rrcRange.getBeginTime() < endTime && rrcRange.getEndTime() >= endTime && !stateAdded) {
            filteredRRCStates.add(new RrcStateRange(rrcRange.getBeginTime(), endTime, rrcRange.getState()));
            stateAdded = true;
        }
    }
    return filteredRRCStates;
}
Also used : ArrayList(java.util.ArrayList) RrcStateRange(com.att.aro.core.packetanalysis.pojo.RrcStateRange)

Example 4 with RrcStateRange

use of com.att.aro.core.packetanalysis.pojo.RrcStateRange in project VideoOptimzer by attdevsupport.

the class RrcStateMachineFactoryImpl method runLTERRcStatistics.

/**
 * LTE RRC state time modification.
 */
private RrcStateMachineLTE runLTERRcStatistics(List<RrcStateRange> staterangelist, ProfileLTE profile, List<PacketInfo> packets, double totalBytes, double packetsDuration, double traceDuration) {
    double totalRRCEnergy = 0, lteIdleTime = 0, lteIdleEnergy = 0, lteIdleToCRPromotionTime = 0;
    double lteIdleToCRPromotionEnergy = 0, lteCrTime = 0, lteCrEnergy = 0, lteCrTailTime = 0;
    double lteCrTailEnergy = 0, lteDrxShortTime = 0, lteDrxShortEnergy = 0, lteDrxLongTime = 0;
    double lteDrxLongEnergy = 0;
    for (RrcStateRange rrc : staterangelist) {
        double duration = rrc.getEndTime() - rrc.getBeginTime();
        double energy = profilefactory.energyLTE(rrc.getBeginTime(), rrc.getEndTime(), rrc.getState(), profile, packets);
        totalRRCEnergy += energy;
        switch(rrc.getState()) {
            case LTE_IDLE:
                lteIdleTime += duration;
                lteIdleEnergy += energy;
                break;
            case LTE_PROMOTION:
                lteIdleToCRPromotionTime += duration;
                lteIdleToCRPromotionEnergy += energy;
                break;
            case LTE_CONTINUOUS:
                lteCrTime += duration;
                lteCrEnergy += energy;
                break;
            case LTE_CR_TAIL:
                lteCrTime += duration;
                lteCrTailTime += duration;
                lteCrEnergy += energy;
                lteCrTailEnergy += energy;
                break;
            case LTE_DRX_SHORT:
                lteDrxShortTime += duration;
                lteDrxShortEnergy += energy;
                break;
            case LTE_DRX_LONG:
                lteDrxLongTime += duration;
                lteDrxLongEnergy += energy;
                break;
            default:
                break;
        }
        rrc.setEnergy(energy);
    }
    double bytes = totalBytes;
    double joulesPerKilobyte = bytes != 0 ? totalRRCEnergy / (bytes / 1000.0) : 0.0;
    RrcStateMachineLTE stmachine = new RrcStateMachineLTE();
    stmachine.setJoulesPerKilobyte(joulesPerKilobyte);
    stmachine.setLteCrEnergy(lteCrEnergy);
    stmachine.setLteCrTailEnergy(lteCrTailEnergy);
    stmachine.setLteCrTailTime(lteCrTailTime);
    stmachine.setLteCrTime(lteCrTime);
    stmachine.setLteDrxLongEnergy(lteDrxLongEnergy);
    stmachine.setLteDrxLongTime(lteDrxLongTime);
    stmachine.setLteDrxShortEnergy(lteDrxShortEnergy);
    stmachine.setLteDrxShortTime(lteDrxShortTime);
    stmachine.setLteIdleEnergy(lteIdleEnergy);
    stmachine.setLteIdleTime(lteIdleTime);
    stmachine.setLteIdleToCRPromotionEnergy(lteIdleToCRPromotionEnergy);
    stmachine.setLteIdleToCRPromotionTime(lteIdleToCRPromotionTime);
    stmachine.setPacketsDuration(packetsDuration);
    stmachine.setTotalRRCEnergy(totalRRCEnergy);
    stmachine.setTraceDuration(traceDuration);
    return stmachine;
}
Also used : RrcStateMachineLTE(com.att.aro.core.packetanalysis.pojo.RrcStateMachineLTE) RrcStateRange(com.att.aro.core.packetanalysis.pojo.RrcStateRange)

Example 5 with RrcStateRange

use of com.att.aro.core.packetanalysis.pojo.RrcStateRange in project VideoOptimzer by attdevsupport.

the class RrcStateRangeFactoryImplTest method Create3G_test8.

@Test
public void Create3G_test8() {
    Profile3G profile3g = mock(Profile3G.class);
    when(profile3g.getProfileType()).thenReturn(ProfileType.T3G);
    when(profile3g.getIdleDchPromoAvg()).thenReturn(12000.0);
    when(profile3g.getIdleDchPromoMin()).thenReturn(1000.0);
    when(profile3g.getIdleDchPromoMax()).thenReturn(20000.0);
    when(profile3g.getFachDchPromoAvg()).thenReturn(1000.0);
    when(profile3g.getFachDchPromoMin()).thenReturn(2500.0);
    when(profile3g.getFachDchPromoMax()).thenReturn(6000.0);
    when(profile3g.getDchFachTimer()).thenReturn(5000.0);
    when(profile3g.getFachIdleTimer()).thenReturn(10000.0);
    double traceDuration = 2000.0;
    List<PacketInfo> packetlist = new ArrayList<PacketInfo>();
    when(pktInfoArray[0].getTimeStamp()).thenReturn(date.getTime() - 7500.0);
    when(pktInfoArray[0].getDir()).thenReturn(PacketDirection.DOWNLINK);
    when(pktInfoArray[0].getLen()).thenReturn(1000);
    when(pktInfoArray[0].getStateMachine()).thenReturn(RRCState.PROMO_FACH_DCH);
    packetlist.add(pktInfoArray[0]);
    when(pktInfoArray[1].getTimeStamp()).thenReturn(date.getTime() + 10000.0);
    when(pktInfoArray[1].getDir()).thenReturn(PacketDirection.DOWNLINK);
    when(pktInfoArray[1].getLen()).thenReturn(1000);
    when(pktInfoArray[1].getStateMachine()).thenReturn(RRCState.PROMO_IDLE_DCH);
    packetlist.add(pktInfoArray[1]);
    when(pktInfoArray[2].getTimeStamp()).thenReturn(date.getTime() + 15000.0);
    when(pktInfoArray[2].getDir()).thenReturn(PacketDirection.DOWNLINK);
    when(pktInfoArray[2].getLen()).thenReturn(1000);
    when(pktInfoArray[2].getStateMachine()).thenReturn(RRCState.PROMO_IDLE_DCH);
    packetlist.add(pktInfoArray[2]);
    List<RrcStateRange> testList = rrcStateRangeFactory.create(packetlist, profile3g, traceDuration);
    assertEquals(1, testList.size());
}
Also used : ArrayList(java.util.ArrayList) Profile3G(com.att.aro.core.configuration.pojo.Profile3G) PacketInfo(com.att.aro.core.packetanalysis.pojo.PacketInfo) RrcStateRange(com.att.aro.core.packetanalysis.pojo.RrcStateRange) Test(org.junit.Test) BaseTest(com.att.aro.core.BaseTest)

Aggregations

RrcStateRange (com.att.aro.core.packetanalysis.pojo.RrcStateRange)59 PacketInfo (com.att.aro.core.packetanalysis.pojo.PacketInfo)48 ArrayList (java.util.ArrayList)47 BaseTest (com.att.aro.core.BaseTest)42 Test (org.junit.Test)42 Profile3G (com.att.aro.core.configuration.pojo.Profile3G)27 Profile (com.att.aro.core.configuration.pojo.Profile)23 RRCState (com.att.aro.core.packetanalysis.pojo.RRCState)22 ProfileLTE (com.att.aro.core.configuration.pojo.ProfileLTE)12 ProfileWiFi (com.att.aro.core.configuration.pojo.ProfileWiFi)9 RrcStateMachine3G (com.att.aro.core.packetanalysis.pojo.RrcStateMachine3G)9 RrcStateMachineLTE (com.att.aro.core.packetanalysis.pojo.RrcStateMachineLTE)9 TCPPacket (com.att.aro.core.packetreader.pojo.TCPPacket)5 UDPPacket (com.att.aro.core.packetreader.pojo.UDPPacket)5 BurstCollectionAnalysisData (com.att.aro.core.packetanalysis.pojo.BurstCollectionAnalysisData)4 RrcStateMachineWiFi (com.att.aro.core.packetanalysis.pojo.RrcStateMachineWiFi)4 DomainNameSystem (com.att.aro.core.packetreader.pojo.DomainNameSystem)4 CpuActivity (com.att.aro.core.peripheral.pojo.CpuActivity)4 InetAddress (java.net.InetAddress)4 HashSet (java.util.HashSet)4