use of com.att.aro.core.pojo.AROTraceData in project VideoOptimzer by attdevsupport.
the class AROController method runAnalyzer.
/**
* <p>Note: Do not use this method - use <em>updateModel(...)</em> instead.</p><p>
*
* Analyze a trace and produce a report either in json or html<br>
*
* @param trace The FQPN of the directory or pcap file to analyze
* @param profile The Profile to use for this analysis - LTE if null
* @param filter The filters to use - can be empty for no filtering specified
* @see #updateModel(String, Profile, AnalysisFilter)
*/
public AROTraceData runAnalyzer(String trace, Profile profile, AnalysisFilter filter) {
serv = context.getBean(IAROService.class);
AROTraceData results = new AROTraceData();
long analysisStartTime = System.currentTimeMillis();
try {
// Request garbage collection before loading a trace
System.gc();
LOG.debug("\nAnalyze trace :" + trace);
LOG.debug(String.format("\nTrace initial memory:%d free:%d", Runtime.getRuntime().totalMemory(), Runtime.getRuntime().freeMemory()));
// analyze trace file or directory?
try {
if (serv.isFile(trace)) {
results = serv.analyzeFile(retrieveBestPractices(), trace, profile, filter);
} else {
results = serv.analyzeDirectory(retrieveBestPractices(), trace, profile, filter);
}
if (results.getAnalyzerResult() != null && results.getAnalyzerResult().getStreamingVideoData() != null && !results.getAnalyzerResult().getStreamingVideoData().isFinished()) {
StreamingVideoData streamingVideoData = results.getAnalyzerResult().getStreamingVideoData();
if (!streamingVideoData.getVideoStreamMap().isEmpty()) {
Runnable waitingForUpdate = () -> {
int count = 1;
while (!streamingVideoData.isFinished()) {
LOG.debug(String.format("(%d) Waiting for FFmpegRunner to complete", count++));
Util.sleep(1000);
}
Util.sleep(1000);
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
analyzeVideoBP();
}
});
};
new Thread(waitingForUpdate, "waitingForUpdate").start();
}
}
} catch (OutOfMemoryError err) {
LOG.error(err.getMessage(), err);
results = new AROTraceData();
results.setSuccess(false);
results.setError(ErrorCodeRegistry.getOutOfMemoryError());
}
} catch (IOException exception) {
LOG.error(exception.getMessage(), exception);
results.setSuccess(false);
results.setError(ErrorCodeRegistry.getUnknownFileFormat());
}
LOG.debug(String.format("\n%s\nTrace Analysis Elapsed time: %.6f sec.", trace, (double) (System.currentTimeMillis() - analysisStartTime) / 1000));
LOG.debug(String.format("\nTrace analysis completed memory:%d free:%d", Runtime.getRuntime().totalMemory(), Runtime.getRuntime().freeMemory()));
return results;
}
use of com.att.aro.core.pojo.AROTraceData in project VideoOptimzer by attdevsupport.
the class VideoChunksPlot method refreshBPVideoResults.
private AROTraceData refreshBPVideoResults(AROTraceData model, AbstractBestPracticeResult bpResult, AbstractBestPracticeResult stallBPResult, AbstractBestPracticeResult bufferOccupancyBPResult) {
removeList.clear();
AROTraceData trace = model;
for (AbstractBestPracticeResult bp : model.getBestPracticeResults()) {
if (bp.getBestPracticeType() == BestPracticeType.STARTUP_DELAY) {
updateAbstractBestPracticeParameters(bp, bpResult, model.getBestPracticeResults().indexOf(bp));
} else if (stallBPResult != null && bp.getBestPracticeType() == BestPracticeType.VIDEO_STALL) {
updateAbstractBestPracticeParameters(bp, stallBPResult, model.getBestPracticeResults().indexOf(bp));
} else if (bufferOccupancyBPResult != null && bp.getBestPracticeType() == BestPracticeType.BUFFER_OCCUPANCY) {
updateAbstractBestPracticeParameters(bp, bufferOccupancyBPResult, model.getBestPracticeResults().indexOf(bp));
}
}
if (!removeList.isEmpty()) {
for (int index : removeList.keySet()) {
AbstractBestPracticeResult bp = removeList.get(index);
trace.getBestPracticeResults().remove(bp);
AbstractBestPracticeResult result = null;
if (bp.getBestPracticeType() == BestPracticeType.STARTUP_DELAY) {
result = bpResult;
} else if (bp.getBestPracticeType() == BestPracticeType.VIDEO_STALL) {
result = stallBPResult;
} else if (bp.getBestPracticeType() == BestPracticeType.BUFFER_OCCUPANCY) {
result = bufferOccupancyBPResult;
}
trace.getBestPracticeResults().add(index, result);
}
}
return trace;
}
use of com.att.aro.core.pojo.AROTraceData in project VideoOptimzer by attdevsupport.
the class StartupDelayDialog method launchStartupCalculations.
/**
* @param startupTime
*/
public void launchStartupCalculations(double startupTime) {
try {
if (startupTime >= segmentChosen.getVideoEvent().getEndTS() && segmentChosen.isSelected()) {
if (videoStreamStartup != null) {
videoStreamStartup.setValidationStartup(ValidationStartup.USER);
}
if (!allUserEventList.isEmpty()) {
segmentChosen.getVideoEvent().setPlayRequestedTime(Double.valueOf(playRequestedTime.getText()));
videoStream.setPlayRequestedTime(Double.valueOf(playRequestedTime.getText()));
}
saveStartupDelay(startupTime, segmentChosen.getVideoEvent(), videoStream, userEventChosen);
videoSegmentAnalyzer.applyStartupDelayToStream(startupTime, segmentChosen.getVideoEvent(), videoStream, streamingVideoData);
AROTraceData aroTraceData = mainFrame.getController().getTheModel();
IVideoBestPractices videoBestPractices = ContextAware.getAROConfigContext().getBean(IVideoBestPractices.class);
videoBestPractices.analyze(aroTraceData);
getGraphPanel().setTraceData(aroTraceData);
VideoManifestPanel videoManifestPanel = segmentTablePanel.getVideoManifestPanel();
videoManifestPanel.refresh(segmentTablePanel.getAnalyzerResult());
mainFrame.refreshBestPracticesTab();
destroy();
}
} catch (Exception ex) {
LOG.error("Error generating video chunk and buffer plots", ex);
MessageDialogFactory.showMessageDialog(parentPanel, "Error in drawing buffer graphs", "Failed to generate buffer plots", JOptionPane.ERROR_MESSAGE);
}
}
use of com.att.aro.core.pojo.AROTraceData in project VideoOptimzer by attdevsupport.
the class SliderDialogBox method getSetButtonListener.
public ActionListener getSetButtonListener(final VideoChunksPlot vcPlot) {
return new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
ComboManifest comboBoxItem = (ComboManifest) jcb.getSelectedItem();
if (segmentChosen != null && segmentChosen.isSelected && (comboBoxItem.getVideoStream() != null)) {
dispose();
try {
LOGGER.info("startTimeField :" + startTimeField.getText());
setStartTime(Double.valueOf(startTimeField.getText()));
} catch (NumberFormatException e1) {
// covers user entered bad data, just go with getStartTime()
}
try {
if (getStartTime() >= segmentChosen.getVideoEvent().getEndTS() && segmentChosen.isSelected) {
ComboManifest selectedStream = (ComboManifest) jcb.getSelectedItem();
if (selectedStream.getVideoStream() != null) {
VideoStream videoStream = selectedStream.getVideoStream();
segmentChosen.getVideoEvent().setPlayTime(getStartTime());
videoStream.getManifest().setDelay(getStartTime() - segmentChosen.getVideoEvent().getEndTS());
videoStream.getManifest().setStartupVideoEvent(segmentChosen.getVideoEvent());
videoStream.getManifest().setStartupDelay(segmentChosen.getVideoEvent().getSegmentStartTime() - videoStream.getManifest().getRequestTime());
LOGGER.info(String.format("Segment playTime = %.03f", segmentChosen.getVideoEvent().getPlayTime()));
startTimeField.setText(String.format("%.03f", segmentChosen.getVideoEvent().getPlayTime()));
revalidate();
for (VideoStream stream : streamingVideoData.getVideoStreamMap().values()) {
if (stream.equals(videoStream)) {
stream.setSelected(true);
} else {
stream.setSelected(false);
}
}
} else {
for (VideoStream stream : streamingVideoData.getVideoStreamMap().values()) {
if (stream.isSelected()) {
stream.getManifest().setDelay(getStartTime() - segmentChosen.getVideoEvent().getEndTS());
}
}
}
AROTraceData aroTraceData = mainFrame.getController().getTheModel();
streamingVideoData.scanVideoStreams();
IVideoBestPractices videoBestPractices = ContextAware.getAROConfigContext().getBean(IVideoBestPractices.class);
videoBestPractices.analyze(aroTraceData);
mainFrame.getDiagnosticTab().getGraphPanel().refresh(aroTraceData);
getGraphPanel().setTraceData(aroTraceData);
AROTraceData traceData = vcPlot.refreshPlot(getGraphPanel().getSubplotMap().get(ChartPlotOptions.VIDEO_CHUNKS).getPlot(), getGraphPanel().getTraceData(), getStartTime(), segmentChosen.getVideoEvent());
getGraphPanel().setTraceData(traceData);
mainFrame.getVideoTab().refresh(traceData);
}
} catch (Exception ex) {
LOGGER.error("Error generating video chunk and buffer plots", ex);
MessageDialogFactory.showMessageDialog(parentPanel, "Error in drawing buffer graphs", "Failed to generate buffer plots", JOptionPane.ERROR_MESSAGE);
}
} else {
showWarningMessage();
}
}
};
}
use of com.att.aro.core.pojo.AROTraceData in project VideoOptimzer by attdevsupport.
the class HtmlReportImplTest method reportGenerator_retunrIsTrue.
@Test
@Ignore
public void reportGenerator_retunrIsTrue() {
AccessingPeripheralResult access = new AccessingPeripheralResult();
access.setResultType(BPResultType.PASS);
CacheControlResult cache = new CacheControlResult();
cache.setResultType(BPResultType.FAIL);
List<AbstractBestPracticeResult> bpResults = new ArrayList<AbstractBestPracticeResult>();
bpResults.add(access);
bpResults.add(cache);
File tempFile = null;
try {
tempFile = folder.newFile("abc.html");
} catch (IOException e) {
e.printStackTrace();
}
if (tempFile != null) {
tempFile.deleteOnExit();
}
when(filereader.createFile(any(String.class))).thenReturn(tempFile);
AROTraceData results = new AROTraceData();
PacketAnalyzerResult analyzerResult = new PacketAnalyzerResult();
TraceDirectoryResult tracedirresult = new TraceDirectoryResult();
EnergyModel energyModel = new EnergyModel();
Statistic statistic = new Statistic();
statistic.setTotalByte(123);
statistic.setTotalHTTPSByte(123);
tracedirresult.setTraceDirectory("temp.txt");
analyzerResult.setTraceresult(tracedirresult);
analyzerResult.setEnergyModel(energyModel);
analyzerResult.setStatistic(statistic);
results.setAnalyzerResult(analyzerResult);
results.setBestPracticeResults(bpResults);
assertTrue(htmlReportImpl.reportGenerator("abc.html", results));
}
Aggregations