use of com.att.aro.core.bestpractice.pojo.BestPracticeType in project VideoOptimzer by attdevsupport.
the class BPSelectionPanel method getGroupedBPPanel.
private Component getGroupedBPPanel(Category category) {
List<BestPracticeType> bpItems = BestPracticeType.getByCategory(category);
JPanel panel = new JPanel();
noOfBestPractices = noOfBestPractices + bpItems.size();
Dimension sectionDimention = new Dimension(350, 45 + 23 * bpItems.size());
panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));
panel.setPreferredSize(sectionDimention);
panel.setMinimumSize(sectionDimention);
panel.setMaximumSize(sectionDimention);
final JCheckBox toggleAll = new JCheckBox("Select All");
toggleAll.setForeground(Color.BLUE);
toggleAll.addActionListener((e) -> setSelectedBoxes(bpItems, toggleAll.isSelected()));
panel.add(toggleAll);
selectAllList.add(toggleAll);
for (BestPracticeType item : bpItems) {
JCheckBox checkBox = new JCheckBox(item.getDescription());
panel.add(checkBox);
map.put(item.name(), checkBox);
}
TitledBorder border = BorderFactory.createTitledBorder(BorderFactory.createRaisedBevelBorder(), category.getDescription());
border.setTitleColor(Color.BLUE);
panel.setBorder(border);
return panel;
}
use of com.att.aro.core.bestpractice.pojo.BestPracticeType in project VideoOptimzer by attdevsupport.
the class PacketAnalyzerImpl method finalResult.
protected PacketAnalyzerResult finalResult(AbstractTraceResult result, Profile profile, AnalysisFilter filter) {
PacketAnalyzerResult data = new PacketAnalyzerResult();
if (filter == null) {
double endTime = result.getAllpackets().size() > 0 ? Math.max(result.getAllpackets().get(result.getAllpackets().size() - 1).getTimeStamp(), result.getTraceDuration()) : 0.0;
result.setTimeRange(new TimeRange("Full", TimeRange.TimeRangeType.FULL, 0.0, endTime));
} else {
result.setTimeRange(filter.getTimeRange());
}
// List of packets included in analysis (application filtered)
List<PacketInfo> filteredPackets;
Profile aProfile = profile;
if (aProfile == null) {
// if the user doesn't load any profile.....
aProfile = profilefactory.createLTEdefault();
aProfile.setName("AT&T LTE");
}
// for the situation, filter out all no-ip packets and caused the allpackets is empty, need to refactor
if (result != null && result.getAllpackets() != null && result.getAllpackets().size() == 0) {
data.setTraceresult(result);
return data;
}
/* Purpose of this code block is to finish building out the filter, if needed, for TimeRange analysis
*
* This code block is excuted when:
* 1: time-range.json exists in trace folder
* a: and the json contains an entry with RangeType.AUTO
* 2: A TimeRange object was created and launched in TimeRangeEditorDialog
*
* AroController will have created an AnalysisFilter and so filter will not be null
*
*/
try {
if ((filter != null && filter.getTimeRange() != null && filter.getTimeRange().getPath() != null) || result.getAllAppNames().size() == 1) {
String app = TraceDataReaderImpl.UNKNOWN_APPNAME;
if (filter != null && filter.getAppSelections() != null && filter.getAppSelections().containsKey(app) && filter.getAppSelections().get(app).getIPAddressSelections().isEmpty()) {
LOGGER.debug("AUTO Time Range analysis: add all found appIps to " + app + ", then store in the filter");
ApplicationSelection appSelection = new ApplicationSelection(app, result.getAppIps().get(app));
filter.getAppSelections().put(app, appSelection);
}
}
} catch (Exception e) {
LOGGER.error("Error handling TimeRange JSON data", e);
}
TimeRange timeRange = null;
boolean isCSI = false;
filteredPackets = new ArrayList<PacketInfo>();
if (filter == null) {
if (result != null) {
filteredPackets = result.getAllpackets();
}
} else {
// do the filter
if (filter.isCSI() && filter.getManifestFilePath() != null) {
isCSI = true;
}
timeRange = filter.getTimeRange();
if (result != null) {
filteredPackets = filterPackets(filter, result.getAllpackets());
}
}
// Fix for Sev 2 Time Range Analysis Issue - DE187848
if (result != null) {
result.setAllpackets(filteredPackets);
SessionManagerImpl sessionMangerImpl = (SessionManagerImpl) sessionmanager;
sessionMangerImpl.setPcapTimeOffset(result.getPcapTimeOffset());
// for iOS trace
sessionmanager.setiOSSecureTracePath(result.getTraceDirectory());
// Check if secure trace path exists
if (result instanceof TraceDirectoryResult) {
File file = new File(((SessionManagerImpl) sessionmanager).getTracePath());
if (file.exists()) {
((TraceDirectoryResult) result).setSecureTrace(true);
}
}
}
Statistic stat = this.getStatistic(filteredPackets);
List<Session> sessionList = sessionmanager.processPacketsAndAssembleSessions(filteredPackets);
generateGetRequestMapAndPopulateLatencyStat(sessionList, stat);
if (result != null && stat.getAppName() != null && stat.getAppName().size() == 1 && stat.getAppName().contains(TraceDataReaderImpl.UNKNOWN_APPNAME)) {
stat.setAppName(new HashSet<String>(result.getAppInfos()));
}
// get Unanalyzed HTTPS bytes
boolean isSecureTrace = result instanceof TraceDirectoryResult ? ((TraceDirectoryResult) result).isSecureTrace() : false;
if (isSecureTrace) {
stat.setTotalHTTPSBytesNotAnalyzed(getHttpsBytesNotAnalyzed(sessionList));
} else {
stat.setTotalHTTPSBytesNotAnalyzed(stat.getTotalHTTPSByte());
}
// stat is used to get some info for RrcStateMachine etc
if (result != null) {
LOGGER.debug("Starting pre processing in PAI");
AbstractRrcStateMachine statemachine = statemachinefactory.create(filteredPackets, aProfile, stat.getPacketDuration(), result.getTraceDuration(), stat.getTotalByte(), timeRange);
EnergyModel energymodel = energymodelfactory.create(aProfile, statemachine.getTotalRRCEnergy(), result.getGpsInfos(), result.getCameraInfos(), result.getBluetoothInfos(), result.getScreenStateInfos());
BurstCollectionAnalysisData burstcollectiondata = burstcollectionanalyzer.analyze(filteredPackets, aProfile, stat.getPacketSizeToCountMap(), statemachine.getStaterangelist(), result.getUserEvents(), result.getCpuActivityList().getCpuActivities(), sessionList);
data.clearBPResults();
try {
List<BestPracticeType> videoBPList = BestPracticeType.getByCategory(BestPracticeType.Category.VIDEO);
data.setStreamingVideoData(videoTrafficCollector.clearData());
if (CollectionUtils.containsAny(SettingsUtil.retrieveBestPractices(), videoBPList)) {
if (isCSI || csiDataHelper.doesCSIFileExist(result.getTraceDirectory())) {
data.setStreamingVideoData(videoTrafficInferencer.inferVideoData(result, sessionList, (filter != null && filter.getManifestFilePath() != null) ? filter.getManifestFilePath() : result.getTraceDirectory()));
} else {
data.setStreamingVideoData(videoTrafficCollector.collect(result, sessionList, requestMap));
}
}
} catch (Exception ex) {
LOGGER.error("Error in Video usage analysis :", ex);
// Guarantee that StreamingVideoData is empty
data.setStreamingVideoData(videoTrafficCollector.clearData());
data.getStreamingVideoData().setFinished(true);
}
try {
List<BestPracticeType> imageBPList = new ArrayList<>();
imageBPList.add(BestPracticeType.IMAGE_MDATA);
imageBPList.add(BestPracticeType.IMAGE_CMPRS);
imageBPList.add(BestPracticeType.IMAGE_FORMAT);
imageBPList.add(BestPracticeType.IMAGE_COMPARE);
if (CollectionUtils.containsAny(SettingsUtil.retrieveBestPractices(), imageBPList)) {
imageExtractor.execute(result, sessionList, requestMap);
}
} catch (Exception ex) {
LOGGER.error("Error in Image extraction:" + ex.getMessage(), ex);
}
htmlExtractor.execute(result, sessionList, requestMap);
// Calculate time range analysis
double beginTime = 0.0d;
double endTime = 0.0d;
if (filter != null && filter.getTimeRange() != null) {
beginTime = filter.getTimeRange().getBeginTime();
endTime = filter.getTimeRange().getEndTime();
} else {
endTime = result.getTraceDuration();
}
data.setBurstCollectionAnalysisData(burstcollectiondata);
data.setEnergyModel(energymodel);
data.setSessionlist(sessionList);
data.setStatemachine(statemachine);
data.setStatistic(stat);
data.setTraceresult(result);
data.setProfile(aProfile);
data.setFilter(filter);
data.setDeviceKeywords(result.getDeviceKeywordInfos());
data.setTimeRangeAnalysis(new TimeRangeAnalysis(beginTime, endTime, data));
}
return data;
}
use of com.att.aro.core.bestpractice.pojo.BestPracticeType in project VideoOptimzer by attdevsupport.
the class SettingsUtil method getUnselectedBestPractices.
private static List<BestPracticeType> getUnselectedBestPractices(List<BestPracticeType> bpList) {
BestPracticeType[] allBP = BestPracticeType.values();
List<BestPracticeType> ret = new ArrayList<>();
List<BestPracticeType> pre = BestPracticeType.getByCategory(Category.PRE_PROCESS);
pre.addAll(bpList);
for (BestPracticeType bpt : allBP) {
if (!pre.contains(bpt)) {
ret.add(bpt);
}
}
return ret;
}
use of com.att.aro.core.bestpractice.pojo.BestPracticeType in project VideoOptimzer by attdevsupport.
the class VideoBestPractices method analyze.
public AROTraceData analyze(AROTraceData traceDataresult) {
PacketAnalyzerResult result = null;
if (null == traceDataresult) {
return null;
}
result = traceDataresult.getAnalyzerResult();
if (result == null) {
return null;
}
VideoStallResult videoStallResult = null;
VideoStartUpDelayResult videoStartUpDelayResult = null;
BufferOccupancyResult bufferOccupancyResult = null;
VideoNetworkComparisonResult videoNetworkComparisonResult = null;
VideoTcpConnectionResult videoTcpConnectionResult = null;
VideoChunkSizeResult videoChunkSizeResult = null;
VideoChunkPacingResult videoChunkPacingResult = null;
VideoRedundancyResult videoRedundancyResult = null;
VideoConcurrentSessionResult videoConcurrentSessionResult = null;
VideoVariableBitrateResult videoVariableBitrateResult = null;
VideoAdaptiveBitrateLadderResult videoSegmentQualityResult = null;
VideoResolutionQualityResult videoResolutionQualityResult = null;
AudioStreamResult videoSeparateAudioResult = null;
List<BestPracticeType> requests = BestPracticeType.getByCategory(Category.VIDEO);
List<AbstractBestPracticeResult> bpResults = traceDataresult.getBestPracticeResults();
List<AbstractBestPracticeResult> videoBestPracticeResults = aroService.analyze(result, requests);
for (AbstractBestPracticeResult videoBPResult : videoBestPracticeResults) {
BestPracticeType bpType = videoBPResult.getBestPracticeType();
switch(bpType) {
case VIDEO_STALL:
videoStallResult = (VideoStallResult) videoBPResult;
break;
case STARTUP_DELAY:
videoStartUpDelayResult = (VideoStartUpDelayResult) videoBPResult;
break;
case BUFFER_OCCUPANCY:
bufferOccupancyResult = (BufferOccupancyResult) videoBPResult;
break;
case NETWORK_COMPARISON:
videoNetworkComparisonResult = (VideoNetworkComparisonResult) videoBPResult;
break;
case TCP_CONNECTION:
videoTcpConnectionResult = (VideoTcpConnectionResult) videoBPResult;
break;
case CHUNK_SIZE:
videoChunkSizeResult = (VideoChunkSizeResult) videoBPResult;
break;
case CHUNK_PACING:
videoChunkPacingResult = (VideoChunkPacingResult) videoBPResult;
break;
case VIDEO_REDUNDANCY:
videoRedundancyResult = (VideoRedundancyResult) videoBPResult;
break;
case VIDEO_CONCURRENT_SESSION:
videoConcurrentSessionResult = (VideoConcurrentSessionResult) videoBPResult;
break;
case VIDEO_VARIABLE_BITRATE:
videoVariableBitrateResult = (VideoVariableBitrateResult) videoBPResult;
break;
case VIDEO_RESOLUTION_QUALITY:
videoResolutionQualityResult = (VideoResolutionQualityResult) videoBPResult;
break;
case VIDEO_ABR_LADDER:
videoSegmentQualityResult = (VideoAdaptiveBitrateLadderResult) videoBPResult;
break;
case AUDIO_STREAM:
videoSeparateAudioResult = (AudioStreamResult) videoBPResult;
break;
default:
break;
}
}
sendGAVideoBPResult(videoBestPracticeResults);
for (AbstractBestPracticeResult bestPractice : bpResults) {
if (bestPractice instanceof VideoStallResult) {
bpResults.set(bpResults.indexOf(bestPractice), videoStallResult);
} else if (bestPractice instanceof VideoStartUpDelayResult) {
bpResults.set(bpResults.indexOf(bestPractice), videoStartUpDelayResult);
} else if (bestPractice instanceof BufferOccupancyResult) {
bpResults.set(bpResults.indexOf(bestPractice), bufferOccupancyResult);
} else if (bestPractice instanceof VideoNetworkComparisonResult) {
bpResults.set(bpResults.indexOf(bestPractice), videoNetworkComparisonResult);
} else if (bestPractice instanceof VideoTcpConnectionResult) {
bpResults.set(bpResults.indexOf(bestPractice), videoTcpConnectionResult);
} else if (bestPractice instanceof VideoChunkSizeResult) {
bpResults.set(bpResults.indexOf(bestPractice), videoChunkSizeResult);
} else if (bestPractice instanceof VideoChunkPacingResult) {
bpResults.set(bpResults.indexOf(bestPractice), videoChunkPacingResult);
} else if (bestPractice instanceof VideoChunkPacingResult) {
bpResults.set(bpResults.indexOf(bestPractice), videoChunkPacingResult);
} else if (bestPractice instanceof VideoRedundancyResult) {
bpResults.set(bpResults.indexOf(bestPractice), videoRedundancyResult);
} else if (bestPractice instanceof VideoConcurrentSessionResult) {
bpResults.set(bpResults.indexOf(bestPractice), videoConcurrentSessionResult);
} else if (bestPractice instanceof VideoVariableBitrateResult) {
bpResults.set(bpResults.indexOf(bestPractice), videoVariableBitrateResult);
} else if (bestPractice instanceof VideoResolutionQualityResult) {
bpResults.set(bpResults.indexOf(bestPractice), videoResolutionQualityResult);
} else if (bestPractice instanceof VideoAdaptiveBitrateLadderResult) {
bpResults.set(bpResults.indexOf(bestPractice), videoSegmentQualityResult);
} else if (bestPractice instanceof AudioStreamResult) {
bpResults.set(bpResults.indexOf(bestPractice), videoSeparateAudioResult);
}
}
traceDataresult.setBestPracticeResults(bpResults);
return traceDataresult;
}
use of com.att.aro.core.bestpractice.pojo.BestPracticeType in project VideoOptimzer by attdevsupport.
the class VideoChunksPlot method refreshPlot.
// StartupDelay calculations
public AROTraceData refreshPlot(XYPlot plot, AROTraceData traceData, double startTime, VideoEvent selectedChunk) {
chunkPlayTime.clear();
chunkPlayTime.put(selectedChunk, startTime);
videoChunkPlotter.setChunkPlayTimeList(chunkPlayTime);
setChunkPlayBackTimeCollection(traceData);
bufferInSecondsPlot.setChunkPlayTimeMap(chunkPlayTime);
populate(plot, traceData);
AbstractBestPracticeResult startupDelayBPResult = videoChunkPlotter.refreshStartUpDelayBP(traceData);
if (traceData.getAnalyzerResult().getStreamingVideoData().getStreamingVideoCompiled().getChunksBySegmentID().isEmpty()) {
return refreshBPVideoResults(traceData, startupDelayBPResult, null, null);
}
bufferInSecondsPlot.populate(bufferTimeXYPlot, traceData);
bufferOccupancyPlot.populate(bufferOccupancyXYPlot, traceData);
refreshVCPlot(plot, traceData);
AbstractBestPracticeResult stallBPResult = null;
AbstractBestPracticeResult bufferOccupancyBPResult = null;
List<BestPracticeType> bpList = SettingsUtil.retrieveBestPractices();
if (bpList.contains(BestPracticeType.VIDEO_STALL)) {
stallBPResult = videoChunkPlotter.refreshVideoStallBP(traceData);
}
if (bpList.contains(BestPracticeType.BUFFER_OCCUPANCY)) {
bufferOccupancyBPResult = videoChunkPlotter.refreshVideoBufferOccupancyBP(traceData);
}
return refreshBPVideoResults(traceData, startupDelayBPResult, stallBPResult, bufferOccupancyBPResult);
}
Aggregations