use of com.att.aro.core.packetanalysis.pojo.TraceResultType in project VideoOptimzer by attdevsupport.
the class AlarmPlot method populate.
@Override
public void populate(XYPlot plot, AROTraceData analysis) {
if (analysis == null) {
LOGGER.info("analysis data is null");
} else {
alarmDataCollection.removeAllSeries();
pointerAnnotation.clear();
TraceResultType resultType = analysis.getAnalyzerResult().getTraceresult().getTraceResultType();
if (resultType.equals(TraceResultType.TRACE_FILE)) {
LOGGER.info("didn't get analysis trace data!");
} else {
// Remove old annotation from previous plots
Iterator<XYPointerAnnotation> pointers = pointerAnnotation.iterator();
while (pointers.hasNext()) {
plot.removeAnnotation(pointers.next());
}
for (AlarmType eventType : AlarmType.values()) {
XYIntervalSeries series = new XYIntervalSeries(eventType);
seriesMap.put(eventType, series);
alarmDataCollection.addSeries(series);
}
TraceDirectoryResult traceresult = (TraceDirectoryResult) analysis.getAnalyzerResult().getTraceresult();
List<AlarmInfo> alarmInfos = traceresult.getAlarmInfos();
List<ScheduledAlarmInfo> pendingAlarms = getHasFiredAlarms(traceresult.getScheduledAlarms());
Iterator<ScheduledAlarmInfo> iterPendingAlarms = pendingAlarms.iterator();
double firedTime = 0;
while (iterPendingAlarms.hasNext()) {
ScheduledAlarmInfo scheduledEvent = iterPendingAlarms.next();
AlarmType pendingAlarmType = scheduledEvent.getAlarmType();
if (pendingAlarmType != null) {
firedTime = (scheduledEvent.getTimeStamp() - scheduledEvent.getRepeatInterval()) / 1000;
seriesMap.get(pendingAlarmType).add(firedTime, firedTime, firedTime, 1, 0.8, 1);
eventMapPending.put(firedTime, scheduledEvent);
// logger.fine("populateAlarmScheduledPlot type:\n" +
// pendingAlarmType
// + "\ntime " + scheduledEvent.getTimeStamp()
// + "\nrepeating " + firedTime);
}
}
Iterator<AlarmInfo> iter = alarmInfos.iterator();
while (iter.hasNext()) {
AlarmInfo currEvent = iter.next();
if (currEvent != null) {
AlarmType alarmType = currEvent.getAlarmType();
if (alarmType != null) {
firedTime = currEvent.getTimeStamp() / 1000;
/*
* Catching any alarms align to quanta as being
* inexactRepeating alarms
*/
if ((currEvent.getTimestampElapsed() / 1000) % 900 < 1) {
seriesMap.get(alarmType).add(firedTime, firedTime, firedTime, 1, 0, 0.7);
// Adding an arrow to mark these
// inexactRepeating alarms
XYPointerAnnotation xypointerannotation = new XYPointerAnnotation(alarmType.name(), firedTime, 0.6, 3.92699082D);
xypointerannotation.setBaseRadius(20D);
xypointerannotation.setTipRadius(1D);
pointerAnnotation.add(xypointerannotation);
plot.addAnnotation(xypointerannotation);
// logger.info("SetInexactRepeating alarm type: "
// + alarmType
// + " time " + firedTime
// + " epoch " + currEvent.getTimestampEpoch()
// + " elapsed:\n" +
// currEvent.getTimestampElapsed()/1000);
} else {
seriesMap.get(alarmType).add(firedTime, firedTime, firedTime, 1, 0, 0.5);
}
eventMap.put(firedTime, currEvent);
}
}
}
XYItemRenderer renderer = plot.getRenderer();
renderer.setSeriesPaint(alarmDataCollection.indexOf(AlarmType.RTC_WAKEUP), Color.red);
renderer.setSeriesPaint(alarmDataCollection.indexOf(AlarmType.RTC), Color.pink);
renderer.setSeriesPaint(alarmDataCollection.indexOf(AlarmType.ELAPSED_REALTIME_WAKEUP), Color.blue);
renderer.setSeriesPaint(alarmDataCollection.indexOf(AlarmType.ELAPSED_REALTIME), Color.cyan);
renderer.setSeriesPaint(alarmDataCollection.indexOf(AlarmType.UNKNOWN), Color.black);
// Assign ToolTip to renderer
renderer.setBaseToolTipGenerator(new XYToolTipGenerator() {
@Override
public String generateToolTip(XYDataset dataset, int series, int item) {
AlarmInfo info = eventMap.get(dataset.getX(series, item));
Date epochTime = new Date();
if (info != null) {
epochTime.setTime((long) info.getTimestampEpoch());
StringBuffer displayInfo = new StringBuffer(ResourceBundleHelper.getMessageString("alarm.tooltip.prefix"));
displayInfo.append(MessageFormat.format(ResourceBundleHelper.getMessageString("alarm.tooltip.content"), info.getAlarmType(), info.getTimeStamp() / 1000, epochTime.toString()));
if ((info.getTimestampElapsed() / 1000) % 900 < 1) {
displayInfo.append(ResourceBundleHelper.getMessageString("alarm.tooltip.setInexactRepeating"));
}
displayInfo.append(ResourceBundleHelper.getMessageString("alarm.tooltip.suffix"));
return displayInfo.toString();
}
ScheduledAlarmInfo infoPending = eventMapPending.get(dataset.getX(series, item));
if (infoPending != null) {
epochTime.setTime((long) (infoPending.getTimestampEpoch() - infoPending.getRepeatInterval()));
StringBuffer displayInfo = new StringBuffer(ResourceBundleHelper.getMessageString("alarm.tooltip.prefix"));
displayInfo.append(MessageFormat.format(ResourceBundleHelper.getMessageString("alarm.tooltip.contentWithName"), infoPending.getAlarmType(), (infoPending.getTimeStamp() - infoPending.getRepeatInterval()) / 1000, epochTime.toString(), infoPending.getApplication(), infoPending.getRepeatInterval() / 1000));
displayInfo.append(ResourceBundleHelper.getMessageString("alarm.tooltip.suffix"));
return displayInfo.toString();
}
return null;
}
});
}
}
plot.setDataset(alarmDataCollection);
// return plot;
}
use of com.att.aro.core.packetanalysis.pojo.TraceResultType 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.TraceResultType 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.TraceResultType 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;
}
Aggregations