From: hyeran74.kim Date: Wed, 29 Oct 2014 07:04:21 +0000 (+0900) Subject: Merge remote-tracking branch 'origin/tizen' into da-file X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=eda2832b6684705eccd199bc3be3a5dd5d9cf5d5;p=sdk%2Ftools%2Fdynamic-analyzer.git Merge remote-tracking branch 'origin/tizen' into da-file Conflicts: org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/FileApiListTable.java org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/FileChartView.java org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/data/FileApiDB.java org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/manager/FileDataMaker.java org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/model/FileEvent.java Change-Id: I9c4cf085acc8d6b2bceedf60035f218bf91d33c7 Signed-off-by: hyeran74.kim --- eda2832b6684705eccd199bc3be3a5dd5d9cf5d5 diff --cc org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/FileApiListTable.java index 61f9011,b16cc9d..f3c6369 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/FileApiListTable.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/FileApiListTable.java @@@ -113,155 -105,115 +113,155 @@@ public class FileApiListTable extends D List removeTableIndex = new ArrayList(); List input = new ArrayList(); - List contents = FileDataManager.getInstance().getSelectedTableAPIList(); - if(contents == null) { - return null; - } - for (int i = 0; i < contents.size(); i++) { - FileEvent contentTemp = contents.get(i); - List contentText = new ArrayList(); - List contentData = new ArrayList(); - - Integer startLogIndex = 0; - int fdApiType = contentTemp.getFdApiType(); - - long seq = contentTemp.getSeq(); - contentText.add(0, Long.toString(seq)); - contentData.add(Long.toString(seq)); - long time = contentTemp.getTime(); - - boolean isExistStartTimeLog = false; - if (fdApiType == LogCenterConstants.FD_API_TYPE_READ_START - || fdApiType == LogCenterConstants.FD_API_TYPE_WRITE_START - || fdApiType == LogCenterConstants.FD_API_TYPE_LOCK_START) { - String keString = contentTemp.getApiName() - + contentTemp.getPid() + contentTemp.getTid() + contentTemp.getFdValue(); - findStartAPITableIndexHashMap.put(keString, i); - - } else if (fdApiType == LogCenterConstants.FD_API_TYPE_READ_END - || fdApiType == LogCenterConstants.FD_API_TYPE_WRITE_END - || fdApiType == LogCenterConstants.FD_API_TYPE_LOCK_END) { - String keString = contentTemp.getApiName() - + contentTemp.getPid() + contentTemp.getTid() + contentTemp.getFdValue(); - startLogIndex = findStartAPITableIndexHashMap.get(keString); - findStartAPITableIndexHashMap.remove(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()).getTime(); - 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)); + FileSelectedData selectedData = fileDataManager.getSelectedData(); + ResultSet rs = fileDataManager.getApiDB().selectAPI( + selectedData.getFileId(), + selectedData.getAccessorId(), + selectedData.isParentChart()); + FileAccessor accessor = selectedData.getFileAccessor(); + boolean isParentChart = selectedData.isParentChart(); + String filePath = null; + int pid = -1; + int tid = -1; + if (rs != null) { + try { + int i = -1; + int index = 0; + while (rs.next()) { + i++; + index++; - isExistStartTimeLog = true; - removeTableIndex.add(startLogIndex.intValue()); - } else { - contentText.add(Formatter.toTimeFormat(contentTemp - .getTime())); // start// - contentData.add(Long.toString(contentTemp.getTime())); - contentText.add("00.000");//$NON-NLS-1$ - contentData.add("00.000");//$NON-NLS-1$ - } - } + List contentText = new ArrayList(); + List contentData = new ArrayList(); - + Integer startLogIndex = 0; - int seq = rs.getInt(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$ - } ++ long seq = rs.getLong(1); + long fd = rs.getLong(2); + int fdApiType = rs.getInt(3); + long time = rs.getLong(4); + int apiId = rs.getInt(5); + long errno = rs.getLong(6); + long fileSize = rs.getLong(7); + long ioSize = rs.getLong(8); + String returns = rs.getString(9); + String args = rs.getString(10); + + if(isParentChart){ + filePath = rs.getString(11); + pid = rs.getInt(12); + tid = rs.getInt(13); + }else{ + filePath = accessor.getFilePath(); + pid = accessor.getPid(); + tid = accessor.getTid(); + } + + FileEvent fileEvent = new FileEvent(seq, filePath, pid, + tid, fd, fdApiType, apiId, time, fileSize, ioSize, + args, returns, errno); + + String apiName = Global.getFunctionName(apiId); + long startTime = 0; + + boolean isExistStartTimeLog = false; + if (fdApiType == LogCenterConstants.FD_API_TYPE_READ_START + || fdApiType == LogCenterConstants.FD_API_TYPE_WRITE_START + || fdApiType == LogCenterConstants.FD_API_TYPE_LOCK_START) { + String keString = apiName + pid + tid + fd; + findStartAPITableIndexHashMap.put(keString, i); + findStartTimeHashMap.put(i, time); + index--; + } else if (fdApiType == LogCenterConstants.FD_API_TYPE_READ_END + || fdApiType == LogCenterConstants.FD_API_TYPE_WRITE_END + || fdApiType == LogCenterConstants.FD_API_TYPE_LOCK_END) { + String keString = apiName + pid + tid + fd; + startLogIndex = findStartAPITableIndexHashMap.get(keString); + findStartAPITableIndexHashMap.remove(keString); + if (null != startLogIndex) { + contentText.add(input.get(startLogIndex.intValue()) + .getText().get(1)); // start time + contentData.add(input.get(startLogIndex.intValue()) + .getText().get(1)); - contentText.add(Integer.toString(contentTemp.getPid())); - contentData.add(Integer.toString(contentTemp.getPid())); + startTime = findStartTimeHashMap.get(startLogIndex); + String timeFormat = Formatter + .toTimeFormat(time - startTime); + String removeTimeFormat = timeFormat.replace( + "00:", CommonConstants.EMPTY);//$NON-NLS-1$ - contentText.add(Integer.toString(contentTemp.getTid())); - contentData.add(Integer.toString(contentTemp.getTid())); - - contentText.add(Long.toString(contentTemp.getFdValue())); - contentData.add(Long.toString(contentTemp.getFdValue())); + contentText.add(removeTimeFormat); // elapsed time + contentData.add(Long.toString(time - startTime)); + + isExistStartTimeLog = true; + removeTableIndex.add(startLogIndex.intValue()); + } else { + contentText.add(Formatter.toTimeFormat(time)); // start// + contentData.add(Long.toString(time)); + contentText.add("00.000");//$NON-NLS-1$ + contentData.add("00.000");//$NON-NLS-1$ + } + } - contentText.add(Global.getFunctionName(contentTemp.getApiId())); - contentData.add(Global.getFunctionName(contentTemp.getApiId())); + 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(contentTemp.getArgs()); - contentData.add(contentTemp.getArgs()); + contentText.add(0, Integer.toString(index)); + contentData.add(0, Integer.toString(index)); + + contentText.add(Integer.toString(pid)); + contentData.add(Integer.toString(pid)); - contentText.add(contentTemp.getReturn()); - contentData.add(contentTemp.getReturn()); + contentText.add(Integer.toString(tid)); + contentData.add(Integer.toString(tid)); + + contentText.add(Long.toString(fd)); + contentData.add(Long.toString(fd)); - 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.getSeq()); - 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); + contentText.add(apiName); + contentData.add(apiName); + + contentText.add(args); + contentData.add(args); + + contentText.add(returns); + contentData.add(returns); + - contentText.add(Integer.toString(seq)); - contentData.add(Integer.toString(seq)); ++ contentText.add(Long.toString(seq)); ++ contentData.add(Long.toString(seq)); + + String errMsg = ErrorCodeManager.getInatance() + .getErrorCode(errno).name(); + if (null == errMsg) { + errMsg = "undefined error code"; //$NON-NLS-1$ + } + + // create DATableDataFormat + DATableDataFormat tableData = new DATableDataFormat(seq); + tableData.setLogData(fileEvent); + 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); + if (time >= rangeStartTime && time <= rangeEndTime) { + tableInput.setInRange(true); + } + } + } catch (SQLException e) { + e.printStackTrace(); + } finally { + SqlConnectionManager.releaseResultSet(rs); } } + int removeCount = 0; for (int index : removeTableIndex) { int removeIndex = index - removeCount; diff --cc org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/FileChart.java index 4eb8165,a101c2c..3ad7b18 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/FileChart.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/FileChart.java @@@ -213,10 -251,11 +213,10 @@@ public class FileChart for(int i =0; i < statusList.size(); i++) { FileStatus data = statusList.get(i); - if(!data.getFilePath().equals(this.filePath) - || data.getErrNo() != 0) { + if(data.getFileId() != this.fileId) { continue; } - double time = Formatter.toLongTimeForDoubleTime(data.getEventTime()); + double time = Formatter.longTimeToDoubleTime(data.getEventTime()); switch(data.getApiType()){ case LogCenterConstants.FD_API_TYPE_OPEN: if(openNum > 0){ // duplicated open diff --cc org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/FileChartBoard.java index 6f45039,0ceb3f3..8f5470e --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/FileChartBoard.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/FileChartBoard.java @@@ -241,20 -216,11 +241,12 @@@ public class FileChartBoard extends DAC initFileChart(chart, false); } else { // parent chart row String fileName = fileChart.getFileName(); - String title = fileName; - int maxLen = DALimit.MAX_STRING_LENGTH; - if (fileName.length() > maxLen && fileName.length() < maxLen * 2) { - title = fileName.substring(0, maxLen) + CommonConstants.NEW_LINE - + fileName.substring(maxLen, fileName.length()); - } else if (fileName.length() >= maxLen *2) { - title = fileName.substring(0, maxLen) + CommonConstants.NEW_LINE - + fileName.substring(maxLen, maxLen*2 - 1) + "..."; - } + String title = splitTitle(fileName, DALimit.MAX_STRING_LENGTH); item = new DAChartBoardItem(this, title); - item.setData(new FileSelectedData(fileChart.getFilePath(), - fileChart.getPid(), fileChart.getTid(), fileChart.getFd(), - fileChart.getFileSize(), true)); + + // add a selected data + item.setData(new FileSelectedData(fileChart.getFileId(), true)); + chart = item.getChart(); initFileChart(chart, true); } @@@ -262,7 -228,15 +254,7 @@@ fileChart.setItem(item); chart.redraw(); } - + - private String splitTitle(String name, int maxLen) { - String title = name; - if (name.length() > maxLen ) { - title = name.substring(0, maxLen) + "..."; - } - return title; - } - /** * update file open status */ diff --cc org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/FileChartView.java index 4b66e54,a61c7f1..9e7f52a --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/FileChartView.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/FileChartView.java @@@ -26,9 -26,6 +26,8 @@@ package org.tizen.dynamicanalyzer.ui.file; +import java.sql.ResultSet; +import java.sql.SQLException; - import org.eclipse.swt.custom.StackLayout; import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.widgets.Composite; @@@ -162,28 -165,19 +161,29 @@@ public class FileChartView extends DAVi if (null != obData && (obData instanceof LogData)) { // summary LogData ldata = (LogData) obData; dataTime = ldata.getTime(); - int seq = ldata.getSeq(); ++ + long seq = ldata.getSeq(); - FileEvent event = chartManager.getApiDB().selectFileEventBySeq(seq); - if(event != null) { - int selectedIndex[] = fileChartBoard.getChartIndex(event); - fileChartBoard.selectItem(selectedIndex[0], selectedIndex[1]); - if (null != lastSelectedItemForSummary) { - AnalyzerManager.getCurrentPage().updateView( - new DASelectionData(FilePage.chartViewID, - dataTime, dataTime, - lastSelectedItemForSummary.getData(), - null)); + + ResultSet rs = chartManager.getApiDB().selectFileEventBySeq(seq); + if (rs != null) { + try { + if (rs.next()) { + int selectedIndex[] = fileChartBoard.getChartIndex(rs.getInt(1)); + fileChartBoard.selectItem(selectedIndex[0], selectedIndex[1]); + if (null != lastSelectedItemForSummary) { + AnalyzerManager.getCurrentPage().updateView( + new DASelectionData(FilePage.chartViewID, + dataTime, dataTime, + lastSelectedItemForSummary.getData(), + null)); + } + } + } catch (SQLException e) { + e.printStackTrace(); + } finally { + SqlConnectionManager.releaseResultSet(rs); } - } // else, no need to update + } } } else { dataTime = selData.getStartTime(); diff --cc org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/data/FileApiDB.java index 799938a,9ba6b7a..d72e7f7 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/data/FileApiDB.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/data/FileApiDB.java @@@ -78,23 -78,25 +78,22 @@@ public class FileApiDB extends DBTable @Override public String getTableName() { - return TABLE_NAME; + return API_TABLE; } - + public FileApiDB() { - addColumn(new DBColumn(COLUMN.SEQUENCE_NUMBER.name, DBConstants.NOT_NULL, DBConstants.DBTYPE_INT4)); - addColumn(new DBColumn(COLUMN.SEQ.getName(), DBConstants.NOT_NULL, DBConstants.LONG)); - addColumn(new DBColumn(COLUMN.FILE_PATH.getName(), DBConstants.EMPTY, DBConstants.BIG_TEXT)); - addColumn(new DBColumn(COLUMN.PID.getName(), DBConstants.NOT_NULL, DBConstants.INTEGER)); - addColumn(new DBColumn(COLUMN.TID.getName(), DBConstants.NOT_NULL, DBConstants.INTEGER)); - addColumn(new DBColumn(COLUMN.FD.getName(), DBConstants.EMPTY, DBConstants.LONG)); - addColumn(new DBColumn(COLUMN.API_TYPE.getName(), DBConstants.NOT_NULL, DBConstants.INTEGER)); - addColumn(new DBColumn(COLUMN.EVENT_TIME.getName(), DBConstants.NOT_NULL, DBConstants.LONG)); - addColumn(new DBColumn(COLUMN.API_ID.getName(), DBConstants.EMPTY, DBConstants.INTEGER)); - addColumn(new DBColumn(COLUMN.ERRNO.getName(), DBConstants.EMPTY, DBConstants.LONG)); - addColumn(new DBColumn(COLUMN.IO_SIZE.getName(), DBConstants.EMPTY, DBConstants.LONG)); - addColumn(new DBColumn(COLUMN.FILE_SIZE.getName(), DBConstants.EMPTY, DBConstants.LONG)); - addColumn(new DBColumn(COLUMN.SIZE.getName(), DBConstants.EMPTY, DBConstants.LONG)); - addColumn(new DBColumn(COLUMN.RETURN_VALUE.getName(), DBConstants.EMPTY, DBConstants.BIG_TEXT)); - addColumn(new DBColumn(COLUMN.ARGS.getName(), DBConstants.EMPTY, DBConstants.BIG_TEXT)); - addColumn(new DBColumn(COLUMN.TARGET.getName(), DBConstants.NOT_NULL, DBConstants.BOOLEAN)); ++ addColumn(new DBColumn(COLUMN.SEQUENCE_NUMBER.name, DBConstants.NOT_NULL, DBConstants.DBTYPE_LONG)); + addColumn(new DBColumn(COLUMN.FILE_ID.name, DBConstants.NOT_NULL, DBConstants.DBTYPE_INT4)); + addColumn(new DBColumn(COLUMN.ACCESSOR_ID.name, DBConstants.NOT_NULL, DBConstants.DBTYPE_INT4)); + addColumn(new DBColumn(COLUMN.FD.name, DBConstants.EMPTY, DBConstants.DBTYPE_LONG)); + addColumn(new DBColumn(COLUMN.API_TYPE.name, DBConstants.NOT_NULL, DBConstants.DBTYPE_INT4)); + addColumn(new DBColumn(COLUMN.EVENT_TIME.name, DBConstants.NOT_NULL, DBConstants.DBTYPE_LONG)); + addColumn(new DBColumn(COLUMN.API_ID.name, DBConstants.EMPTY, DBConstants.DBTYPE_INT4)); + addColumn(new DBColumn(COLUMN.ERRNO.name, DBConstants.EMPTY, DBConstants.DBTYPE_LONG)); + addColumn(new DBColumn(COLUMN.IO_SIZE.name, DBConstants.EMPTY, DBConstants.DBTYPE_LONG)); + addColumn(new DBColumn(COLUMN.FILE_SIZE.name, DBConstants.EMPTY, DBConstants.DBTYPE_LONG)); + addColumn(new DBColumn(COLUMN.RETURN_VALUE.name, DBConstants.EMPTY, DBTYPE_RETUREN_VALUE)); + addColumn(new DBColumn(COLUMN.ARGUMENTS_VALUE.name, DBConstants.EMPTY, DBTYPE_ARGUMENTS_VALUE)); - } private static final String selectAllColumn = selectAllColumn(); @@@ -129,96 -148,85 +128,96 @@@ private static final String SELECT_ALL = "select " + selectAllColumn + " from " - + TABLE_NAME + " where " - + COLUMN.TARGET.getName() + " = 'true'"; + + API_TABLE; - public void insert(List> insertData) { - insertData(insertData); + public ResultSet executeQuery(String query) { + ResultSet rs = SqlConnectionManager.executeQueryRS(query); + return rs; } - // for updating api series chart - public List selectAPISeries(double visibleStartTime, - double visibleEndTime) { - double selectStartTime = visibleStartTime * TimelineConstants.MEGA_DOUBLE; - double selectEndTime = visibleEndTime * TimelineConstants.MEGA_DOUBLE; - - String query = String.format(SELECT_API_SERIES, selectStartTime, selectEndTime); - - List> result = SqlConnectionManager.executeQuery(query); - if (null == result || result.size() == 0 || result.get(0).size() == 0) { - return null; - } - List apiList = new ArrayList(); - for (List data : result) { - apiList.add(new FileEvent(data)); + public List executeQueryRS(String query) { + List resultData = new ArrayList(); + ResultSet rs = SqlConnectionManager.executeQueryRS(query); + if (rs != null) { + try { + while (rs.next()) { + FileEvent event= getDataFromResultSet(rs); + if (event != null) { + resultData.add(event); + } + } + } catch (SQLException e) { + e.printStackTrace(); + } finally { + SqlConnectionManager.releaseResultSet(rs); + } } - return apiList; + return resultData; } - // for updating api series chart - public List selectFailedAPISeries(double visibleStartTime, - double visibleEndTime) { - double selectStartTime = visibleStartTime - * TimelineConstants.MEGA_DOUBLE; - double selectEndTime = visibleEndTime * TimelineConstants.MEGA_DOUBLE; - - String query = String.format(SELECT_FAILED_API_SERIES, selectStartTime, - selectEndTime); - - List> result = SqlConnectionManager.executeQuery(query); - if (null == result || result.size() == 0 || result.get(0).size() == 0) { + public FileEvent getDataFromResultSet(ResultSet rs) { + FileEvent event = null; + try { + event = new FileEvent( - rs.getInt(COLUMN.SEQUENCE_NUMBER.index), ++ rs.getLong(COLUMN.SEQUENCE_NUMBER.index), + rs.getInt(COLUMN.FILE_ID.index), + rs.getInt(COLUMN.ACCESSOR_ID.index), + rs.getLong(COLUMN.FD.index), + rs.getInt(COLUMN.API_TYPE.index), + rs.getInt(COLUMN.API_ID.index), + rs.getLong(COLUMN.EVENT_TIME.index), + rs.getLong(COLUMN.FILE_SIZE.index), + rs.getLong(COLUMN.IO_SIZE.index), + rs.getString(COLUMN.ARGUMENTS_VALUE.index), + rs.getString(COLUMN.RETURN_VALUE.index), + rs.getLong(COLUMN.ERRNO.index) + ); + } catch (SQLException e) { + e.printStackTrace(); return null; } - List apiList = new ArrayList(); - for (List data : result) { - apiList.add(new FileEvent(data)); - } - return apiList; + return event; } - - // for updating api table view - public List selectAPITable(String filePath, int pid, int tid, + + public void insert(List> insertData) { + insertData(insertData); + } + + // for updating api table view and detail view + public ResultSet selectAPI(int fileId, int accessorId, boolean isParentChart) { - String query = String.format(SELECT_APIS_FOR_CHILD, filePath, pid, tid); + String query = null; if (isParentChart) { - query = String - .format(SELECT_APIS_FOR_PARENT, filePath); - } - List> result = SqlConnectionManager.executeQuery(query); - if (null == result || result.size() == 0 || result.get(0).size() == 0) { - return null; + query = String.format(SELECT_APIS_FOR_PARENT, fileId); + }else{ + query = String.format(SELECT_APIS_FOR_CHILD, accessorId); } - List apiList = new ArrayList(); - for (List data : result) { - apiList.add(new FileEvent(data)); - } - return apiList; + return SqlConnectionManager.executeQueryRS(query); } - - public FileEvent selectFileEventBySeq(long seq) { + + // to get chart row index + public ResultSet selectFileEventBySeq(long seq) { String query = String.format(SELECT_FILE_EVENT_BY_SEQ, seq); - List> result = SqlConnectionManager.executeQuery(query); - if (null == result || result.size() == 0 || result.get(0).size() == 0) { - return null; + + return SqlConnectionManager.executeQueryRS(query); + } + + public int getTotal() { + String query = SELECT_APIS_COUNT; + ResultSet rs = SqlConnectionManager.executeQueryRS(query); + int totalCount = 0; + if (rs != null) { + try { + if (rs.next()) { + totalCount = rs.getInt(1); + } + } catch (SQLException e) { + e.printStackTrace(); + } finally { + SqlConnectionManager.releaseResultSet(rs); + } } - List data = result.get(0); - FileEvent fileEvent = new FileEvent( - (Long) data.get(FileApiDB.COLUMN.SEQ.getValue()), - (String) data.get(FileApiDB.COLUMN.FILE_PATH.getValue()), - (Integer) data.get(FileApiDB.COLUMN.PID.getValue()), - (Integer) data.get(FileApiDB.COLUMN.TID.getValue())); - return fileEvent; + return totalCount; } public List select() { @@@ -265,18 -288,21 +264,18 @@@ isPrepared = false; } else { try { - prep.setInt(1, (Integer)(rowData.get(0))); - prep.setLong(1, (Long)(rowData.get(COLUMN.SEQ.getValue()))); - prep.setString(2, (String)(rowData.get(COLUMN.FILE_PATH.getValue()))); - prep.setInt(3, (Integer)(rowData.get(COLUMN.PID.getValue()))); - prep.setInt(4, (Integer)(rowData.get(COLUMN.TID.getValue()))); - prep.setLong(5, (Long)(rowData.get(COLUMN.FD.getValue()))); - prep.setInt(6, (Integer)(rowData.get(COLUMN.API_TYPE.getValue()))); - prep.setLong(7, (Long)(rowData.get(COLUMN.EVENT_TIME.getValue()))); - prep.setInt(8, (Integer)(rowData.get(COLUMN.API_ID.getValue()))); - prep.setLong(9, (Long)(rowData.get(COLUMN.ERRNO.getValue()))); - prep.setLong(10, (Long)(rowData.get(COLUMN.IO_SIZE.getValue()))); - prep.setLong(11, (Long)(rowData.get(COLUMN.FILE_SIZE.getValue()))); - prep.setLong(12, (Long)(rowData.get(COLUMN.SIZE.getValue()))); - prep.setString(13, (String)(rowData.get(COLUMN.RETURN_VALUE.getValue()))); - prep.setString(14, (String)(rowData.get(COLUMN.ARGS.getValue()))); - prep.setBoolean(15, (Boolean)(rowData.get(COLUMN.TARGET.getValue()))); ++ prep.setLong(1, (Long)(rowData.get(0))); + prep.setInt(2, (Integer)(rowData.get(1))); + prep.setInt(3, (Integer)(rowData.get(2))); + prep.setLong(4, (Long)(rowData.get(3))); + prep.setInt(5, (Integer)(rowData.get(4))); + prep.setLong(6, (Long)(rowData.get(5))); + prep.setInt(7, (Integer)(rowData.get(6))); + prep.setLong(8, (Long)(rowData.get(7))); + prep.setLong(9, (Long)(rowData.get(8))); + prep.setLong(10, (Long)(rowData.get(9))); + prep.setString(11, (String)(rowData.get(10))); + prep.setString(12, (String)(rowData.get(11))); } catch (SQLException e) { e.printStackTrace(); isPrepared = false; diff --cc org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/manager/FileDataMaker.java index b33ef1a,29eb87a..c18a904 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/manager/FileDataMaker.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/manager/FileDataMaker.java @@@ -26,21 -24,16 +24,19 @@@ * */ + package org.tizen.dynamicanalyzer.ui.file.manager; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; +import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Queue; +import java.util.Set; import java.util.concurrent.ConcurrentLinkedQueue; +import java.util.concurrent.atomic.AtomicInteger; - import org.eclipse.swt.SWT; - import org.eclipse.swt.widgets.Display; - import org.eclipse.swt.widgets.Shell; -import org.tizen.dynamicanalyzer.common.AnalyzerConstants; import org.tizen.dynamicanalyzer.common.AnalyzerManager; import org.tizen.dynamicanalyzer.common.DALimit; import org.tizen.dynamicanalyzer.common.Global; @@@ -75,16 -61,25 +65,16 @@@ public class FileDataMaker private List fileStatusList = new ArrayList(); private List fileAccessList = new ArrayList(); private List fileApiList = new ArrayList(); - - - // to find file path, (key(PID, TID, FD), value (file_path)) - private Map fileAccessorMap = new HashMap(); - - // temporary, file log list for 1second - private Queue> fileLogsQueue = new ConcurrentLinkedQueue>(); - - // (key(file path), value (read_count or write_count)) - private Map concurrentAccessNumMap = new HashMap(); - private Map lockNumMap = new HashMap(); + private List fileAccessorList = new ArrayList(); - private Map entryMap = new HashMap(); // to match entry and exit message - // for filtering out non-target file from syscall messages - List accessedFilePathList = new ArrayList(); ++ private Map entryMap = new HashMap(); // to match entry and exit message + private Map> fileAccessorMap= new HashMap>(); + private Map> filePathMap= new HashMap>(); // to find file path + private Queue> fileAccessorQueue = new ConcurrentLinkedQueue>(); + private Map, List> accessorHasLockMap = new HashMap, List>(); //to auto release + private Map concurrentAccessNumMap = new HashMap(); // to check concurrent access - // temporary, to check if open event has been sent before the event has been sent - private Map sysCallMap = new HashMap(); - // for searching entry message from exit message - Map entryMap = new HashMap(); + AtomicInteger idGenerator = new AtomicInteger(); public FileDataMaker() {} @@@ -249,11 -266,11 +239,10 @@@ }// else, non-target file break; case DataChannelConstants.MSG_FUNCTION_EXIT: - // for creating read/write end event with MSG_FUNCTION_EXIT + // for creating read/write/lock end event with MSG_FUNCTION_EXIT - int entrySeq = profileData.getEntrySeq(); + long entrySeq = profileData.getEntrySeq(); + String ret = profileData.getReturn(); - if(entryMap.containsKey(entrySeq)) { - Logger.debug(">> syscall entrySeq:" + + entrySeq + "endseq:" + seq + ", pid:" + pid - + ", tid:" + tid + ", type:" + eventType); event = entryMap.get(entrySeq); if(Long.parseLong(profileData.getReturn()) == -1) { event.setErrNo(-1); @@@ -387,13 -370,12 +376,13 @@@ } break; case LogCenterConstants.FD_API_TYPE_READ_START: - FileAccess readAccess = new FileAccess(filePath, pid, - tid, fd, apiType, eventTime); + FileAccess readAccess = new FileAccess(event.getAccessorId(), fd, apiType, + eventTime, FilePageLabels.FILE_CHART_TOOLTIP_READ); if(checkConcurrentAccess(filePath)) { readAccess.setWarning(); + readAccess.setTooltip(FilePageLabels.FILE_CHART_TOOLTIP_CONCURRENT_READ); if(logData != null) { - SummaryDataManager.getInstance().getWarningDataMaker().makeData( + SummaryDataManager.getInstance().getWarningDataMaker().add( logData, FilePageLabels.FILE_CAHRT_PROCESS_ID + pid + ", " + FilePageLabels.FILE_CAHRT_THREAD_ID + tid, @@@ -408,13 -390,12 +397,13 @@@ removeConcurrentAccess(filePath); break; case LogCenterConstants.FD_API_TYPE_WRITE_START: - FileAccess writeAccess = new FileAccess(filePath, pid, - tid, fd, apiType, eventTime); + FileAccess writeAccess = new FileAccess(event.getAccessorId(), fd, apiType, + eventTime, FilePageLabels.FILE_CHART_TOOLTIP_WRITE); if(checkConcurrentAccess(filePath)) { writeAccess.setWarning(); + writeAccess.setTooltip(FilePageLabels.FILE_CHART_TOOLTIP_CONCURRENT_WRITE); if(logData != null) { - SummaryDataManager.getInstance().getWarningDataMaker().makeData( + SummaryDataManager.getInstance().getWarningDataMaker().add( logData, FilePageLabels.FILE_CAHRT_PROCESS_ID + pid + ", " + FilePageLabels.FILE_CAHRT_THREAD_ID + tid, @@@ -521,8 -532,8 +510,9 @@@ int num = 0; if(concurrentAccessNumMap.containsKey(concurrentKey)) { num = concurrentAccessNumMap.get(concurrentKey); ++ }else{ ++ concurrentAccessNumMap.put(concurrentKey, 1); } -- concurrentAccessNumMap.put(concurrentKey, num+1); if(num > 0) { return true; }else { diff --cc org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/model/FileEvent.java index 66f3a42,9198953..9ab496e --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/model/FileEvent.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/model/FileEvent.java @@@ -74,39 -74,28 +74,39 @@@ public class FileEvent extends FileData this.target = target; } - public FileEvent(int seq, String filePath, int pid, int tid, - public FileEvent(long seq, String filePath, int pid, int tid) { ++ public FileEvent(long seq, String filePath, int pid, int tid, + long fd, int apiType, int apiId, long eventTime, long fileSize, long size, + String args, String returnVal, long errNo){ this.seq = seq; - this.filePath = filePath; this.pid = pid; this.tid = tid; + this.filePath = filePath; + this.fdValue = fd; + this.fdApiType = apiType; + this.apiId = apiId; + this.time = eventTime; + this.fileSize = fileSize; + this.size = size; + this.args = args; + this.ret = returnVal; + this.errno = errNo; } -- - public FileEvent(int seq, int accessorId, int fileId, - public FileEvent(List data) { - this.seq = (Long) data.get(FileApiDB.COLUMN.SEQ.getValue()); - this.filePath = (String) data.get(FileApiDB.COLUMN.FILE_PATH.getValue()); - this.pid = (Integer) data.get(FileApiDB.COLUMN.PID.getValue()); - this.tid = (Integer) data.get(FileApiDB.COLUMN.TID.getValue()); - this.fdValue = (Long) data.get(FileApiDB.COLUMN.FD.getValue()); - this.fdApiType = (Integer) data.get(FileApiDB.COLUMN.API_TYPE.getValue()); - this.apiId = (Integer) data.get(FileApiDB.COLUMN.API_ID.getValue()); - this.time = (Long) data.get(FileApiDB.COLUMN.EVENT_TIME.getValue()); - this.fileSize = (Long) data.get(FileApiDB.COLUMN.FILE_SIZE.getValue()); - this.size = (Long) data.get(FileApiDB.COLUMN.SIZE.getValue()); - this.ret = (String) data.get(FileApiDB.COLUMN.RETURN_VALUE.getValue()); - this.args = (String) data.get(FileApiDB.COLUMN.ARGS.getValue()); - this.errno = (Long) data.get(FileApiDB.COLUMN.ERRNO.getValue()); - this.target = (Boolean) data.get(FileApiDB.COLUMN.TARGET.getValue()); ++ ++ public FileEvent(long seq, int accessorId, int fileId, + long fd, int apiType, int apiId, long eventTime, long fileSize, long size, + String args, String returnVal, long errNo){ + this.seq = seq; + this.fileId = fileId; + this.accessorId = accessorId; + this.fdValue = fd; + this.fdApiType = apiType; + this.apiId = apiId; + this.time = eventTime; + this.fileSize = fileSize; + this.size = size; + this.args = args; + this.ret = returnVal; + this.errno = errNo; } public List getDBData() {