* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact:
- * Hyunjong Park <phjwithyou.park@samsung.com>
- * yeongtaik byeon <yeongtaik.byeon@samsung.com>
+ * Hyeran kim <hyearn74.kim@samsung.com>
* Juyoung Kim <j0.kim@samsung.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
import org.tizen.dynamicanalyzer.ui.widgets.table.DAApiListTableComposite;
import org.tizen.dynamicanalyzer.ui.widgets.table.DATableDataFormat;
import org.tizen.dynamicanalyzer.utils.Formatter;
+import org.tizen.dynamicanalyzer.ui.file.FilePage;
+import org.tizen.dynamicanalyzer.ui.file.manager.FileChartManager;
+import org.tizen.dynamicanalyzer.ui.file.model.FileEvent;
+
+// TODO: contains a lot legacy code, need to refatoring this class
public class FileApiListTable extends DAApiListTableComposite {
public FileApiListTable(Composite parent, int compStyle, int tableStyle) {
super(parent, compStyle, tableStyle);
endTime = itemTime;
}
}
-
DASelectionData selData = new DASelectionData(
FilePage.apilistViewID, startTime, endTime, items,
table);
FileApiListView view = (FileApiListView) AnalyzerManager
.getCurrentPage().getView(FilePage.apilistViewID);
- FileChartData data = view.getPageData();
- if (null == data) {
- return null;
- }
-
long rangeStartTime = view.getRangeStartTime();
long rangeEndTime = view.getRangeEndTime();
-
- List<TableInput> input = new ArrayList<TableInput>();
- List<FileChartDataEvent> contents = data.getContents();
+
HashMap<String, Integer> findStartAPITableIndexHashMap = new HashMap<String, Integer>();
List<Integer> removeTableIndex = new ArrayList<Integer>();
- FileChartDataEvent content;
+ List<TableInput> input = new ArrayList<TableInput>();
+
+ List<FileEvent> contents = FileChartManager.getInstance().getSelectedTableAPIList();
+ if(contents == null) {
+ return null;
+ }
for (int i = 0; i < contents.size(); i++) {
- content = contents.get(i);
- FileData contentTemp = content.getContents();
+ FileEvent contentTemp = contents.get(i);
int selectedPid = ToolbarArea.getInstance().getSelectedPid();
if (selectedPid != 0) {
if (selectedPid != contentTemp.getPid()) {
List<String> contentData = new ArrayList<String>();
Integer startLogIndex = 0;
- int fdApiType = contentTemp.getFdApiType();
+ int fdApiType = contentTemp.getApiType();
- int seq = contentTemp.getSeq();
+ int seq = contentTemp.getSeqNo();
contentText.add(0, Integer.toString(seq));
contentData.add(Integer.toString(seq));
- long time = contentTemp.getTime();
+ long time = contentTemp.getEventTime();
boolean isExistStartTimeLog = false;
if (fdApiType == LogCenterConstants.FD_API_TYPE_READ_START
contentData.add(input.get(startLogIndex.intValue())
.getText().get(1));
- long startTime = contents.get(startLogIndex.intValue())
- .getContents().getTime();
+ long startTime = contents.get(startLogIndex.intValue()).getEventTime();
String timeFormat = Formatter
.toTimeFormat(time - startTime);
String removeTimeFormat = timeFormat.replace(
removeTableIndex.add(startLogIndex.intValue());
} else {
contentText.add(Formatter.toTimeFormat(contentTemp
- .getTime())); // start//
- contentData.add(Long.toString(contentTemp.getTime()));
+ .getEventTime())); // start//
+ contentData.add(Long.toString(contentTemp.getEventTime()));
contentText.add("00.000");//$NON-NLS-1$
contentData.add("00.000");//$NON-NLS-1$
}
contentText.add(contentTemp.getArgs());
contentData.add(contentTemp.getArgs());
- contentText.add(contentTemp.getReturn());
- contentData.add(contentTemp.getReturn());
+ contentText.add(contentTemp.getReturnVal());
+ contentData.add(contentTemp.getReturnVal());
String errMsg = ErrorCodeManager.getInatance()
- .getErrorCode(contentTemp.getErrno()).name();
+ .getErrorCode(contentTemp.getErrNo()).name();
if (null == errMsg) {
errMsg = "undefined error code"; //$NON-NLS-1$
}
contentData.add(Long.toString(contentTemp.getFileSize()));
DATableDataFormat tableData = new DATableDataFormat(
- contentTemp.getSeq());
+ contentTemp.getSeqNo());
tableData.setLogData(contentTemp);
tableData.getData().addAll(contentData);
TableInput tableInput = new TableInput();
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact:
- * Hyunjong Park <phjwithyou.park@samsung.com>
- * yeongtaik byeon <yeongtaik.byeon@samsung.com>
+ * Hyeran kim <hyearn74.kim@samsung.com>
* Juyoung Kim <j0.kim@samsung.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
package org.tizen.dynamicanalyzer.ui.file;
-import org.eclipse.nebula.widgets.grid.Grid;
+import java.util.List;
+
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
-import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.common.DASelectionData;
import org.tizen.dynamicanalyzer.nl.FilePageLabels;
import org.tizen.dynamicanalyzer.resources.ColorResources;
-import org.tizen.dynamicanalyzer.swap.model.data.LogData;
+import org.tizen.dynamicanalyzer.ui.file.model.FileEvent;
+import org.tizen.dynamicanalyzer.ui.file.model.FileSelectedData;
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.widgets.da.view.DAViewComposite;
import org.tizen.dynamicanalyzer.widgets.da.view.DAViewData;
+import org.tizen.dynamicanalyzer.ui.file.manager.FileChartManager;
+import org.tizen.dynamicanalyzer.util.DALogger;
+//TODO: contains a lot legacy code, need to refatoring this class
public class FileApiListView extends DAViewComposite {
- private FileChartData data;
+ private static final DALogger DA_LOG = DALogger.getInstance();
+
+ // TODO: comment below variables
+ // TODO: remove unused variables
private long analysisStartTime = 0;
private long analysisEndTime = 0;
- private long selectionStartTime = 0;
- private long selectionEndTime = 0;
private int preSelectionPId = 1;
+ private long preAnalysisStartTime = 0;
+ private long preAnalysisEndTime = 0;
+ private boolean isChangedSelected = true;
+ private FileSelectedData selectedData = null;
private String[] columnNames = { FilePageLabels.FILE_API_LIST_VIEW_INDEX,
FilePageLabels.FILE_API_LIST_VIEW_START_TIME,
AnalyzerConstants.SORT_TYPE_STRING };
FileApiListTable tableComp = null;
+ FileChartManager manager = FileChartManager.getInstance();
public FileApiListView(Composite parent, int style) {
super(parent, style, true);
@Override
public void updateView() {
- if (null == data) {
+ if (null == tableComp || selectedData == null) {
return;
}
long newAnalysisStartTime = 0;
long newAnalysisEndTime = 0;
+ // TODO: comment
if (RangeDataManager.getInstance().isBeingAnalyzed()) {
newAnalysisStartTime = RangeDataManager.getInstance()
.getAnalysisStartTime();
}
preSelectionPId = selectedPid;
- if (tableComp.getTable().getItemCount() > 0
- && data.getContents().size() != tableComp.getTable()
- .getItemCount()) {
- tableComp.updateTable();
- }
-
- }
-
- @Override
- public void updateView(DAViewData data) {
- if (!(data instanceof DASelectionData))
- return;
+ List<FileEvent> events = manager.getApiDB().selectAPITable(
+ selectedData.getDentry(), selectedData.getPid(),
+ selectedData.getTid(), selectedData.isParentChart());
- DASelectionData seldata = (DASelectionData) data;
-
- if(seldata.isLogData()) {
- Object odata = seldata.getData();
- if(!(odata instanceof LogData) || odata == null)
- return;
-
- LogData ldata = (LogData) odata;
-
- int seq = ldata.getSeq();
- tableComp.updateTable();
- int nSize = tableComp.getTable().getItemCount();
- for (int ii = 0; ii < nSize; ii++) {
- if (tableComp.getTable().getItem(ii).getText(0)
- .equals(Integer.toString(seq))) {
- tableComp.getTable().setSelection(ii);
- tableComp
- .getTable()
- .getVerticalBar()
- .setSelection(
- getScrollSelectionIndex(tableComp.getTable(),
- ii));
- tableComp.updateTable();
- }
+ if(events != null) {
+ if (tableComp.getTable().getItemCount() > 0
+ && events.size() != tableComp.getTable().getItemCount()) {
+ manager.setSelectedTableAPIList(events);
+ tableComp.updateTable();
}
- long selectedTime = ldata.getTime();
- DASelectionData selection = new DASelectionData(FilePage.apilistViewID,
- selectedTime, selectedTime,
- tableComp.getTable().getSelection(), tableComp.getTable());
- AnalyzerManager.getCurrentPage().updateView(selection);
} else {
- if (!(seldata.getData() instanceof FileChartData)) {
- selectionStartTime = seldata.getStartTime();
- selectionEndTime = seldata.getEndTime();
- } else {
- this.data = (FileChartData) seldata.getData();
- }
- tableComp.getTable().removeAll();
- tableComp.updateTable();
- tableComp.setSelectionByTime(selectionStartTime, selectionEndTime);
+ DA_LOG.error("It can't find data in DB");
}
- }
-
- private int getScrollSelectionIndex(Grid table, int selection) {
- int size = table.getVerticalBar().getThumb() / 2;
- int output = selection - size;
- output = (output < 0) ? 0 : output;
- return output;
+
}
@Override
@Override
public void clear() {
tableComp.getTable().removeAll();
- data = null;
+ }
+
+ @Override
+ public void updateView(DAViewData data) {
+ DASelectionData selData = (DASelectionData) data;
+ long selectionStartTime = selData.getStartTime();
+ long selectionEndTime = selData.getEndTime();
+ if (selData.getData() instanceof FileSelectedData) {
+ selectedData = (FileSelectedData) selData.getData();
+ if (null == selectedData) {
+ return;
+ }
+ manager.setSelectedTableAPIList(
+ manager.getApiDB().
+ selectAPITable(selectedData.getDentry(),
+ selectedData.getPid(),
+ selectedData.getTid(),
+ selectedData.isParentChart()));
+
+ tableComp.updateTable();
+ tableComp.setSelectionByTime(selectionStartTime,
+ selectionEndTime);
+ isChangedSelected = true;
+ }
}
- public FileChartData getPageData() {
- return data;
+
+ public FileSelectedData getSelectedData() {
+ return selectedData;
}
public long getRangeStartTime() {
*
*/
-package org.tizen.dynamicanalyzer.ui.file.view;
+package org.tizen.dynamicanalyzer.ui.file;
import java.util.ArrayList;
import java.util.List;
*
*/
-package org.tizen.dynamicanalyzer.ui.file.view;
+package org.tizen.dynamicanalyzer.ui.file;
import java.util.ArrayList;
import java.util.HashMap;
import org.tizen.dynamicanalyzer.constant.CommonConstants;
import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
import org.tizen.dynamicanalyzer.nl.FilePageLabels;
-import org.tizen.dynamicanalyzer.nl.NetworkPageLabels;
-import org.tizen.dynamicanalyzer.nl.ThreadPageLabels;
import org.tizen.dynamicanalyzer.nl.TimelineChartLabels;
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.resources.FontResources;
import org.tizen.dynamicanalyzer.ui.common.PopupStartMenuItemClickListener;
import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseEventListener;
import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseTrackAdapter;
-import org.tizen.dynamicanalyzer.ui.file.FileChartData;
import org.tizen.dynamicanalyzer.ui.file.data.FileApiDB;
import org.tizen.dynamicanalyzer.ui.file.manager.FileChartDataMaker;
import org.tizen.dynamicanalyzer.ui.file.manager.FileChartManager;
import org.tizen.dynamicanalyzer.ui.file.model.FileEvent;
import org.tizen.dynamicanalyzer.ui.file.model.FileSelectedData;
import org.tizen.dynamicanalyzer.ui.file.model.FileStatus;
-import org.tizen.dynamicanalyzer.ui.network.NetworkChart;
-import org.tizen.dynamicanalyzer.ui.network.data.NetworkDataManager;
-import org.tizen.dynamicanalyzer.ui.network.data.type.NetworkAPIType;
-import org.tizen.dynamicanalyzer.ui.network.data.type.NetworkSelectionType;
-import org.tizen.dynamicanalyzer.ui.network.data.type.NetworkSeriesType;
import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
-import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
import org.tizen.dynamicanalyzer.widgets.chart.DAChart;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotIntervalMarker;
+++ /dev/null
-/*
- * Dynamic Analyzer
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Hyunjong Park <phjwithyou.park@samsung.com>
- * yeongtaik byeon <yeongtaik.byeon@samsung.com>
- * Juyoung Kim <j0.kim@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-package org.tizen.dynamicanalyzer.ui.file;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.tizen.dynamicanalyzer.common.AnalyzerManager;
-import org.tizen.dynamicanalyzer.constant.CommonConstants;
-import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
-import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
-import org.tizen.dynamicanalyzer.nl.FilePageLabels;
-import org.tizen.dynamicanalyzer.resources.ColorResources;
-import org.tizen.dynamicanalyzer.ui.summary.failed.FailedData;
-import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
-import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
-import org.tizen.dynamicanalyzer.util.DALogger;
-import org.tizen.dynamicanalyzer.widgets.chart.DAChart;
-import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeries;
-import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeriesItem;
-import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardItem;
-
-public class FileChartData {
- private static final DALogger DA_LOG = DALogger.getInstance();
-
- private List<FileChartData> children = new ArrayList<FileChartData>();
- private DAChartSeries apiSeries;
- private DAChartSeries accessSeries;
- private DAChartSeries statueSeries;
-
- private long fd = -1;
- private String filePath = AnalyzerLabels.EMPTY_STRING;
- private boolean isClosedFile = true;
- private boolean isFailedAPI = false;
- // for Detail View Data
- private List<FailedData> failedData = null;
- private long fileSize = 0;
- private long readSize = 0;
- private long writeSize = 0;
- private double fileOpendTime = 0;
- private double fileClosedTime = 0;
- private double fileLastUsedTime = 0;
- private double fileTotalUsedTime = 0;
-
- protected DAChartBoardItem item;
- protected List<FileChartDataEvent> contents = new ArrayList<FileChartDataEvent>();
- protected List<FileChartDataEvent> contentsQueue = new ArrayList<FileChartDataEvent>();
-
- protected DAChart chart;
- protected boolean hasUpdate = false;
-
- // private int lastAccessIndexForParent = 0;
-
- public FileChartData(String filePath, long Fd, boolean isRoot) {
- setFilePath(filePath);
- setFd(Fd);
- }
-
- public void pushChild(FileChartData data) {
- children.add(data);
- hasUpdate = true;
- }
-
- public DAChartBoardItem getItem() {
- return item;
- }
-
- public DAChart getChart() {
- return chart;
- }
-
- public void setChart(DAChart chart) {
- this.chart = chart;
- }
-
- public void pushEvent(FileChartDataEvent event) {
- contentsQueue.add(event);
- makeDetailViewData(event);
- hasUpdate = true;
- }
-
- public void makeDetailViewData(FileChartDataEvent event) {
- setFileSize(event.getFileSize());
- setReadSize(event.getReadSize());
- setWriteSize(event.getWriteSize());
- if (event.getFailedData() != null) {
- getFailedData().add(event.getFailedData());
- }
- }
-
- public List<FailedData> getFailedData() {
- if (null == failedData) {
- failedData = new ArrayList<FailedData>();
- }
- return failedData;
- }
-
- public List<Integer> getFailedRelations() {
- List<Integer> output = new ArrayList<Integer>();
- int size = getFailedData().size();
- for (int i = 0; i < size; i++) {
- FailedData ffd = failedData.get(i);
- int seq = ffd.getSeq();
- output.add(seq);
- }
- return output;
- }
-
- public void setHasUpdate() {
- hasUpdate = true;
- }
-
- public List<FileChartDataEvent> getContents() {
- return contents;
- }
-
- public int getChildCount() {
- return children.size();
- }
-
- public List<FileChartData> getChild() {
- return children;
- }
-
- public long getFD() {
- return fd;
- }
-
- public void setFd(long data) {
- this.fd = data;
- }
-
- public void setClosed(boolean data) {
- this.isClosedFile = data;
- }
-
- public boolean isClosed(FileChartDataEvent event) {
- if (event == null) {
- return this.isClosedFile;
- }
- if (isParent()) {
- this.isClosedFile = true;
- for (int i = 0; i < children.size(); i++) {
-
- double fileOpendTime = children.get(i).getFileOpendTime();
- double fileClosedTime = children.get(i).getFileClosedTime();
- if (event.getApiChartTime() == fileOpendTime) {
- this.isClosedFile = true;
- break;
- }
- if (event.getApiChartTime() < fileOpendTime) {
- continue;
- }
- if ((event.getApiChartTime() > fileClosedTime)
- && (fileClosedTime != 0)) {
- continue;
- }
- if (fileClosedTime == 0) {
- if (!children.get(i).isClosed(null)) {
- this.isClosedFile = false;
- break;
- }
- }
- if (fileOpendTime < event.getApiChartTime()
- && event.getApiChartTime() < fileClosedTime) {
- this.isClosedFile = false;
- break;
- }
- }
- return this.isClosedFile;
- }
- return this.isClosedFile;
- }
-
- public boolean isFileOpenFailed() {
- if (isParent()) {
- this.isClosedFile = true;
- for (int i = 0; i < children.size(); i++) {
- if (!children.get(i).isFileOpenFailed()) {
- return false;
- }
- }
- return true;
- } else {
- return isFailedAPI;
- }
- }
-
- public void setFileOpenFailed(boolean data) {
- this.isFailedAPI = data;
- }
-
- public void setFilePath(String name) {
- this.filePath = name;
- }
-
- public String getFilePath() {
- return filePath;
- }
-
- public String getFileName() {
- String[] splitPath = this.filePath.split("\\/"); //$NON-NLS-1$
- String fileName = new String(splitPath[splitPath.length - 1]);
- return fileName;
- }
-
- public int getFailedApiCount() {
- return getFailedData().size();
- }
-
- public int getApiCount() {
- return getContents().size();
- }
-
- public void setFileSize(long data) {
- if (data > 0) {
- this.fileSize = data;
- }
- }
-
- public long getFileSize() {
- return this.fileSize;
- }
-
- public void setReadSize(long data) {
- this.readSize += data;
- }
-
- public long getReadSize() {
- return this.readSize;
- }
-
- public void setWriteSize(long data) {
- this.writeSize += data;
- }
-
- public long getWriteSize() {
- return this.writeSize;
- }
-
- private boolean isParent() {
- boolean isParent = false;
- if (children.size() > 0) {
- isParent = true;
- } else {
- isParent = false;
- }
- return isParent;
- }
-
- public FileChartData findChildData(FileChartDataEvent event) {
- int size = children.size();
- FileChartData ret;
- for (int i = 0; i < size; i++) {
- ret = children.get(i);
- if ((ret.getFD() == event.getFd())
- && (ret.isClosed(event) == false)) {
- return ret;
- }
- }
- return null;
- }
-
- public void setItem(DAChartBoardItem item) {
- this.item = item;
- setChart(item.getChart());
- apiSeries = chart.getSeries(FilePageLabels.FILE_CHART_API);
- accessSeries = chart.getSeries(FilePageLabels.FILE_CHART_ACCESS);
- statueSeries = chart.getSeries(FilePageLabels.FILE_CHART_SERIES);
-
- }
-
- public void checkUpdate() {
- if (false == hasUpdate && AnalyzerManager.isRunning()) {
- return;
- } else {
- hasUpdate = false;
- }
-
- int size = contentsQueue.size();
- FileChartDataEvent event = null;
- if (size > 0) {
- for (int i = 0; i < size; i++) {
- event = contentsQueue.get(0);
- setStatusColor(event);
- getContents().add(event);
- createChartItem(event);
- contentsQueue.remove(0);
- }
- chart.redraw();
- }
-
- size = children.size();
- if (size > 0) {
- FileChartData data;
- for (int i = 0; i < size; i++) {
- data = children.get(i);
- data.checkUpdate();
- }
- }
-
- if (!AnalyzerManager.isRunning()) {
- if (isParent() && (event == null)) {
- for (int i = 0; i < size; i++) {
- if ((!children.get(i).isClosed(null))
- && (children.get(i).getFD() != -1)) {
- setNotClosedFileStatus();
- break;
- }
- }
- } else {
- if (!isClosed(event)) {
- setNotClosedFileStatus();
- }
- }
- }
- }
-
- private void setStatusColor(FileChartDataEvent event) {
- if ((isFileOpenFailed()) == true || (event.isFailedAPI() == true)) {
- return;
- }
- if (event.getApiType() == LogCenterConstants.FD_API_TYPE_OPEN) {
- if (isParent()) {
- if (isClosed(event)) {
- setOpendFileStatus(event);
- }
- } else {
- setOpendFileStatus(event);
- }
- } else if (event.getApiType() == LogCenterConstants.FD_API_TYPE_CLOSE) {
- if (isParent()) {
- if (isClosed(event)) {
- setClosedFileStatus(event);
- }
- } else {
- setClosedFileStatus(event);
- }
- }
- }
-
- private void setOpendFileStatus(FileChartDataEvent event) {
- DAChartSeriesItem seriesItem = new DAChartSeriesItem(
- event.getApiChartTime(),
- DAChartSeriesItem.SERIES_STATE_CONTINUE,
- ColorResources.FILE_AREA_USED_END,
- ColorResources.FILE_AREA_USED_START,
- FilePageLabels.FILE_CHART_TOOLTIP_OPEND);
- statueSeries.addSeriesItem(seriesItem);
- }
-
- private void setClosedFileStatus(FileChartDataEvent event) {
- int nStatusLastIndex = statueSeries.getSeriesItemList().size() - 1;
- if (nStatusLastIndex > -1) {
- statueSeries.getSeriesItemList().get(nStatusLastIndex)
- .setColor(ColorResources.FILE_AREA_CLOSED_END);
- statueSeries
- .getSeriesItemList()
- .get(nStatusLastIndex)
- .setGradationForegroundColor(
- ColorResources.FILE_AREA_CLOSED_START);
- DAChartSeriesItem seriesItem = new DAChartSeriesItem(
- event.getApiChartTime(),
- DAChartSeriesItem.SERIES_STATE_BAR,
- ColorResources.FILE_AREA_CLOSED_END,
- ColorResources.FILE_AREA_CLOSED_START,
- FilePageLabels.FILE_CHART_TOOLTIP_CLOSED);
- seriesItem.setBarWidth(0);
- statueSeries.addSeriesItem(seriesItem);
- statueSeries.getSeriesItemList().get(nStatusLastIndex)
- .setTooltipText(FilePageLabels.FILE_CHART_TOOLTIP_CLOSED);
- }
- }
-
- private void setNotClosedFileStatus() {
- int nStatusLastIndex = statueSeries.getSeriesItemList().size() - 1;
- if (nStatusLastIndex > -1) {
- statueSeries.getSeriesItemList().get(nStatusLastIndex)
- .setColor(ColorResources.FILE_AREA_NOT_ACCESS_END);
- statueSeries
- .getSeriesItemList()
- .get(nStatusLastIndex)
- .setGradationForegroundColor(
- ColorResources.FILE_AREA_NOT_ACCESS_START);
- statueSeries.getSeriesItemList().get(nStatusLastIndex)
- .setTooltipText(FilePageLabels.FILE_CHART_TOOLTIP_OPEND);
- }
- }
-
- protected int createChartItem(FileChartDataEvent event) {
- DAChartSeriesItem seriesItem = null;
- DAChartSeriesItem accessItem = null;
- int apiType = event.getApiType();
- if (event.isFailedAPI() == true) {
- seriesItem = new DAChartSeriesItem(event.getApiChartTime(),
- DAChartSeriesItem.SERIES_STATE_BAR,
- ColorResources.FILE_API_FAILED, event.getTooltipContent());
- apiSeries.addSeriesItem(seriesItem);
- return apiType;
- }
- switch (apiType) {
- case LogCenterConstants.FD_API_TYPE_OPEN:
- seriesItem = new DAChartSeriesItem(event.getApiChartTime(),
- DAChartSeriesItem.SERIES_STATE_BAR,
- ColorResources.FILE_API_USED, event.getTooltipContent());
- break;
- case LogCenterConstants.FD_API_TYPE_CLOSE:
- seriesItem = new DAChartSeriesItem(event.getApiChartTime(),
- DAChartSeriesItem.SERIES_STATE_BAR,
- ColorResources.FILE_API_USED, event.getTooltipContent());
- break;
- case LogCenterConstants.FD_API_TYPE_READ_START:
- seriesItem = new DAChartSeriesItem(event.getApiChartTime(),
- DAChartSeriesItem.SERIES_STATE_BAR,
- ColorResources.FILE_API_USED, event.getTooltipContent());
- accessItem = new DAChartSeriesItem(event.getApiChartTime(),
- event.getApiChartTime(), ColorResources.FILE_ACCESS_READ,
- event.getTooltipContent());
- break;
- case LogCenterConstants.FD_API_TYPE_READ_END:
- setAccessSeriesEnd(accessSeries.getSeriesItemList().size() - 1,
- event.getApiChartTime());
- break;
- case LogCenterConstants.FD_API_TYPE_WRITE_START:
- seriesItem = new DAChartSeriesItem(event.getApiChartTime(),
- DAChartSeriesItem.SERIES_STATE_BAR,
- ColorResources.FILE_API_USED, event.getTooltipContent());
- accessItem = new DAChartSeriesItem(event.getApiChartTime(),
- event.getApiChartTime(), ColorResources.FILE_ACCESS_WRITE,
- event.getTooltipContent());
- break;
- case LogCenterConstants.FD_API_TYPE_WRITE_END:
- setAccessSeriesEnd(accessSeries.getSeriesItemList().size() - 1,
- event.getApiChartTime());
- break;
-
- case LogCenterConstants.FD_API_TYPE_OTHERS:
- seriesItem = new DAChartSeriesItem(event.getApiChartTime(),
- DAChartSeriesItem.SERIES_STATE_BAR,
- ColorResources.FILE_API_USED, event.getTooltipContent());
- break;
- default:
- DA_LOG.debug("createChartItem : no case FileChartDataEvent");
- return -1;
- }
- if (seriesItem != null) {
- apiSeries.addSeriesItem(seriesItem);
- }
- if (accessItem != null) {
- accessSeries.addSeriesItem(accessItem);
- }
-
- return apiType;
- }
-
- public void setAccessSeriesEnd(int lastIndex, double endTime) {
- if (lastIndex < 0) {
- return;
- }
- accessSeries.getSeriesItemList().get(lastIndex).setY(endTime);
- }
-
- public void setFileOpendTime(double data) {
- this.fileOpendTime = data;
- }
-
- public double getFileOpendTime() {
- return this.fileOpendTime / TimelineConstants.MEGA_DOUBLE;
- }
-
- public void setFileClosedTime(double data) {
- fileClosedTime = data;
- }
-
- public double getFileClosedTime() {
- return this.fileClosedTime / TimelineConstants.MEGA_DOUBLE;
- }
-
- public void setFileLastUsedTime(double data) {
- fileLastUsedTime = data;
- }
-
- public double getFileLastUsedTime() {
- return this.fileLastUsedTime / TimelineConstants.MEGA_DOUBLE;
- }
-
- public void setFileUsedTime(double data) {
- if (this.fileOpendTime == 0) {
- this.setFileTotalUsedTime(0);
- } else {
- this.setFileTotalUsedTime(data - this.fileOpendTime);
- }
- setFileLastUsedTime(data);
- }
-
- private double parentTotalUsedTime() {
- List<String> totalUsedTimeList = new ArrayList<String>();
- boolean firstInputData = false;
- double fileTotalUsedTime = 0;
- FileChartData fileData;
- double firstUsedTime = 0;
- double lastUsedTime = 0;
- for (int i = 0; i < children.size(); i++) {
- fileData = children.get(i);
- firstUsedTime = fileData.getFileOpendTime()
- * TimelineConstants.MEGA_DOUBLE;
- lastUsedTime = fileData.getFileLastUsedTime()
- * TimelineConstants.MEGA_DOUBLE;
- if (lastUsedTime == 0) {
- continue;
- } else if (!fileData.isFileOpenFailed() && firstInputData == false) {
- firstInputData = true;
- totalUsedTimeList
- .add(Double.toString(firstUsedTime)
- + CommonConstants.COLON
- + Double.toString(lastUsedTime));
- }
- int nLastIndex = totalUsedTimeList.size() - 1;
- if (nLastIndex < 0) {
- continue;
- }
- String data = totalUsedTimeList.get(nLastIndex);
- String[] splitTimeDataList = data.split(CommonConstants.COLON);
- double savedFirstUsedTime = Double
- .parseDouble(splitTimeDataList[0]);
- double savedLastUsedTime = Double.parseDouble(splitTimeDataList[1]);
- if ((savedFirstUsedTime < firstUsedTime)
- && (firstUsedTime < savedLastUsedTime)
- && (savedFirstUsedTime < savedLastUsedTime)
- && (savedLastUsedTime < lastUsedTime)) {
- totalUsedTimeList.remove(nLastIndex);
- totalUsedTimeList
- .add(Double.toString(savedFirstUsedTime)
- + CommonConstants.COLON
- + Double.toString(lastUsedTime));
- } else if ((savedLastUsedTime < firstUsedTime)
- && (savedLastUsedTime < lastUsedTime)) {
- totalUsedTimeList
- .add(Double.toString(firstUsedTime)
- + CommonConstants.COLON
- + Double.toString(lastUsedTime));
- } else if ((lastUsedTime < savedFirstUsedTime)
- && (lastUsedTime < savedLastUsedTime)) {
- totalUsedTimeList
- .add(Double.toString(firstUsedTime)
- + CommonConstants.COLON
- + Double.toString(lastUsedTime));
- }
- }
- int nSize = totalUsedTimeList.size();
- for (int i = 0; i < nSize; i++) {
- String data = totalUsedTimeList.get(i);
- String[] splitTimeDataList = data.split(CommonConstants.COLON); //$NON-NLS-1$
- double savedFirstUsedTime = Double
- .parseDouble(splitTimeDataList[0]);
- double savedLastUsedTime = Double.parseDouble(splitTimeDataList[1]);
- fileTotalUsedTime += (savedLastUsedTime - savedFirstUsedTime);
- }
- return fileTotalUsedTime;
- }
-
- public double getFileTotalUseTime() {
-
- if (isParent()) {
- double fistOpenTime = 1000000;
- FileChartData fileData;
- boolean isAllClosed = true;
- for (int i = 0; i < children.size(); i++) {
- fileData = children.get(i);
- if (fileData.getFileOpendTime() < fistOpenTime) {
- fistOpenTime = fileData.getFileOpendTime();
- }
- if (fileData.isClosed(null) != true) {
- if (isAllClosed) {
- isAllClosed = false;
- }
- }
- }
- if (isAllClosed) {
- return parentTotalUsedTime();
- } else {
- return ToolbarArea.getInstance().getTime() - fistOpenTime;
- }
- }
- if (isClosed(null) == true) {
- return this.fileLastUsedTime - this.fileOpendTime;
- } else {
- return ToolbarArea.getInstance().getTime() - this.fileOpendTime;
- }
- }
-
- public double getFileTotalUsedTime() {
- return fileTotalUsedTime;
- }
-
- public void setFileTotalUsedTime(double fileTotalUsedTime) {
- this.fileTotalUsedTime = fileTotalUsedTime;
- }
-
-}
\ No newline at end of file
+++ /dev/null
-/*
- * Dynamic Analyzer
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Hyunjong Park <phjwithyou.park@samsung.com>
- * yeongtaik byeon <yeongtaik.byeon@samsung.com>
- * Juyoung Kim <j0.kim@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-package org.tizen.dynamicanalyzer.ui.file;
-
-import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
-import org.tizen.dynamicanalyzer.swap.model.data.FileData;
-import org.tizen.dynamicanalyzer.ui.summary.failed.FailedData;
-import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
-
-public class FileChartDataEvent {
-
- private FileData contents;
- private FailedData failedData = null;
-
- private long fd = -1;
- private String filePath = AnalyzerLabels.EMPTY_STRING;
-
- private int apiType = -1;
- private double logTime = -1;
-
- private long fileSize = 0;
- private long readSize = 0;
- private long writeSize = 0;
-
- private boolean isFailedAPI = false;
-
- private String tooltip = null;
-
- public FileChartDataEvent(String filePath, long fd, long time,
- String tooltip, FileData contents) {
- setFilePath(filePath);
- setFd(fd);
- setLogTime(time);
- setContents(contents);
- setTooltipContent(tooltip);
- }
-
- public FileChartDataEvent(FileData contents) {
- setContents(contents);
- }
-
- public FileData getContents() {
- return contents;
- }
-
- public void setContents(FileData contents) {
- this.contents = contents;
- }
-
- public long getFd() {
- return fd;
- }
-
- public void setFd(long fd) {
- this.fd = fd;
- }
-
- public boolean isFailedAPI() {
- return isFailedAPI;
- }
-
- public void setFailedAPI() {
- this.isFailedAPI = true;
- }
-
- public int getApiType() {
- return apiType;
- }
-
- public void setApiType(int apiType) {
- this.apiType = apiType;
- }
-
- public double getLogTime() {
- return logTime;
- }
-
- public void setLogTime(double data) {
- this.logTime = data;
- }
-
- public double getApiChartTime() {
- return getLogTime() / TimelineConstants.MEGA_DOUBLE;
- }
-
- public void setFilePath(String data) {
- this.filePath = data;
- }
-
- public String getFilePath() {
- return filePath;
- }
-
- public void setFileSize(long data) {
- this.fileSize = data;
- this.writeSize = data;
- }
-
- public long getFileSize() {
- return this.fileSize;
- }
-
- public void setReadSize(long data) {
- this.readSize = data;
- }
-
- public long getReadSize() {
- return this.readSize;
- }
-
- public void setWriteSize(long data) {
- this.writeSize = data;
- }
-
- public long getWriteSize() {
- return this.writeSize;
- }
-
- public void setFailedData(FailedData data) {
- failedData = data;
- }
-
- public FailedData getFailedData() {
- return failedData;
- }
-
- public String getTooltipContent() {
- return tooltip;
- }
-
- public void setTooltipContent(String tooltip) {
- this.tooltip = tooltip;
- }
-}
+++ /dev/null
-/*
- * Dynamic Analyzer
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Hyunjong Park <phjwithyou.park@samsung.com>
- * Jooyoul Lee <jy.exe.lee@samsung.com>
- * Juyoung Kim <j0.kim@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-package org.tizen.dynamicanalyzer.ui.file;
-
-import java.util.List;
-
-import org.tizen.dynamicanalyzer.common.AnalyzerManager;
-import org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants;
-import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
-import org.tizen.dynamicanalyzer.swap.logparser.Logs;
-import org.tizen.dynamicanalyzer.swap.logparser.PageDataManager;
-import org.tizen.dynamicanalyzer.swap.model.data.LogData;
-
-public class FileChartManager extends PageDataManager {
- private FileDataMaker fileDataMaker = null;
- private static FileChartManager instance = null;
-
- private FileChartManager() {
- fileDataMaker = new FileDataMaker(AnalyzerManager.getFailedChecker(),
- AnalyzerManager.getLeakDetector(),
- AnalyzerManager.getWarningChecker());
- }
-
- public synchronized static FileChartManager getInstance() {
- if (null == instance) {
- instance = new FileChartManager();
- }
- return instance;
- }
-
- public FileDataMaker getFileDataMaker() {
- return fileDataMaker;
- }
-
- public void clear() {
- instance = null;
- fileDataMaker.clear();
- }
-
- public int[] getParentChartIndex(int seq) {
- int parentChartIndex = -1;
- FileChartData chartData = null;
- List<FileChartData> fileChartDataLow = getFileDataMaker().getFileChartLow();
- for (int i = 0; i < fileChartDataLow.size(); i++) {
- chartData = fileChartDataLow.get(i);
- if (chartData.getChildCount() != 0) {
- parentChartIndex++;
- if (isEqualsSeq(chartData, seq)) {
- return new int[] { parentChartIndex, i };
- }
- }
- }
- return new int[] { 0, 0 };
- }
-
- public int getChildChartIndex(int parentChartIndex, int seq) {
- List<FileChartData> fileChartDataLow = getFileDataMaker().getFileChartLow();
- if(fileChartDataLow.size() <=parentChartIndex){
- return 0;
- }
- List<FileChartData> childData = fileChartDataLow.get(parentChartIndex)
- .getChild();
- FileChartData childChartData = null;
- for (int i = 0; i < childData.size(); i++) {
- childChartData = childData.get(i);
- if (isEqualsSeq(childChartData, seq)) {
- return i;
- }
- }
- return 0;
- }
-
- public boolean isEqualsSeq(FileChartData chartData, int seq) {
- for (int j = 0; j < chartData.getContents().size(); j++) {
- if (chartData.getContents().get(j).getContents()
- .getSeq() == seq) {
- return true;
- }
- }
- return false;
- }
-
- @Override
- protected void makeData(LogPackage pack) {
- Logs logs = pack.getLogs(DataChannelConstants.MSG_PROBE_FILE);
- if (null != logs && (logs.getRawLogs().size() != 0)) {
- List<LogData> inputs = logs.getLogs();
- getFileDataMaker().makeData(inputs);
- }
- }
-}
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact:
- * Hyunjong Park <phjwithyou.park@samsung.com>
- * yeongtaik byeon <yeongtaik.byeon@samsung.com>
+ * Hyeran kim <hyearn74.kim@samsung.com>
* Juyoung Kim <j0.kim@samsung.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
package org.tizen.dynamicanalyzer.ui.file;
+import java.util.List;
+
import org.eclipse.swt.custom.StackLayout;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.tizen.dynamicanalyzer.swap.model.data.LogData;
import org.tizen.dynamicanalyzer.ui.common.SetRangeMarkerMouseMoveListener;
import org.tizen.dynamicanalyzer.ui.common.UICommonConstants;
+import org.tizen.dynamicanalyzer.ui.file.FilePage;
+import org.tizen.dynamicanalyzer.ui.file.manager.FileChartManager;
+import org.tizen.dynamicanalyzer.ui.file.model.FileEvent;
import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
import org.tizen.dynamicanalyzer.ui.timeline.logparser.LifecycleLogParser;
import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
+import org.tizen.dynamicanalyzer.util.DALogger;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotIntervalMarker;
import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardItem;
import org.tizen.dynamicanalyzer.widgets.timeline.DATimeline;
public class FileChartView extends DAViewComposite {
+ private static final DALogger DA_LOG = DALogger.getInstance();
+ // TODO: the height can be changed
public final static int FILE_CHART_HEIGHT = 40;
private final Composite contents;
- private DAChartBoard fileChart;
+ private FileChartBoard fileChartBoard;
private final StackLayout stackLayout;
+ private DAChartBoardItem lastSelectedItemForSummary = null;
private final RangeDataManager rangeDataManager = RangeDataManager
.getInstance();
+ private FileChartManager chartManager = FileChartManager.getInstance();
public FileChartView(Composite parent, int style) {
super(parent, style, false);
contents.setBackground(ColorResources.WINDOW_BG_COLOR);
stackLayout = new StackLayout();
contents.setLayout(stackLayout);
- fileChart = new DAChartBoard(contents, FilePageLabels.FILE_CHART_FILE);
- fileChart.setNameFont(FontResources.CHART_NAME_FONT);
- fileChart.addSelectionListener(new DAChartBoardSelectionListener() {
-
+ fileChartBoard = new FileChartBoard(contents, FilePageLabels.FILE_CHART_FILE);
+ fileChartBoard.setNameFont(FontResources.CHART_NAME_FONT);
+ fileChartBoard.addSelectionListener(new DAChartBoardSelectionListener() {
@Override
public void handleSelectionEvent(DAChartBoardItem item) {
+ lastSelectedItemForSummary = item;
AnalyzerManager
- .getCurrentPage()
- .updateView(
+ .getCurrentPage().updateView(
new DASelectionData(
FilePage.chartViewID,
- (long) (((DAChartPlotIntervalMarker) fileChart
+ (long) (((DAChartPlotIntervalMarker) fileChartBoard
.getMarkers()
.get(UICommonConstants.SELECTION_MARKER_INDEX))
+ // TODO: use utility API
.getStartVal() * TimelineConstants.MEGA_DOUBLE),
- (long) (((DAChartPlotIntervalMarker) fileChart
+ (long) (((DAChartPlotIntervalMarker) fileChartBoard
.getMarkers()
.get(UICommonConstants.SELECTION_MARKER_INDEX))
+ // TODO: use utility API
.getEndVal() * TimelineConstants.MEGA_DOUBLE),
item.getData(), null));
}
});
- initIntervalMarkers(fileChart);
+ initIntervalMarkers(fileChartBoard);
+
+ stackLayout.topControl = fileChartBoard;
- stackLayout.topControl = fileChart;
-
// Making title composition using resource of timeline pages.
- fileChart.makeDefaultTitleComposite(FilePageLabels.FILE_CHART_FILE,
+ fileChartBoard.makeDefaultTitleComposite(FilePageLabels.FILE_CHART_FILE,
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 = fileChart.getTimeline();
+
+ DATimeline timeline = fileChartBoard.getTimeline();
timeline.setTimeTickFont(FontResources.TIMELINE_TICK_FONT);
timeline.setTimeBalloonFont(FontResources.TIMELINE_BALLOON_FONT);
LifecycleLogParser.getInstance().registerLifecycleBar(
- fileChart.getLifecycleBar());
+ fileChartBoard.getLifecycleBar());
LifecycleLogParser.getInstance().registerTimeline(timeline);
timeline.addMouseMoveListener(new SetRangeMarkerMouseMoveListener(
- rangeDataManager, fileChart, timeline));
+ rangeDataManager, fileChartBoard, timeline));
}
@Override
public void updateView() {
- FileChartManager.getInstance().getFileDataMaker().checkUpdate();
- fileChart.setTotalEndTime(ToolbarArea.getInstance().getTime());
+ fileChartBoard.updateChart();
+
+ fileChartBoard.setTotalEndTime(ToolbarArea.getInstance().getTime());
- fileChart.setTimelineMarkerStartTime(rangeDataManager
+ fileChartBoard.setTimelineMarkerStartTime(rangeDataManager
.getMarkerStartTime() / TimelineConstants.MEGA_DOUBLE);
- fileChart.setTimelineMarkerEndTime(rangeDataManager.getMarkerEndTime()
+ fileChartBoard.setTimelineMarkerEndTime(rangeDataManager.getMarkerEndTime()
/ TimelineConstants.MEGA_DOUBLE);
if (RangeDataManager.getInstance().isBeingAnalyzed()) {
- ((DAChartPlotIntervalMarker) fileChart.getMarkers().get(
+ ((DAChartPlotIntervalMarker) fileChartBoard.getMarkers().get(
UICommonConstants.RANGE_ANALYSIS_MARKER_INDEX))
.setInterval(rangeDataManager.getAnalysisStartTime()
/ TimelineConstants.MEGA_DOUBLE,
rangeDataManager.getAnalysisEndTime()
/ TimelineConstants.MEGA_DOUBLE);
} else {
- ((DAChartPlotIntervalMarker) fileChart.getMarkers().get(
+ ((DAChartPlotIntervalMarker) fileChartBoard.getMarkers().get(
UICommonConstants.RANGE_ANALYSIS_MARKER_INDEX))
.setInterval(-1, -1);
}
- ((DAChartPlotIntervalMarker) fileChart.getMarkers().get(
+ ((DAChartPlotIntervalMarker) fileChartBoard.getMarkers().get(
UICommonConstants.RANGE_MARKER_INDEX)).setInterval(
rangeDataManager.getMarkerStartTime()
/ TimelineConstants.MEGA_DOUBLE,
@Override
public void updateView(DAViewData data) {
- if (!(data instanceof DASelectionData))
- return;
-
- DASelectionData selData = (DASelectionData) data;
-
- if(selData.isLogData()) {
- Object odata = selData.getData();
- if(!(odata instanceof LogData) || odata == null)
- return;
-
- LogData ldata = (LogData) odata;
- int seq = ldata.getSeq();
- int selectedIndex[] = FileChartManager.getInstance()
- .getParentChartIndex(seq);
- fileChart.selectItem(selectedIndex[0], FileChartManager.getInstance()
- .getChildChartIndex(selectedIndex[1], seq));
- } else {
- long start = selData.getStartTime();
- long end = selData.getEndTime();
-
- double startTime = (double) start / TimelineConstants.MEGA_DOUBLE;
- double endTime = (double) end / TimelineConstants.MEGA_DOUBLE;
- // double middleTime = (startTime + endTime) / 2.0;
- // if (start == end) {
- // middleTime = startTime;
- // }
-
- DAChartBoard chartBoard = (DAChartBoard) stackLayout.topControl;
+ // TODO refactoring
+ fileChartBoard.updateChart();
+ if (data instanceof DASelectionData) {
+ DASelectionData selData = (DASelectionData) data;
+ long dataTime = -1;
+
+ if (selData.isLogData()) {
+ Object obData = selData.getData();
+ if (null != obData && (obData instanceof LogData)) { // summary
+ LogData ldata = (LogData) obData;
+ dataTime = ldata.getTime();
+
+ int seq = ldata.getSeq();
+
+ List<FileEvent> event = chartManager.getApiDB().selectFileEventBySeq(seq);
+ if(event != null) {
+ int selectedIndex[] = fileChartBoard.getChartIndex(event.get(0));
+ fileChartBoard.selectItem(selectedIndex[0], selectedIndex[1]);
+
+ if (null != lastSelectedItemForSummary) {
+ AnalyzerManager.getCurrentPage().updateView(
+ new DASelectionData(FilePage.chartViewID,
+ dataTime, dataTime,
+ lastSelectedItemForSummary.getData(),
+ null));
+ }
+ }else{
+ DA_LOG.error("It can't find data in DB, seq number:" + seq);
+ }
+ }
+ } else {
+ dataTime = selData.getStartTime();
+ }
+ double startTime = dataTime / TimelineConstants.MEGA_DOUBLE;
+ double endTime = selData.getEndTime() / TimelineConstants.MEGA_DOUBLE;
- // chartBoard.setVisibleMiddleTime(middleTime);
- DAChartPlotIntervalMarker intervalMarker = (DAChartPlotIntervalMarker) chartBoard
+ DAChartPlotIntervalMarker intervalMarker = (DAChartPlotIntervalMarker)fileChartBoard
.getMarkers().get(UICommonConstants.SELECTION_MARKER_INDEX);
intervalMarker.setInterval(startTime, endTime);
+
}
}
@Override
public void clear() {
- fileChart.clear();
- initIntervalMarkers(fileChart);
- FileChartManager.getInstance().getFileDataMaker().clear();
- FileChartManager.getInstance().getFileDataMaker().setBoard(fileChart);
+ fileChartBoard.clear();
+ initIntervalMarkers(fileChartBoard);
+ chartManager.getFileChartDataMaker().clear();
}
@Override
public Control getControl() {
- return fileChart;
+ return fileChartBoard;
}
private void initIntervalMarkers(DAChartBoard board) {
}
public void setRangeMarker(double starttime, double endtime) {
- fileChart.setTimelineMarkerStartTime(starttime);
- fileChart.setTimelineMarkerEndTime(endtime);
+ fileChartBoard.setTimelineMarkerStartTime(starttime);
+ fileChartBoard.setTimelineMarkerEndTime(endtime);
- ((DAChartPlotIntervalMarker) fileChart.getMarkers().get(
+ ((DAChartPlotIntervalMarker) fileChartBoard.getMarkers().get(
UICommonConstants.RANGE_MARKER_INDEX)).setInterval(
starttime, endtime);
}
+++ /dev/null
-/*
- * Dynamic Analyzer
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Hyunjong Park <phjwithyou.park@samsung.com>
- * Jooyoul Lee <jy.exe.lee@samsung.com>
- * Juyoung Kim <j0.kim@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-package org.tizen.dynamicanalyzer.ui.file;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-import org.tizen.dynamicanalyzer.common.AnalyzerManager;
-import org.tizen.dynamicanalyzer.constant.CommonConstants;
-import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
-import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
-import org.tizen.dynamicanalyzer.nl.ConfigureLabels;
-import org.tizen.dynamicanalyzer.nl.FilePageLabels;
-import org.tizen.dynamicanalyzer.nl.ThreadPageLabels;
-import org.tizen.dynamicanalyzer.nl.TimelineChartLabels;
-import org.tizen.dynamicanalyzer.resources.ColorResources;
-import org.tizen.dynamicanalyzer.resources.FontResources;
-import org.tizen.dynamicanalyzer.resources.ImageResources;
-import org.tizen.dynamicanalyzer.swap.model.data.FileData;
-import org.tizen.dynamicanalyzer.swap.model.data.LogData;
-import org.tizen.dynamicanalyzer.ui.common.PopupAnalysisMenuItemClickListener;
-import org.tizen.dynamicanalyzer.ui.common.PopupClearMenuItemClickListener;
-import org.tizen.dynamicanalyzer.ui.common.PopupEndMenuItemClickListener;
-import org.tizen.dynamicanalyzer.ui.common.PopupFromSelectionMenuItemClickListener;
-import org.tizen.dynamicanalyzer.ui.common.PopupStartMenuItemClickListener;
-import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseEventListener;
-import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseTrackAdapter;
-import org.tizen.dynamicanalyzer.ui.summary.SummaryDataManager;
-import org.tizen.dynamicanalyzer.ui.summary.failed.FailedChecker;
-import org.tizen.dynamicanalyzer.ui.summary.failed.FailedData;
-import org.tizen.dynamicanalyzer.ui.summary.leaks.LeakDetector;
-import org.tizen.dynamicanalyzer.ui.summary.warning.WarningCase;
-import org.tizen.dynamicanalyzer.ui.summary.warning.WarningChecker;
-import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
-import org.tizen.dynamicanalyzer.ui.toolbar.configuration.ConfigurationDialogDataManager;
-import org.tizen.dynamicanalyzer.util.DALogger;
-import org.tizen.dynamicanalyzer.widgets.chart.DAChart;
-import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot;
-import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot.AutoRangeType;
-import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotTooltip;
-import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeries;
-import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
-import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardItem;
-import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenu;
-import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenuItem;
-
-public class FileDataMaker {
- private static final DALogger DA_LOG = DALogger.getInstance();
-
- private DAChartBoard board;
- private List<FileChartData> rows = new ArrayList<FileChartData>();
- private List<FileChartDataEvent> fileEventQueue = new ArrayList<FileChartDataEvent>();
- private List<FileChartDataEvent> fileEventWarningQueue = new ArrayList<FileChartDataEvent>();
- private HashMap<Long, String> findPathHashMap = new HashMap<Long, String>();
- private int timeLineFileChartFDCount = 0;
- private FailedChecker failedChecker = null;
- private WarningChecker warningChecker = null;
- private int preSelectionPId = -1;
-
- public FileDataMaker(FailedChecker failedChecker,
- LeakDetector leakDetector, WarningChecker warningChecker) {
- this.failedChecker = failedChecker;
- this.warningChecker = warningChecker;
- }
-
- public void setBoard(DAChartBoard board) {
- this.board = board;
- }
-
- public void clear() {
- rows.clear();
- fileEventQueue.clear();
- fileEventWarningQueue.clear();
- findPathHashMap.clear();
- timeLineFileChartFDCount = 0;
- }
-
- public List<FileChartData> getFileChartLow() {
- return rows;
- }
-
- private boolean isOpenMainLog(FileData input) {
- String filePath = input.getFilePath();
- if (filePath.contains(CommonConstants.SLASH)) {
- String[] splitApiFilePath = filePath.split(CommonConstants.SLASH);
- String strApiFilePath = new String(
- splitApiFilePath[splitApiFilePath.length - 1].trim());
- if (AnalyzerManager.getProject().getPackageID().equals(strApiFilePath)) {
- return true;
- }
- }
- return false;
- }
-
- private boolean isPrintLog(FileData input) {
- String apiName = input.getApiName();
- if (apiName.contains("print")) {//$NON-NLS-1$
- return true;
- }
- return false;
- }
-
- public void makeData(List<LogData> inputs) {
- int size = inputs.size();
- for (int i = 0; i < size; i++) {
- FileData input = (FileData) inputs.get(i);
-
- if (ConfigurationDialogDataManager.getInstance().getfeatureValue(
- ConfigureLabels.INCLUDE_INSIDE_CALL_FILE) == 0) {
- if (input.isInternal()) {
- continue;
- }
- }
-
- if (isPrintLog(input)) {
- continue;
- }
-
- if (isOpenMainLog(input)) {
- continue;
- }
-
- int fdApiType = input.getFdApiType();
- String path = input.getFilePath();
- long fd = input.getFdValue();
-
- long errno = input.getErrno();
-
- String name = input.getApiName();
- long time = input.getTime();
-
- if (fdApiType != LogCenterConstants.FD_API_TYPE_OPEN) {
- path = AnalyzerLabels.EMPTY_STRING;
- }
- FileChartDataEvent event = new FileChartDataEvent(path, fd, time,
- name, input);
-
- // error check
- if (errno != 0) {
- switch (input.getFdApiType()) {
- case LogCenterConstants.SOCKET_API_ACCEPT_END:
- case LogCenterConstants.SOCKET_API_SEND_END:
- case LogCenterConstants.SOCKET_API_RECV_END:
- case LogCenterConstants.SOCKET_API_EVENT_END: {
- FailedData ffd = new FailedData(input);
- event.setFailedData(ffd);
- this.failedChecker.getFailedList().add(ffd);
- event.setFailedAPI();
- }
- }
- } else if (name.equals("fdopen")) { //$NON-NLS-1$
- DA_LOG.debug("fdopen");
- continue;
- }
-
- if (fdApiType == LogCenterConstants.FD_API_TYPE_OPEN) {
- event.setApiType(LogCenterConstants.FD_API_TYPE_OPEN);
- checkDuplicateOpen(event);
- if (errno == 0) {
- timeLineFileChartFDCount++;
- }
- } else if (fdApiType == LogCenterConstants.FD_API_TYPE_CLOSE) {
- event.setApiType(LogCenterConstants.FD_API_TYPE_CLOSE);
- if (errno == 0) {
- timeLineFileChartFDCount--;
- if (timeLineFileChartFDCount < 0) {
- timeLineFileChartFDCount = 0;
- }
- }
- } else if (fdApiType == LogCenterConstants.FD_API_TYPE_READ_END
- || fdApiType == LogCenterConstants.FD_API_TYPE_WRITE_END) {
- long fileSize = input.getFileSize();
- if (fileSize < 0) {
- fileSize = 0;
- }
- if (fdApiType == LogCenterConstants.FD_API_TYPE_READ_END) {
- event.setReadSize(fileSize);
- event.setApiType(LogCenterConstants.FD_API_TYPE_READ_END);
- } else if (fdApiType == LogCenterConstants.FD_API_TYPE_WRITE_END) {
- event.setFileSize(fileSize);
- event.setWriteSize(fileSize);
- event.setApiType(LogCenterConstants.FD_API_TYPE_WRITE_END);
- }
- }
- event.setApiType(fdApiType);
- fileEventQueue.add(event);
- fileEventWarningQueue.add(event);
- if (fdApiType == LogCenterConstants.FD_API_TYPE_CLOSE) {
- checkWithoutUsing(event);
- }
- }
- }
-
- private void checkDuplicateOpen(FileChartDataEvent data) {
- if (data.isFailedAPI()) {
- return;
- }
- for (int i = 0; i < fileEventWarningQueue.size(); i++) {
- FileChartDataEvent event = fileEventWarningQueue.get(i);
- if ((event.getFilePath().equals(data.getFilePath()))
- && (event.getApiType() == LogCenterConstants.FD_API_TYPE_OPEN)) {
-// if (!warningChecker.isChecked(data.getFilePath(),
-// WarningCase.DUPLICATE_OPEN.getType())) {
-// WarningData wData = new WarningData(
-// WarningCase.DUPLICATE_OPEN.getType(),
-// data.getContents(), data.getFilePath());
-// warningChecker.getWarningData().add(wData);
- SummaryDataManager.getInstance().getWarningDataMaker().makeData(
- data.getContents(), data.getFilePath(), WarningCase.DUPLICATE_OPEN.getType());
-// }
- }
- }
- }
-
- private void checkWithoutUsing(FileChartDataEvent data) {
- int nAPICount = 0;
- for (int i = 0; i < fileEventWarningQueue.size(); i++) {
- FileChartDataEvent event = fileEventWarningQueue.get(i);
- if ((event.getFd() == data.getFd())) {
- nAPICount++;
- if (event.getApiType() == LogCenterConstants.FD_API_TYPE_OPEN) {
- data.setFilePath(event.getFilePath());
- }
- fileEventWarningQueue.remove(i--);
- }
- }
-
- if ((nAPICount < 3)
- && (data.getFilePath().equals(AnalyzerLabels.EMPTY_STRING) == false)) { // open-close
-// if (!warningChecker.isChecked(data.getFilePath(),
-// WarningCase.WITHOUT_USING.getType())) {
-// WarningData wData = new WarningData(
-// WarningCase.WITHOUT_USING.getType(),
-// data.getContents(), data.getFilePath());
-// warningChecker.getWarningData().add(wData);
- SummaryDataManager.getInstance().getWarningDataMaker().makeData(
- data.getContents(), data.getFilePath(), WarningCase.WITHOUT_USING.getType());
-// }
- }
- }
-
- private void initFileChart(DAChart chart, boolean isParent) {
- if (null == chart) {
- return;
- }
-
- DAChartSeries apiSeries = new DAChartSeries(
- FilePageLabels.FILE_CHART_API,
- DAChartSeries.SERIES_STYLE_EVENT, ColorResources.YELLOW);
-
- DAChartSeries stateSeries = new DAChartSeries(
- FilePageLabels.FILE_CHART_SERIES,
- DAChartSeries.SERIES_STYLE_STATE, ColorResources.WHITE);
-
- DAChartSeries accessSeries = new DAChartSeries(
- FilePageLabels.FILE_CHART_ACCESS,
- DAChartSeries.SERIES_STYLE_EVENT_AREA, ColorResources.WHITE);
-
- apiSeries.setSummarizeTooltipText(ThreadPageLabels.THREAD_TOOLTIP_APIS);
-
- chart.addSeries(stateSeries);
- chart.addSeries(apiSeries);
- chart.addSeries(accessSeries);
-
- DAChartPlot plot = chart.getPlot();
- if (null == plot) {
- return;
- }
- if (true == isParent) {
- plot.setBackgroundImage(ImageResources.BG_GRADIENT);
- } else {
- plot.setBackgroundImage(ImageResources.BG_CHILD_GRADIENT);
- }
- plot.setAutoHeightRange(AutoRangeType.MANUAL);
- plot.setAxisFont(FontResources.CHART_AXIS_FONT);
- plot.setAxisRangeY(0, 101);
- plot.setAxisRangeX(board.getVisibleStartTime(),
- board.getVisibleEndTime());
- DAChartPlotTooltip tooltip = new DAChartPlotTooltip(-1);
- tooltip.setFont(FontResources.CHART_TOOLTIP_FONT);
- plot.setTooltip(tooltip);
-
- DAPopupMenu popupMenu = new DAPopupMenu(chart);
- popupMenu.setFont(FontResources.CONTEXT_MENU_ITEM_FONT);
- DAPopupMenuItem startItem = new DAPopupMenuItem(popupMenu,
- DAPopupMenuItem.NONE);
- startItem.setText(TimelineChartLabels.RANGE_CONTEXT_SET_START);
- startItem.addListener(new PopupStartMenuItemClickListener(startItem,
- board));
-
- DAPopupMenuItem endItem = new DAPopupMenuItem(popupMenu,
- DAPopupMenuItem.NONE);
- endItem.setText(TimelineChartLabels.RANGE_CONTEXT_SET_END);
- endItem.addListener(new PopupEndMenuItemClickListener(endItem, board));
-
- DAPopupMenuItem fromSelectionItem = new DAPopupMenuItem(popupMenu,
- DAPopupMenuItem.NONE);
- fromSelectionItem
- .setText(TimelineChartLabels.RANGE_CONTEXT_SET_FROM_SELECTION);
- fromSelectionItem
- .addListener(new PopupFromSelectionMenuItemClickListener(
- fromSelectionItem, board));
-
- DAPopupMenuItem analysisItem = new DAPopupMenuItem(popupMenu,
- DAPopupMenuItem.NONE);
- analysisItem.setText(TimelineChartLabels.RANGE_CONTEXT_ANALYSIS);
- analysisItem.addListener(new PopupAnalysisMenuItemClickListener());
-
- DAPopupMenuItem clearItem = new DAPopupMenuItem(popupMenu,
- DAPopupMenuItem.NONE);
- clearItem.setText(TimelineChartLabels.RANGE_CONTEXT_CLEAR);
- clearItem.addListener(new PopupClearMenuItemClickListener());
-
- TimelineChartMouseEventListener timelineChartMouseEventListener = new TimelineChartMouseEventListener(
- popupMenu, board.getTimeline());
- chart.addMouseListener(timelineChartMouseEventListener);
- chart.addMouseMoveListener(timelineChartMouseEventListener);
- chart.addMouseTrackListener(new TimelineChartMouseTrackAdapter(board
- .getTimeline()));
- plot.setMarkers(board.getMarkers());
- }
-
- private boolean createFileBoardItem(FileChartData parent,
- FileChartData sync, FileChartDataEvent event) {
- DAChartBoardItem item;
- DAChart chart;
- if (null == parent) {
- String fileName = sync.getFileName();
- if (sync.getFileName().length() > 12) {
- fileName = sync.getFileName().substring(0, 12);
- fileName += CommonConstants.NEW_LINE
- + sync.getFileName().substring(12,
- sync.getFileName().length());
- }
- item = new DAChartBoardItem(board, fileName);
- chart = item.getChart();
- initFileChart(chart, true);
- } else {
- DAChartBoardItem parentItem = parent.getItem();
- if (sync.getFD() > 0x10000000) {
- item = new DAChartBoardItem(parentItem, "0x"//$NON-NLS-1$
- + Long.toHexString(sync.getFD()));
- } else {
- item = new DAChartBoardItem(parentItem, Long.toString(sync
- .getFD()));
- }
-
- chart = item.getChart();
- initFileChart(chart, false);
- }
-
- sync.setItem(item);
- item.setData(sync);
- chart.setData(sync);
- chart.redraw();
- return true;
- }
-
- private FileChartData findParent(String filePath, long fd) {
- filePath = findPathHashMap.get(fd);
- int size = rows.size();
- FileChartData returnData = null;
- for (int i = 0; i < size; i++) {
- returnData = rows.get(i);
- if (returnData.getFilePath().equals(filePath) == true) {
- return returnData;
- } else if ((returnData.getFilePath()
- .equals(FilePageLabels.FILE_CHART_UNKNOWN_FILE))
- && (filePath == null)) {
- return returnData;
- }
- }
- return null;
- }
-
- private void chartFilteringByPId() {
- if (null == board || null == board.getItemList()) {
- return;
- }
- int selectedPid = ToolbarArea.getInstance().getSelectedPid();
- boolean isCheck = false;
-
- if (fileEventQueue.size() > 0) {
- isCheck = true;
- }
-
- if (preSelectionPId != -1 && preSelectionPId != selectedPid) {
- isCheck = true;
- }
-
- if (isCheck) {
- int parentSize = board.getItemList().getItemSize();
- for (int i = 0; i < parentSize; i++) {
- DAChartBoardItem parentItem = board.getItemList().get(i);
- int childSize = parentItem.getChildItemList().getItemSize();
- int hidedCount = 0;
- for (int j = 0; j < childSize; j++) {
- DAChartBoardItem childItem = parentItem.getChildItemList()
- .get(j);
- int itemPid = getItemPid(childItem);
- if (itemPid == selectedPid) {
- parentItem.getChildItemList().showItem(j);
- board.showItem(i);
- } else if (selectedPid == 0) {
- parentItem.getChildItemList().showItem(j);
- board.showItem(i);
- } else if (itemPid == -1) {
- board.showItem(i);
- } else {
- parentItem.getChildItemList().hideItem(j);
- hidedCount++;
- }
- }
- if (childSize == 0) {
- int itemPid = getItemPid(parentItem);
- if (itemPid == selectedPid) {
- board.showItem(i);
- } else if (selectedPid == 0) {
- board.showItem(i);
- } else if (itemPid == -1) {
- board.showItem(i);
- } else {
- board.hideItem(i);
- hidedCount++;
- }
- } else {
- if (childSize == hidedCount) {
- board.hideItem(i);
- }
- }
- }
- }
- preSelectionPId = selectedPid;
- }
-
- private int getItemPid(DAChartBoardItem item) {
- int pid = -1;
- if (item.getData() instanceof FileChartData) {
- FileChartData chartData = (FileChartData) item.getData();
- if (chartData.getContents().size() > 0) {
- pid = chartData.getContents().get(0).getContents().getPid();
- }
- }
- return pid;
- }
-
- public void checkUpdate() {
- if (!AnalyzerManager.isRunning()) {
- int size = rows.size();
- FileChartData data;
- for (int i = 0; i < size; i++) {
- data = rows.get(i);
- data.checkUpdate();
- }
- }
- chartFilteringByPId();
- int size = fileEventQueue.size();
- if (size > 0) {
- FileChartData parentChart;
- FileChartData childChart;
- FileChartDataEvent event;
- for (int i = 0; i < size; i++) {
- event = fileEventQueue.get(0);
- int apiType = event.getApiType();
- String filePath = AnalyzerLabels.EMPTY_STRING;
- if (event.getFilePath().trim()
- .equals(AnalyzerLabels.EMPTY_STRING)) {
- filePath = FilePageLabels.FILE_CHART_UNKNOWN_FILE;
- } else {
- filePath = event.getFilePath();
- }
- if (apiType == LogCenterConstants.FD_API_TYPE_OPEN) {
- findPathHashMap.put(event.getFd(), filePath);
- }
- parentChart = findParent(event.getFilePath(), event.getFd());
- if (null == parentChart) {
- findPathHashMap.put(event.getFd(), filePath);
- parentChart = new FileChartData(filePath, event.getFd(),
- true);
- childChart = new FileChartData(filePath, event.getFd(),
- false);
- if (!event.isFailedAPI()) {
- parentChart.setClosed(false);
- childChart.setClosed(false);
- }
-
- if (event.isFailedAPI()) {
- childChart.setFileOpenFailed(true);
- parentChart.setFileOpenFailed(true);
- } else if (filePath
- .equals(FilePageLabels.FILE_CHART_UNKNOWN_FILE)) {
- childChart.setFileOpenFailed(true);
- parentChart.setFileOpenFailed(true);
- } else {
- childChart.setFileOpenFailed(false);
- parentChart.setFileOpenFailed(false);
- }
-
- parentChart.pushChild(childChart);
- createFileBoardItem(null, parentChart, event);
- createFileBoardItem(parentChart, childChart, event);
- if (!event.isFailedAPI()) {
- parentChart.setFileOpendTime((long) event.getLogTime());
- childChart.setFileOpendTime((long) event.getLogTime());
- } else {
- childChart.setFileOpenFailed(true);
- parentChart.setFileOpenFailed(true);
- }
- parentChart.pushEvent(event);
- childChart.pushEvent(event);
- rows.add(parentChart);
- rows.add(childChart);
- } else if (null != parentChart) {
- childChart = parentChart.findChildData(event);
- if (null == childChart) {
- childChart = new FileChartData(filePath, event.getFd(),
- false);
- if (!event.isFailedAPI()) {
- childChart.setClosed(false);
- }
- if (event.isFailedAPI()) {
- childChart.setFileOpenFailed(true);
- parentChart.setFileOpenFailed(true);
- } else if (filePath
- .equals(FilePageLabels.FILE_CHART_UNKNOWN_FILE)) {
- childChart.setFileOpenFailed(true);
- parentChart.setFileOpenFailed(true);
- } else {
- childChart.setFileOpenFailed(false);
- parentChart.setFileOpenFailed(false);
- }
- rows.add(childChart);
- parentChart.pushChild(childChart);
- createFileBoardItem(parentChart, childChart, event);
- if (!event.isFailedAPI()) {
- childChart.setFileOpendTime((long) event
- .getLogTime());
- } else {
- childChart.setFileOpenFailed(true);
- }
- childChart.pushEvent(event);
- } else if (null != childChart) {
- if (apiType == LogCenterConstants.FD_API_TYPE_CLOSE) {
- if (!event.isFailedAPI()) {
- childChart.setClosed(true);
- childChart.setFileClosedTime((long) event
- .getLogTime());
- } else {
- childChart.setFileOpenFailed(true);
- }
-
- childChart.pushEvent(event);
- findPathHashMap.remove(event.getFd());
- } else {
- childChart.pushEvent(event);
- }
- }
- parentChart.pushEvent(event);
- parentChart.setFileUsedTime(event.getLogTime());
- childChart.setFileUsedTime(event.getLogTime());
- }
- fileEventQueue.remove(0);
- }
- }
- size = rows.size();
- if (size > 0) {
- FileChartData data;
- for (int i = 0; i < size; i++) {
- data = rows.get(i);
- data.checkUpdate();
- }
- }
- }
-}
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact:
- * Hyunjong Park <phjwithyou.park@samsung.com>
- * yeongtaik byeon <yeongtaik.byeon@samsung.com>
+ * Hyeran kim <hyearn74.kim@samsung.com>
* Juyoung Kim <j0.kim@samsung.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
package org.tizen.dynamicanalyzer.ui.file;
+import java.util.List;
+
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.tizen.dynamicanalyzer.nl.FilePageLabels;
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.resources.FontResources;
+import org.tizen.dynamicanalyzer.ui.file.FilePage;
+import org.tizen.dynamicanalyzer.ui.file.manager.FileChartManager;
+import org.tizen.dynamicanalyzer.ui.file.model.FileEvent;
+import org.tizen.dynamicanalyzer.ui.file.model.FileSelectedData;
import org.tizen.dynamicanalyzer.utils.Formatter;
import org.tizen.dynamicanalyzer.widgets.da.view.DAViewComposite;
import org.tizen.dynamicanalyzer.widgets.da.view.DAViewData;
+//TODO: contains a lot legacy code, need to refatoring this class
+// TODO: comment the contents of the detail view
+// TODO: add: process name (PID), thread function name (TID)
public class FileDetailInfoView extends DAViewComposite {
private Canvas canvas = null;
private String fileName = AnalyzerLabels.EMPTY_STRING;
private long writeSize = 0;
private long totalUseTime = 0;
private int apiCount = 0;
- private int failedApiCount = 0;
-
+ private int failedApiCount = 0;
+
+ private FileChartManager fileChartManager = FileChartManager.getInstance();
+
private void init() {
fileName = AnalyzerLabels.EMPTY_STRING;
filePath = AnalyzerLabels.EMPTY_STRING;
private void updateData() {
FileApiListView view = (FileApiListView) AnalyzerManager
.getCurrentPage().getView(FilePage.apilistViewID);
- FileChartData selectData = view.getPageData();
+ FileSelectedData selectData = view.getSelectedData();
if (null == selectData) {
return;
}
-
- fileName = selectData.getFileName();
- filePath = selectData.getFilePath();
- fileSize = selectData.getFileSize();
- readSize = selectData.getReadSize();
- writeSize = selectData.getWriteSize();
- totalUseTime = (long) selectData.getFileTotalUseTime();
- apiCount = selectData.getApiCount();
- failedApiCount = selectData.getFailedApiCount();
+ List<FileEvent> events = null;
+ events = fileChartManager.getApiDB()
+ .selectAPITable(selectData.getDentry(),
+ selectData.getPid(), selectData.getTid(), selectData.isParentChart());
+ if(events != null) {
+ filePath = events.get(0).getFilePath();
+ fileName = events.get(0).getFileName();
+ fileSize = events.get(0).getFileSize();
+ apiCount = events.size();
+ }
+ events = fileChartManager.getApiDB()
+ .selectFailedAPI(selectData.getDentry(),
+ selectData.getPid(), selectData.getTid(), selectData.isParentChart());
+ if(events != null) {
+ failedApiCount = events.size();
+ }
+ // TODO define What totalUseTime
+ // totalUseTime = (long) selectData.getFileTotalUseTime();
+ // readSize = selectData.getReadSize();
+ // writeSize = selectData.getWriteSize();
+
canvas.redraw();
}
import org.tizen.dynamicanalyzer.swap.logparser.DataManagerRegistry;
import org.tizen.dynamicanalyzer.ui.page.ScreenshotTabComposite;
import org.tizen.dynamicanalyzer.widgets.da.view.DAPageComposite;
+import org.tizen.dynamicanalyzer.ui.file.manager.FileChartManager;
public class FilePage extends DAPageComposite {
// page and view IDs
+++ /dev/null
-/*
- * Dynamic Analyzer
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Hyeran kim <hyearn74.kim@samsung.com>
- * Juyoung Kim <j0.kim@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-package org.tizen.dynamicanalyzer.ui.file.view;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-import org.eclipse.nebula.widgets.grid.GridItem;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.widgets.Composite;
-import org.tizen.dynamicanalyzer.common.AnalyzerManager;
-import org.tizen.dynamicanalyzer.common.DASelectionData;
-import org.tizen.dynamicanalyzer.constant.CommonConstants;
-import org.tizen.dynamicanalyzer.error.ErrorCodeManager;
-import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
-import org.tizen.dynamicanalyzer.model.TableInput;
-import org.tizen.dynamicanalyzer.swap.model.data.FileData;
-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.utils.Formatter;
-import org.tizen.dynamicanalyzer.ui.file.FilePage;
-import org.tizen.dynamicanalyzer.ui.file.manager.FileChartManager;
-import org.tizen.dynamicanalyzer.ui.file.model.FileEvent;
-
-
-// TODO: contains a lot legacy code, need to refatoring this class
-public class FileApiListTable extends DAApiListTableComposite {
- public FileApiListTable(Composite parent, int compStyle, int tableStyle) {
- super(parent, compStyle, tableStyle);
- table.addSelectionListener(new SelectionListener() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
-
- GridItem[] items = table.getSelection();
- if (null == items) {
- return;
- }
- long startTime = 0;
- long endTime = 0;
-
- DATableDataFormat dataFormat;
- long itemTime;
- for (int i = 0; i < items.length; i++) {
- dataFormat = (DATableDataFormat) items[i].getData();
- itemTime = dataFormat.getLogData().getTime();
- if (0 == startTime) {
- startTime = itemTime;
- }
- if (startTime > itemTime) {
- startTime = itemTime;
- }
- if (endTime < itemTime) {
- endTime = itemTime;
- }
- }
- DASelectionData selData = new DASelectionData(
- FilePage.apilistViewID, startTime, endTime, items,
- table);
- AnalyzerManager.getCurrentPage().updateView(selData);
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- });
- }
-
- @Override
- protected List<TableInput> makeTableInput() {
- FileApiListView view = (FileApiListView) AnalyzerManager
- .getCurrentPage().getView(FilePage.apilistViewID);
-
- long rangeStartTime = view.getRangeStartTime();
- long rangeEndTime = view.getRangeEndTime();
-
- HashMap<String, Integer> findStartAPITableIndexHashMap = new HashMap<String, Integer>();
- List<Integer> removeTableIndex = new ArrayList<Integer>();
- List<TableInput> input = new ArrayList<TableInput>();
-
- List<FileEvent> contents = FileChartManager.getInstance().getSelectedTableAPIList();
- if(contents == null) {
- return null;
- }
- for (int i = 0; i < contents.size(); i++) {
- FileEvent contentTemp = contents.get(i);
- int selectedPid = ToolbarArea.getInstance().getSelectedPid();
- if (selectedPid != 0) {
- if (selectedPid != contentTemp.getPid()) {
- continue;
- }
- }
- List<String> contentText = new ArrayList<String>();
- List<String> contentData = new ArrayList<String>();
-
- Integer startLogIndex = 0;
- int fdApiType = contentTemp.getApiType();
-
- int seq = contentTemp.getSeqNo();
- contentText.add(0, Integer.toString(seq));
- contentData.add(Integer.toString(seq));
- long time = contentTemp.getEventTime();
-
- boolean isExistStartTimeLog = false;
- if (fdApiType == LogCenterConstants.FD_API_TYPE_READ_START
- || fdApiType == LogCenterConstants.FD_API_TYPE_WRITE_START) {
- String keString = contentTemp.getApiName()
- + contentTemp.getPid() + contentTemp.getTid();
- findStartAPITableIndexHashMap.put(keString, i);
-
- } else if (fdApiType == LogCenterConstants.FD_API_TYPE_READ_END
- || fdApiType == LogCenterConstants.FD_API_TYPE_WRITE_END) {
- String keString = contentTemp.getApiName()
- + contentTemp.getPid() + contentTemp.getTid();
- startLogIndex = findStartAPITableIndexHashMap.get(keString);
- 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 = contents.get(startLogIndex.intValue()).getEventTime();
- String timeFormat = Formatter
- .toTimeFormat(time - startTime);
- String removeTimeFormat = timeFormat.replace(
- "00:", CommonConstants.EMPTY);//$NON-NLS-1$
-
- contentText.add(removeTimeFormat); // elapsed time
- contentData.add(Long.toString(time - startTime));
-
- isExistStartTimeLog = true;
- removeTableIndex.add(startLogIndex.intValue());
- } else {
- contentText.add(Formatter.toTimeFormat(contentTemp
- .getEventTime())); // start//
- contentData.add(Long.toString(contentTemp.getEventTime()));
- contentText.add("00.000");//$NON-NLS-1$
- contentData.add("00.000");//$NON-NLS-1$
- }
- }
-
- if (!isExistStartTimeLog) {
- contentText.add(Formatter.toTimeFormat(time)); // start time
- contentData.add(Long.toString(time));
- contentText.add("00.000");//$NON-NLS-1$ //elapsed time
- contentData.add("00.000");//$NON-NLS-1$
- }
-
- 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.getReturnVal());
- contentData.add(contentTemp.getReturnVal());
-
- String errMsg = ErrorCodeManager.getInatance()
- .getErrorCode(contentTemp.getErrNo()).name();
- if (null == errMsg) {
- errMsg = "undefined error code"; //$NON-NLS-1$
- }
- contentText.add(errMsg);
- contentData.add(errMsg);
- contentText.add(Long.toString(contentTemp.getFileSize()));
- contentData.add(Long.toString(contentTemp.getFileSize()));
-
- DATableDataFormat tableData = new DATableDataFormat(
- contentTemp.getSeqNo());
- tableData.setLogData(contentTemp);
- tableData.getData().addAll(contentData);
- TableInput tableInput = new TableInput();
- tableInput.setText(contentText);
- tableInput.setData(tableData);
- if (!errMsg.contains("SUCCESS")) {//$NON-NLS-1$
- tableInput.setFailed(true);
- }
- input.add(tableInput);
-
- if (time >= rangeStartTime && time <= rangeEndTime) {
- tableInput.setInRange(true);
- }
- }
- int removeCount = 0;
- for (int index : removeTableIndex) {
- int removeIndex = index - removeCount;
- if (removeIndex > 0) {
- input.remove(removeIndex);
- removeCount++;
- }
- }
- return input;
- }
-
- protected void actionSetStartEnd(int type) {
- GridItem item = table.getItem(mousePoint);
- if (null != item) {
- FileData data = (FileData) ((DATableDataFormat) item.getData())
- .getLogData();
- long time = data.getTime();
- double startTime = -1;
- double endTime = -1;
-
- if (type == START_TIME) {
- rangeDataManager.setMarkerStartTime(time);
- startTime = time / TimelineConstants.MEGA_DOUBLE;
- endTime = rangeDataManager.getMarkerEndTime()
- / TimelineConstants.MEGA_DOUBLE;
-
- } else if (type == END_TIME) {
- rangeDataManager.setMarkerEndTime(time);
- endTime = time / TimelineConstants.MEGA_DOUBLE;
- startTime = rangeDataManager.getMarkerStartTime()
- / TimelineConstants.MEGA_DOUBLE;
- }
-
- FileChartView chartview = (FileChartView) (AnalyzerManager
- .getCurrentPage().getView(FilePage.chartViewID));
-
- chartview.setRangeMarker(startTime, endTime);
- }
- }
-}
+++ /dev/null
-/*
- * Dynamic Analyzer
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Hyeran kim <hyearn74.kim@samsung.com>
- * Juyoung Kim <j0.kim@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-package org.tizen.dynamicanalyzer.ui.file.view;
-
-import java.util.List;
-
-import org.eclipse.nebula.widgets.grid.Grid;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
-import org.tizen.dynamicanalyzer.common.AnalyzerManager;
-import org.tizen.dynamicanalyzer.common.DASelectionData;
-import org.tizen.dynamicanalyzer.nl.FilePageLabels;
-import org.tizen.dynamicanalyzer.resources.ColorResources;
-import org.tizen.dynamicanalyzer.swap.model.data.LogData;
-import org.tizen.dynamicanalyzer.ui.file.FileChartData;
-import org.tizen.dynamicanalyzer.ui.file.FilePage;
-import org.tizen.dynamicanalyzer.ui.file.model.FileEvent;
-import org.tizen.dynamicanalyzer.ui.file.model.FileSelectedData;
-import org.tizen.dynamicanalyzer.ui.network.data.NetworkDataManager;
-import org.tizen.dynamicanalyzer.ui.network.data.type.NetworkSelectionType;
-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.widgets.da.view.DAViewComposite;
-import org.tizen.dynamicanalyzer.widgets.da.view.DAViewData;
-import org.tizen.dynamicanalyzer.ui.file.manager.FileChartManager;
-
-//TODO: contains a lot legacy code, need to refatoring this class
-public class FileApiListView extends DAViewComposite {
- // TODO: comment below variables
- // TODO: remove unused variables
- private long analysisStartTime = 0;
- private long analysisEndTime = 0;
- private int preSelectionPId = 1;
- private long preAnalysisStartTime = 0;
- private long preAnalysisEndTime = 0;
- private boolean isChangedSelected = true;
- private FileSelectedData selectedData = null;
-
- private String[] columnNames = { FilePageLabels.FILE_API_LIST_VIEW_INDEX,
- FilePageLabels.FILE_API_LIST_VIEW_START_TIME,
- FilePageLabels.FILE_API_LIST_VIEW_ELAPSED_TIME,
- FilePageLabels.FILE_API_LIST_VIEW_PID,
- FilePageLabels.FILE_API_LIST_VIEW_THREAD_ID,
- FilePageLabels.FILE_API_LIST_VIEW_API,
- FilePageLabels.FILE_API_LIST_VIEW_PARAMETER,
- FilePageLabels.FILE_API_LIST_VIEW_RETURN,
- FilePageLabels.FILE_API_LIST_VIEW_ERRNO };
-
- private int[] columnSizes = { 40, 70, 100, 40, 40, 120, 250, 70, 100 };
- private int[] columnAlignment = { SWT.RIGHT, SWT.RIGHT, SWT.RIGHT,
- SWT.RIGHT, SWT.RIGHT, SWT.LEFT, SWT.LEFT, SWT.LEFT, SWT.LEFT };
-
- int[] sortTypes = { AnalyzerConstants.SORT_TYPE_NUM,
- AnalyzerConstants.SORT_TYPE_STRING,
- AnalyzerConstants.SORT_TYPE_STRING,
- AnalyzerConstants.SORT_TYPE_NUM, AnalyzerConstants.SORT_TYPE_NUM,
- AnalyzerConstants.SORT_TYPE_STRING,
- AnalyzerConstants.SORT_TYPE_STRING,
- AnalyzerConstants.SORT_TYPE_STRING,
- AnalyzerConstants.SORT_TYPE_STRING };
-
- FileApiListTable tableComp = null;
- FileChartManager manager = FileChartManager.getInstance();
-
- public FileApiListView(Composite parent, int style) {
- super(parent, style, true);
- this.setLayout(new FillLayout());
-
- setTitle(FilePageLabels.FILE_API_LIST_VIEW_TITLE);
-
- Composite contents = getContentArea();
- contents.setBackground(ColorResources.WINDOW_BG_COLOR);
- contents.setLayout(new FillLayout());
- tableComp = new FileApiListTable(contents, SWT.NONE, SWT.MULTI
- | SWT.BORDER | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL);
- tableComp.setSortTypes(sortTypes);
- tableComp.setColumnAlignment(columnAlignment);
- tableComp.setColumns(columnNames);
- tableComp.setColumnSize(columnSizes);
- tableComp.setTableName(FilePageLabels.FILE_API_LIST_VIEW_TITLE);
- contents.addControlListener(new TableColumnSizePackListener(tableComp,
- columnSizes));
- }
-
- @Override
- public void updateView() {
- if (null == tableComp || selectedData == null) {
- return;
- }
-
- long newAnalysisStartTime = 0;
- long newAnalysisEndTime = 0;
-
- // TODO: comment
- if (RangeDataManager.getInstance().isBeingAnalyzed()) {
- newAnalysisStartTime = RangeDataManager.getInstance()
- .getAnalysisStartTime();
- newAnalysisEndTime = RangeDataManager.getInstance()
- .getAnalysisEndTime();
- } else {
- newAnalysisStartTime = 0;
- newAnalysisEndTime = 0;
- }
-
- if (newAnalysisStartTime != analysisStartTime
- || newAnalysisEndTime != analysisEndTime) {
- analysisStartTime = newAnalysisStartTime;
- analysisEndTime = newAnalysisEndTime;
- tableComp.updateTable();
- return;
- }
-
- int selectedPid = ToolbarArea.getInstance().getSelectedPid();
- if (preSelectionPId != -1 && preSelectionPId != selectedPid) {
- tableComp.updateTable();
- }
- preSelectionPId = selectedPid;
-
- List<FileEvent> events = manager.getApiDB().selectAPITable(
- selectedData.getDentry(), selectedData.getPid(),
- selectedData.getTid(), selectedData.isParentChart());
- if (tableComp.getTable().getItemCount() > 0
- && events.size() != tableComp.getTable().getItemCount()) {
- manager.setSelectedTableAPIList(events);
- tableComp.updateTable();
- }
- }
-
- @Override
- public Control getControl() {
- return tableComp;
- }
-
- @Override
- public void clear() {
- tableComp.getTable().removeAll();
- }
-
- @Override
- public void updateView(DAViewData data) {
- DASelectionData selData = (DASelectionData) data;
- long selectionStartTime = selData.getStartTime();
- long selectionEndTime = selData.getEndTime();
- if (selData.getData() instanceof FileSelectedData) {
- selectedData = (FileSelectedData) selData.getData();
- if (null == selectedData) {
- return;
- }
- manager.setSelectedTableAPIList(
- manager.getApiDB().
- selectAPITable(selectedData.getDentry(),
- selectedData.getPid(),
- selectedData.getTid(),
- selectedData.isParentChart()));
-
- tableComp.updateTable();
- tableComp.setSelectionByTime(selectionStartTime,
- selectionEndTime);
- isChangedSelected = true;
- }
- }
-
-
- public FileSelectedData getSelectedData() {
- return selectedData;
- }
-
- public long getRangeStartTime() {
- return analysisStartTime;
- }
-
- public long getRangeEndTime() {
- return analysisEndTime;
- }
-}
+++ /dev/null
-/*
- * Dynamic Analyzer
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Hyeran kim <hyearn74.kim@samsung.com>
- * Juyoung Kim <j0.kim@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-package org.tizen.dynamicanalyzer.ui.file.view;
-
-import java.util.List;
-
-import org.eclipse.swt.custom.StackLayout;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.tizen.dynamicanalyzer.common.AnalyzerManager;
-import org.tizen.dynamicanalyzer.common.DASelectionData;
-import org.tizen.dynamicanalyzer.nl.FilePageLabels;
-import org.tizen.dynamicanalyzer.resources.ColorResources;
-import org.tizen.dynamicanalyzer.resources.FontResources;
-import org.tizen.dynamicanalyzer.swap.model.data.LogData;
-import org.tizen.dynamicanalyzer.ui.common.SetRangeMarkerMouseMoveListener;
-import org.tizen.dynamicanalyzer.ui.common.UICommonConstants;
-import org.tizen.dynamicanalyzer.ui.file.FilePage;
-import org.tizen.dynamicanalyzer.ui.file.manager.FileChartManager;
-import org.tizen.dynamicanalyzer.ui.file.model.FileEvent;
-import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
-import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
-import org.tizen.dynamicanalyzer.ui.timeline.logparser.LifecycleLogParser;
-import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
-import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotIntervalMarker;
-import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
-import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardItem;
-import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardSelectionListener;
-import org.tizen.dynamicanalyzer.widgets.da.view.DAViewComposite;
-import org.tizen.dynamicanalyzer.widgets.da.view.DAViewData;
-import org.tizen.dynamicanalyzer.widgets.timeline.DATimeline;
-
-public class FileChartView extends DAViewComposite {
- // TODO: the height can be changed
- public final static int FILE_CHART_HEIGHT = 40;
-
- private final Composite contents;
- private FileChartBoard fileChartBoard;
- private final StackLayout stackLayout;
- private DAChartBoardItem lastSelectedItemForSummary = null;
-
- private final RangeDataManager rangeDataManager = RangeDataManager
- .getInstance();
- private FileChartManager chartManager = FileChartManager.getInstance();
-
- public FileChartView(Composite parent, int style) {
- super(parent, style, false);
- this.setLayout(new FillLayout());
-
- setTitle(FilePageLabels.FILE_CHART_FILE);
-
- contents = getContentArea();
- contents.setBackground(ColorResources.WINDOW_BG_COLOR);
- stackLayout = new StackLayout();
- contents.setLayout(stackLayout);
- fileChartBoard = new FileChartBoard(contents, FilePageLabels.FILE_CHART_FILE);
- fileChartBoard.setNameFont(FontResources.CHART_NAME_FONT);
- fileChartBoard.addSelectionListener(new DAChartBoardSelectionListener() {
- @Override
- public void handleSelectionEvent(DAChartBoardItem item) {
- lastSelectedItemForSummary = item;
- AnalyzerManager
- .getCurrentPage().updateView(
- new DASelectionData(
- FilePage.chartViewID,
- (long) (((DAChartPlotIntervalMarker) fileChartBoard
- .getMarkers()
- .get(UICommonConstants.SELECTION_MARKER_INDEX))
- // TODO: use utility API
- .getStartVal() * TimelineConstants.MEGA_DOUBLE),
- (long) (((DAChartPlotIntervalMarker) fileChartBoard
- .getMarkers()
- .get(UICommonConstants.SELECTION_MARKER_INDEX))
- // TODO: use utility API
- .getEndVal() * TimelineConstants.MEGA_DOUBLE),
- item.getData(), null));
- }
- });
-
- initIntervalMarkers(fileChartBoard);
-
- stackLayout.topControl = fileChartBoard;
-
- // Making title composition using resource of timeline pages.
- fileChartBoard.makeDefaultTitleComposite(FilePageLabels.FILE_CHART_FILE,
- 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 = fileChartBoard.getTimeline();
-
- timeline.setTimeTickFont(FontResources.TIMELINE_TICK_FONT);
- timeline.setTimeBalloonFont(FontResources.TIMELINE_BALLOON_FONT);
-
- LifecycleLogParser.getInstance().registerLifecycleBar(
- fileChartBoard.getLifecycleBar());
- LifecycleLogParser.getInstance().registerTimeline(timeline);
-
- timeline.addMouseMoveListener(new SetRangeMarkerMouseMoveListener(
- rangeDataManager, fileChartBoard, timeline));
- }
-
- @Override
- public void updateView() {
- fileChartBoard.updateChart();
-
- fileChartBoard.setTotalEndTime(ToolbarArea.getInstance().getTime());
-
- fileChartBoard.setTimelineMarkerStartTime(rangeDataManager
- .getMarkerStartTime() / TimelineConstants.MEGA_DOUBLE);
- fileChartBoard.setTimelineMarkerEndTime(rangeDataManager.getMarkerEndTime()
- / TimelineConstants.MEGA_DOUBLE);
-
- if (RangeDataManager.getInstance().isBeingAnalyzed()) {
- ((DAChartPlotIntervalMarker) fileChartBoard.getMarkers().get(
- UICommonConstants.RANGE_ANALYSIS_MARKER_INDEX))
- .setInterval(rangeDataManager.getAnalysisStartTime()
- / TimelineConstants.MEGA_DOUBLE,
- rangeDataManager.getAnalysisEndTime()
- / TimelineConstants.MEGA_DOUBLE);
- } else {
- ((DAChartPlotIntervalMarker) fileChartBoard.getMarkers().get(
- UICommonConstants.RANGE_ANALYSIS_MARKER_INDEX))
- .setInterval(-1, -1);
- }
-
- ((DAChartPlotIntervalMarker) fileChartBoard.getMarkers().get(
- UICommonConstants.RANGE_MARKER_INDEX)).setInterval(
- rangeDataManager.getMarkerStartTime()
- / TimelineConstants.MEGA_DOUBLE,
- rangeDataManager.getMarkerEndTime()
- / TimelineConstants.MEGA_DOUBLE);
-
- }
-
- @Override
- // TODO: need to refactoring
- public void updateView(DAViewData data) {
- fileChartBoard.updateChart();
- if (data instanceof DASelectionData) {
- DASelectionData selData = (DASelectionData) data;
- long dataTime = -1;
-
- if (selData.isLogData()) {
- Object obData = selData.getData();
- if (null != obData && (obData instanceof LogData)) { // summary
- LogData ldata = (LogData) obData;
- dataTime = ldata.getTime();
-
- int seq = ldata.getSeq();
- List<FileEvent> event = chartManager.getApiDB().selectFileEventBySeq(seq);
- int selectedIndex[] = fileChartBoard.getChartIndex(event.get(0));
- fileChartBoard.selectItem(selectedIndex[0], selectedIndex[1]);
-
- if (null != lastSelectedItemForSummary) {
- AnalyzerManager.getCurrentPage().updateView(
- new DASelectionData(FilePage.chartViewID,
- dataTime, dataTime,
- lastSelectedItemForSummary.getData(),
- null));
- }
- }
- } else {
- dataTime = selData.getStartTime();
- }
- double startTime = dataTime / TimelineConstants.MEGA_DOUBLE;
- double endTime = selData.getEndTime() / TimelineConstants.MEGA_DOUBLE;
-
- DAChartPlotIntervalMarker intervalMarker = (DAChartPlotIntervalMarker)fileChartBoard
- .getMarkers().get(UICommonConstants.SELECTION_MARKER_INDEX);
- intervalMarker.setInterval(startTime, endTime);
-
- }
- }
-
- @Override
- public void clear() {
- fileChartBoard.clear();
- initIntervalMarkers(fileChartBoard);
- chartManager.getFileChartDataMaker().clear();
- }
-
- @Override
- public Control getControl() {
- return fileChartBoard;
- }
-
- private void initIntervalMarkers(DAChartBoard board) {
- // selection marker
- DAChartPlotIntervalMarker selectionMarker = new DAChartPlotIntervalMarker(
- -1, -1, DAChartPlotIntervalMarker.INTERVAL_MARKER_STYLE_AREA);
- selectionMarker.setBackgroundColor(ColorResources.SELECTION_RANGE);
- selectionMarker.setAlpha((int) (255 * 0.25));
- board.addIntervalMarker(selectionMarker);
-
- // range analysis marker
- DAChartPlotIntervalMarker rangeAnalyzeMarker = new DAChartPlotIntervalMarker(
- -1, -1, DAChartPlotIntervalMarker.INTERVAL_MARKER_STYLE_AREA);
- rangeAnalyzeMarker.setBackgroundColor(ColorResources.YELLOW);
- rangeAnalyzeMarker.setAlpha((int) (255 * 0.25));
- board.addIntervalMarker(rangeAnalyzeMarker);
-
- // range marker
- DAChartPlotIntervalMarker rangeMarker = new DAChartPlotIntervalMarker(
- -1, -1, DAChartPlotIntervalMarker.INTERVAL_MARKER_STYLE_LINE);
- rangeMarker.setForegroundColor(ColorResources.RED);
- rangeMarker.setAlpha((int) (255 * 0.25));
- board.addIntervalMarker(rangeMarker);
- }
-
- public void setRangeMarker(double starttime, double endtime) {
- fileChartBoard.setTimelineMarkerStartTime(starttime);
- fileChartBoard.setTimelineMarkerEndTime(endtime);
-
- ((DAChartPlotIntervalMarker) fileChartBoard.getMarkers().get(
- UICommonConstants.RANGE_MARKER_INDEX)).setInterval(
- starttime, endtime);
- }
-
-}
+++ /dev/null
-/*
- * Dynamic Analyzer
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Hyeran kim <hyearn74.kim@samsung.com>
- * Juyoung Kim <j0.kim@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-package org.tizen.dynamicanalyzer.ui.file.view;
-
-import java.util.List;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.PaintEvent;
-import org.eclipse.swt.events.PaintListener;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.widgets.Canvas;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.tizen.dynamicanalyzer.common.AnalyzerManager;
-import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
-import org.tizen.dynamicanalyzer.nl.FilePageLabels;
-import org.tizen.dynamicanalyzer.resources.ColorResources;
-import org.tizen.dynamicanalyzer.resources.FontResources;
-import org.tizen.dynamicanalyzer.ui.file.FilePage;
-import org.tizen.dynamicanalyzer.ui.file.manager.FileChartManager;
-import org.tizen.dynamicanalyzer.ui.file.model.FileEvent;
-import org.tizen.dynamicanalyzer.ui.file.model.FileSelectedData;
-import org.tizen.dynamicanalyzer.utils.Formatter;
-import org.tizen.dynamicanalyzer.widgets.da.view.DAViewComposite;
-import org.tizen.dynamicanalyzer.widgets.da.view.DAViewData;
-
-//TODO: contains a lot legacy code, need to refatoring this class
-// TODO: comment the contents of the detail view
-// TODO: add: process name (PID), thread function name (TID)
-public class FileDetailInfoView extends DAViewComposite {
- private Canvas canvas = null;
- private String fileName = AnalyzerLabels.EMPTY_STRING;
- private String filePath = AnalyzerLabels.EMPTY_STRING;
- private long fileSize = 0;
- private long readSize = 0;
- private long writeSize = 0;
- private long totalUseTime = 0;
- private int apiCount = 0;
- private int failedApiCount = 0;
-
- private FileChartManager fileChartManager = FileChartManager.getInstance();
-
- private void init() {
- fileName = AnalyzerLabels.EMPTY_STRING;
- filePath = AnalyzerLabels.EMPTY_STRING;
- fileSize = 0;
- readSize = 0;
- writeSize = 0;
- totalUseTime = 0;
- apiCount = 0;
- failedApiCount = 0;
- }
-
- public FileDetailInfoView(Composite parent, int style) {
- super(parent, style, true);
- this.setLayout(new FillLayout());
-
- setTitle(FilePageLabels.FILE_DETAILS_TITLE);
-
- Composite contents = getContentArea();
- contents.setBackground(ColorResources.VIEW_BG_COLOR);
- contents.setLayout(new FillLayout());
- canvas = new Canvas(contents, SWT.TRANSPARENT);
- canvas.addPaintListener(new PaintListener() {
-
- @Override
- public void paintControl(PaintEvent e) {
- int x = 0;
- int y = 0;
- Rectangle rect = canvas.getBounds();
- e.gc.setBackground(ColorResources.VIEW_BG_COLOR);
- e.gc.fillRectangle(rect.x, rect.y, rect.width, rect.height);
- e.gc.setForeground(ColorResources.TABLE_CONTENTS_FONT_COLOR);
- e.gc.setFont(FontResources.DETAIL_INFO_FONT);
-
- String fName = FilePageLabels.FILE_DETAILS_FILE_NAME + fileName;
- Point textSize = e.gc.textExtent(fName, SWT.DRAW_MNEMONIC);
- if (textSize.x > rect.width) {
- fName = FilePageLabels.FILE_DETAILS_FILE_NAME_NEWLINE
- + fileName;
- }
- int fontHeight = textSize.y + 5;
- e.gc.drawString(fName, x += 10, y += fontHeight);
-
- // file path bolck
- {
- String pathLabel = FilePageLabels.FILE_DETAILS_FILE_PATH;
- e.gc.drawString(pathLabel, x, y + fontHeight);
- Point pathSize = e.gc.textExtent(pathLabel,
- SWT.DRAW_MNEMONIC);
- int xPos = x + pathSize.x;
- int width = rect.width - xPos;
- String text = filePath;
- if (text.length() > 0) {
- while (text.length() > 0) {
- Point tSize = e.gc.textExtent(text,
- SWT.DRAW_MNEMONIC);
- String inputText = AnalyzerLabels.EMPTY_STRING;
- if (tSize.x > width) {
- int strLen = (width * text.length()) / tSize.x;
- inputText += text.substring(0, strLen - 1);
- text = text.substring(strLen - 1, text.length());
- } else {
- inputText += text;
- text = AnalyzerLabels.EMPTY_STRING;
- }
- e.gc.drawString(inputText, xPos, y += fontHeight);
- }
- } else {
- y += fontHeight;
- }
- }
-
- e.gc.drawString(
- FilePageLabels.FILE_DETAILS_TOTAL_SIZE
- + Long.toString(fileSize), x, y += fontHeight);
- e.gc.drawString(
- FilePageLabels.FILE_DETAILS_READ_SIZE
- + Long.toString(readSize), x, y += fontHeight);
- e.gc.drawString(
- FilePageLabels.FILE_DETAILS_WRITE_SIZE
- + Long.toString(writeSize), x, y += fontHeight);
- e.gc.drawString(FilePageLabels.FILE_DETAILS_TOTAL_USE_TIME
- + Formatter.toTimeFormat(totalUseTime)
- + FilePageLabels.TIME_MS, x, y += fontHeight);
- e.gc.drawString(
- FilePageLabels.FILE_DETAILS_API_COUNT
- + Integer.toString(apiCount), x,
- y += fontHeight);
- e.gc.drawString(FilePageLabels.FILE_DETAILS_FAILED_API_COUNT
- + Integer.toString(failedApiCount), x, y += fontHeight);
- }
- });
- }
-
- @Override
- public void updateView(DAViewData data) {
- updateData();
- }
-
- @Override
- public void updateView() {
- updateData();
- }
-
- private void updateData() {
- FileApiListView view = (FileApiListView) AnalyzerManager
- .getCurrentPage().getView(FilePage.apilistViewID);
- FileSelectedData selectData = view.getSelectedData();
-
- if (null == selectData) {
- return;
- }
- List<FileEvent> events = null;
- events = fileChartManager.getApiDB()
- .selectAPITable(selectData.getDentry(),
- selectData.getPid(), selectData.getTid(), selectData.isParentChart());
- if(events != null) {
- filePath = events.get(0).getFilePath();
- fileName = events.get(0).getFileName();
- fileSize = events.get(0).getFileSize();
- apiCount = events.size();
- }
- events = fileChartManager.getApiDB()
- .selectFailedAPI(selectData.getDentry(),
- selectData.getPid(), selectData.getTid(), selectData.isParentChart());
- if(events != null) {
- failedApiCount = events.size();
- }
- // TODO define What totalUseTime
- // totalUseTime = (long) selectData.getFileTotalUseTime();
- // readSize = selectData.getReadSize();
- // writeSize = selectData.getWriteSize();
-
- canvas.redraw();
- }
-
- @Override
- public Control getControl() {
- return canvas;
- }
-
- @Override
- public void clear() {
- init();
- canvas.redraw();
- }
-}