Search in sources :

Example 1 with IProfileFactory

use of com.att.aro.core.configuration.IProfileFactory in project VideoOptimzer by attdevsupport.

the class TimeRangeAnalysis method performTimeRangeAnalysis.

/**
 * Performs a TimeRangeAnalysis on the trace data.
 * TODO:  The calculation should not be in the UI - move elsewhere (Core)
 *
 * @return TimeRangeAnalysis The object containing TimeRangeAnalysis
 *         data.
 */
public static TimeRangeAnalysis performTimeRangeAnalysis(PacketAnalyzerResult analysisData, double analyzeBeginTime, double analyzeEndTime) {
    List<RrcStateRange> rrcCollection = analysisData.getStatemachine().getStaterangelist();
    List<PacketInfo> packets = analysisData.getTraceresult().getAllpackets();
    Profile profile = analysisData.getProfile();
    long payloadLength = 0;
    long totalBytes = 0;
    long uplinkBytes = 0;
    long downlinkBytes = 0;
    int packetNum = packets.size();
    for (int i = 0; i < packetNum; i++) {
        PacketInfo packetInfo = packets.get(i);
        if (packetInfo.getTimeStamp() >= analyzeBeginTime && packetInfo.getTimeStamp() <= analyzeEndTime) {
            payloadLength += packetInfo.getPayloadLen();
            totalBytes += packetInfo.getLen();
            if (packetInfo.getDir().equals(PacketDirection.UPLINK)) {
                uplinkBytes += packetInfo.getLen();
            } else if (packetInfo.getDir().equals(PacketDirection.DOWNLINK)) {
                downlinkBytes += packetInfo.getLen();
            }
        }
    }
    double energy = 0.0f;
    double activeTime = 0.0f;
    int collectionSize = rrcCollection.size();
    for (int i = 0; i < collectionSize; i++) {
        double beginTime;
        double endTime;
        RrcStateRange rrc = rrcCollection.get(i);
        if (rrc.getEndTime() < analyzeBeginTime) {
            continue;
        }
        if (rrc.getBeginTime() > analyzeEndTime) {
            continue;
        }
        if (rrc.getBeginTime() >= analyzeBeginTime) {
            beginTime = rrc.getBeginTime();
        } else {
            beginTime = analyzeBeginTime;
        }
        if (rrc.getEndTime() <= analyzeEndTime) {
            endTime = rrc.getEndTime();
        } else {
            endTime = analyzeEndTime;
        }
        RRCState rrcState = rrc.getState();
        IProfileFactory profileFactory = ContextAware.getAROConfigContext().getBean(IProfileFactory.class);
        energy += updateEnergy(analysisData, profile, beginTime, endTime, rrcState, profileFactory);
        activeTime += updateActiveTime(profile, beginTime, endTime, rrcState);
    }
    return new TimeRangeAnalysis(analyzeBeginTime, analyzeEndTime, totalBytes, uplinkBytes, downlinkBytes, payloadLength, activeTime, energy);
}
Also used : RRCState(com.att.aro.core.packetanalysis.pojo.RRCState) RrcStateRange(com.att.aro.core.packetanalysis.pojo.RrcStateRange) PacketInfo(com.att.aro.core.packetanalysis.pojo.PacketInfo) IProfileFactory(com.att.aro.core.configuration.IProfileFactory) Profile(com.att.aro.core.configuration.pojo.Profile)

Example 2 with IProfileFactory

use of com.att.aro.core.configuration.IProfileFactory in project VideoOptimzer by attdevsupport.

the class ConfigurationTableModel method getProfile.

/**
 * Returns the profile represented by this table model.
 *
 * @return The profile for the Configuration table.
 *
 * @throws ProfileException
 */
public Profile getProfile() throws ProfileException {
    Properties props = new Properties();
    props = setProperties(props, getNetworkAttributesTableModel().getData());
    props = setProperties(props, getDeviceAttributesTableModel().getData());
    IProfileFactory profileFactory = ContextAware.getAROConfigContext().getBean(IProfileFactory.class);
    Profile profile = profileFactory.create(profileType, props);
    profile.setName(profileName);
    return profile;
}
Also used : Properties(java.util.Properties) IProfileFactory(com.att.aro.core.configuration.IProfileFactory) Profile(com.att.aro.core.configuration.pojo.Profile)

Aggregations

IProfileFactory (com.att.aro.core.configuration.IProfileFactory)2 Profile (com.att.aro.core.configuration.pojo.Profile)2 PacketInfo (com.att.aro.core.packetanalysis.pojo.PacketInfo)1 RRCState (com.att.aro.core.packetanalysis.pojo.RRCState)1 RrcStateRange (com.att.aro.core.packetanalysis.pojo.RrcStateRange)1 Properties (java.util.Properties)1