use of com.att.aro.core.packetanalysis.pojo.RrcStateRange in project VideoOptimzer by attdevsupport.
the class RrcStateRangeFactoryImpl method tailWiFi.
private static double tailWiFi(List<RrcStateRange> result, double timer, double start, double end, ProfileWiFi profile) {
double tailTime = timer;
// Add the continuous reception time
result.add(new RrcStateRange(tailTime, start, RRCState.WIFI_ACTIVE));
// Check for CR tail time
tailTime = Math.min(start + profile.getWifiTailTime(), end);
if (tailTime > start) {
result.add(new RrcStateRange(start, tailTime, RRCState.WIFI_TAIL));
}
return tailTime;
}
use of com.att.aro.core.packetanalysis.pojo.RrcStateRange in project VideoOptimzer by attdevsupport.
the class RrcStateRangeFactoryImpl method promoteLTE.
/**
* Private utility method that creates RRC state range entries for promoting
* between LTE idle and continuous reception. This method will create the
* IDLE and PROMOTION state ranges. The
*
* @param result
* List where state ranges will be added
* @param start
* Indicates time of end of last LTE long tail state or beginning
* of trace
* @param end
* Indicates time of packet that is causing the promotion.
* @param profile
* LTE profile being used to model state ranges
* @return The time at which the promotion is complete
*/
private double promoteLTE(List<RrcStateRange> result, double start, double end, ProfileLTE profile) {
// Find the time that the promotion started before the packet was
// received
double promoStart = Math.max(start, end - profile.getPromotionTime());
// Check to see if there was some IDLE time
if (promoStart > start) {
result.add(new RrcStateRange(start, promoStart, RRCState.LTE_IDLE));
}
// Add the promotion state range
result.add(new RrcStateRange(promoStart, end, RRCState.LTE_PROMOTION));
return end;
}
use of com.att.aro.core.packetanalysis.pojo.RrcStateRange in project VideoOptimzer by attdevsupport.
the class RrcStateRangeFactoryImpl method addStateRangeEx.
/**
* This method adds the an RrcStateRange to the list rrc.
*
* @param time
* @param d
* The duration of the state.
* @param state
* The RRC state
* @param tMax
*/
private static double addStateRangeEx(List<RrcStateRange> rrc, double time, double duration1, RRCState state, double tMax) {
double duration = duration1;
if ((time >= tMax) || (duration <= 0)) {
return time;
}
if ((time + duration) > tMax) {
duration = tMax - time;
}
double end = time + duration;
rrc.add(new RrcStateRange(time, end, state));
return end;
}
use of com.att.aro.core.packetanalysis.pojo.RrcStateRange 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);
}
use of com.att.aro.core.packetanalysis.pojo.RrcStateRange in project VideoOptimzer by attdevsupport.
the class RrcPlot method populate.
@Override
public void populate(XYPlot plot, AROTraceData analysis) {
if (analysis != null) {
rrcDataCollection.removeAllSeries();
Map<RRCState, XYIntervalSeries> seriesMap = new EnumMap<RRCState, XYIntervalSeries>(RRCState.class);
for (RRCState eventType : RRCState.values()) {
XYIntervalSeries series = new XYIntervalSeries(eventType);
seriesMap.put(eventType, series);
rrcDataCollection.addSeries(series);
}
List<RrcStateRange> rrcStates = analysis.getAnalyzerResult().getStatemachine().getStaterangelist();
Iterator<RrcStateRange> iter = rrcStates.iterator();
while (iter.hasNext()) {
RrcStateRange currEvent = iter.next();
RRCState state = currEvent.getState();
if (state == RRCState.STATE_FACH || state == RRCState.TAIL_FACH) {
seriesMap.get(state).add(currEvent.getBeginTime(), currEvent.getBeginTime(), currEvent.getEndTime(), 0.25, 0, 0.5);
} else {
seriesMap.get(state).add(currEvent.getBeginTime(), currEvent.getBeginTime(), currEvent.getEndTime(), 0.5, 0, 1);
}
}
XYItemRenderer renderer = plot.getRenderer();
Color dchGreen = new Color(34, 177, 76);
Color fachOrange = new Color(255, 201, 14);
renderer.setSeriesPaint(rrcDataCollection.indexOf(RRCState.STATE_IDLE), Color.white);
renderer.setSeriesPaint(rrcDataCollection.indexOf(RRCState.LTE_IDLE), Color.white);
renderer.setSeriesPaint(rrcDataCollection.indexOf(RRCState.PROMO_IDLE_DCH), Color.red);
renderer.setSeriesPaint(rrcDataCollection.indexOf(RRCState.LTE_PROMOTION), Color.red);
renderer.setSeriesPaint(rrcDataCollection.indexOf(RRCState.STATE_DCH), fachOrange);
renderer.setSeriesPaint(rrcDataCollection.indexOf(RRCState.LTE_CONTINUOUS), fachOrange);
renderer.setSeriesPaint(rrcDataCollection.indexOf(RRCState.TAIL_DCH), getTailPaint(fachOrange));
renderer.setSeriesPaint(rrcDataCollection.indexOf(RRCState.LTE_CR_TAIL), getTailPaint(fachOrange));
renderer.setSeriesPaint(rrcDataCollection.indexOf(RRCState.LTE_DRX_SHORT), getTailPaint(fachOrange));
renderer.setSeriesPaint(rrcDataCollection.indexOf(RRCState.LTE_DRX_LONG), getTailPaint(fachOrange));
renderer.setSeriesPaint(rrcDataCollection.indexOf(RRCState.STATE_FACH), dchGreen);
renderer.setSeriesPaint(rrcDataCollection.indexOf(RRCState.TAIL_FACH), getTailPaint(dchGreen));
renderer.setSeriesPaint(rrcDataCollection.indexOf(RRCState.PROMO_FACH_DCH), Color.red);
renderer.setSeriesPaint(rrcDataCollection.indexOf(RRCState.WIFI_IDLE), Color.white);
renderer.setSeriesPaint(rrcDataCollection.indexOf(RRCState.WIFI_ACTIVE), fachOrange);
renderer.setSeriesPaint(rrcDataCollection.indexOf(RRCState.WIFI_TAIL), getTailPaint(fachOrange));
// Assign ToolTip to renderer
final Profile profile = analysis.getAnalyzerResult().getProfile();
renderer.setBaseToolTipGenerator(new XYToolTipGenerator() {
@Override
public String generateToolTip(XYDataset dataset, int series, int item) {
RRCState eventType = (RRCState) rrcDataCollection.getSeries(series).getKey();
final String PREFIX = "RRCTooltip.";
if (eventType == RRCState.LTE_IDLE && profile instanceof ProfileLTE) {
return MessageFormat.format(ResourceBundleHelper.getMessageString(PREFIX + eventType), ((ProfileLTE) profile).getIdlePingPeriod());
}
return ResourceBundleHelper.getMessageString(PREFIX + eventType);
}
});
}
plot.setDataset(rrcDataCollection);
// return plot;
}
Aggregations