use of com.att.aro.core.packetanalysis.pojo.RrcStateMachineWiFi 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;
}
use of com.att.aro.core.packetanalysis.pojo.RrcStateMachineWiFi in project VideoOptimzer by attdevsupport.
the class RrcStateMachineFactoryImplTest method create_WIFIStateIsWIFI_IDLE.
@Test
public void create_WIFIStateIsWIFI_IDLE() {
ProfileWiFi profile18 = mock(ProfileWiFi.class);
when(profile18.getProfileType()).thenReturn(ProfileType.WIFI);
when(profilefactory.energyWiFi(any(double.class), any(double.class), any(RRCState.class), any(ProfileWiFi.class))).thenReturn(100.0);
List<PacketInfo> packetlist1 = new ArrayList<PacketInfo>();
List<RrcStateRange> staterangelist = new ArrayList<RrcStateRange>();
RrcStateRange[] rrcStateRangeArray = new RrcStateRange[5];
for (int i = 0; i < 5; i++) {
rrcStateRangeArray[i] = mock(RrcStateRange.class);
when(rrcStateRangeArray[i].getState()).thenReturn(RRCState.WIFI_IDLE);
when(rrcStateRangeArray[i].getBeginTime()).thenReturn((double) date.getTime() + 2 * i * 1000);
when(rrcStateRangeArray[i].getEndTime()).thenReturn((double) date.getTime() + (2 * i + 1) * 1000.0);
}
for (int i = 0; i < 5; i++) {
staterangelist.add(rrcStateRangeArray[i]);
}
when(staterange.create(any(ArrayList.class), any(Profile.class), any(double.class))).thenReturn(staterangelist);
RrcStateMachineWiFi rrcStateMachineWifi = (RrcStateMachineWiFi) machineFactoryimpl.create(packetlist1, profile18, packetDuration, traceDuration, totalBytes * 100, null);
assertEquals(50, rrcStateMachineWifi.getJoulesPerKilobyte(), 0.0);
assertEquals(5000, rrcStateMachineWifi.getWifiIdleTime(), 0.0);
assertEquals(500, rrcStateMachineWifi.getWifiIdleEnergy(), 0.0);
}
use of com.att.aro.core.packetanalysis.pojo.RrcStateMachineWiFi in project VideoOptimzer by attdevsupport.
the class EnergyModelStatisticsWiFiPanel method refreshRRCStatistic.
/**
* Refreshes the RRCStatistics portion of the EnergyModelStatisticsWiFiPanel when a trace is loaded.
*
* @param analysis
* - The Analysis object containing the trace data.
* @param nf
* - The number format used to display the label values.
*/
@Override
public void refreshRRCStatistic(AROTraceData analysis, NumberFormat nf) {
if (analysis != null) {
RrcStateMachineWiFi rrc = (RrcStateMachineWiFi) analysis.getAnalyzerResult().getStatemachine();
wifiActiveValueLabel.setText(MessageFormat.format(units, nf.format(rrc.getWifiActiveEnergy())));
wifiTailValueLabel.setText(MessageFormat.format(units, nf.format(rrc.getWifiTailEnergy())));
wifiIdleValueLabel.setText(MessageFormat.format(units, nf.format(rrc.getWifiIdleEnergy())));
totalRrcEnergyValueLabel.setText(MessageFormat.format(units, nf.format(rrc.getTotalRRCEnergy())));
energyContent.put(rb.getString("rrc.wifiActive"), wifiActiveValueLabel.getText());
energyContent.put(rb.getString("rrc.WifiTail"), wifiTailValueLabel.getText());
energyContent.put(rb.getString("rrc.WiFiIdle"), wifiIdleValueLabel.getText());
energyContent.put(rb.getString("energy.wifiTotal"), totalRrcEnergyValueLabel.getText());
} else {
wifiActiveValueLabel.setText(null);
wifiTailValueLabel.setText(null);
wifiIdleValueLabel.setText(null);
totalRrcEnergyValueLabel.setText(null);
}
}
use of com.att.aro.core.packetanalysis.pojo.RrcStateMachineWiFi in project VideoOptimzer by attdevsupport.
the class TraceBenchmarkChartPanel method generateDataForChart.
public TraceBenchmarkInfo generateDataForChart() {
TraceBenchmarkInfo traceBenchmarkPojo = new TraceBenchmarkInfo();
if (traceModel != null && traceModel.getAnalyzerResult() != null) {
double averageKbps = traceModel.getAnalyzerResult().getStatistic().getAverageKbps();
traceBenchmarkPojo.setThroughputPct(ApplicationSampling.getInstance().getThroughputPercentile(averageKbps));
double totalKbps = traceModel.getAnalyzerResult().getStatistic().getTotalByte() / 1024;
traceBenchmarkPojo.setKbps(totalKbps);
double promo = 0.0;
double joulesPerKbps = 0.0;
switch(traceModel.getAnalyzerResult().getStatemachine().getType()) {
case Type3G:
RrcStateMachine3G rrcState3G = (RrcStateMachine3G) traceModel.getAnalyzerResult().getStatemachine();
joulesPerKbps = rrcState3G.getJoulesPerKilobyte();
promo = rrcState3G.getPromotionRatio();
break;
case LTE:
RrcStateMachineLTE rrcStateLTE = (RrcStateMachineLTE) traceModel.getAnalyzerResult().getStatemachine();
joulesPerKbps = rrcStateLTE.getJoulesPerKilobyte();
promo = rrcStateLTE.getLteDrxLongRatio();
break;
case WiFi:
RrcStateMachineWiFi rrcStateWifi = (RrcStateMachineWiFi) traceModel.getAnalyzerResult().getStatemachine();
joulesPerKbps = rrcStateWifi.getJoulesPerKilobyte();
promo = (rrcStateWifi.getWifiIdleTime() + rrcStateWifi.getWifiActiveTime()) / rrcStateWifi.getPacketsDuration();
break;
default:
break;
}
traceBenchmarkPojo.setJpkb(joulesPerKbps);
traceBenchmarkPojo.setJpkbPct(ApplicationSampling.getInstance().getJpkbPercentile(joulesPerKbps));
traceBenchmarkPojo.setPromotionRatioPct(promo);
traceBenchmarkPojo.setPromoRatioPercentail(ApplicationSampling.getInstance().getPromoRatioPercentile(promo));
}
return traceBenchmarkPojo;
}
use of com.att.aro.core.packetanalysis.pojo.RrcStateMachineWiFi in project VideoOptimzer by attdevsupport.
the class RrcStateMachineFactoryImplTest method create_WIFIStateIsWIFI_ACTIVE.
@Test
public void create_WIFIStateIsWIFI_ACTIVE() {
ProfileWiFi profile02 = mock(ProfileWiFi.class);
when(profile02.getProfileType()).thenReturn(ProfileType.WIFI);
List<PacketInfo> packetlist2 = new ArrayList<PacketInfo>();
List<RrcStateRange> staterangelist = new ArrayList<RrcStateRange>();
RrcStateRange rrc01 = mock(RrcStateRange.class);
when(rrc01.getBeginTime()).thenReturn((double) date.getTime());
when(rrc01.getEndTime()).thenReturn(date.getTime() + 2000.0);
when(profilefactory.energyWiFi(any(double.class), any(double.class), any(RRCState.class), any(ProfileWiFi.class))).thenReturn(2.0);
when(rrc01.getState()).thenReturn(RRCState.WIFI_ACTIVE);
staterangelist.add(rrc01);
when(staterange.create(any(ArrayList.class), any(Profile.class), any(double.class))).thenReturn(staterangelist);
RrcStateMachineWiFi rrcStateMachineWifi = (RrcStateMachineWiFi) machineFactoryimpl.create(packetlist2, profile02, packetDuration, traceDuration, totalBytes, null);
assertEquals(20.0, rrcStateMachineWifi.getJoulesPerKilobyte(), 0.0);
assertEquals(1000.0, rrcStateMachineWifi.getPacketsDuration(), 0.0);
assertEquals(2.0, rrcStateMachineWifi.getTotalRRCEnergy(), 0.0);
assertEquals(2000.0, rrcStateMachineWifi.getTraceDuration(), 0.0);
}
Aggregations