use of com.att.aro.core.packetanalysis.pojo.TimeRange in project VideoOptimzer by attdevsupport.
the class TimeRangeAnalysisDialog method getReanalyzeButton.
/*
* Get Reanalyze button
*/
private JButton getReanalyzeButton() {
if (reanalyzeButton == null) {
reanalyzeButton = new JButton();
reanalyzeButton.setText(resourceBundle.getString("menu.tools.timeRangeAnalysis.reanalyze.button"));
reanalyzeButton.setToolTipText(resourceBundle.getString("menu.tools.timeRangeAnalysis.reanalyze.button.tooltip"));
reanalyzeButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
double startTime;
double endTime;
try {
startTime = getTimeValue(startTimeTextField);
endTime = getTimeValue(endTimeTextField);
} catch (NumberFormatException e) {
MessageDialogFactory.getInstance().showErrorDialog(TimeRangeAnalysisDialog.this, resourceBundle.getString("timerangeanalysis.numberError"));
return;
}
double timeRangeEndTime = Double.valueOf(doubleToFixedDecimal(traceEndTime, 3));
if (startTime < endTime) {
if (startTime >= 0.0 && startTime <= endTime && endTime <= timeRangeEndTime) {
if (!updateCurrentfilter()) {
return;
}
AnalysisFilter filter = currentTraceResult.getFilter();
filter.setTimeRange(new TimeRange(startTime, endTime));
((MainFrame) parent).updateFilter(filter);
dispose();
} else {
String strErrorMessage = MessageFormat.format(resourceBundle.getString("timerangeanalysis.rangeError"), 0.00, doubleToFixedDecimal(traceEndTime, 3));
MessageDialogFactory.showMessageDialog(TimeRangeAnalysisDialog.this, strErrorMessage, resourceBundle.getString("menu.error.title"), JOptionPane.ERROR_MESSAGE);
}
} else {
String strErrorMessage = resourceBundle.getString("timerangeanalysis.startTimeError");
MessageDialogFactory.showMessageDialog(TimeRangeAnalysisDialog.this, strErrorMessage, resourceBundle.getString("menu.error.title"), JOptionPane.ERROR_MESSAGE);
}
}
});
}
return reanalyzeButton;
}
use of com.att.aro.core.packetanalysis.pojo.TimeRange in project VideoOptimzer by attdevsupport.
the class ExcludeTimeRangeAnalysisDialog method getOKButton.
/**
* Initializes and returns the start button
*/
private JButton getOKButton() {
if (startButton == null) {
startButton = new JButton();
startButton.setText(ResourceBundleHelper.getMessageString(DialogItem.Button_ok));
startButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
double startTime;
double endTime;
try {
startTime = getTimeValue(startTimeTextField);
endTime = getTimeValue(endTimeTextField);
} catch (NumberFormatException e) {
MessageDialogFactory.getInstance().showErrorDialog(ExcludeTimeRangeAnalysisDialog.this, ResourceBundleHelper.getMessageString(DialogItem.timerangeanalysis_numberError));
return;
}
double timeRangeEndTime = Double.valueOf(DECIMAL_FORMAT.format(traceEndTime));
if (startTime < endTime) {
if ((startTime >= 0.0) && (startTime <= endTime) && endTime <= timeRangeEndTime) {
AnalysisFilter filter = ((MainFrame) parent).getController().getTheModel().getAnalyzerResult().getFilter();
filter.setTimeRange(new TimeRange(startTime, endTime));
if (!hasDataAfterFiltering(filter)) {
MessageDialogFactory.getInstance().showErrorDialog(ExcludeTimeRangeAnalysisDialog.this, ResourceBundleHelper.getMessageString(DialogItem.timerangeanalysis_noResultDataError));
} else {
((MainFrame) parent).updateFilter(filter);
dispose();
}
} else {
String strErrorMessage = MessageFormat.format(ResourceBundleHelper.getMessageString(DialogItem.timerangeanalysis_rangeError), 0.00, DECIMAL_FORMAT.format(timeRangeEndTime));
MessageDialogFactory.showMessageDialog(ExcludeTimeRangeAnalysisDialog.this, strErrorMessage, ResourceBundleHelper.getMessageString(DialogItem.menu_error_title), JOptionPane.ERROR_MESSAGE);
}
} else {
String strErrorMessage = ResourceBundleHelper.getMessageString(DialogItem.timerangeanalysis_startTimeError);
MessageDialogFactory.showMessageDialog(ExcludeTimeRangeAnalysisDialog.this, strErrorMessage, ResourceBundleHelper.getMessageString(DialogItem.menu_error_title), JOptionPane.ERROR_MESSAGE);
}
}
});
}
return startButton;
}
use of com.att.aro.core.packetanalysis.pojo.TimeRange in project VideoOptimzer by attdevsupport.
the class GraphPanel method filterFlowTable.
// In 4.1.1, the method called refreshGraph()
public void filterFlowTable() {
AROTraceData filteredSessionTraceData = getTraceData();
double filteredStartTime = 0.0;
double filteredEndTime = 0.0;
double filteredDuration = filteredSessionTraceData.getAnalyzerResult().getTraceresult().getTraceDuration();
List<Session> tcpsessionsList = new ArrayList<Session>();
if (getTraceData() == null) {
return;
} else {
TCPUDPFlowsTableModel model = (TCPUDPFlowsTableModel) parent.getJTCPFlowsTable().getModel();
Map<String, Session> subSessionMap = model.getSessionMap();
Map<String, Boolean> subcheckboxMap = model.getCheckboxMap();
for (Map.Entry<String, Boolean> entry : subcheckboxMap.entrySet()) {
if (entry.getValue()) {
tcpsessionsList.add(subSessionMap.get(entry.getKey()));
}
}
filteredSessionTraceData.getAnalyzerResult().setSessionlist(tcpsessionsList);
}
List<PacketInfo> packetsForSelectedSession = new ArrayList<PacketInfo>();
for (Session tcpSession : tcpsessionsList) {
if (tcpSession.getTcpPackets() != null) {
packetsForSelectedSession.addAll(tcpSession.getTcpPackets());
}
}
// when generating graph, make sure session is ordered by time stamp
Collections.sort(packetsForSelectedSession, new Comparator<PacketInfo>() {
@Override
public int compare(PacketInfo p1, PacketInfo p2) {
return (int) (p1.getTimeStamp() * 1000 - p2.getTimeStamp() * 1000);
}
});
boolean selectedAllPackets = false;
// Adding the TCP packets to the trace for getting redoing the analysis
if (packetsForSelectedSession.size() > 0) {
if (tcpsessionsList.size() == getAllTcpSessions()) {
// For select all use all exiting packets
filteredSessionTraceData.getAnalyzerResult().getTraceresult().setAllpackets(getAllPackets());
selectedAllPackets = true;
} else {
// Collections.sort(packetsForSelectedSession);//?
filteredSessionTraceData.getAnalyzerResult().getTraceresult().setAllpackets(packetsForSelectedSession);
}
}
if (selectedAllPackets) {
filteredStartTime = -0.01;
filteredEndTime = filteredDuration;
} else {
int index = 0;
for (Session tcpSession : tcpsessionsList) {
if (tcpSession.getTcpPackets().size() != 0) {
if (index == 0) {
filteredStartTime = tcpSession.getTcpPackets().get(0).getTimeStamp();
filteredEndTime = tcpSession.getTcpPackets().get(0).getTimeStamp();
}
if (filteredStartTime > tcpSession.getTcpPackets().get(0).getTimeStamp()) {
filteredStartTime = tcpSession.getTcpPackets().get(0).getTimeStamp();
}
if (filteredEndTime < tcpSession.getTcpPackets().get(0).getTimeStamp()) {
filteredEndTime = tcpSession.getTcpPackets().get(0).getTimeStamp();
}
index++;
}
}
if (index == 0) {
filteredStartTime = 0.0;
filteredEndTime = 0.0;
}
}
// for Analysis data particular time of the graph, some number is not clear..
if (filteredStartTime > 0) {
// adjust the time line axis number
filteredStartTime = filteredStartTime - 2;
if (filteredStartTime < 0) {
filteredStartTime = -0.01;
}
}
if (filteredStartTime < 0) {
filteredStartTime = -0.01;
}
if (!selectedAllPackets) {
if (filteredEndTime > 0) {
// adjust the time line axis number
filteredEndTime = filteredEndTime + 15;
}
if (filteredEndTime > filteredDuration) {
filteredEndTime = filteredDuration;
}
}
this.startTime = filteredStartTime;
this.endTime = filteredEndTime;
if (getTraceData() != null) {
TimeRange timeRange = new TimeRange(filteredStartTime, filteredEndTime);
AnalysisFilter filter = filteredSessionTraceData.getAnalyzerResult().getFilter();
filter.setTimeRange(timeRange);
filteredSessionTraceData.getAnalyzerResult().setFilter(filter);
Statistic stat = ContextAware.getAROConfigContext().getBean(IPacketAnalyzer.class).getStatistic(packetsForSelectedSession);
long totaltemp = 0;
for (Session byteCountSession : tcpsessionsList) {
totaltemp += byteCountSession.getBytesTransferred();
}
stat.setTotalByte(totaltemp);
AbstractRrcStateMachine statemachine = ContextAware.getAROConfigContext().getBean(IRrcStateMachineFactory.class).create(packetsForSelectedSession, filteredSessionTraceData.getAnalyzerResult().getProfile(), stat.getPacketDuration(), filteredDuration, stat.getTotalByte(), timeRange);
BurstCollectionAnalysisData burstcollectiondata = new BurstCollectionAnalysisData();
if (stat.getTotalByte() > 0) {
burstcollectiondata = ContextAware.getAROConfigContext().getBean(IBurstCollectionAnalysis.class).analyze(packetsForSelectedSession, filteredSessionTraceData.getAnalyzerResult().getProfile(), stat.getPacketSizeToCountMap(), statemachine.getStaterangelist(), filteredSessionTraceData.getAnalyzerResult().getTraceresult().getUserEvents(), filteredSessionTraceData.getAnalyzerResult().getTraceresult().getCpuActivityList().getCpuActivities(), tcpsessionsList);
}
filteredSessionTraceData.getAnalyzerResult().getStatistic().setTotalByte(stat.getTotalByte());
filteredSessionTraceData.getAnalyzerResult().setStatemachine(statemachine);
filteredSessionTraceData.getAnalyzerResult().setBurstCollectionAnalysisData(burstcollectiondata);
refresh(filteredSessionTraceData);
}
}
use of com.att.aro.core.packetanalysis.pojo.TimeRange in project VideoOptimzer by attdevsupport.
the class AROFileMenu method openTraceFolder.
/**
* Choose a trace folder for direct analysis
*
* @param aEvent
* @param isRecent
* @return
*/
private void openTraceFolder(ActionEvent aEvent, boolean isRecent) {
File traceFolder = null;
Object event = aEvent.getSource();
if (event instanceof JMenuItem) {
if ((traceFolder = selectTraceFolder(aEvent, isRecent)) != null) {
File trj;
TimeRange timeRange = null;
if ((trj = new File(traceFolder, "time-range.json")).exists()) {
try {
String jsonData = fileManager.readAllData(trj.getPath());
if (!jsonData.contains("\"timeRangeType\" : \"DEFAULT\",")) {
JDialog splash = new TransitionDialog(parent.getFrame(), "Time-Range file detected\n", "Preparing to open in Time-Range chooser/editor dialog");
TimeRangeEditorDialog dialog;
try {
if ((dialog = displayTimeRangeEditor(traceFolder, true, splash)) != null && dialog.isContinueWithAnalyze()) {
timeRange = dialog.getTimeRange();
} else {
LOG.debug("Time-Range, Selection cancelled by user");
splash.dispose();
return;
}
} catch (Exception e) {
LOG.error("Exception in TimeRangeDialog:", e);
new MessageDialogFactory().showErrorDialog(null, "Exception in TimeRangeDialog:" + e.getMessage());
return;
}
} else {
TraceTimeRange traceTimeRange;
if ((traceTimeRange = timeRangeReadWrite.readData(traceFolder)) != null) {
if (traceTimeRange.getTimeRangeList().stream().filter(a -> a.getTimeRangeType().equals(TimeRangeType.DEFAULT)).count() > 1) {
LOG.error("Too many TimeRanges set to AUTO");
MessageDialogFactory.getInstance().showErrorDialog(parent.getFrame(), "Too many TimeRanges set to AUTO, please fix the selections");
return;
}
Optional<TimeRange> optionalTimeRange = traceTimeRange.getTimeRangeList().stream().filter(p -> p.getTimeRangeType().equals(TimeRange.TimeRangeType.DEFAULT)).findFirst();
if (optionalTimeRange.isPresent()) {
timeRange = optionalTimeRange.get();
}
}
}
} catch (IOException e) {
LOG.error("Problem reading time-range.json", e);
}
}
if (timeRange != null) {
launchTraceFolderAnalysis(traceFolder, timeRange);
} else {
launchTraceFolderAnalysis(traceFolder);
}
} else {
LOG.error("Invalid trace folder selected, no traffic file");
}
}
}
use of com.att.aro.core.packetanalysis.pojo.TimeRange in project VideoOptimzer by attdevsupport.
the class TimeRangeEditorDialog method validateTimeSpan.
private double validateTimeSpan() {
TimeRange temp = null;
temp = loadTimeRange(temp);
return (temp.getEndTime() - temp.getBeginTime());
}
Aggregations