use of com.att.aro.core.packetanalysis.pojo.TraceDirectoryResult in project VideoOptimzer by attdevsupport.
the class TemperaturePlot method populate.
@Override
public void populate(XYPlot plot, AROTraceData analysis) {
XYSeries series = new XYSeries(0);
XYIntervalSeriesCollection thermalDataSeries = new XYIntervalSeriesCollection();
if (analysis == null) {
LOGGER.info("analysis data is null");
} else {
TraceResultType resultType = analysis.getAnalyzerResult().getTraceresult().getTraceResultType();
if (resultType.equals(TraceResultType.TRACE_FILE)) {
LOGGER.info("didn't get analysis trace data!");
} else {
TraceDirectoryResult traceresult = (TraceDirectoryResult) analysis.getAnalyzerResult().getTraceresult();
AnalysisFilter filter = analysis.getAnalyzerResult().getFilter();
temperatureInfos = traceresult.getTemperatureInfos();
thermalStatusInfos = traceresult.getThermalstatusInfos();
NumberAxis axis = new NumberAxis();
axis.setAutoRange(true);
// Calculate max and min temperature
List<Integer> tempLists = new ArrayList<>();
if (CollectionUtils.isNotEmpty(temperatureInfos)) {
for (TemperatureEvent bi : temperatureInfos) {
series.add(bi.getTimeRecorded(), bi.getcelciusTemperature());
tempLists.add(bi.getcelciusTemperature());
}
TemperatureEvent last = temperatureInfos.get(temperatureInfos.size() - 1);
if (filter.getTimeRange() != null) {
series.add(filter.getTimeRange().getEndTime().doubleValue(), last.getcelciusTemperature());
} else {
series.add(traceresult.getTraceDuration(), last.getcelciusTemperature());
}
XYItemRenderer renderer = plot.getRenderer(0);
renderer.setBaseToolTipGenerator(new XYToolTipGenerator() {
@Override
public String generateToolTip(XYDataset dataset, int series, int item) {
return toolTipContent(item);
}
});
Collections.sort(tempLists);
axis.setRange(Math.round(tempLists.get(0) / 1.2), Math.round(tempLists.get(tempLists.size() - 1) * 1.2));
axis.setAutoRange(false);
plot.setRenderer(0, renderer);
}
if (CollectionUtils.isNotEmpty(thermalStatusInfos)) {
Map<ThermalStatus, XYIntervalSeries> seriesMap = new EnumMap<ThermalStatus, XYIntervalSeries>(ThermalStatus.class);
for (ThermalStatus tstatus : ThermalStatus.values()) {
XYIntervalSeries series2 = new XYIntervalSeries(tstatus);
seriesMap.put(tstatus, series2);
thermalDataSeries.addSeries(series2);
}
Iterator<ThermalStatusInfo> iter = thermalStatusInfos.iterator();
if (iter.hasNext()) {
while (iter.hasNext()) {
ThermalStatusInfo info = iter.next();
seriesMap.get(info.getThermalStatus()).add(info.getBeginTimeStamp(), info.getBeginTimeStamp(), info.getEndTimeStamp(), 0.5, 0, 100);
}
}
XYBarRenderer barRenderer = new XYBarRenderer();
barRenderer.setDrawBarOutline(false);
barRenderer.setUseYInterval(true);
barRenderer.setAutoPopulateSeriesPaint(false);
barRenderer.setShadowVisible(false);
barRenderer.setGradientPaintTransformer(null);
barRenderer.setBarPainter(new StandardXYBarPainter());
setRenderingColorForDataSeries(barRenderer, thermalDataSeries);
barRenderer.setBaseToolTipGenerator(new XYToolTipGenerator() {
@Override
public String generateToolTip(XYDataset dataset, int series, int item) {
ThermalStatus info = (ThermalStatus) thermalDataSeries.getSeries(series).getKey();
return MessageFormat.format(ResourceBundleHelper.getMessageString("network.tooltip"), dataset.getX(series, item), ResourceBundleHelper.getEnumString(info));
}
});
plot.setRenderer(1, barRenderer);
plot.setRangeAxis(axis);
}
}
plot.setDataset(0, new XYSeriesCollection(series));
plot.setDataset(1, thermalDataSeries);
}
}
use of com.att.aro.core.packetanalysis.pojo.TraceDirectoryResult in project VideoOptimzer by attdevsupport.
the class CpuPlot method populate.
@Override
public void populate(XYPlot plot, AROTraceData analysis) {
XYSeries series = new XYSeries(0);
if (analysis == null) {
LOGGER.info("didn't get analysis trace data!");
} else {
TraceResultType resultType = analysis.getAnalyzerResult().getTraceresult().getTraceResultType();
if (resultType.equals(TraceResultType.TRACE_FILE)) {
LOGGER.info("didn't get analysis trace folder!");
} else {
TraceDirectoryResult traceresult = (TraceDirectoryResult) analysis.getAnalyzerResult().getTraceresult();
cpuAList = traceresult.getCpuActivityList();
boolean filterByTime = cpuAList.isFilterByTime();
double beginTime = 0;
double endTime = 0;
if (filterByTime) {
beginTime = cpuAList.getBeginTraceTime();
endTime = cpuAList.getEndTraceTime();
}
cpuData = cpuAList.getCpuActivities();
LOGGER.debug("Size of CPU data: " + cpuData.size());
if (cpuData.size() > 0) {
for (CpuActivity cpu : cpuData) {
if (filterByTime) {
// logger.debug("timestamp: {0}" + cpu.getTimeStamp());
if (cpu.getTimeStamp() >= beginTime && cpu.getTimeStamp() <= endTime) {
// logger.debug("CPU usage: {0}"+ cpu.getCpuUsageTotalFiltered());
series.add(cpu.getTimeStamp(), cpu.getCpuUsageTotalFiltered());
}
} else {
// logger.debug("CPU usage: {0}"+ cpu.getCpuUsageTotalFiltered());
series.add(cpu.getTimeStamp(), cpu.getCpuUsageTotalFiltered());
}
}
}
// Assign ToolTip to renderer
XYItemRenderer renderer = plot.getRenderer();
renderer.setBaseToolTipGenerator(new XYToolTipGenerator() {
@Override
public String generateToolTip(XYDataset dataset, int series, int item) {
return constructCpuToolTipText(cpuAList, cpuData, item);
}
});
}
}
plot.setDataset(new XYSeriesCollection(series));
// return plot;
}
use of com.att.aro.core.packetanalysis.pojo.TraceDirectoryResult in project VideoOptimzer by attdevsupport.
the class ScreenStatePlot method populate.
@Override
public void populate(XYPlot plot, AROTraceData analysis) {
if (analysis == null) {
LOGGER.info("analysis data is null");
} else {
screenData.removeAllSeries();
TraceResultType resultType = analysis.getAnalyzerResult().getTraceresult().getTraceResultType();
if (resultType.equals(TraceResultType.TRACE_FILE)) {
LOGGER.info("didn't get analysis trace data!");
} else {
TraceDirectoryResult traceresult = (TraceDirectoryResult) analysis.getAnalyzerResult().getTraceresult();
XYIntervalSeries series = new XYIntervalSeries(ScreenState.SCREEN_ON);
screenData.addSeries(series);
// Populate the data set
final Map<Double, ScreenStateInfo> dataMap = new HashMap<Double, ScreenStateInfo>();
Iterator<ScreenStateInfo> iter = traceresult.getScreenStateInfos().iterator();
if (iter.hasNext()) {
while (iter.hasNext()) {
ScreenStateInfo screenEvent = iter.next();
if (screenEvent.getScreenState() == ScreenState.SCREEN_ON) {
series.add(screenEvent.getBeginTimeStamp(), screenEvent.getBeginTimeStamp(), screenEvent.getEndTimeStamp(), 0.5, 0, 1);
dataMap.put(screenEvent.getBeginTimeStamp(), screenEvent);
}
}
}
// Assign ToolTip to renderer
XYItemRenderer renderer = plot.getRenderer();
renderer.setBaseToolTipGenerator(new XYToolTipGenerator() {
@Override
public String generateToolTip(XYDataset dataset, int series, int item) {
ScreenStateInfo si = dataMap.get(dataset.getXValue(series, item));
if (si != null) {
StringBuffer displayInfo = new StringBuffer(ResourceBundleHelper.getMessageString("screenstate.tooltip.prefix"));
int timeout = si.getScreenTimeout();
displayInfo.append(MessageFormat.format(ResourceBundleHelper.getMessageString("screenstate.tooltip.content"), ResourceBundleHelper.getEnumString(si.getScreenState()), si.getScreenBrightness(), timeout > 0 ? timeout : ResourceBundleHelper.getMessageString("screenstate.noTimeout")));
displayInfo.append(ResourceBundleHelper.getMessageString("screenstate.tooltip.suffix"));
return displayInfo.toString();
}
return null;
}
});
}
}
plot.setDataset(screenData);
// return plot;
}
use of com.att.aro.core.packetanalysis.pojo.TraceDirectoryResult in project VideoOptimzer by attdevsupport.
the class TraceDataReaderImpl method readTimeAndPcap.
/**
* Reads the PCAP file and the trace times from the time trace file.
*
* @throws IOException
*/
private TraceDirectoryResult readTimeAndPcap(TraceDirectoryResult dresult) throws IOException {
TraceDirectoryResult result = dresult;
String filepath = result.getTraceDirectory() + Util.FILE_SEPARATOR + TraceDataConst.FileName.TIME_FILE;
Double startTime = null;
Double duration = null;
if (filereader.fileExist(filepath)) {
TraceTime times = readTimes(result);
startTime = times.getStartTime();
if (times.getEventTime() != null) {
result.setEventTime0(times.getEventTime());
}
if (times.getTimezoneOffset() != null) {
result.setCaptureOffset(times.getTimezoneOffset());
}
duration = times.getDuration();
}
// Read the pcap files to get default times
List<Integer> appIds = readAppIDs(result);
result.setAppIds(appIds);
result.setTotalNoPackets(appIds.size());
if (dresult.getTraceFile() != null && !dresult.getTraceFile().equals("")) {
filepath = result.getTraceFile();
} else {
filepath = result.getTraceDirectory() + Util.FILE_SEPARATOR + TraceDataConst.FileName.TRAFFIC + TraceDataConst.FileName.CAP_EXT;
}
this.init();
this.ipCountMap = result.getIpCountMap();
result = (TraceDirectoryResult) this.readPcapTraceFile(filepath, startTime, duration, result);
if (result == null) {
return new TraceDirectoryResult();
}
for (int i = 1; ; i++) {
filepath = result.getTraceDirectory() + Util.FILE_SEPARATOR + TraceDataConst.FileName.TRAFFIC + i + TraceDataConst.FileName.CAP_EXT;
if (filereader.fileExist(filepath)) {
result = (TraceDirectoryResult) this.readPcapTraceFile(filepath, startTime, duration, result);
} else {
break;
}
}
if (result != null) {
String secureFilePath = result.getTraceDirectory() + Util.FILE_SEPARATOR + TraceDataConst.FileName.SECURE_PCAP_FILE;
if (filereader.fileExist(secureFilePath)) {
try {
isSecurePcap = true;
result.setSecureTrace(isSecurePcap);
this.readSecurePcapTraceFile(secureFilePath, result);
} finally {
isSecurePcap = false;
}
}
}
if (result == null) {
result = new TraceDirectoryResult();
}
result.setAllpackets(this.allPackets);
this.checkExternalVideoAndTime(result, startTime, duration);
return result;
}
use of com.att.aro.core.packetanalysis.pojo.TraceDirectoryResult in project VideoOptimzer by attdevsupport.
the class MissingTraceFiles method retrieveMissingFiles.
public Set<File> retrieveMissingFiles() {
Set<File> missingFiles = new LinkedHashSet<File>();
addMissingFileMaybe(TraceDataConst.FileName.APPNAME_FILE, missingFiles);
addMissingFileMaybe(TraceDataConst.FileName.DEVICEINFO_FILE, missingFiles);
addMissingFileMaybe(TraceDataConst.FileName.DEVICEDETAILS_FILE, missingFiles);
// addMissingFileMaybe(TraceDataConst.FileName.NETWORKINFO_FILE, missingFiles);
addMissingFileMaybe(TraceDataConst.FileName.CPU_FILE, missingFiles);
addMissingFileMaybe(TraceDataConst.FileName.GPS_FILE, missingFiles);
addMissingFileMaybe(TraceDataConst.FileName.BLUETOOTH_FILE, missingFiles);
addMissingFileMaybe(TraceDataConst.FileName.WIFI_FILE, missingFiles);
addMissingFileMaybe(TraceDataConst.FileName.CAMERA_FILE, missingFiles);
addMissingFileMaybe(TraceDataConst.FileName.SCREEN_STATE_FILE, missingFiles);
addMissingFileMaybe(TraceDataConst.FileName.USER_EVENTS_FILE, missingFiles);
// addMissingFileMaybe(TraceDataConst.FileName.SCREEN_ROTATIONS_FILE, missingFiles);
addMissingFileMaybe(TraceDataConst.FileName.ALARM_END_FILE, missingFiles);
addMissingFileMaybe(TraceDataConst.FileName.ALARM_START_FILE, missingFiles);
addMissingFileMaybe(TraceDataConst.FileName.KERNEL_LOG_FILE, missingFiles);
addMissingFileMaybe(TraceDataConst.FileName.BATTERY_FILE, missingFiles);
addMissingFileMaybe(TraceDataConst.FileName.BATTERYINFO_FILE, missingFiles);
addMissingFileMaybe(TraceDataConst.FileName.TEMPERATURE_FILE, missingFiles);
addMissingFileMaybe(TraceDataConst.FileName.LOCATION_FILE, missingFiles);
addMissingFileMaybe(TraceDataConst.FileName.RADIO_EVENTS_FILE, missingFiles);
if (isFilePresent(ResourceBundleHelper.getMessageString("video.videoDisplayFile")) || isFilePresent(ResourceBundleHelper.getMessageString("video.videoFileOnDevice"))) {
addMissingFileMaybe(TraceDataConst.FileName.VIDEO_TIME_FILE, missingFiles);
}
if (isFilePresent(ResourceBundleHelper.getMessageString("video.exVideoDisplayFile")) || isExternalVideoSourceFilePresent("video.mp4", "video.mov")) {
addMissingFileMaybe(TraceDataConst.FileName.EXVIDEO_TIME_FILE, missingFiles);
}
// UI shoule not be doing this!!!
if (model != null) {
AbstractTraceResult traceResult = model.getAnalyzerResult().getTraceresult();
if (traceResult instanceof TraceDirectoryResult) {
((TraceDirectoryResult) traceResult).setMissingFiles(getModelMissingFiles(missingFiles));
}
}
return missingFiles;
}
Aggregations