extract method that contain nested if or nested loop.
Change-Id: I3c6adb916f9c8d4b7b4d1636998b3e5e6d1263cf
Signed-off-by: Hyunjong.park <phjwithyou.park@samsung.com>
private int pId = -1;
public NetworkChart(String chartName, String destinationAddress, String fdValue,
- DAChartBoardItem item, DAChart chart, int parentChartIndex,
- int childChartIndex) {
+ DAChartBoardItem item, DAChart chart, int parentChartIndex, int childChartIndex) {
setChartName(chartName);
setDestinationAddress(destinationAddress);
setFdValue(fdValue);
public void updateApiSeries(List<NetworkAPIType> apiList) {
for (int i = 0; i < apiList.size(); i++) {
- if (getDestinationAddress().equals(apiList.get(i).getDestinationAddress())) {
- if (!isParentChartRow()
- && !getFdValue().equals(apiList.get(i).getFdStr())) {
- continue;
- }
- NetworkAPIType data = apiList.get(i);
- DAChartSeriesItem seriesItem = null;
- double time = getConvertTime(data.getTime());
- Color color = ColorResources.NETWORK_API_USED;
- String apiName = FunctionNameManager.getFunctionName(data.getApiNameID());
- if (data.getErrno() != 0) {
- color = ColorResources.NETWORK_API_FAILED;
- }
- seriesItem = new DAChartSeriesItem(time,
- DAChartSeriesItem.SERIES_STATE_BAR, color, apiName);
- apiSeries.addSeriesItem(seriesItem);
- if (!isParentChartRow() && data.getErrno() != 0) {
- setChartIndexOfSeq(data.getSeq());
- }
+ if (!getDestinationAddress().equals(apiList.get(i).getDestinationAddress())) {
+ continue;
+ }
+ if (!isParentChartRow() && !getFdValue().equals(apiList.get(i).getFdStr())) {
+ continue;
+ }
+ NetworkAPIType data = apiList.get(i);
+ DAChartSeriesItem seriesItem = null;
+ double time = getConvertTime(data.getTime());
+ Color color = ColorResources.NETWORK_API_USED;
+ String apiName = FunctionNameManager.getFunctionName(data.getApiNameID());
+ if (data.getErrno() != 0) {
+ color = ColorResources.NETWORK_API_FAILED;
+ }
+ seriesItem = new DAChartSeriesItem(time, DAChartSeriesItem.SERIES_STATE_BAR, color,
+ apiName);
+ apiSeries.addSeriesItem(seriesItem);
+ if (!isParentChartRow() && data.getErrno() != 0) {
+ setChartIndexOfSeq(data.getSeq());
}
}
chart.redraw();
public void updateParentChartStatusSeries(List<NetworkSeriesType> statusList) {
NetworkSeriesType data = null;
- double startTime = -1;
- double endTime = -1;
-
- double openTimeOfNotClosed = NetworkDataManager.MAX_CHART_TIME;
-
for (int i = 0; i < statusList.size(); i++) {
- if (getDestinationAddress().equals(statusList.get(i).getDestinationAddress())) {
- data = statusList.get(i);
-
- if (isAccessEvnet(data.getAPIType())) {
- continue;
- }
-
- startTime = getConvertTime(data.getStartTime());
- endTime = getConvertTime(data.getEndTime());
-
- if (endTime > 0 && openTimeOfNotClosed > startTime) { // closed
- DAChartSeriesItem seriesItem = new DAChartSeriesItem(startTime,
- DAChartSeriesItem.SERIES_STATE_CONTINUE,
- ColorResources.NETWORK_AREA_CLOSED_END,
- ColorResources.NETWORK_AREA_CLOSED_START,
- NetworkPageLabels.NETWORK_CHART_TOOLTIP_CLOSED);
- statueSeries.addSeriesItem(seriesItem);
-
- int nStatusLastIndex = statueSeries.getSeriesItemList().size() - 1;
- DAChartSeriesItem endSeriesItem = new DAChartSeriesItem(endTime,
- DAChartSeriesItem.SERIES_STATE_BAR,
- ColorResources.NETWORK_AREA_CLOSED_END,
- ColorResources.NETWORK_AREA_CLOSED_START,
- NetworkPageLabels.NETWORK_CHART_TOOLTIP_CLOSED);
- seriesItem.setBarWidth(0);
- statueSeries.addSeriesItem(seriesItem);
- statueSeries
- .getSeriesItemList()
- .get(nStatusLastIndex)
- .setTooltipText(
- NetworkPageLabels.NETWORK_CHART_TOOLTIP_CLOSED);
- statueSeries.addSeriesItem(endSeriesItem);
- } else { // open
- openTimeOfNotClosed = startTime;
- DAChartSeriesItem seriesItem = new DAChartSeriesItem(startTime,
- DAChartSeriesItem.SERIES_STATE_CONTINUE,
- ColorResources.NETWORK_AREA_FD_USED_END,
- ColorResources.NETWORK_AREA_FD_USED_START,
- NetworkPageLabels.NETWORK_CHART_TOOLTIP_FD_OPEND);
- statueSeries.addSeriesItem(seriesItem);
- }
+ if (!getDestinationAddress().equals(statusList.get(i).getDestinationAddress())) {
+ continue;
+ }
+ data = statusList.get(i);
+ if (isAccessEvnet(data.getAPIType())) {
+ continue;
}
+ addSeriesItemAtParentChartStatusSeries(getConvertTime(data.getStartTime()),
+ getConvertTime(data.getEndTime()));
}
chart.redraw();
}
+ private void addSeriesItemAtParentChartStatusSeries(double startTime, double endTime) {
+ double openTimeOfNotClosed = NetworkDataManager.MAX_CHART_TIME;
+ if (endTime > 0 && openTimeOfNotClosed > startTime) { // closed
+ DAChartSeriesItem seriesItem = new DAChartSeriesItem(startTime,
+ DAChartSeriesItem.SERIES_STATE_CONTINUE,
+ ColorResources.NETWORK_AREA_CLOSED_END,
+ ColorResources.NETWORK_AREA_CLOSED_START,
+ NetworkPageLabels.NETWORK_CHART_TOOLTIP_CLOSED);
+ statueSeries.addSeriesItem(seriesItem);
+
+ int nStatusLastIndex = statueSeries.getSeriesItemList().size() - 1;
+ DAChartSeriesItem endSeriesItem = new DAChartSeriesItem(endTime,
+ DAChartSeriesItem.SERIES_STATE_BAR, ColorResources.NETWORK_AREA_CLOSED_END,
+ ColorResources.NETWORK_AREA_CLOSED_START,
+ NetworkPageLabels.NETWORK_CHART_TOOLTIP_CLOSED);
+ seriesItem.setBarWidth(0);
+ statueSeries.addSeriesItem(seriesItem);
+ statueSeries.getSeriesItemList().get(nStatusLastIndex)
+ .setTooltipText(NetworkPageLabels.NETWORK_CHART_TOOLTIP_CLOSED);
+ statueSeries.addSeriesItem(endSeriesItem);
+ } else { // open
+ openTimeOfNotClosed = startTime;
+ DAChartSeriesItem seriesItem = new DAChartSeriesItem(startTime,
+ DAChartSeriesItem.SERIES_STATE_CONTINUE,
+ ColorResources.NETWORK_AREA_FD_USED_END,
+ ColorResources.NETWORK_AREA_FD_USED_START,
+ NetworkPageLabels.NETWORK_CHART_TOOLTIP_FD_OPEND);
+ statueSeries.addSeriesItem(seriesItem);
+ }
+ }
+
public void updateStatusSeries(List<NetworkSeriesType> statusList) {
if (isParentChartRow()) {
sortStatusSeriesByStartTime(statusList);
double startTime = -1;
double endTime = -1;
for (int i = 0; i < statusList.size(); i++) {
- if (getDestinationAddress().equals(statusList.get(i).getDestinationAddress())
- && getFdValue().equals(statusList.get(i).getFdValue())) {
- data = statusList.get(i);
-
- if (isAccessEvnet(data.getAPIType())) {
- continue;
- }
- startTime = getConvertTime(data.getStartTime());
- endTime = getConvertTime(data.getEndTime());
+ if (!getDestinationAddress().equals(statusList.get(i).getDestinationAddress())
+ || !getFdValue().equals(statusList.get(i).getFdValue())) {
+ continue;
}
+ data = statusList.get(i);
+ if (null == data) {
+ continue;
+ }
+ if (isAccessEvnet(data.getAPIType())) {
+ continue;
+ }
+ startTime = getConvertTime(data.getStartTime());
+ endTime = getConvertTime(data.getEndTime());
}
- if (null == data) {
- return;
- }
-
DAChartSeriesItem seriesItem = new DAChartSeriesItem(startTime,
- DAChartSeriesItem.SERIES_STATE_CONTINUE,
- ColorResources.NETWORK_AREA_FD_USED_END,
+ DAChartSeriesItem.SERIES_STATE_CONTINUE, ColorResources.NETWORK_AREA_FD_USED_END,
ColorResources.NETWORK_AREA_FD_USED_START,
NetworkPageLabels.NETWORK_CHART_TOOLTIP_FD_OPEND);
statueSeries.addSeriesItem(seriesItem);
+ addSeriesItemWhenCloseStatus(endTime, seriesItem);
+ chart.redraw();
+ }
- if (endTime > 0) {
- int nStatusLastIndex = statueSeries.getSeriesItemList().size() - 1;
- statueSeries.getSeriesItemList().get(nStatusLastIndex)
- .setColor(ColorResources.NETWORK_AREA_CLOSED_END);
- statueSeries
- .getSeriesItemList()
- .get(nStatusLastIndex)
- .setGradationForegroundColor(ColorResources.NETWORK_AREA_CLOSED_START);
- statueSeries.getSeriesItemList().get(nStatusLastIndex)
- .setTooltipText(NetworkPageLabels.NETWORK_CHART_TOOLTIP_CLOSED);
-
- DAChartSeriesItem endSeriesItem = new DAChartSeriesItem(endTime,
- DAChartSeriesItem.SERIES_STATE_BAR,
- ColorResources.NETWORK_AREA_CLOSED_END,
- ColorResources.NETWORK_AREA_CLOSED_START,
- NetworkPageLabels.NETWORK_CHART_TOOLTIP_CLOSED);
- seriesItem.setBarWidth(0);
- statueSeries.addSeriesItem(seriesItem);
- statueSeries.getSeriesItemList().get(nStatusLastIndex)
- .setTooltipText(NetworkPageLabels.NETWORK_CHART_TOOLTIP_CLOSED);
- statueSeries.addSeriesItem(endSeriesItem);
+ private void addSeriesItemWhenCloseStatus(double endTime, DAChartSeriesItem seriesItem) {
+ if (endTime <= 0) {
+ return;
}
-
- chart.redraw();
+ int nStatusLastIndex = statueSeries.getSeriesItemList().size() - 1;
+ statueSeries.getSeriesItemList().get(nStatusLastIndex)
+ .setColor(ColorResources.NETWORK_AREA_CLOSED_END);
+ statueSeries.getSeriesItemList().get(nStatusLastIndex)
+ .setGradationForegroundColor(ColorResources.NETWORK_AREA_CLOSED_START);
+ statueSeries.getSeriesItemList().get(nStatusLastIndex)
+ .setTooltipText(NetworkPageLabels.NETWORK_CHART_TOOLTIP_CLOSED);
+
+ DAChartSeriesItem endSeriesItem = new DAChartSeriesItem(endTime,
+ DAChartSeriesItem.SERIES_STATE_BAR, ColorResources.NETWORK_AREA_CLOSED_END,
+ ColorResources.NETWORK_AREA_CLOSED_START,
+ NetworkPageLabels.NETWORK_CHART_TOOLTIP_CLOSED);
+ seriesItem.setBarWidth(0);
+ statueSeries.addSeriesItem(seriesItem);
+ statueSeries.getSeriesItemList().get(nStatusLastIndex)
+ .setTooltipText(NetworkPageLabels.NETWORK_CHART_TOOLTIP_CLOSED);
+ statueSeries.addSeriesItem(endSeriesItem);
}
public void updateAccessSeries(List<NetworkSeriesType> accessList) {
double startTime = -1;
double endTime = -1;
for (int i = 0; i < accessList.size(); i++) {
- if (getDestinationAddress().equals(accessList.get(i).getDestinationAddress())) {
- if (!isParentChartRow()
- && !getFdValue().equals(accessList.get(i).getFdValue())) {
- continue;
- }
- data = accessList.get(i);
- if (null == data) {
- continue;
- }
-
- if (!isAccessEvnet(data.getAPIType())) {
- continue;
- }
- startTime = getConvertTime(data.getStartTime());
- endTime = getConvertTime(data.getEndTime());
- int status = data.getAPIType();
-
- Color waitiColor = null;
- if (status == NetworkSeriesType.ACCESS_TYPE_WRITE) {
- waitiColor = ColorResources.NETWORK_ACCESS_SEND;
- } else if (status == NetworkSeriesType.ACCESS_TYPE_READ) {
- waitiColor = ColorResources.NETWORK_ACCESS_RECV;
- } else {
- waitiColor = ColorResources.NETWORK_ACCESS_WAIT;
- }
-
- DAChartSeriesItem seriesItem = new DAChartSeriesItem(startTime, endTime,
- waitiColor, FunctionNameManager.getFunctionName(data.getApiID()));
- accessSeries.addSeriesItem(seriesItem);
-
- startTime = -1;
- endTime = -1;
+ if (!getDestinationAddress().equals(accessList.get(i).getDestinationAddress())) {
+ continue;
+ }
+ if (!isParentChartRow() && !getFdValue().equals(accessList.get(i).getFdValue())) {
+ continue;
+ }
+ data = accessList.get(i);
+ if (null == data) {
+ continue;
}
- }
+ if (!isAccessEvnet(data.getAPIType())) {
+ continue;
+ }
+ startTime = getConvertTime(data.getStartTime());
+ endTime = getConvertTime(data.getEndTime());
+
+ DAChartSeriesItem seriesItem = new DAChartSeriesItem(startTime, endTime,
+ getAccessSeriesColor(data.getAPIType()),
+ FunctionNameManager.getFunctionName(data.getApiID()));
+ accessSeries.addSeriesItem(seriesItem);
+
+ startTime = -1;
+ endTime = -1;
+ }
chart.redraw();
}
+ private Color getAccessSeriesColor(int status) {
+ if (status == NetworkSeriesType.ACCESS_TYPE_WRITE) {
+ return ColorResources.NETWORK_ACCESS_SEND;
+ } else if (status == NetworkSeriesType.ACCESS_TYPE_READ) {
+ return ColorResources.NETWORK_ACCESS_RECV;
+ } else {
+ return ColorResources.NETWORK_ACCESS_WAIT;
+ }
+ }
+
private double getConvertTime(double logTime) {
return logTime / TimelineConstants.MEGA_DOUBLE;
}
private boolean isAccessEvnet(int apiType) {
- {
- if (apiType == NetworkSeriesType.ACCESS_TYPE_WAIT
- || apiType == NetworkSeriesType.ACCESS_TYPE_READ
- || apiType == NetworkSeriesType.ACCESS_TYPE_WRITE) {
- return true;
- } else {
- return false;
- }
+ if (apiType == NetworkSeriesType.ACCESS_TYPE_WAIT
+ || apiType == NetworkSeriesType.ACCESS_TYPE_READ
+ || apiType == NetworkSeriesType.ACCESS_TYPE_WRITE) {
+ return true;
+ } else {
+ return false;
}
-
}
public int getParentChartIndex() {
return;
}
int selectedPid = ToolbarArea.getInstance().getSelectedPid();
- boolean isCheck = false;
-
if (preSelectionPId != -1 && preSelectionPId != selectedPid) {
- isCheck = true;
+ return;
}
- if (isCheck) {
- int parentIndex = 0;
- for (NetworkChart chart : chartItemList) {
- if (chart.isParentChartRow()) {
- if (selectedPid == 0) {
- showItem(parentIndex);
- } else if (selectedPid == chart.getpId()) {
- showItem(parentIndex);
- } else {
- hideItem(parentIndex);
- }
- parentIndex++;
- }
+ int parentIndex = 0;
+ for (NetworkChart chart : chartItemList) {
+ if (!chart.isParentChartRow()) {
+ continue;
}
+ if (selectedPid == 0) {
+ showItem(parentIndex);
+ } else if (selectedPid == chart.getpId()) {
+ showItem(parentIndex);
+ } else {
+ hideItem(parentIndex);
+ }
+ parentIndex++;
}
preSelectionPId = selectedPid;
}
public void initIntervalMarkers() {
// selection marker
- DAChartPlotIntervalMarker selectionMarker = new DAChartPlotIntervalMarker(
- -1, -1, DAChartPlotIntervalMarker.INTERVAL_MARKER_STYLE_AREA);
+ DAChartPlotIntervalMarker selectionMarker = new DAChartPlotIntervalMarker(-1, -1,
+ DAChartPlotIntervalMarker.INTERVAL_MARKER_STYLE_AREA);
selectionMarker.setBackgroundColor(ColorResources.SELECTION_RANGE);
selectionMarker.setAlpha((int) (255 * 0.25));
addIntervalMarker(selectionMarker);
// range analysis marker
- DAChartPlotIntervalMarker rangeAnalyzeMarker = new DAChartPlotIntervalMarker(
- -1, -1, DAChartPlotIntervalMarker.INTERVAL_MARKER_STYLE_AREA);
+ DAChartPlotIntervalMarker rangeAnalyzeMarker = new DAChartPlotIntervalMarker(-1, -1,
+ DAChartPlotIntervalMarker.INTERVAL_MARKER_STYLE_AREA);
rangeAnalyzeMarker.setBackgroundColor(ColorResources.YELLOW);
rangeAnalyzeMarker.setAlpha((int) (255 * 0.25));
addIntervalMarker(rangeAnalyzeMarker);
// range marker
- DAChartPlotIntervalMarker rangeMarker = new DAChartPlotIntervalMarker(
- -1, -1, DAChartPlotIntervalMarker.INTERVAL_MARKER_STYLE_LINE);
+ DAChartPlotIntervalMarker rangeMarker = new DAChartPlotIntervalMarker(-1, -1,
+ DAChartPlotIntervalMarker.INTERVAL_MARKER_STYLE_LINE);
rangeMarker.setForegroundColor(ColorResources.RED);
rangeMarker.setAlpha((int) (255 * 0.25));
addIntervalMarker(rangeMarker);
DAPopupMenu popupMenu = new DAPopupMenu(chart);
popupMenu.setFont(FontResources.CONTEXT_MENU_ITEM_FONT);
- DAPopupMenuItem startItem = new DAPopupMenuItem(popupMenu,
- DAPopupMenuItem.NONE);
+ DAPopupMenuItem startItem = new DAPopupMenuItem(popupMenu, DAPopupMenuItem.NONE);
startItem.setText(TimelineChartLabels.RANGE_CONTEXT_SET_START);
- startItem.addListener(new PopupStartMenuItemClickListener(startItem,
- this));
+ startItem.addListener(new PopupStartMenuItemClickListener(startItem, this));
- DAPopupMenuItem endItem = new DAPopupMenuItem(popupMenu,
- DAPopupMenuItem.NONE);
+ DAPopupMenuItem endItem = new DAPopupMenuItem(popupMenu, DAPopupMenuItem.NONE);
endItem.setText(TimelineChartLabels.RANGE_CONTEXT_SET_END);
endItem.addListener(new PopupEndMenuItemClickListener(endItem, this));
- DAPopupMenuItem fromSelectionItem = new DAPopupMenuItem(popupMenu,
- DAPopupMenuItem.NONE);
- fromSelectionItem
- .setText(TimelineChartLabels.RANGE_CONTEXT_SET_FROM_SELECTION);
- fromSelectionItem
- .addListener(new PopupFromSelectionMenuItemClickListener(
- fromSelectionItem, this));
+ DAPopupMenuItem fromSelectionItem = new DAPopupMenuItem(popupMenu, DAPopupMenuItem.NONE);
+ fromSelectionItem.setText(TimelineChartLabels.RANGE_CONTEXT_SET_FROM_SELECTION);
+ fromSelectionItem.addListener(new PopupFromSelectionMenuItemClickListener(
+ fromSelectionItem, this));
- DAPopupMenuItem analysisItem = new DAPopupMenuItem(popupMenu,
- DAPopupMenuItem.NONE);
+ DAPopupMenuItem analysisItem = new DAPopupMenuItem(popupMenu, DAPopupMenuItem.NONE);
analysisItem.setText(TimelineChartLabels.RANGE_CONTEXT_ANALYSIS);
analysisItem.addListener(new PopupAnalysisMenuItemClickListener());
- DAPopupMenuItem clearItem = new DAPopupMenuItem(popupMenu,
- DAPopupMenuItem.NONE);
+ DAPopupMenuItem clearItem = new DAPopupMenuItem(popupMenu, DAPopupMenuItem.NONE);
clearItem.setText(TimelineChartLabels.RANGE_CONTEXT_CLEAR);
clearItem.addListener(new PopupClearMenuItemClickListener());
popupMenu, getTimeline());
chart.addMouseListener(timelineChartMouseEventListener);
chart.addMouseMoveListener(timelineChartMouseEventListener);
- chart.addMouseTrackListener(new TimelineChartMouseTrackAdapter(
- getTimeline()));
+ chart.addMouseTrackListener(new TimelineChartMouseTrackAdapter(getTimeline()));
plot.setMarkers(getMarkers());
}
private NetworkChart getParentChartData(String address, String fd) {
for (NetworkChart chart : chartItemList) {
- if (chart.getDestinationAddress().equals(address)
- && chart.isParentChartRow()) {
+ if (chart.getDestinationAddress().equals(address) && chart.isParentChartRow()) {
return chart;
}
}
}
private void addSeries(DAChart chart) {
- DAChartSeries apiSeries = new DAChartSeries(
- NetworkPageLabels.NETWORK_CHART_API,
+ DAChartSeries apiSeries = new DAChartSeries(NetworkPageLabels.NETWORK_CHART_API,
DAChartSeries.SERIES_STYLE_EVENT, ColorResources.YELLOW);
- DAChartSeries stateSeries = new DAChartSeries(
- NetworkPageLabels.NETWORK_CHART_SERIES,
+ DAChartSeries stateSeries = new DAChartSeries(NetworkPageLabels.NETWORK_CHART_SERIES,
DAChartSeries.SERIES_STYLE_STATE, ColorResources.WHITE);
- DAChartSeries accessSeries = new DAChartSeries(
- NetworkPageLabels.NETWORK_CHART_ACCESS,
+ DAChartSeries accessSeries = new DAChartSeries(NetworkPageLabels.NETWORK_CHART_ACCESS,
DAChartSeries.SERIES_STYLE_EVENT_AREA, ColorResources.WHITE);
apiSeries.setSummarizeTooltipText(ThreadPageLabels.THREAD_TOOLTIP_APIS);
}
public boolean createChartItem() {
- if (!AnalyzerManager.isRunning() && isFirstMakeChart == true) {
- if (null != NetworkDataManager.getInstance().getSeriesList()) {
- isFirstMakeChart = false;
- for (NetworkSeriesType status : NetworkDataManager
- .getInstance().getSeriesList()) {
- NetworkDataManager
- .getInstance()
- .getCheckStatusSeries()
- .put(status.getFdValue(),
- status.getDestinationAddress());
- }
+ updateStatusSeriesWhenOpen();
+ if (statusSeriesListCount == NetworkDataManager.getInstance().getCheckStatusSeries().size()) {
+ return true;
+ }
+ for (String fd : NetworkDataManager.getInstance().getCheckStatusSeries().keySet()) {
+ String destinationAddress = NetworkDataManager.getInstance().getCheckStatusSeries()
+ .get(fd);
+ if (isExistChartRow(destinationAddress, fd)) {
+ continue;
}
+ addChartItemList(destinationAddress, fd);
+ }
+ statusSeriesListCount = NetworkDataManager.getInstance().getCheckStatusSeries().size();
+ return true;
+ }
+
+ private void updateStatusSeriesWhenOpen() {
+ if (AnalyzerManager.isRunning() || isFirstMakeChart == false
+ || null == NetworkDataManager.getInstance().getSeriesList()) {
+ return;
}
+ for (NetworkSeriesType status : NetworkDataManager.getInstance().getSeriesList()) {
+ NetworkDataManager.getInstance().getCheckStatusSeries()
+ .put(status.getFdValue(), status.getDestinationAddress());
+ }
+ isFirstMakeChart = false;
+ }
- if (statusSeriesListCount != NetworkDataManager.getInstance()
- .getCheckStatusSeries().size()) {
- for (String fd : NetworkDataManager.getInstance()
- .getCheckStatusSeries().keySet()) {
- String destinationAddress = NetworkDataManager.getInstance()
- .getCheckStatusSeries().get(fd);
-
- boolean findMatchChartRow = false;
- for (NetworkChart chart : chartItemList) {
- if (chart.getDestinationAddress()
- .equals(destinationAddress)
- && chart.getFdValue().equals(fd)) {
- findMatchChartRow = true;
- break;
- }
- }
- if (findMatchChartRow) {
- continue;
- }
-
- NetworkChart parent = getParentChartData(destinationAddress, fd);
- if (null == parent) {
- parentChartIndex++;
- lastChildChartIndexOfEachParent.put(parentChartIndex, 1);
- StringBuffer chartName = new StringBuffer(
- destinationAddress);
- if (chartName.length() > 10) {
- chartName.replace(10, chartName.length(),
- CommonConstants.EMPTY);
- chartName.insert(chartName.length(), "...");//$NON-NLS-1$
- }
- DAChartBoardItem parentItem = new DAChartBoardItem(this,
- chartName.toString());
- parentItem.setData(new NetworkSelectionType(
- destinationAddress, fd, true));
- DAChart parentDAChart = parentItem.getChart();
-
- initNetworkChart(parentDAChart, true);
- addSeries(parentDAChart);
- NetworkChart parentChartData = new NetworkChart(
- chartName.toString(), destinationAddress, fd,
- parentItem, parentDAChart, parentChartIndex, 0);
- chartItemList.add(parentChartData);
-
- String childChartName = NetworkPageLabels.NETWORK_CHILD_CHART_NAME
- + fd;
- DAChartBoardItem childItem = new DAChartBoardItem(
- parentItem, childChartName);
- childItem.setData(new NetworkSelectionType(
- destinationAddress, fd, false));
- DAChart childDAChart = childItem.getChart();
- initNetworkChart(childDAChart, false);
- addSeries(childDAChart);
- NetworkChart childChartData = new NetworkChart(
- childChartName, destinationAddress, fd, childItem,
- childDAChart, parentChartIndex, 0);
- parentChartData.pushChild(childChartData);
- chartItemList.add(childChartData);
- } else {
- int childChartIndex = lastChildChartIndexOfEachParent
- .get(parent.getParentChartIndex());
-
- String childChartName = NetworkPageLabels.NETWORK_CHILD_CHART_NAME
- + fd;
- DAChartBoardItem parentItem = parent.getItem();
-
- DAChartBoardItem childItem = new DAChartBoardItem(
- parentItem, childChartName);
- childItem.setData(new NetworkSelectionType(
- destinationAddress, fd, false));
- DAChart childDAChart = childItem.getChart();
- initNetworkChart(childDAChart, false);
- addSeries(childDAChart);
-
- NetworkChart childChartData = new NetworkChart(
- childChartName, destinationAddress, fd, childItem,
- childDAChart, parent.getParentChartIndex(),
- childChartIndex);
- parent.pushChild(childChartData);
- chartItemList.add(childChartData);
- lastChildChartIndexOfEachParent.put(
- parent.getParentChartIndex(), ++childChartIndex);
- }
+ private boolean isExistChartRow(String destinationAddress, String fd) {
+ for (NetworkChart chart : chartItemList) {
+ if (chart.getDestinationAddress().equals(destinationAddress)
+ && chart.getFdValue().equals(fd)) {
+ return true;
}
- statusSeriesListCount = NetworkDataManager.getInstance()
- .getCheckStatusSeries().size();
}
- return true;
+ return false;
+ }
+
+ private void addChartItemList(String destinationAddress, String fd) {
+ NetworkChart parent = getParentChartData(destinationAddress, fd);
+ if (null == parent) {
+ addParentChartItemList(destinationAddress, fd);
+ } else {
+ addChildChartItemList(parent, destinationAddress, fd);
+ }
+ }
+
+ private void addParentChartItemList(String destinationAddress, String fd) {
+ parentChartIndex++;
+ lastChildChartIndexOfEachParent.put(parentChartIndex, 1);
+ StringBuffer chartName = new StringBuffer(destinationAddress);
+ if (chartName.length() > 10) {
+ chartName.replace(10, chartName.length(), CommonConstants.EMPTY);
+ chartName.insert(chartName.length(), "...");//$NON-NLS-1$
+ }
+ DAChartBoardItem parentItem = new DAChartBoardItem(this, chartName.toString());
+ parentItem.setData(new NetworkSelectionType(destinationAddress, fd, true));
+ DAChart parentDAChart = parentItem.getChart();
+
+ initNetworkChart(parentDAChart, true);
+ addSeries(parentDAChart);
+ NetworkChart parentChartData = new NetworkChart(chartName.toString(), destinationAddress,
+ fd, parentItem, parentDAChart, parentChartIndex, 0);
+ chartItemList.add(parentChartData);
+
+ String childChartName = NetworkPageLabels.NETWORK_CHILD_CHART_NAME + fd;
+ DAChartBoardItem childItem = new DAChartBoardItem(parentItem, childChartName);
+ childItem.setData(new NetworkSelectionType(destinationAddress, fd, false));
+ DAChart childDAChart = childItem.getChart();
+ initNetworkChart(childDAChart, false);
+ addSeries(childDAChart);
+ NetworkChart childChartData = new NetworkChart(childChartName, destinationAddress, fd,
+ childItem, childDAChart, parentChartIndex, 0);
+ parentChartData.pushChild(childChartData);
+ chartItemList.add(childChartData);
+ }
+
+ private void addChildChartItemList(NetworkChart parent, String destinationAddress, String fd) {
+ int childChartIndex = lastChildChartIndexOfEachParent.get(parent.getParentChartIndex());
+
+ String childChartName = NetworkPageLabels.NETWORK_CHILD_CHART_NAME + fd;
+ DAChartBoardItem parentItem = parent.getItem();
+
+ DAChartBoardItem childItem = new DAChartBoardItem(parentItem, childChartName);
+ childItem.setData(new NetworkSelectionType(destinationAddress, fd, false));
+ DAChart childDAChart = childItem.getChart();
+ initNetworkChart(childDAChart, false);
+ addSeries(childDAChart);
+
+ NetworkChart childChartData = new NetworkChart(childChartName, destinationAddress, fd,
+ childItem, childDAChart, parent.getParentChartIndex(), childChartIndex);
+ parent.pushChild(childChartData);
+ chartItemList.add(childChartData);
+ lastChildChartIndexOfEachParent.put(parent.getParentChartIndex(), ++childChartIndex);
}
public void clearSeries() {
}
public void updateApiSeries() {
- List<NetworkAPIType> apiList = NetworkDataManager.getInstance()
- .getAPIDBManger()
+ List<NetworkAPIType> apiList = NetworkDataManager.getInstance().getAPIDBManger()
.selectAPISeries(getVisibleStartTime(), getVisibleEndTime());
if (null == apiList) {
return;
return;
}
+ updateStatusSeries(seriesList);
+ updateAccessSeries(seriesList);
+ }
+
+ private void updateStatusSeries(List<NetworkSeriesType> seriesList) {
for (NetworkChart chart : chartItemList) {
chart.updateStatusSeries(seriesList);
- for (int i = 0; i < seriesList.size(); i++) {
- if (chart.getDestinationAddress().equals(
- seriesList.get(i).getDestinationAddress())
- && chart.getFdValue().equals(
- seriesList.get(i).getFdValue())) {
- chart.setpId(seriesList.get(i).getpId());
- }
- }
+ setPIDOfChart(chart, seriesList);
}
+ }
+
+ private void updateAccessSeries(List<NetworkSeriesType> seriesList) {
for (NetworkChart chart : chartItemList) {
chart.updateAccessSeries(seriesList);
}
}
+ private void setPIDOfChart(NetworkChart chart, List<NetworkSeriesType> seriesList) {
+ for (int i = 0; i < seriesList.size(); i++) {
+ if (!chart.getDestinationAddress().equals(seriesList.get(i).getDestinationAddress())
+ || !chart.getFdValue().equals(seriesList.get(i).getFdValue())) {
+ continue;
+ }
+ chart.setpId(seriesList.get(i).getpId());
+ }
+ }
+
private List<NetworkSeriesType> filetirngSeriresList() {
List<NetworkSeriesType> filterTimeList = new ArrayList<NetworkSeriesType>();
if (null == NetworkDataManager.getInstance().getSeriesList()) {
return null;
}
- for (int i = 0; i < NetworkDataManager.getInstance().getSeriesList()
- .size(); i++) {
- double startTime = NetworkDataManager.getInstance().getSeriesList()
- .get(i).getStartTime()
- / TimelineConstants.MEGA_DOUBLE;
- double endTime = NetworkDataManager.getInstance().getSeriesList()
- .get(i).getEndTime()
- / TimelineConstants.MEGA_DOUBLE;
-
- if (getVisibleStartTime() <= startTime
- && startTime <= getVisibleEndTime()) {
- filterTimeList.add(NetworkDataManager.getInstance()
- .getSeriesList().get(i));
- } else if (getVisibleStartTime() <= endTime
- && endTime <= getVisibleEndTime()) {
- filterTimeList.add(NetworkDataManager.getInstance()
- .getSeriesList().get(i));
- } else if (endTime < 0) {
- filterTimeList.add(NetworkDataManager.getInstance()
- .getSeriesList().get(i));
- }
+ for (int i = 0; i < NetworkDataManager.getInstance().getSeriesList().size(); i++) {
+ addFilterTimeList(filterTimeList, i);
}
return filterTimeList;
}
+ private void addFilterTimeList(List<NetworkSeriesType> filterTimeList, int index) {
+ double startTime = NetworkDataManager.getInstance().getSeriesList().get(index)
+ .getStartTime()
+ / TimelineConstants.MEGA_DOUBLE;
+ double endTime = NetworkDataManager.getInstance().getSeriesList().get(index).getEndTime()
+ / TimelineConstants.MEGA_DOUBLE;
+
+ if (getVisibleStartTime() <= startTime && startTime <= getVisibleEndTime()) {
+ filterTimeList.add(NetworkDataManager.getInstance().getSeriesList().get(index));
+ } else if (getVisibleStartTime() <= endTime && endTime <= getVisibleEndTime()) {
+ filterTimeList.add(NetworkDataManager.getInstance().getSeriesList().get(index));
+ } else if (endTime < 0) {
+ filterTimeList.add(NetworkDataManager.getInstance().getSeriesList().get(index));
+ }
+ }
+
}
private final StackLayout stackLayout;
private DAChartBoardItem lastSelectedItemForSummary = null;
- private final RangeDataManager rangeDataManager = RangeDataManager
- .getInstance();
+ private final RangeDataManager rangeDataManager = RangeDataManager.getInstance();
public NetworkChartView(Composite parent, int style) {
super(parent, style, false);
contents.setBackground(ColorResources.WINDOW_BG_COLOR);
stackLayout = new StackLayout();
contents.setLayout(stackLayout);
- networkChartBoard = new NetworkChartBoard(contents,
- NetworkPageLabels.NETWORK_CHART);
+ networkChartBoard = new NetworkChartBoard(contents, NetworkPageLabels.NETWORK_CHART);
networkChartBoard.setNameFont(FontResources.CHART_NAME_FONT);
- networkChartBoard
- .addSelectionListener(new DAChartBoardSelectionListener() {
-
- @Override
- public void handleSelectionEvent(DAChartBoardItem item) {
- lastSelectedItemForSummary = item;
- DAChartPlotIntervalMarker intervalMarker = (DAChartPlotIntervalMarker) networkChartBoard
- .getMarkers()
- .get(UICommonConstants.SELECTION_MARKER_INDEX);
- long selectiedStartTime = (long) (intervalMarker
- .getStartVal() * TimelineConstants.MEGA_DOUBLE);
- long selectiedEndTime = (long) (intervalMarker
- .getEndVal() * TimelineConstants.MEGA_DOUBLE);
- AnalyzerManager.getCurrentPage().updateView(
- new DASelectionData(NetworkPage.chartViewID,
- selectiedStartTime, selectiedEndTime,
- item.getData(), null));
- }
- });
+ networkChartBoard.addSelectionListener(new DAChartBoardSelectionListener() {
+
+ @Override
+ public void handleSelectionEvent(DAChartBoardItem item) {
+ lastSelectedItemForSummary = item;
+ DAChartPlotIntervalMarker intervalMarker = (DAChartPlotIntervalMarker) networkChartBoard
+ .getMarkers().get(UICommonConstants.SELECTION_MARKER_INDEX);
+ long selectiedStartTime = (long) (intervalMarker.getStartVal() * TimelineConstants.MEGA_DOUBLE);
+ long selectiedEndTime = (long) (intervalMarker.getEndVal() * TimelineConstants.MEGA_DOUBLE);
+ AnalyzerManager.getCurrentPage().updateView(
+ new DASelectionData(NetworkPage.chartViewID, selectiedStartTime,
+ selectiedEndTime, item.getData(), null));
+ }
+ });
stackLayout.topControl = networkChartBoard;
-
+
// Making title composition using resource of timeline pages.
networkChartBoard.makeDefaultTitleComposite(NetworkPageLabels.NETWORK_CHART,
- FontResources.ADDITEM_BUTTON_FONT,
- ColorResources.ADD_CHART_FONT_COLOR,
- ColorResources.ADD_CHART_NORMAL_START,
- ColorResources.ADD_CHART_NORMAL_END,
+ FontResources.ADDITEM_BUTTON_FONT, ColorResources.ADD_CHART_FONT_COLOR,
+ ColorResources.ADD_CHART_NORMAL_START, ColorResources.ADD_CHART_NORMAL_END,
ColorResources.ADD_CHART_NORMAL_STROKE);
-
+
DATimeline timeline = networkChartBoard.getTimeline();
timeline.setTimeTickFont(FontResources.TIMELINE_TICK_FONT);
timeline.setTimeBalloonFont(FontResources.TIMELINE_BALLOON_FONT);
- LifecycleLogParser.getInstance().registerLifecycleBar(
- networkChartBoard.getLifecycleBar());
+ LifecycleLogParser.getInstance().registerLifecycleBar(networkChartBoard.getLifecycleBar());
LifecycleLogParser.getInstance().registerTimeline(timeline);
- timeline.addMouseMoveListener(new SetRangeMarkerMouseMoveListener(
- rangeDataManager, networkChartBoard, timeline));
+ timeline.addMouseMoveListener(new SetRangeMarkerMouseMoveListener(rangeDataManager,
+ networkChartBoard, timeline));
}
@Override
networkChartBoard.setTotalEndTime(ToolbarArea.getInstance().getTime());
- networkChartBoard.setTimelineMarkerStartTime(rangeDataManager
- .getMarkerStartTime() / TimelineConstants.MEGA_DOUBLE);
- networkChartBoard.setTimelineMarkerEndTime(rangeDataManager
- .getMarkerEndTime() / TimelineConstants.MEGA_DOUBLE);
+ networkChartBoard.setTimelineMarkerStartTime(rangeDataManager.getMarkerStartTime()
+ / TimelineConstants.MEGA_DOUBLE);
+ networkChartBoard.setTimelineMarkerEndTime(rangeDataManager.getMarkerEndTime()
+ / TimelineConstants.MEGA_DOUBLE);
if (RangeDataManager.getInstance().isBeingAnalyzed()) {
((DAChartPlotIntervalMarker) networkChartBoard.getMarkers().get(
- UICommonConstants.RANGE_ANALYSIS_MARKER_INDEX))
- .setInterval(rangeDataManager.getAnalysisStartTime()
- / TimelineConstants.MEGA_DOUBLE,
- rangeDataManager.getAnalysisEndTime()
- / TimelineConstants.MEGA_DOUBLE);
+ UICommonConstants.RANGE_ANALYSIS_MARKER_INDEX)).setInterval(
+ rangeDataManager.getAnalysisStartTime() / TimelineConstants.MEGA_DOUBLE,
+ rangeDataManager.getAnalysisEndTime() / TimelineConstants.MEGA_DOUBLE);
} else {
((DAChartPlotIntervalMarker) networkChartBoard.getMarkers().get(
- UICommonConstants.RANGE_ANALYSIS_MARKER_INDEX))
- .setInterval(-1, -1);
+ UICommonConstants.RANGE_ANALYSIS_MARKER_INDEX)).setInterval(-1, -1);
}
((DAChartPlotIntervalMarker) networkChartBoard.getMarkers().get(
UICommonConstants.RANGE_MARKER_INDEX)).setInterval(
- rangeDataManager.getMarkerStartTime()
- / TimelineConstants.MEGA_DOUBLE,
- rangeDataManager.getMarkerEndTime()
- / TimelineConstants.MEGA_DOUBLE);
+ rangeDataManager.getMarkerStartTime() / TimelineConstants.MEGA_DOUBLE,
+ rangeDataManager.getMarkerEndTime() / TimelineConstants.MEGA_DOUBLE);
}
@Override
public void updateView(DAViewData data) {
networkChartBoard.updateChart();
- if (data instanceof DASelectionData) {
- DASelectionData selData = (DASelectionData) data;
-
- String id = data.getViewID();
- long dataTime = -1;
- if (id.equals(NetworkPage.listViewID)) {
- dataTime = selData.getStartTime();
- moveChartPosition(dataTime, -1);
- } else if (id.equals(NetworkPage.chartViewID)
- || id.equals(NetworkPage.detailViewID)) {
- return;
- } else {
- Object obData = selData.getData();
- if (null != obData && (obData instanceof LogData)) { // summary
- LogData ldata = (LogData) obData;
- dataTime = ldata.getTime();
- if (null != lastSelectedItemForSummary) {
- AnalyzerManager.getCurrentPage().updateView(
- new DASelectionData(NetworkPage.chartViewID,
- dataTime, dataTime,
- lastSelectedItemForSummary.getData(),
- null));
- }
- moveChartPosition(dataTime, ldata.getSeq());
- }
- }
+ if (data instanceof DASelectionData == false) {
+ return;
+ }
+ DASelectionData selData = (DASelectionData) data;
+ String id = data.getViewID();
+ if (id.equals(NetworkPage.chartViewID) || id.equals(NetworkPage.detailViewID)) {
+ return;
+ }
+ if (id.equals(NetworkPage.listViewID)) {
+ moveChartPosition(selData.getStartTime(), -1);
+ } else {
+ updateFromOtherView(selData.getData());
+ }
+ }
+
+ private void updateFromOtherView(Object obData) {
+ if (null == obData || (obData instanceof LogData == false)) { // summary
+ return;
+ }
+ LogData ldata = (LogData) obData;
+ long dataTime = ldata.getTime();
+ if (null != lastSelectedItemForSummary) {
+ AnalyzerManager.getCurrentPage().updateView(
+ new DASelectionData(NetworkPage.chartViewID, dataTime, dataTime,
+ lastSelectedItemForSummary.getData(), null));
}
+ moveChartPosition(dataTime, ldata.getSeq());
}
private void moveChartPosition(long dataTime, int seq) {
.getMarkers().get(UICommonConstants.SELECTION_MARKER_INDEX);
intervalMarker.setInterval(selectionTime, selectionTime);
if (seq > 0) {
- int parentChartIndex = NetworkDataManager.getInstance()
- .getParentIndexOfSeq(seq);
- int childChartIndex = NetworkDataManager.getInstance()
- .getChildIndexOfSeq(seq);
+ int parentChartIndex = NetworkDataManager.getInstance().getParentIndexOfSeq(seq);
+ int childChartIndex = NetworkDataManager.getInstance().getChildIndexOfSeq(seq);
networkChartBoard.selectItem(parentChartIndex, childChartIndex);
}
-
}
@Override
networkChartBoard.setTimelineMarkerEndTime(endtime);
((DAChartPlotIntervalMarker) networkChartBoard.getMarkers().get(
- UICommonConstants.RANGE_MARKER_INDEX)).setInterval(starttime,
- endtime);
+ UICommonConstants.RANGE_MARKER_INDEX)).setInterval(starttime, endtime);
}
}
import org.tizen.dynamicanalyzer.common.DASelectionData;
import org.tizen.dynamicanalyzer.constant.CommonConstants;
import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
-import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
import org.tizen.dynamicanalyzer.nl.NetworkPageLabels;
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.resources.FontResources;
private Text detailText = null;
private Label labelMessage = null;
- private final static String leftFormAttachment = CommonConstants.SPACE
- + CommonConstants.SPACE;
+ private final static String leftFormAttachment = CommonConstants.SPACE + CommonConstants.SPACE;
private final static String heightFormAttachment = CommonConstants.NEW_LINE
+ CommonConstants.NEW_LINE;
contents.setBackground(ColorResources.VIEW_BG_COLOR);
contents.setLayout(new FormLayout());
- detailText = new Text(contents, SWT.BORDER | SWT.V_SCROLL
- | SWT.H_SCROLL);
+ detailText = new Text(contents, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
detailText.setBackground(ColorResources.VIEW_BG_COLOR);
detailText.setForeground(ColorResources.TABLE_CONTENTS_FONT_COLOR);
detailText.setFont(FontResources.DETAIL_INFO_FONT);
detailText.getVerticalBar().setVisible(false);
detailText.getHorizontalBar().setVisible(false);
- StringBuffer strDetailView = new StringBuffer();
- strDetailView.append(CommonConstants.NEW_LINE);
- strDetailView.append(leftFormAttachment
- + NetworkPageLabels.NETWORK_DETAILS_ADDRESS
- + heightFormAttachment);
- strDetailView.append(leftFormAttachment
- + NetworkPageLabels.NETWORK_DETAILS_RECV_SIZE
- + heightFormAttachment);
- strDetailView.append(leftFormAttachment
- + NetworkPageLabels.NETWORK_DETAILS_SEND_SIZE
- + heightFormAttachment);
- strDetailView.append(leftFormAttachment
- + NetworkPageLabels.NETWORK_DETAILS_TOTAL_USE_TIME
- + heightFormAttachment);
- strDetailView.append(leftFormAttachment
- + NetworkPageLabels.NETWORK_DETAILS_API_COUNT
- + heightFormAttachment);
- strDetailView.append(leftFormAttachment
- + NetworkPageLabels.NETWORK_DETAILS_FAILED_API_COUNT
- + heightFormAttachment);
- strDetailView.append(leftFormAttachment
- + NetworkPageLabels.NETWORK_DETAILS_PAYLOAD_ASCII
- + heightFormAttachment);
-
- strDetailView.append(leftFormAttachment
- + NetworkPageLabels.NETWORK_DETAILS_SEND_ACK_TIME
- + heightFormAttachment);
- strDetailView.append(CommonConstants.EMPTY);
+ StringBuffer strDetailView = new StringBuffer(CommonConstants.NEW_LINE);
+ addDetailInfo(strDetailView, NetworkPageLabels.NETWORK_DETAILS_ADDRESS);
+ addDetailInfo(strDetailView, NetworkPageLabels.NETWORK_DETAILS_RECV_SIZE);
+ addDetailInfo(strDetailView, NetworkPageLabels.NETWORK_DETAILS_SEND_SIZE);
+ addDetailInfo(strDetailView, NetworkPageLabels.NETWORK_DETAILS_TOTAL_USE_TIME);
+ addDetailInfo(strDetailView, NetworkPageLabels.NETWORK_DETAILS_API_COUNT);
+ addDetailInfo(strDetailView, NetworkPageLabels.NETWORK_DETAILS_FAILED_API_COUNT);
+ addDetailInfo(strDetailView, NetworkPageLabels.NETWORK_DETAILS_PAYLOAD_ASCII);
+ addDetailInfo(strDetailView, NetworkPageLabels.NETWORK_DETAILS_SEND_ACK_TIME);
detailText.setText(strDetailView.toString());
}
@Override
public void updateView(DAViewData data) {
- if (data instanceof DASelectionData) {
- DASelectionData seldata = (DASelectionData) data;
- int seq = 0;
- if (seldata.getData() instanceof GridItem[]) {
- GridItem[] tableData = (GridItem[]) data.getData();
- DATableDataFormat tableFormat = (DATableDataFormat) tableData[0]
- .getData();
- NetworkAPIType apiType = (NetworkAPIType) tableFormat
- .getLogData();
- seq = apiType.getSeq();
- }
- updateData(seq);
+ if (data instanceof DASelectionData == false) {
+ return;
+ }
+ DASelectionData seldata = (DASelectionData) data;
+ if (seldata.getData() instanceof GridItem[] == false) {
+ return;
}
+ GridItem[] tableData = (GridItem[]) data.getData();
+ DATableDataFormat tableFormat = (DATableDataFormat) tableData[0].getData();
+ NetworkAPIType apiType = (NetworkAPIType) tableFormat.getLogData();
+ updateData(apiType.getSeq());
}
@Override
int recvSize = 0;
int apiCount = 0;
int failedAPICount = 0;
- long usedTime = contentList.get(contentList.size() - 1).getTime()
- - contentList.get(0).getTime();
- String payload = CommonConstants.EMPTY;
-
- // ackSendTime
- String sendAckTime = CommonConstants.EMPTY;
long recvTime = 0;
long sendTime = 0;
boolean isSendAPICall = false;
+ String payload = CommonConstants.EMPTY;
for (int i = 0; i < contentList.size(); i++) {
NetworkAPIType apiType = contentList.get(i);
-
- if (apiType.getFdApiType() == LogCenterConstants.SOCKET_API_SEND_END
- || apiType.getFdApiType() == LogCenterConstants.HTTP_API_REQUEST) {
+ if (isSendEndAPI(apiType)) {
sendSize += apiType.getPacketMessageSize();
- if (seq == apiType.getSeq()) {
+ if (isSelectedTableIndex(seq, apiType)) {
payload = apiType.getPacketMessage();
sendTime = apiType.getTime();
isSendAPICall = true;
}
-
- } else if (apiType.getFdApiType() == LogCenterConstants.SOCKET_API_RECV_END
- || apiType.getFdApiType() == LogCenterConstants.HTTP_API_RESPONSE) {
+ } else if (isRecvEndAPI(apiType)) {
recvSize += apiType.getPacketMessageSize();
- if (seq == apiType.getSeq()) {
+ if (isSelectedTableIndex(seq, apiType)) {
payload = apiType.getPacketMessage();
}
-
if (isSendAPICall) {
isSendAPICall = false;
recvTime = apiType.getTime();
}
-
}
-
if (apiType.getErrno() > 0) {
failedAPICount++;
}
-
- if (apiType.getFdApiType() == LogCenterConstants.SOCKET_API_RECV_END
- || apiType.getFdApiType() == LogCenterConstants.SOCKET_API_SEND_END
- || apiType.getFdApiType() == LogCenterConstants.SOCKET_API_ACCEPT_END
- || apiType.getFdApiType() == LogCenterConstants.SOCKET_API_EVENT_END) {
- continue;
- } else {
+ if (!isEndAPI(apiType)) {
apiCount++;
}
}
- if (sendTime > 0 && recvTime > 0) {
- long ackTime = recvTime - sendTime;
- String timeFormat = Formatter.toTimeFormat(ackTime);
- sendAckTime = timeFormat.replace("00:", CommonConstants.EMPTY);//$NON-NLS-1$
- }
- String detailAddress = contentList.get(0).getDestinationAddress();
- detailAddress = detailAddress.replace(CommonConstants.NEW_LINE,
- CommonConstants.COLON);
-
- StringBuffer strDetailView = new StringBuffer();
- strDetailView.append(heightFormAttachment);
- strDetailView.append(leftFormAttachment
- + NetworkPageLabels.NETWORK_DETAILS_ADDRESS + detailAddress
- + heightFormAttachment);
-
- strDetailView.append(leftFormAttachment
- + NetworkPageLabels.NETWORK_DETAILS_RECV_SIZE + recvSize
- + heightFormAttachment);
-
- strDetailView.append(leftFormAttachment
- + NetworkPageLabels.NETWORK_DETAILS_SEND_SIZE + sendSize
- + heightFormAttachment);
-
- strDetailView.append(leftFormAttachment
- + NetworkPageLabels.NETWORK_DETAILS_TOTAL_USE_TIME
- + Formatter.toTimeFormat(usedTime) + heightFormAttachment);
-
- strDetailView.append(leftFormAttachment
- + NetworkPageLabels.NETWORK_DETAILS_API_COUNT + apiCount
- + heightFormAttachment);
-
- strDetailView.append(leftFormAttachment
- + NetworkPageLabels.NETWORK_DETAILS_FAILED_API_COUNT
- + failedAPICount + heightFormAttachment);
-
- if (!sendAckTime.equals(CommonConstants.EMPTY)) {
- strDetailView.append(leftFormAttachment
- + NetworkPageLabels.NETWORK_DETAILS_SEND_ACK_TIME
- + sendAckTime + AnalyzerLabels.TIME_MS
- + heightFormAttachment);
+ StringBuffer strDetailView = new StringBuffer(heightFormAttachment);
+ addDetailInfo(strDetailView, getAddress(contentList));
+ addDetailInfo(strDetailView, NetworkPageLabels.NETWORK_DETAILS_RECV_SIZE,
+ Integer.toString(recvSize));
+ addDetailInfo(strDetailView, NetworkPageLabels.NETWORK_DETAILS_SEND_SIZE,
+ Integer.toString(sendSize));
+ addDetailInfo(strDetailView, NetworkPageLabels.NETWORK_DETAILS_TOTAL_USE_TIME,
+ getUsedTime(contentList));
+ addDetailInfo(strDetailView, NetworkPageLabels.NETWORK_DETAILS_API_COUNT,
+ Integer.toString(apiCount));
+ addDetailInfo(strDetailView, NetworkPageLabels.NETWORK_DETAILS_FAILED_API_COUNT,
+ Integer.toString(failedAPICount));
+ addDetailInfo(strDetailView, getSendAckTime(sendTime, recvTime));
+ if (!payload.equals(CommonConstants.EMPTY)) {
+ strDetailView.append(getPacketMessage(DownloadContentfileManager
+ .getFileContents(payload)));
}
+ setControlBar(payload);
+ detailText.setText(strDetailView.toString());
+ }
+
+ private void setControlBar(String payload) {
if (!payload.equals(CommonConstants.EMPTY)) {
detailText.getVerticalBar().setVisible(true);
detailText.getHorizontalBar().setVisible(true);
- strDetailView.append(getPacketMessage(DownloadContentfileManager
- .getFileContents(payload)));
} else {
detailText.getVerticalBar().setVisible(true);
detailText.getHorizontalBar().setVisible(true);
}
+ }
- detailText.setText(strDetailView.toString());
-
+ private String getUsedTime(List<NetworkAPIType> contentList) {
+ long usedTime = contentList.get(contentList.size() - 1).getTime()
+ - contentList.get(0).getTime();
+ return Formatter.toTimeFormat(usedTime);
}
- public String getPacketMessage(String packetMessage) {
- StringBuffer out = new StringBuffer();
- StringBuffer strHex = new StringBuffer();
- StringBuffer strAscii = new StringBuffer();
- int index = 0;
- long hexAddress = 0;
- for (int nIndex = 0; nIndex < packetMessage.length(); nIndex++) {
+ private String getSendAckTime(long recvTime, long sendTime) {
+ String sendAckTime = CommonConstants.EMPTY;
+ if (sendTime <= 0 || recvTime <= 0) {
+ return sendAckTime;
+ }
+ long ackTime = recvTime - sendTime;
+ String timeFormat = Formatter.toTimeFormat(ackTime);
+ sendAckTime = timeFormat.replace("00:", CommonConstants.EMPTY);//$NON-NLS-1$
+ return NetworkPageLabels.NETWORK_DETAILS_SEND_ACK_TIME + sendAckTime;
+ }
- strAscii.append(packetMessage.charAt(nIndex));
+ private boolean isSendEndAPI(NetworkAPIType apiType) {
+ if (apiType.getFdApiType() == LogCenterConstants.SOCKET_API_SEND_END
+ || apiType.getFdApiType() == LogCenterConstants.HTTP_API_REQUEST) {
+ return true;
+ } else {
+ return false;
+ }
+ }
- if (index % 8 == 0) {
- hexAddress++;
- String strHexCode = Long.toHexString((Long) hexAddress)
- .toUpperCase();
- String strhexCodeFormat = CommonConstants.EMPTY;
- if (strHexCode.length() == 1) {
- strhexCodeFormat += CommonConstants.ZERO
- + CommonConstants.ZERO + strHexCode
- + CommonConstants.ZERO;
- } else if (strHexCode.length() == 2) {
- strhexCodeFormat += CommonConstants.ZERO + strHexCode
- + CommonConstants.ZERO;
- } else if (strHexCode.length() == 3) {
- strhexCodeFormat += strHexCode + CommonConstants.ZERO;
- }
- strHex.append(CommonConstants.NEW_LINE)
- .append(strhexCodeFormat).append(CommonConstants.TAB);
+ private boolean isRecvEndAPI(NetworkAPIType apiType) {
+ if (apiType.getFdApiType() == LogCenterConstants.SOCKET_API_RECV_END
+ || apiType.getFdApiType() == LogCenterConstants.HTTP_API_RESPONSE) {
+ return true;
+ } else {
+ return false;
+ }
+ }
- }
- strHex.append(String.format("%02X ",//$NON-NLS-1$
- (int) packetMessage.charAt(nIndex)));
+ private boolean isEndAPI(NetworkAPIType apiType) {
+ if (apiType.getFdApiType() == LogCenterConstants.SOCKET_API_RECV_END
+ || apiType.getFdApiType() == LogCenterConstants.SOCKET_API_SEND_END
+ || apiType.getFdApiType() == LogCenterConstants.SOCKET_API_ACCEPT_END
+ || apiType.getFdApiType() == LogCenterConstants.SOCKET_API_EVENT_END) {
+ return true;
+ } else {
+ return false;
+ }
+ }
- index++;
+ private boolean isSelectedTableIndex(int selectedSeq, NetworkAPIType apiType) {
+ if (selectedSeq == apiType.getSeq()) {
+ return true;
+ } else {
+ return false;
}
+ }
- out.append(CommonConstants.SPACE).append(CommonConstants.SPACE);
- out.append(NetworkPageLabels.NETWORK_DETAILS_PAYLOAD_ASCII)
- .append(CommonConstants.NEW_LINE)
- .append(CommonConstants.NEW_LINE);
- out.append(strAscii.toString());
+ private String getAddress(List<NetworkAPIType> contentList) {
+ String detailAddress = contentList.get(0).getDestinationAddress();
+ detailAddress = detailAddress.replace(CommonConstants.NEW_LINE, CommonConstants.COLON);
+ return NetworkPageLabels.NETWORK_DETAILS_ADDRESS + detailAddress;
+ }
+
+ private void addDetailInfo(StringBuffer strDetailView, String title, String detailInfo) {
+ strDetailView.append(leftFormAttachment + title + detailInfo + heightFormAttachment);
+ }
+ private void addDetailInfo(StringBuffer strDetailView, String info) {
+ strDetailView.append(leftFormAttachment + info + heightFormAttachment);
+ }
+
+ public String getPacketMessage(String packetMessage) {
+ StringBuffer out = new StringBuffer(CommonConstants.SPACE).append(CommonConstants.SPACE);
+ out.append(NetworkPageLabels.NETWORK_DETAILS_PAYLOAD_ASCII)
+ .append(CommonConstants.NEW_LINE).append(CommonConstants.NEW_LINE);
+ out.append(getAsciiPayload(packetMessage));
out.append(CommonConstants.NEW_LINE).append(CommonConstants.NEW_LINE);
out.append(CommonConstants.SPACE).append(CommonConstants.SPACE);
-
out.append(NetworkPageLabels.NETWORK_DETAILS_PAYLOAD_HEXCODE).append(
CommonConstants.NEW_LINE);
- out.append(strHex.toString());
+ out.append(getHexPayload(packetMessage));
return out.toString();
}
+ private String getAsciiPayload(String packetMessage) {
+ StringBuffer strAscii = new StringBuffer();
+ for (int nIndex = 0; nIndex < packetMessage.length(); nIndex++) {
+ strAscii.append(packetMessage.charAt(nIndex));
+ }
+ return strAscii.toString();
+ }
+
+ private String getHexPayload(String packetMessage) {
+ StringBuffer strHex = new StringBuffer();
+ long hexAddress = 0;
+ for (int i = 0; i < packetMessage.length(); i++) {
+ if (isHexNewLine(i)) {
+ hexAddress++;
+ strHex.append(CommonConstants.NEW_LINE).append(getHexAddress(hexAddress))
+ .append(CommonConstants.TAB);
+ }
+ strHex.append(String.format("%02X ",//$NON-NLS-1$
+ (int) packetMessage.charAt(i)));
+ }
+ return strHex.toString();
+ }
+
+ private boolean isHexNewLine(int charIndex) {
+ if (charIndex % 8 == 0) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ private String getHexAddress(long hexAddress) {
+ String strHexCode = Long.toHexString((Long) hexAddress).toUpperCase();
+ String strhexAddress = CommonConstants.EMPTY;
+ if (strHexCode.length() == 1) {
+ strhexAddress += CommonConstants.ZERO + CommonConstants.ZERO + strHexCode
+ + CommonConstants.ZERO;
+ } else if (strHexCode.length() == 2) {
+ strhexAddress += CommonConstants.ZERO + strHexCode + CommonConstants.ZERO;
+ } else if (strHexCode.length() == 3) {
+ strhexAddress += strHexCode + CommonConstants.ZERO;
+ }
+ return strhexAddress;
+ }
+
@Override
public Control getControl() {
return contents;
package org.tizen.dynamicanalyzer.ui.network;
import java.util.ArrayList;
-import java.util.HashMap;
+import java.util.LinkedHashMap;
import java.util.List;
+import java.util.Map;
import org.eclipse.nebula.widgets.grid.GridItem;
import org.eclipse.swt.events.SelectionEvent;
import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
import org.tizen.dynamicanalyzer.model.TableInput;
import org.tizen.dynamicanalyzer.project.FunctionNameManager;
-import org.tizen.dynamicanalyzer.swap.model.data.NetworkData;
import org.tizen.dynamicanalyzer.ui.network.data.NetworkDataManager;
import org.tizen.dynamicanalyzer.ui.network.data.type.NetworkAPIType;
-import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
import org.tizen.dynamicanalyzer.ui.widgets.table.DAApiListTableComposite;
import org.tizen.dynamicanalyzer.ui.widgets.table.DATableDataFormat;
+import org.tizen.dynamicanalyzer.util.Logger;
import org.tizen.dynamicanalyzer.utils.Formatter;
public class NetworkTable extends DAApiListTableComposite {
endTime = itemTime;
}
}
- DASelectionData selData = new DASelectionData(NetworkTableView.ID,
- startTime, endTime, items, table);
+ DASelectionData selData = new DASelectionData(NetworkTableView.ID, startTime,
+ endTime, items, table);
AnalyzerManager.getCurrentPage().updateView(selData);
}
@Override
protected List<TableInput> makeTableInput() {
- NetworkTableView view = (NetworkTableView) AnalyzerManager
- .getCurrentPage().getView(NetworkTableView.ID);
+ NetworkTableView view = (NetworkTableView) AnalyzerManager.getCurrentPage().getView(
+ NetworkTableView.ID);
if (null == view) {
return null;
}
-
- long rangeStartTime = view.getRangeStartTime();
- long rangeEndTime = view.getRangeEndTime();
List<TableInput> input = new ArrayList<TableInput>();
List<NetworkAPIType> contentList = NetworkDataManager.getInstance()
if (null == contentList) {
return null;
}
- HashMap<String, Integer> findStartAPITableIndexHashMap = new HashMap<String, Integer>();
- List<Integer> removeTableIndex = new ArrayList<Integer>();
+ LinkedHashMap<String, Integer> findStartAPITableIndexHashMap = new LinkedHashMap<String, Integer>();
for (int i = 0; i < contentList.size(); i++) {
+
NetworkAPIType contentTemp = contentList.get(i);
int selectedPid = ToolbarArea.getInstance().getSelectedPid();
- if (selectedPid != 0) {
- if (selectedPid != contentTemp.getPid()) {
- continue;
- }
+ if (selectedPid != 0 && selectedPid != contentTemp.getPid()) {
+ continue;
}
+ setRemoveAPIIndex(contentTemp, i, findStartAPITableIndexHashMap);
List<String> contentText = new ArrayList<String>();
- List<String> contentData = new ArrayList<String>();
-
- Integer startLogIndex = 0;
- String fdApiType = Integer.toString(contentTemp.getFdApiType());
-
- String seq = Integer.toString(contentTemp.getSeq());
- contentText.add(0, seq);
- contentData.add(seq);
-
- if (fdApiType.equals(Integer
- .toString(LogCenterConstants.SOCKET_API_RECV_START))
- || fdApiType.equals(Integer
- .toString(LogCenterConstants.SOCKET_API_SEND_START))
- || fdApiType.equals(Integer
- .toString(LogCenterConstants.SOCKET_API_ACCEPT_START))
- || fdApiType.equals(Integer
- .toString(LogCenterConstants.SOCKET_API_EVENT_START))) {
-
- String keyString = FunctionNameManager.getFunctionName(
- contentTemp.getApiNameID())
- + contentTemp.getPid() + contentTemp.getTid();
- findStartAPITableIndexHashMap.put(keyString, i);
-
- contentText.add(Formatter.toTimeFormat(contentTemp.getTime())); // start//
- contentData.add(Formatter.toTimeFormat(contentTemp.getTime()));
- contentText.add("00.000");//$NON-NLS-1$
- contentData.add("0");//$NON-NLS-1$
-
- } else if (fdApiType.equals(Integer
- .toString(LogCenterConstants.SOCKET_API_RECV_END))
- || fdApiType.equals(Integer
- .toString(LogCenterConstants.SOCKET_API_SEND_END))
- || fdApiType.equals(Integer
- .toString(LogCenterConstants.SOCKET_API_ACCEPT_END))
- || fdApiType.equals(Integer
- .toString(LogCenterConstants.SOCKET_API_EVENT_END))) {
- String keyString = FunctionNameManager.getFunctionName(
- contentTemp.getApiNameID())
- + contentTemp.getPid() + contentTemp.getTid();
- startLogIndex = findStartAPITableIndexHashMap.get(keyString);
- if (null != startLogIndex) {
- contentText.add(input.get(startLogIndex.intValue()).getText().get(1)); // start
- // time
- contentData.add(input.get(startLogIndex.intValue()).getText().get(1));
-
- long startTime = contentList.get(startLogIndex.intValue()).getTime();
- String timeFormat = Formatter.toTimeFormat(contentTemp.getTime()
- - startTime);
- String removeTimeFormat = timeFormat.replace(
- "00:", CommonConstants.EMPTY);//$NON-NLS-1$
-
- contentText.add(removeTimeFormat); // elapsed time
- contentData.add(Long.toString(contentTemp.getTime()
- - startTime));
- removeTableIndex.add(startLogIndex);
- } else {
- contentText.add(Formatter.toTimeFormat(contentTemp.getTime())); // start//
- contentData.add(Long.toString(contentTemp.getTime()));
- contentText.add("00.000");//$NON-NLS-1$
- contentData.add("0");//$NON-NLS-1$
- }
- } else {
- contentText.add(Formatter.toTimeFormat(contentTemp.getTime())); // start//
- // time
- contentData.add(Long.toString(contentTemp.getTime()));
- contentText.add("00.000");//$NON-NLS-1$ //elapsed time
- contentData.add("0");//$NON-NLS-1$
- }
-
+ contentText.add(Integer.toString(contentTemp.getSeq()));
+ contentText.add(getStartTime(contentTemp, findStartAPITableIndexHashMap, input));
+ contentText
+ .add(getElaspsedTime(contentTemp, findStartAPITableIndexHashMap, contentList));
contentText.add(Integer.toString(contentTemp.getPid()));
- contentData.add(Integer.toString(contentTemp.getPid()));
-
contentText.add(Integer.toString(contentTemp.getTid()));
- contentData.add(Integer.toString(contentTemp.getTid()));
-
contentText.add(contentTemp.getApiName());
- contentData.add(contentTemp.getApiName());
-
contentText.add(contentTemp.getArgs());
- contentData.add(contentTemp.getArgs());
-
contentText.add(contentTemp.getReturn());
- contentData.add(contentTemp.getReturn());
-
- int apiType = contentTemp.getFdApiType();
- if (apiType == LogCenterConstants.SOCKET_API_SEND_END
- || apiType == LogCenterConstants.SOCKET_API_RECV_END
- || apiType == LogCenterConstants.HTTP_API_REQUEST
- || apiType == LogCenterConstants.HTTP_API_RESPONSE) {
- contentText.add(Integer.toString(contentTemp.getPacketMessageSize()));
- contentData.add(Integer.toString(contentTemp.getPacketMessageSize()));
- } else {
- contentText.add(CommonConstants.EMPTY);
- contentData.add(CommonConstants.EMPTY);
- }
-
- StringBuffer payloadInfo = new StringBuffer(contentTemp.getPacketMessage());
- if (payloadInfo.length() > 20) {
- payloadInfo.replace(10, payloadInfo.length(), CommonConstants.EMPTY);
- payloadInfo.insert(payloadInfo.length(), "...");//$NON-NLS-1$
- }
- contentText.add(payloadInfo.toString());
- contentData.add(payloadInfo.toString());
-
- String errMsg = ErrorCodeManager.getInatance().getErrorCode(
- Long.toString(contentTemp.getErrno()));
- if (null == errMsg) {
- errMsg = "undefined error code"; //$NON-NLS-1$
- }
- contentText.add(errMsg);
- contentData.add(errMsg);
+ contentText.add(getMessage(contentTemp));
+ contentText.add(getPayload(contentTemp));
+ contentText.add(getErrno(contentTemp));
contentText.add(contentTemp.getReturn());
- contentData.add(contentTemp.getReturn());
DATableDataFormat tableData = new DATableDataFormat(contentTemp.getSeq());
tableData.setLogData(contentTemp);
- tableData.getData().addAll(contentData);
+ tableData.getData().addAll(getCompareData(contentText, contentTemp));
TableInput tableInput = new TableInput();
tableInput.setText(contentText);
tableInput.setData(tableData);
- if (!errMsg.contains("SUCCESS")) {//$NON-NLS-1$
- tableInput.setFailed(true);
- }
+ tableInput.setFailed(setFailed(contentTemp));
input.add(tableInput);
+ tableInput.setInRange(setRange(contentTemp, view));
+ }
+ removeEndAPI(input, findStartAPITableIndexHashMap);
+ return input;
+ }
- long time = contentTemp.getTime();
- if (time >= rangeStartTime && time <= rangeEndTime) {
- tableInput.setInRange(true);
- }
+ private void setRemoveAPIIndex(NetworkAPIType contentTemp, int tableIndex,
+ LinkedHashMap<String, Integer> findStartAPITableIndexHashMap) {
+ String fdApiType = Integer.toString(contentTemp.getFdApiType());
+ if (isStartAPI(fdApiType)) {
+ findStartAPITableIndexHashMap.put(apiEqualsKey(contentTemp), tableIndex);
}
+ }
- int removeCount = 0;
- for (int index : removeTableIndex) {
- int removeIndex = index - removeCount;
- if (removeIndex > 0) {
- input.remove(removeIndex);
- removeCount++;
+ private boolean isStartAPI(String fdApiType) {
+ if (fdApiType.equals(Integer.toString(LogCenterConstants.SOCKET_API_RECV_START))
+ || fdApiType.equals(Integer.toString(LogCenterConstants.SOCKET_API_SEND_START))
+ || fdApiType.equals(Integer.toString(LogCenterConstants.SOCKET_API_ACCEPT_START))
+ || fdApiType.equals(Integer.toString(LogCenterConstants.SOCKET_API_EVENT_START))) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ private boolean isEndAPI(String fdApiType) {
+ if (fdApiType.equals(Integer.toString(LogCenterConstants.SOCKET_API_RECV_END))
+ || fdApiType.equals(Integer.toString(LogCenterConstants.SOCKET_API_SEND_END))
+ || fdApiType.equals(Integer.toString(LogCenterConstants.SOCKET_API_ACCEPT_END))
+ || fdApiType.equals(Integer.toString(LogCenterConstants.SOCKET_API_EVENT_END))) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ private List<String> getCompareData(List<String> contentText, NetworkAPIType contentTemp) {
+ List<String> contentData = new ArrayList<String>();
+ for (int j = 0; j < contentText.size(); j++) {
+ if (j == NetworkTableView.COLUMN.START_TIME.ordinal()) {
+ contentData.add(Long.toString(contentTemp.getTime()));
+ } else if (j == NetworkTableView.COLUMN.ELASPSED_TIME.ordinal()) {
+ contentData.add(CommonConstants.ZERO);
+ } else {
+ contentData.add(contentText.get(j));
}
}
+ return contentData;
+ }
- return input;
+ private String getStartTime(NetworkAPIType contentTemp,
+ LinkedHashMap<String, Integer> findStartAPITableIndexHashMap, List<TableInput> input) {
+ String fdApiType = Integer.toString(contentTemp.getFdApiType());
+ if (isEndAPI(fdApiType)) {
+ return input.get(getStartAPIIndex(contentTemp, findStartAPITableIndexHashMap))
+ .getText().get(NetworkTableView.COLUMN.START_TIME.ordinal());
+ } else {
+ return Formatter.toTimeFormat(contentTemp.getTime());
+ }
}
- protected void actionSetStartEnd(int type) {
+ private String getElaspsedTime(NetworkAPIType contentTemp,
+ LinkedHashMap<String, Integer> findStartAPITableIndexHashMap,
+ List<NetworkAPIType> contentList) {
+ String fdApiType = Integer.toString(contentTemp.getFdApiType());
+
+ if (isEndAPI(fdApiType)) {
+ NetworkAPIType startAPIContentTemp = contentList.get(getStartAPIIndex(contentTemp,
+ findStartAPITableIndexHashMap));
+ long startTime = startAPIContentTemp.getTime();
+ String timeFormat = Formatter.toTimeFormat(contentTemp.getTime() - startTime);
+ String removeTimeFormat = timeFormat.replace("00:", CommonConstants.EMPTY);//$NON-NLS-1$
+ return removeTimeFormat;
+ } else {
+ return "00.000";//$NON-NLS-1$
+ }
+ }
- GridItem item = table.getItem(mousePoint);
- if (null != item) {
- NetworkData data = (NetworkData) ((DATableDataFormat) item.getData())
- .getLogData();
- long time = data.getTime();
- double startTime = -1;
- double endTime = -1;
+ private int getStartAPIIndex(NetworkAPIType contentTemp,
+ LinkedHashMap<String, Integer> findStartAPITableIndexHashMap) {
+ Integer startLogIndex = findStartAPITableIndexHashMap.get(apiEqualsKey(contentTemp));
+ if (null == startLogIndex) {
+ Logger.error("not exist network start api index");
+ return 0;
+ } else {
+ return startLogIndex;
+ }
+ }
- if (type == START_TIME) {
- rangeDataManager.setMarkerStartTime(time);
- startTime = time / TimelineConstants.MEGA_DOUBLE;
- endTime = rangeDataManager.getMarkerEndTime()
- / TimelineConstants.MEGA_DOUBLE;
+ private String apiEqualsKey(NetworkAPIType contentTemp) {
+ return FunctionNameManager.getFunctionName(contentTemp.getApiNameID())
+ + contentTemp.getPid() + contentTemp.getTid();
+ }
- } else if (type == END_TIME) {
- rangeDataManager.setMarkerEndTime(time);
- endTime = time / TimelineConstants.MEGA_DOUBLE;
- startTime = rangeDataManager.getMarkerStartTime()
- / TimelineConstants.MEGA_DOUBLE;
- }
+ private String getMessage(NetworkAPIType contentTemp) {
+ int apiType = contentTemp.getFdApiType();
+ if (apiType == LogCenterConstants.SOCKET_API_SEND_END
+ || apiType == LogCenterConstants.SOCKET_API_RECV_END
+ || apiType == LogCenterConstants.HTTP_API_REQUEST
+ || apiType == LogCenterConstants.HTTP_API_RESPONSE) {
+ return Integer.toString(contentTemp.getPacketMessageSize());
+ } else {
+ return CommonConstants.EMPTY;
+ }
+ }
+
+ private String getPayload(NetworkAPIType contentTemp) {
+ StringBuffer payloadInfo = new StringBuffer(contentTemp.getPacketMessage());
+ if (payloadInfo.length() > 20) {
+ payloadInfo.replace(10, payloadInfo.length(), CommonConstants.EMPTY);
+ payloadInfo.insert(payloadInfo.length(), "...");//$NON-NLS-1$
+ }
+ return payloadInfo.toString();
+ }
- NetworkChartView chartview = (NetworkChartView) (AnalyzerManager
- .getCurrentPage().getView(NetworkPage.chartViewID));
- if (null == chartview) {
+ private String getErrno(NetworkAPIType contentTemp) {
+ String errMsg = ErrorCodeManager.getInatance().getErrorCode(
+ Long.toString(contentTemp.getErrno()));
+ if (null == errMsg) {
+ errMsg = "undefined error code"; //$NON-NLS-1$
+ }
+ return errMsg;
+ }
+
+ private boolean setFailed(NetworkAPIType contentTemp) {
+ if (!getErrno(contentTemp).contains("SUCCESS")) {//$NON-NLS-1$
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ private boolean setRange(NetworkAPIType contentTemp, NetworkTableView view) {
+ long rangeStartTime = view.getRangeStartTime();
+ long rangeEndTime = view.getRangeEndTime();
+ long time = contentTemp.getTime();
+ if (time >= rangeStartTime && time <= rangeEndTime) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ private void removeEndAPI(List<TableInput> input,
+ LinkedHashMap<String, Integer> findStartAPITableIndexHashMap) {
+ int removeCount = 0;
+ for (Map.Entry<String, Integer> entry : findStartAPITableIndexHashMap.entrySet()) {
+ int removeIndex = entry.getValue() - removeCount;
+ if (input.size() <= removeIndex) {
+ Logger.error("not exist network remove start api index");
return;
}
- chartview.setRangeMarker(startTime, endTime);
+ input.remove(removeIndex);
+ removeCount++;
}
}
}
import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
import org.tizen.dynamicanalyzer.ui.widgets.table.TableColumnSizePackListener;
+import org.tizen.dynamicanalyzer.util.Logger;
import org.tizen.dynamicanalyzer.widgets.da.view.DAViewComposite;
import org.tizen.dynamicanalyzer.widgets.da.view.DAViewData;
private boolean isChangedSelected = true;
private int preSelectionPId = 1;
- private String[] columnNames = {
- NetworkPageLabels.NETWORK_API_LIST_VIEW_INDEX,
+ public enum COLUMN {
+ INDEX(0, NetworkPageLabels.NETWORK_API_LIST_VIEW_INDEX), START_TIME(1,
+ NetworkPageLabels.NETWORK_API_LIST_VIEW_START_TIME), ELASPSED_TIME(2,
+ NetworkPageLabels.NETWORK_API_LIST_VIEW_ELAPSED_TIME), PID(3,
+ NetworkPageLabels.NETWORK_API_LIST_VIEW_PID), TID(4,
+ NetworkPageLabels.NETWORK_API_LIST_VIEW_THREAD_ID), API(5,
+ NetworkPageLabels.NETWORK_API_LIST_VIEW_API), PARAMETER(6,
+ NetworkPageLabels.NETWORK_API_LIST_VIEW_PARAMETER), RETURN(7,
+ NetworkPageLabels.NETWORK_API_LIST_VIEW_RETURN), BYTE_SIZE(8,
+ NetworkPageLabels.NETWORK_API_LIST_VIEW_BYTE_SIZE), MESSAGE(9,
+ NetworkPageLabels.NETWORK_API_LIST_VIEW_MESSAGE), ERRNO(10,
+ NetworkPageLabels.NETWORK_API_LIST_VIEW_ERRNO);
+ public final int index;
+ public final String name;
+
+ COLUMN(int index, String name) {
+ this.index = index;
+ this.name = name;
+ }
+ }
+
+ private String[] columnNames = { NetworkPageLabels.NETWORK_API_LIST_VIEW_INDEX,
NetworkPageLabels.NETWORK_API_LIST_VIEW_START_TIME,
NetworkPageLabels.NETWORK_API_LIST_VIEW_ELAPSED_TIME,
NetworkPageLabels.NETWORK_API_LIST_VIEW_PID,
NetworkPageLabels.NETWORK_API_LIST_VIEW_MESSAGE,
NetworkPageLabels.NETWORK_API_LIST_VIEW_ERRNO };
- private int[] columnSizes = { 40, 70, 100, 40, 40, 200, 100, 70, 100, 100,
- 100 };
- private int[] columnAlignment = { SWT.RIGHT, SWT.RIGHT, SWT.RIGHT,
- SWT.RIGHT, SWT.RIGHT, SWT.LEFT, SWT.LEFT, SWT.LEFT, SWT.RIGHT,
- SWT.RIGHT, SWT.LEFT };
+ private int[] columnSizes = { 40, 70, 100, 40, 40, 200, 100, 70, 100, 100, 100 };
+ private int[] columnAlignment = { SWT.RIGHT, SWT.RIGHT, SWT.RIGHT, SWT.RIGHT, SWT.RIGHT,
+ SWT.LEFT, SWT.LEFT, SWT.LEFT, SWT.RIGHT, SWT.RIGHT, SWT.LEFT };
- int[] sortTypes = { AnalyzerConstants.SORT_TYPE_NUM,
- AnalyzerConstants.SORT_TYPE_STRING,
+ int[] sortTypes = { AnalyzerConstants.SORT_TYPE_NUM, AnalyzerConstants.SORT_TYPE_STRING,
AnalyzerConstants.SORT_TYPE_NUM, AnalyzerConstants.SORT_TYPE_NUM,
- AnalyzerConstants.SORT_TYPE_NUM,
- AnalyzerConstants.SORT_TYPE_STRING,
- AnalyzerConstants.SORT_TYPE_STRING,
- AnalyzerConstants.SORT_TYPE_STRING,
- AnalyzerConstants.SORT_TYPE_STRING,
- AnalyzerConstants.SORT_TYPE_STRING,
+ AnalyzerConstants.SORT_TYPE_NUM, AnalyzerConstants.SORT_TYPE_STRING,
+ AnalyzerConstants.SORT_TYPE_STRING, AnalyzerConstants.SORT_TYPE_STRING,
+ AnalyzerConstants.SORT_TYPE_STRING, AnalyzerConstants.SORT_TYPE_STRING,
AnalyzerConstants.SORT_TYPE_STRING };
NetworkTable tableComp = null;
tableComp.setColumns(columnNames);
tableComp.setColumnSize(columnSizes);
tableComp.setTableName(NetworkPageLabels.NETWORK_API_LIST_VIEW_TITLE);
- contents.addControlListener(new TableColumnSizePackListener(tableComp,
- columnSizes));
+ contents.addControlListener(new TableColumnSizePackListener(tableComp, columnSizes));
}
@Override
public void updateView() {
- if (null == tableComp) {
- return;
- }
+ try {
+ if (null == tableComp) {
+ return;
+ }
- if (isUpdateTable()) {
- tableComp.updateTable();
+ if (isUpdateTable()) {
+ tableComp.updateTable();
+ }
+ } catch (Exception e) {
+ Logger.error("exception network updateView");
}
}
long newAnalysisStartTime = 0;
long newAnalysisEndTime = 0;
if (RangeDataManager.getInstance().isBeingAnalyzed()) {
- newAnalysisStartTime = RangeDataManager.getInstance()
- .getAnalysisStartTime();
- newAnalysisEndTime = RangeDataManager.getInstance()
- .getAnalysisEndTime();
+ newAnalysisStartTime = RangeDataManager.getInstance().getAnalysisStartTime();
+ newAnalysisEndTime = RangeDataManager.getInstance().getAnalysisEndTime();
} else {
newAnalysisStartTime = 0;
newAnalysisEndTime = 0;
@Override
public void updateView(DAViewData data) {
- if (data instanceof DASelectionData) {
- DASelectionData selData = (DASelectionData) data;
- long selectionStartTime = selData.getStartTime();
- long selectionEndTime = selData.getEndTime();
- if (selData.getData() instanceof NetworkSelectionType) {
- NetworkSelectionType netSelection = (NetworkSelectionType) selData
- .getData();
+ try {
+ if (data instanceof DASelectionData) {
+ DASelectionData selData = (DASelectionData) data;
+ long selectionStartTime = selData.getStartTime();
+ long selectionEndTime = selData.getEndTime();
+ if ((selData.getData() instanceof NetworkSelectionType) == false) {
+ return;
+ }
+
+ NetworkSelectionType netSelection = (NetworkSelectionType) selData.getData();
if (null == netSelection) {
return;
}
NetworkDataManager
.getInstance()
.getAPIDBManger()
- .selectAPITable(netSelection.getAddress(),
- netSelection.getFd(),
+ .selectAPITable(netSelection.getAddress(), netSelection.getFd(),
netSelection.isParentChart()));
tableComp.updateTable();
- tableComp.setSelectionByTime(selectionStartTime,
- selectionEndTime);
+ tableComp.setSelectionByTime(selectionStartTime, selectionEndTime);
isChangedSelected = true;
}
+ } catch (Exception e) {
+ Logger.error("exception network updateView(DAViewData data)");
}
}
addFailedAPIData(input);
}
- if (destinationApiSeriesList.size() > 0) {
- List<List<Object>> insetApiSeriesData = new ArrayList<List<Object>>();
- List<NetworkAPIType> removeEventQueue = new ArrayList<NetworkAPIType>();
- for (NetworkAPIType data : destinationApiSeriesList) {
- insetApiSeriesData.add(data.getDBInsertData());
- removeEventQueue.add(data);
- }
- NetworkDataManager.getInstance().getAPIDBManger()
- .insert(insetApiSeriesData);
- destinationApiSeriesList.removeAll(removeEventQueue);
+ if (destinationApiSeriesList.size() <= 0) {
+ return;
+ }
+ List<List<Object>> insetApiSeriesData = new ArrayList<List<Object>>();
+ List<NetworkAPIType> removeEventQueue = new ArrayList<NetworkAPIType>();
+ for (NetworkAPIType data : destinationApiSeriesList) {
+ insetApiSeriesData.add(data.getDBInsertData());
+ removeEventQueue.add(data);
}
+ NetworkDataManager.getInstance().getAPIDBManger().insert(insetApiSeriesData);
+ destinationApiSeriesList.removeAll(removeEventQueue);
}
private void addFailedAPIData(NetworkData logs) {
if (logs.getErrno() != 0) {
- SummaryDataManager.getInstance().getFailedApiDataMaker()
- .makeData(logs);
+ SummaryDataManager.getInstance().getFailedApiDataMaker().makeData(logs);
}
}
String[] strInput = parameter.split(CommonConstants.COMMA);
if (strInput.length <= 0) {
Logger.error("argument length is wrong : " + input.getApiName());
- return;
+ break;
}
apiAddress = strInput[1].trim();
addressByFdHashMap.put(apiFD, apiAddress);
break;
}
case LogCenterConstants.SOCKET_API_ACCEPT_START:
- setStartSeries(apiAddress, apiFD, time, -1,
- NetworkSeriesType.ACCESS_TYPE_WAIT, apiId, pId);
+ setStartSeries(apiAddress, apiFD, time, -1, NetworkSeriesType.ACCESS_TYPE_WAIT, apiId,
+ pId);
break;
case LogCenterConstants.SOCKET_API_ACCEPT_END: {
String clientFD = returnValue;
addressByFdHashMap.put(clientFD, parentAddress);
- setEndSeries(apiAddress, apiFD, time,
- NetworkSeriesType.ACCESS_TYPE_WAIT);
+ setEndSeries(apiAddress, apiFD, time, NetworkSeriesType.ACCESS_TYPE_WAIT);
break;
}
case LogCenterConstants.SOCKET_API_FD_CLOSE: {
if (errno == 0) {
addressByFdHashMap.remove(apiFD);
- setEndSeries(apiAddress, apiFD, time,
- NetworkSeriesType.STATUS_TYPE_OPEN);
+ setEndSeries(apiAddress, apiFD, time, NetworkSeriesType.STATUS_TYPE_OPEN);
}
break;
}
case LogCenterConstants.SOCKET_API_RECV_START:
- setStartSeries(apiAddress, apiFD, time, -1,
- NetworkSeriesType.ACCESS_TYPE_READ, apiId, pId);
+ setStartSeries(apiAddress, apiFD, time, -1, NetworkSeriesType.ACCESS_TYPE_READ, apiId,
+ pId);
break;
case LogCenterConstants.SOCKET_API_RECV_END:
- setEndSeries(apiAddress, apiFD, time,
- NetworkSeriesType.ACCESS_TYPE_READ);
- payloadInfo = DownloadContentfileManager
- .getDowonloadFilePath(payloadInfo);
+ setEndSeries(apiAddress, apiFD, time, NetworkSeriesType.ACCESS_TYPE_READ);
+ payloadInfo = DownloadContentfileManager.getDowonloadFilePath(payloadInfo);
break;
case LogCenterConstants.SOCKET_API_SEND_START:
- setStartSeries(apiAddress, apiFD, time, -1,
- NetworkSeriesType.ACCESS_TYPE_WRITE, apiId, pId);
+ setStartSeries(apiAddress, apiFD, time, -1, NetworkSeriesType.ACCESS_TYPE_WRITE, apiId,
+ pId);
break;
case LogCenterConstants.SOCKET_API_SEND_END:
- setEndSeries(apiAddress, apiFD, time,
- NetworkSeriesType.ACCESS_TYPE_WRITE);
- payloadInfo = DownloadContentfileManager
- .getDowonloadFilePath(payloadInfo);
+ setEndSeries(apiAddress, apiFD, time, NetworkSeriesType.ACCESS_TYPE_WRITE);
+ payloadInfo = DownloadContentfileManager.getDowonloadFilePath(payloadInfo);
break;
case LogCenterConstants.SOCKET_API_EVENT_START:
- setStartSeries(apiAddress, apiFD, time, -1,
- NetworkSeriesType.ACCESS_TYPE_WAIT, apiId, pId);
+ setStartSeries(apiAddress, apiFD, time, -1, NetworkSeriesType.ACCESS_TYPE_WAIT, apiId,
+ pId);
break;
case LogCenterConstants.SOCKET_API_EVENT_END:
- setEndSeries(apiAddress, apiFD, time,
- NetworkSeriesType.ACCESS_TYPE_WAIT);
+ setEndSeries(apiAddress, apiFD, time, NetworkSeriesType.ACCESS_TYPE_WAIT);
break;
case LogCenterConstants.SOCKET_API_BIND: {
String[] strInput = parameter.split(CommonConstants.COMMA);
if (strInput.length <= 0) {
Logger.error("argument length is wrong : " + input.getApiName());
- return;
+ break;
}
apiAddress = strInput[1].trim();
addressByFdHashMap.put(apiFD, apiAddress);
case LogCenterConstants.SOCKET_API_LISTEN:
break;
case LogCenterConstants.SOCKET_API_OTHER: {
- if (apiName.contains("epoll_ctl")) { //$NON-NLS-1$
- String[] strInput = parameter.split(CommonConstants.COMMA);
- if (strInput.length <= 0) {
- Logger.error("argument length is wrong : " + input.getApiName());
- return;
- }
- String clientFD = strInput[0].trim();
- addressByFdHashMap.put(clientFD, parentAddress);
- apiFD = clientFD;
- addressByFdHashMap.put(apiFD, apiAddress);
+ if (!apiName.contains("epoll_ctl")) { //$NON-NLS-1$
+ break;
+ }
+ String[] strInput = parameter.split(CommonConstants.COMMA);
+ if (strInput.length <= 0) {
+ Logger.error("argument length is wrong : " + input.getApiName());
+ break;
}
+ String clientFD = strInput[0].trim();
+ addressByFdHashMap.put(clientFD, parentAddress);
+ apiFD = clientFD;
+ addressByFdHashMap.put(apiFD, apiAddress);
break;
}
// HTTP
return;
}
- NetworkAPIType seriesType = new NetworkAPIType(seq, apiAddress, apiFD,
- time, apiId, errno, pId, tId, parameter, returnValue, byteSize,
- payloadInfo, apiType, input.getCallerPcAddr(),
- input.getLibName());
+ NetworkAPIType seriesType = new NetworkAPIType(seq, apiAddress, apiFD, time, apiId, errno,
+ pId, tId, parameter, returnValue, byteSize, payloadInfo, apiType,
+ input.getCallerPcAddr(), input.getLibName());
if (apiAddress.equals(CommonConstants.EMPTY)) {
noDestinationApiSeriesList.add(seriesType);
} else {
updateUnDestinationApiSeriesList(seriesType);
destinationApiSeriesList.add(seriesType);
- if (null == NetworkDataManager.getInstance().getCheckStatusSeries()
- .get(apiFD)) {
+ if (null == NetworkDataManager.getInstance().getCheckStatusSeries().get(apiFD)) {
NetworkDataManager.getInstance().getCheckStatusSeries()
.put(apiFD.trim(), apiAddress.trim());
- setStartSeries(apiAddress, apiFD, time, -1,
- NetworkSeriesType.STATUS_TYPE_OPEN, apiId, pId);
+ setStartSeries(apiAddress, apiFD, time, -1, NetworkSeriesType.STATUS_TYPE_OPEN,
+ apiId, pId);
}
}
}
- private void setStartSeries(String apiAddress, String apiFD, long time,
- int eventType, int apiType, int apiId, int pId) {
+ private void setStartSeries(String apiAddress, String apiFD, long time, int eventType,
+ int apiType, int apiId, int pId) {
- NetworkSeriesType statusType = new NetworkSeriesType(apiAddress, apiFD,
- time, -1, apiType, apiId, pId);
+ NetworkSeriesType statusType = new NetworkSeriesType(apiAddress, apiFD, time, -1, apiType,
+ apiId, pId);
NetworkDataManager.getInstance().setStartSeriesData(statusType);
}
- private void setEndSeries(String apiAddress, String apiFD, long time,
- int apiType) {
- NetworkDataManager.getInstance().setEndSeriesData(apiAddress, apiFD,
- time, apiType);
+ private void setEndSeries(String apiAddress, String apiFD, long time, int apiType) {
+ NetworkDataManager.getInstance().setEndSeriesData(apiAddress, apiFD, time, apiType);
}
private void updateUnDestinationApiSeriesList(NetworkAPIType seriesType) {
import org.tizen.dynamicanalyzer.ui.network.data.type.NetworkAPIType;
import org.tizen.dynamicanalyzer.ui.network.data.type.NetworkSeriesType;
import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
+import org.tizen.dynamicanalyzer.util.Logger;
import org.tizen.dynamicanalyzer.util.WorkbenchUtil;
import org.tizen.dynamicanalyzer.widgets.da.base.DADialog;
seriesList.add(seriesType);
}
- public void setEndSeriesData(String address, String fd, long endTime,
- int apiType) {
+ public void setEndSeriesData(String address, String fd, long endTime, int apiType) {
for (int i = 0; i < seriesList.size(); i++) {
NetworkSeriesType seriesType = seriesList.get(i);
if (seriesType.getDestinationAddress().equals(address)
- && seriesType.getFdValue().equals(fd)
- && seriesType.getAPIType() == apiType
+ && seriesType.getFdValue().equals(fd) && seriesType.getAPIType() == apiType
&& seriesType.getEndTime() < 0) {
seriesList.get(i).setEndTime(endTime);
seriesDBManager.insert(seriesType);
}
public void saveData(Map<String, String> dataMap) {
- stopProcess();
}
public void openData(Map<String, String> dataMap) {
}
}
}
-
+
@Override
protected void onThreadStop() {
stopProcess();
return selectedTableAPIList;
}
- public void setSelectedTableAPIList(
- List<NetworkAPIType> selectedTableAPIList) {
+ public void setSelectedTableAPIList(List<NetworkAPIType> selectedTableAPIList) {
this.selectedTableAPIList = selectedTableAPIList;
}
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
- final Shell shell = WorkbenchUtil.getWorkbenchWindow()
- .getShell();
+ final Shell shell = WorkbenchUtil.getWorkbenchWindow().getShell();
DADialog dialog = new DADialog(shell, SWT.NONE, 550, 153);
dialog.setIcon(ImageResources.DIALOG_WARNING_ICON);
dialog.setMessage(AnalyzerLabels.HEAP_MEMORY_WARNING_PRE
- + PathManager.DA_INSTALL_PATH
- + AnalyzerLabels.HEAP_MEMORY_WARNING_POST);
+ + PathManager.DA_INSTALL_PATH + AnalyzerLabels.HEAP_MEMORY_WARNING_POST);
dialog.open();
}
});
/*** make network data thread ***/
@Override
protected void makeData(LogPackage pack) {
- Logs logs = pack.getLogs(DataChannelConstants.MSG_PROBE_NETWORK);
- if (null != logs && logs.getRawLogs().size() != 0) {
- List<LogData> inputs = logs.getLogs();
+ try {
+ Logs logs = pack.getLogs(DataChannelConstants.MSG_PROBE_NETWORK);
+ if (null != logs && logs.getRawLogs().size() != 0) {
+ List<LogData> inputs = logs.getLogs();
- networkDataMaker.makeData(inputs);
+ networkDataMaker.makeData(inputs);
+ }
+ } catch (Exception e) {
+ Logger.error("exception network updateView");
}
}
}