use of com.att.aro.core.packetanalysis.impl.TimeRangeAnalysis in project VideoOptimzer by attdevsupport.
the class HtmlReportImpl method getTimeRangeAnalysisAndStatisticRows.
private String getTimeRangeAnalysisAndStatisticRows(PacketAnalyzerResult results) {
StringBuilder builder = new StringBuilder();
if (results != null) {
TimeRangeAnalysis timeRangeAnalysis = results.getTimeRangeAnalysis();
// Calculate time range
if (timeRangeAnalysis == null) {
AnalysisFilter filter = results.getFilter();
double beginTime = 0.0d;
double endTime = 0.0d;
boolean readyForAnalysis = false;
if (filter != null && filter.getTimeRange() != null) {
beginTime = filter.getTimeRange().getBeginTime();
endTime = filter.getTimeRange().getEndTime();
readyForAnalysis = true;
} else if (results.getTraceresult() != null) {
endTime = results.getTraceresult().getTraceDuration();
readyForAnalysis = true;
}
if (readyForAnalysis) {
timeRangeAnalysis = new TimeRangeAnalysis(beginTime, endTime, results);
}
}
if (timeRangeAnalysis != null) {
double traceDuration = timeRangeAnalysis.getEndTime() - timeRangeAnalysis.getStartTime();
long traceDurationLong = (long) traceDuration;
builder.append("<tr><th>Duration (second)</th><td>" + String.format("%.3f", traceDuration) + "</td></tr>");
builder.append("<tr><th>Duration (hh:mm:ss.sss)</th><td>" + String.format("%02d:%02d:%02d", traceDurationLong / 3600, (traceDurationLong % 3600) / 60, traceDurationLong % 60) + String.format("%.3f", traceDuration - Math.floor(traceDuration)).substring(1));
String timeRangeTitle = results.getTraceresult().getTimeRange().getTitle();
builder.append("<tr><th>Time Range Identifier</th><td>" + (timeRangeTitle != null ? timeRangeTitle : "") + "</td></tr>");
builder.append("<tr><th>Start Time (second)</th><td>" + doubleToFixedDecimal(timeRangeAnalysis.getStartTime(), 3) + "</td></tr>");
builder.append("<tr><th>End Time (second)</th><td>" + doubleToFixedDecimal(timeRangeAnalysis.getEndTime(), 3) + "</td></tr>");
}
Statistic statistic = results.getStatistic();
if (statistic != null) {
builder.append(tableLIne() + "<th>Total Data (Byte)</th><td>" + statistic.getTotalByte() + tableChange() + System.getProperty(lineSeperator()));
builder.append(tableLIne() + "<th>Total PayLoad Data (Byte)</th><td>" + statistic.getTotalPayloadBytes() + tableChange() + System.getProperty(lineSeperator()));
builder.append(tableLIne() + "<th>Total HTTPS Data (Byte)</th><td>" + statistic.getTotalHTTPSByte() + " (" + String.format("%.2f", statistic.getTotalHTTPSByte() * 100.0 / statistic.getTotalByte()) + "%)" + tableChange() + System.getProperty(lineSeperator()));
builder.append(tableLIne() + "<th>Total Unanalyzed HTTPS Data (Byte)</th><td>" + statistic.getTotalHTTPSBytesNotAnalyzed() + " (" + String.format("%.2f", statistic.getTotalHTTPSBytesNotAnalyzed() * 100.0 / statistic.getTotalByte()) + "%)</td>" + System.getProperty(lineSeperator()));
}
if (timeRangeAnalysis != null) {
builder.append("<tr><th>Average Throughput (kbps)</th><td>" + doubleToFixedDecimal(timeRangeAnalysis.getAverageThroughput(), 2) + "</td></tr>" + System.getProperty(lineSeperator()));
builder.append("<tr><th>Total Upload Data (Byte)</th><td>" + timeRangeAnalysis.getUplinkBytes() + "</td></tr>" + System.getProperty(lineSeperator()));
builder.append("<tr><th>Average Upload Throughput (kbps)</th><td>" + doubleToFixedDecimal(timeRangeAnalysis.getAverageUplinkThroughput(), 2) + "</td></tr>" + System.getProperty(lineSeperator()));
builder.append("<tr><th>Total Download Data (Byte)</th><td>" + timeRangeAnalysis.getDownlinkBytes() + "</td></tr>" + System.getProperty(lineSeperator()));
builder.append("<tr><th>Average Download Throughput (kbps)</th><td>" + doubleToFixedDecimal(timeRangeAnalysis.getAverageDownlinkThroughput(), 2) + "</td></tr>" + System.getProperty(lineSeperator()));
}
EnergyModel energyModel = results.getEnergyModel();
if (energyModel != null) {
builder.append("<tr><th>Total Energy Consumed (J)</th><td>" + doubleToFixedDecimal(energyModel.getTotalEnergyConsumed(), 2) + "</td></tr>" + System.getProperty(lineSeperator()));
}
}
return builder.toString();
}
use of com.att.aro.core.packetanalysis.impl.TimeRangeAnalysis in project VideoOptimzer by attdevsupport.
the class BestPracticeResultsListener method addTimeRangeAnalysisAndStatisticRows.
private void addTimeRangeAnalysisAndStatisticRows(List<List<Object>> dataRows) {
if (traceData.getAnalyzerResult() != null) {
TimeRangeAnalysis timeRangeAnalysis = traceData.getAnalyzerResult().getTimeRangeAnalysis();
// Calculate time range
if (timeRangeAnalysis == null) {
AnalysisFilter filter = traceData.getAnalyzerResult().getFilter();
double beginTime = 0.0d;
double endTime = 0.0d;
boolean readyForAnalysis = false;
if (filter != null && filter.getTimeRange() != null) {
beginTime = filter.getTimeRange().getBeginTime();
endTime = filter.getTimeRange().getEndTime();
readyForAnalysis = true;
} else if (traceData.getAnalyzerResult().getTraceresult() != null) {
endTime = traceData.getAnalyzerResult().getTraceresult().getTraceDuration();
readyForAnalysis = true;
}
if (readyForAnalysis) {
timeRangeAnalysis = new TimeRangeAnalysis(beginTime, endTime, traceData.getAnalyzerResult());
}
}
if (timeRangeAnalysis != null) {
double traceDuration = timeRangeAnalysis.getEndTime() - timeRangeAnalysis.getStartTime();
long traceDurationLong = (long) traceDuration;
dataRows.add(Arrays.asList(getFontStyledColumn("Duration (second)"), formatToFixedDecimal(3, traceDuration)));
dataRows.add(Arrays.asList(getFontStyledColumn("Duration (hh:mm:ss.sss)"), String.format("%02d:%02d:%02d", traceDurationLong / 3600, (traceDurationLong % 3600) / 60, traceDurationLong % 60) + String.format("%.3f", traceDuration - Math.floor(traceDuration)).substring(1)));
String timeRangeTitle = traceData.getAnalyzerResult().getTraceresult().getTimeRange().getTitle();
dataRows.add(Arrays.asList(getFontStyledColumn("Time Range Identifier"), timeRangeTitle != null ? timeRangeTitle : ""));
dataRows.add(Arrays.asList(getFontStyledColumn("Start Time (second)"), formatToFixedDecimal(3, timeRangeAnalysis.getStartTime())));
dataRows.add(Arrays.asList(getFontStyledColumn("End Time (second)"), formatToFixedDecimal(3, timeRangeAnalysis.getEndTime())));
}
Statistic statistic = traceData.getAnalyzerResult().getStatistic();
if (statistic != null) {
dataRows.add(Arrays.asList(getFontStyledColumn("Total Data (KB)"), formatToFixedDecimal(2, statistic.getTotalByte() / 1000.0)));
dataRows.add(Arrays.asList(getFontStyledColumn("Total Payload Data (KB)"), formatToFixedDecimal(2, statistic.getTotalPayloadBytes() / 1000.0)));
dataRows.add(Arrays.asList(getFontStyledColumn("HTTPS Data (KB)"), formatToFixedDecimal(2, statistic.getTotalHTTPSByte() / 1000.0)));
dataRows.add(Arrays.asList(getFontStyledColumn("Unanalyzed HTTPS Data (KB)"), formatToFixedDecimal(2, statistic.getTotalHTTPSBytesNotAnalyzed() / 1000.0)));
}
if (timeRangeAnalysis != null) {
dataRows.add(Arrays.asList(getFontStyledColumn("Average Throughput (kbps)"), formatToFixedDecimal(2, timeRangeAnalysis.getAverageThroughput())));
dataRows.add(Arrays.asList(getFontStyledColumn("Total Upload Data (KB)"), formatToFixedDecimal(2, timeRangeAnalysis.getUplinkBytes() / 1000.0)));
dataRows.add(Arrays.asList(getFontStyledColumn("Average Upload Throughput (kbps)"), formatToFixedDecimal(2, timeRangeAnalysis.getAverageUplinkThroughput())));
dataRows.add(Arrays.asList(getFontStyledColumn("Total Download Data (KB)"), formatToFixedDecimal(2, timeRangeAnalysis.getDownlinkBytes() / 1000.0)));
dataRows.add(Arrays.asList(getFontStyledColumn("Average Download Throughput (kbps)"), formatToFixedDecimal(2, timeRangeAnalysis.getAverageDownlinkThroughput())));
}
if (statistic != null) {
dataRows.add(Arrays.asList(getFontStyledColumn("Total Energy Consumed (J)"), formatToFixedDecimal(2, traceData.getAnalyzerResult().getEnergyModel().getTotalEnergyConsumed())));
}
}
}
use of com.att.aro.core.packetanalysis.impl.TimeRangeAnalysis in project VideoOptimzer by attdevsupport.
the class TimeRangeAnalysisDialog method getCalculateStatisticsButton.
/**
* Initializes and returns the Calculate Statistics button
*/
private JButton getCalculateStatisticsButton() {
if (calculateStatisticsButton == null) {
calculateStatisticsButton = new JButton();
calculateStatisticsButton.setText(resourceBundle.getString("menu.tools.timeRangeAnalysis.calculateStatistics.button"));
calculateStatisticsButton.setToolTipText(resourceBundle.getString("menu.tools.timeRangeAnalysis.calculateStatistics.button.tooltip"));
calculateStatisticsButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
if (currentTraceResult == null) {
MessageDialogFactory.showMessageDialog(TimeRangeAnalysisDialog.this, resourceBundle.getString("menu.error.noTraceLoadedMessage"), resourceBundle.getString("error.title"), JOptionPane.ERROR_MESSAGE);
} else {
if (!updateCurrentfilter()) {
return;
}
if (!hasDataAfterFiltering(currentTraceResult.getFilter())) {
MessageDialogFactory.getInstance().showErrorDialog(TimeRangeAnalysisDialog.this, resourceBundle.getString("timerangeanalysis.noResultDataError"));
return;
}
double startTime;
double endTime;
try {
startTime = getTimeValue(startTimeTextField);
endTime = getTimeValue(endTimeTextField);
} catch (NumberFormatException e) {
MessageDialogFactory.showMessageDialog(TimeRangeAnalysisDialog.this, resourceBundle.getString("timerangeanalysis.numberError"));
return;
}
// Rounding traceEndTime as getEndTimeTextField() to
// handle time comparison
Double traceEndTimeRounded = Double.valueOf(DECIMAL_FORMAT.format(traceEndTime + ROUNDING_VALUE));
if (startTime < endTime) {
if (startTime >= 0.0 && startTime <= traceEndTimeRounded && endTime >= 0.0 && endTime <= traceEndTimeRounded) {
TimeRangeAnalysis timeRangeAnalysis = new TimeRangeAnalysis(startTime, endTime, currentTraceResult, ((MainFrame) parent).getController());
String msg = null;
ProfileType profileType = currentTraceResult.getProfile().getProfileType();
if (profileType == ProfileType.T3G) {
msg = resourceBundle.getString("timerangeanalysis.3g");
} else if (profileType == ProfileType.LTE) {
msg = resourceBundle.getString("timerangeanalysis.lte");
} else if (profileType == ProfileType.WIFI) {
msg = resourceBundle.getString("timerangeanalysis.wifi");
}
timeRangeAnalysisResultsTextArea.setText(MessageFormat.format((msg == null ? "" : msg), doubleToFixedDecimal(startTime, 3), doubleToFixedDecimal(endTime, 3), timeRangeAnalysis.getPayloadLen(), timeRangeAnalysis.getTotalBytes(), timeRangeAnalysis.getUplinkBytes(), timeRangeAnalysis.getDownlinkBytes(), doubleToFixedDecimal(timeRangeAnalysis.getRrcEnergy(), 2), doubleToFixedDecimal(timeRangeAnalysis.getActiveTime(), 2), doubleToFixedDecimal(timeRangeAnalysis.getAverageThroughput(), 2), doubleToFixedDecimal(timeRangeAnalysis.getAverageUplinkThroughput(), 2), doubleToFixedDecimal(timeRangeAnalysis.getAverageDownlinkThroughput(), 2) + getResultPanelNote(timeRangeAnalysis)));
timeRangeStartTime = startTime;
timeRangeEndTime = endTime;
} else {
String strErrorMessage = MessageFormat.format(resourceBundle.getString("timerangeanalysis.rangeError"), 0.00, doubleToFixedDecimal(traceEndTimeRounded, 3));
MessageDialogFactory.showMessageDialog(TimeRangeAnalysisDialog.this, strErrorMessage, resourceBundle.getString("error.title"), JOptionPane.ERROR_MESSAGE);
}
} else {
String strErrorMessage = resourceBundle.getString("timerangeanalysis.startTimeError");
MessageDialogFactory.showMessageDialog(TimeRangeAnalysisDialog.this, strErrorMessage, resourceBundle.getString("error.title"), JOptionPane.ERROR_MESSAGE);
}
}
}
});
}
return calculateStatisticsButton;
}
Aggregations