public static Color FILE_AREA_NOT_ACCESS_END = getColor("file_not_access_end"); //$NON-NLS-1$\r
public static Color FILE_ACCESS_READ = getColor("file_access_read"); //$NON-NLS-1$\r
public static Color FILE_ACCESS_WRITE = getColor("file_access_write"); //$NON-NLS-1$\r
+ public static Color FILE_ACCESS_CONCURRENT_READ = getColor("file_access_concurrent_read"); //$NON-NLS-1$\r
+ public static Color FILE_ACCESS_CONCURRENT_WRITE = getColor("file_access_concurrent_write"); //$NON-NLS-1$\r
public static Color FILE_LOCK_ACQUIRED = getColor("file_lock_acquired"); //$NON-NLS-1$\r
public static Color FILE_LOCK_WAITING = getColor("file_lock_waiting"); //$NON-NLS-1$\r
public static Color FILE_OTHER_OPERATION = getColor("file_other_operation"); //$NON-NLS-1$\r
setColor("file_not_access_start", new RGB(178, 178, 178)); //$NON-NLS-1$
setColor("file_not_access_end", new RGB(106, 106, 106)); //$NON-NLS-1$
setColor("file_access_read", new RGB(131, 207, 232)); //$NON-NLS-1$
- setColor("file_access_write", new RGB(229, 123, 206)); //$NON-NLS-1$
- setColor("file_lock_acquired", new RGB(90, 200, 177)); //$NON-NLS-1$
- setColor("file_lock_waiting", new RGB(216, 160, 76)); //$NON-NLS-1$
- setColor("file_other_operation", new RGB(173, 173, 173)); //$NON-NLS-1$
- setColor("file_opened", new RGB(206, 177, 77)); //$NON-NLS-1$
- setColor("file_duplicate_opened", new RGB(141, 180, 70)); //$NON-NLS-1$
+ setColor("file_access_write",new RGB(131, 207, 232)); //$NON-NLS-1$
+ setColor("file_access_concurrent_read", new RGB(40, 160, 198)); //$NON-NLS-1$
+ setColor("file_access_concurrent_write", new RGB(40, 160, 198)); //$NON-NLS-1$
+ setColor("file_lock_acquired", new RGB(216, 160, 76)); //$NON-NLS-1$
+ setColor("file_lock_waiting", new RGB(238, 122, 67)); //$NON-NLS-1$
+ setColor("file_other_operation", new RGB(173, 173, 173)); //$NON-NLS-1$
+ setColor("file_other_operation", new RGB(173, 173, 173)); //$NON-NLS-1$
+ setColor("file_opened", new RGB(141, 180, 70)); //$NON-NLS-1$
+ setColor("file_duplicate_opened", new RGB(125, 161, 60)); //$NON-NLS-1$
/** Network chart colors **/
setColor("network_api_used", new RGB(15, 153, 232)); //$NON-NLS-1$
public static final int FD_API_TYPE_OTHERS = 8;
public static final int FD_API_TYPE_LOCK_START = 14;
public static final int FD_API_TYPE_LOCK_END = 15;
+ public static final int FD_API_TYPE_LOCK_WAIT_START = 16;
+ public static final int FD_API_TYPE_LOCK_WAIT_END = 17;
/* Log Network */
public static final int SOCKET_API_FD_OPEN = 0;
public static String FILE_API_LIST_VIEW_THREAD_ID;
public static String FILE_API_LIST_VIEW_RETURN;
public static String FILE_API_LIST_VIEW_ERRNO;
-
+ public static String FILE_CAHRT_PROCESS_ID;
+ public static String FILE_CAHRT_THREAD_ID;
public static String FILE_CHART_FILE;
public static String FILE_CHART_UNKNOWN_FILE;
public static String FILE_CHART_TOOLTIP_WRITE;
public static String FILE_CHART_TOOLTIP_READ;
public static String FILE_CHART_TOOLTIP_LOCK;
+ public static String FILE_CHART_TOOLTIP_LOCK_WAIT;
public static String FILE_API_DB;
public static String FILE_STATUS_DB;
FILE_API_LIST_VIEW_THREAD_ID=TID
FILE_API_LIST_VIEW_RETURN=Return
FILE_API_LIST_VIEW_ERRNO=Error code
-
+FILE_CAHRT_THREAD_ID=TID:
+FILE_CAHRT_PROCESS_ID=PID:
FILE_CHART_FILE=File
FILE_CHART_UNKNOWN_FILE=unknown file
FILE_CHART_TOOLTIP_WRITE=WRITE
FILE_CHART_TOOLTIP_READ=READ
FILE_CHART_TOOLTIP_LOCK=LOCKED
+FILE_CHART_TOOLTIP_LOCK_WAIT=LOCK WAITING
FILE_API_DB=FILE_API_DB
FILE_STATUS_DB=FILE_STATUS_DB
public static String WARNING_CASE_POST_FIX_JOINABLE_LEAK;
public static String WARNING_CASE_POST_CLOSED_FD_FOR_FAILED_FD;
public static String WARNING_CASE_BRIEF_CLOSED_FD_FOR_FAILED_FD;
+ public static String WARNING_CASE_BRIEF_CONCURRENT_ACCESS;
+ public static String WARNING_CASE_POST_CONCURRENT_ACCESS;
public static String WARNING_CASE_PRE_FIX;
WARNING_CASE_POST_FIX_JOINABLE_LEAK=> If the thread is joinable, the join() method must be called, else it could create memory leaks.
WARNING_CASE_BRIEF_CLOSED_FD_FOR_FAILED_FD= FD that cannot be used is not closed.
WARNING_CASE_POST_CLOSED_FD_FOR_FAILED_FD=> State of the FD was closed, it is not possible to use this FD anymore, Please close the FD.
+WARNING_CASE_BRIEF_CONCURRENT_ACCESS=Concurrent access.
+WARNING_CASE_POST_CONCURRENT_ACCESS=> It is recommended to lock the file before accessing the file
WARNING_CASE_PRE_FIX=<
private int tid = -1;
private long fd = -1;
private long fileSize = 0;
- private int parentChartIndex = -1;
+ //private int parentChartIndex = -1;
+ private int chartIndex = -1;
private boolean isTarget = false;
}
public FileChart(int pid, int tid, long fd, String filePath, long fileSize,
- boolean isTarget, int parentChartIndex) {
+ boolean isTarget, int chartIndex) {
this.filePath = filePath;
this.pid = pid;
this.tid = tid;
this.fd = fd;
this.fileSize = fileSize;
this.isTarget = isTarget;
- this.parentChartIndex = parentChartIndex;
+ this.chartIndex = chartIndex;
}
public void setItem(DAChartBoardItem item) {
continue;
}
double time = event.getTime() / TimelineConstants.MEGA_DOUBLE;
+ String apiName = event.getApiName();
+ Color color = ColorResources.FILE_API_FAILED;
+
+ DAChartSeriesItem seriesItem = new DAChartSeriesItem(time,
+ DAChartSeriesItem.SERIES_AREA_BAR, color, color, apiName);
+ accessSeries.addSeriesItem(seriesItem);
+ /*double time = event.getTime() / TimelineConstants.MEGA_DOUBLE;
int id = event.getFdApiType();
String apiName = null;
}
DAChartSeriesItem seriesItem = new DAChartSeriesItem(time,
DAChartSeriesItem.SERIES_AREA_BAR, color, color, apiName);
- accessSeries.addSeriesItem(seriesItem);
+ accessSeries.addSeriesItem(seriesItem);*/
}
chart.redraw();
}
switch(data.getApiType()){
case LogCenterConstants.FD_API_TYPE_READ_START:
// if the file has been already read by other thread or process(concurrent read)
- if(data.isAlreadyReading()) {
+ if(data.isWarning()) {
accessSeries.addSeriesItem(new DAChartSeriesItem(
startTime, DAChartSeriesItem.SERIES_AREA_START,
- ColorResources.FILE_ACCESS_READ,
- ColorResources.FILE_ACCESS_READ, true,
+ ColorResources.FILE_ACCESS_CONCURRENT_READ,
+ ColorResources.FILE_ACCESS_CONCURRENT_READ, false,
FilePageLabels.FILE_CHART_TOOLTIP_READ));
if(endTime > 0) {
accessSeries.addSeriesItem(new DAChartSeriesItem(
endTime, DAChartSeriesItem.SERIES_AREA_END,
- ColorResources.FILE_ACCESS_READ,
- ColorResources.FILE_ACCESS_READ, true,
+ ColorResources.FILE_ACCESS_CONCURRENT_READ,
+ ColorResources.FILE_ACCESS_CONCURRENT_READ, false,
FilePageLabels.FILE_CHART_TOOLTIP_READ));
} // else, if endTime <=0, still accessing
}else{
break;
case LogCenterConstants.FD_API_TYPE_WRITE_START:
// if the file has been already written by other thread or process(concurrent write)
- if(data.isAlreadyWriting()) {
+ if(data.isWarning()) {
accessSeries.addSeriesItem(new DAChartSeriesItem(
startTime, DAChartSeriesItem.SERIES_AREA_START,
- ColorResources.FILE_ACCESS_WRITE,
- ColorResources.FILE_ACCESS_WRITE, true,
+ ColorResources.FILE_ACCESS_CONCURRENT_WRITE,
+ ColorResources.FILE_ACCESS_CONCURRENT_WRITE, false,
FilePageLabels.FILE_CHART_TOOLTIP_WRITE));
if(endTime > 0) {
accessSeries.addSeriesItem(new DAChartSeriesItem(
endTime, DAChartSeriesItem.SERIES_AREA_END,
- ColorResources.FILE_ACCESS_WRITE,
- ColorResources.FILE_ACCESS_WRITE, true,
+ ColorResources.FILE_ACCESS_CONCURRENT_WRITE,
+ ColorResources.FILE_ACCESS_CONCURRENT_WRITE, false,
FilePageLabels.FILE_CHART_TOOLTIP_WRITE));
} // else, if endTime <=0, still accessing
}else{
FilePageLabels.FILE_CHART_TOOLTIP_LOCK));
}// else, if endTime <=0, still accessing
break;
+ case LogCenterConstants.FD_API_TYPE_LOCK_WAIT_START:
+ lockSeries.addSeriesItem(new DAChartSeriesItem(
+ startTime, DAChartSeriesItem.SERIES_AREA_START,
+ ColorResources.FILE_LOCK_WAITING,
+ ColorResources.FILE_LOCK_WAITING, false,
+ FilePageLabels.FILE_CHART_TOOLTIP_LOCK_WAIT));
+ if(endTime > 0){
+ lockSeries.addSeriesItem(new DAChartSeriesItem(
+ endTime, DAChartSeriesItem.SERIES_AREA_END,
+ ColorResources.FILE_LOCK_WAITING,
+ ColorResources.FILE_LOCK_WAITING, false,
+ FilePageLabels.FILE_CHART_TOOLTIP_LOCK_WAIT));
+ }// else, if endTime <=0, still accessing
+ break;
}
}
return isTarget;
}
- public int getParentChartIndex() {
- return parentChartIndex;
+ public int getChartIndex() {
+ return chartIndex;
}
- public void setParentChartIndex(int index) {
- this.parentChartIndex = index;
+ public void setChartIndex(int index) {
+ this.chartIndex = index;
}
}
\ No newline at end of file
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.data.NetworkDataManager;
import org.tizen.dynamicanalyzer.util.DALogger;
import org.tizen.dynamicanalyzer.utils.Formatter;
import org.tizen.dynamicanalyzer.widgets.chart.DAChart;
event.getFdValue(), event.getFilePath(),
event.getFileSize(), event.isTarget(), parentChartIndex);
parent.addChild(child);
+ parent.setChartIndex(parentChartIndex);
createChartItem(null, parent);
createChartItem(parent, child);
chartList.add(parent);
if (child == null) {
child = new FileChart(event.getPid(), event.getTid(),
event.getFdValue(), event.getFilePath(),
- event.getFileSize(), event.isTarget(), parent.getParentChartIndex());
+ event.getFileSize(), event.isTarget(), parent.getChartIndex());
parent.addChild(child);
createChartItem(parent, child);
chartList.add(child);
*/
private void updateApiSeries() {
if (chartList.size() > 0) {
- List<FileEvent> apiList = apiDB.selectAPISeries(
+ /*List<FileEvent> apiList = apiDB.selectAPISeries(
+ getVisibleStartTime(), getVisibleEndTime());*/
+ List<FileEvent> apiList = apiDB.selectFailedAPISeries(
getVisibleStartTime(), getVisibleEndTime());
if (null == apiList) {
// no file event within the selected time range.
set.add(childChart.getFilePath());
set.add(childChart.getPid());
set.add(childChart.getTid());
- chartIndexMap.put(set, new int[] { childChart.getParentChartIndex(),
+ chartIndexMap.put(set, new int[] { parentChart.getChartIndex(),
parentChart.getLastChildChartIndex() });
}
+ COLUMN.EVENT_TIME.getName()
+ " <= %s";
+ private static final String SELECT_FAILED_API_SERIES = "select "
+ + selectAllColumn
+ +" from "
+ + TABLE_NAME + " where %s <= "
+ + COLUMN.EVENT_TIME.getName() + " and "
+ + COLUMN.EVENT_TIME.getName()
+ + " <= %s" + " and "
+ + COLUMN.ERRNO.getName() + " != '0'" + " and "
+ + COLUMN.TARGET.getName() + " = 'true'";
+
private static final String SELECT_APIS_FOR_CHILD = "select "
+ selectAllColumn
+" from "
}
return apiList;
}
+
+ // for updating api series chart
+ public List<FileEvent> 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<List<Object>> result = SqlConnectionManager.executeQuery(query);
+ if (null == result || result.size() == 0 || result.get(0).size() == 0) {
+ return null;
+ }
+ List<FileEvent> apiList = new ArrayList<FileEvent>();
+ for (List<Object> data : result) {
+ apiList.add(new FileEvent(data));
+ }
+ return apiList;
+ }
// for updating api table view
public List<FileEvent> selectAPITable(String filePath, int pid, int tid,
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Queue;
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.resources.ImageResources;
import org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants;
import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
import org.tizen.dynamicanalyzer.ui.file.model.FileEvent;
import org.tizen.dynamicanalyzer.ui.file.model.FileStatus;
import org.tizen.dynamicanalyzer.ui.summary.SummaryDataManager;
+import org.tizen.dynamicanalyzer.ui.summary.warning.WarningCase;
import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
import org.tizen.dynamicanalyzer.ui.toolbar.configuration.ConfigurationDialogDataManager;
import org.tizen.dynamicanalyzer.util.DALogger;
// (key(file path), value (read_count or write_count))
private Map<String, Integer> concurrentReadNumMap = new HashMap<String, Integer>();
private Map<String, Integer> concurrentWriteNumMap = new HashMap<String, Integer>();
+ private Map<String, Integer> concurrentAccessNumMap = new HashMap<String, Integer>();
+ private Map<String, Integer> lockNumMap = new HashMap<String, Integer>();
+ private List<HashSet<Object>> lockWaitingAccessor = new ArrayList<HashSet<Object>>();
// for filtering out non-target file from syscall messages
List<String> accessedFilePathList = new ArrayList<String>();
input.getTime(), input.getFileSize(), input.getSize(),
input.getArgs(), input.getReturn(), input.getErrno(),
true);
- addFileEvent(fileEventList, event);
+ addFileEvent(fileEventList, event, input);
}
// TODO temp code
switch(eventType) {
case LogCenterConstants.FD_API_TYPE_OPEN:
sysCallMap.put(filePath, event);
- addFileEvent(fileEventList, event);
+ addFileEvent(fileEventList, event, null);
break;
case LogCenterConstants.FD_API_TYPE_CLOSE:
openEvent = sysCallMap.get(filePath);
if(sysLockedFd.contains(fd)) {
sysLockedFd.remove(fd);
}
- addFileEvent(fileEventList, event);
+ addFileEvent(fileEventList, event, null);
}
break;
case LogCenterConstants.FD_API_TYPE_LOCK_START:
tid, fd, filePath,
LogCenterConstants.FD_API_TYPE_OPEN,
time, 0, false);
- addFileEvent(fileEventList, openEvent);
+ addFileEvent(fileEventList, openEvent, null);
}
sysLockedFd.add(fd);
- addFileEvent(fileEventList, event);
+ addFileEvent(fileEventList, event, null);
break;
case LogCenterConstants.FD_API_TYPE_LOCK_END:
if(sysLockedFd.contains(fd)) {
- addFileEvent(fileEventList, event);
+ addFileEvent(fileEventList, event, null);
}
break;
case LogCenterConstants.FD_API_TYPE_READ_START:
tid, fd, filePath,
LogCenterConstants.FD_API_TYPE_OPEN,
time, 0, false);
- addFileEvent(fileEventList, openEvent);
+ addFileEvent(fileEventList, openEvent, null);
}
entryMap.put(seq, event);
- addFileEvent(fileEventList, event);
+ addFileEvent(fileEventList, event, null);
break;
default:
break;
switch(eventType) {
case LogCenterConstants.FD_API_TYPE_READ_START:
event.setFdApiType(LogCenterConstants.FD_API_TYPE_READ_END);
- addFileEvent(fileEventList, event);
+ addFileEvent(fileEventList, event, null);
break;
case LogCenterConstants.FD_API_TYPE_WRITE_START:
event.setFdApiType(LogCenterConstants.FD_API_TYPE_WRITE_END);
- addFileEvent(fileEventList, event);
+ addFileEvent(fileEventList, event, null);
break;
default:
break;
* @param event: original file event
* set event to list
*/
- public void addFileEvent(List<FileEvent> fileEventList, FileEvent event) {
+ public void addFileEvent(List<FileEvent> fileEventList, FileEvent event, FileData logData ) {
// check heap memory
checkFileAnalysisLimit();
case LogCenterConstants.FD_API_TYPE_READ_START:
FileAccess readAccess = new FileAccess(filePath, pid,
tid, fd, apiType, eventTime);
- if(checkConcurrentRead(filePath)) {
- readAccess.setAlreadyReading(true);
+
+ if(isLockWaitingAccessor(pid, tid)) {
+ addEndAccessData(pid, tid, fd, filePath, eventTime,
+ size, LogCenterConstants.FD_API_TYPE_LOCK_WAIT_END, 0);
+ addStartAccessData(new FileAccess(filePath, pid, tid, fd,
+ LogCenterConstants.FD_API_TYPE_LOCK_START, eventTime));
+ }else{
+ if(checkConcurrentAccess(filePath)) {
+ readAccess.setWarning();
+ SummaryDataManager.getInstance().getWarningDataMaker().makeData(
+ logData,
+ FilePageLabels.FILE_CAHRT_PROCESS_ID + pid + ", " +
+ FilePageLabels.FILE_CAHRT_THREAD_ID + tid,
+ WarningCase.CONCURRENT_ACCESS.getType());
+ }
}
addStartAccessData(readAccess);
break;
case LogCenterConstants.FD_API_TYPE_READ_END:
addEndAccessData(pid, tid, fd, filePath, eventTime,
size, LogCenterConstants.FD_API_TYPE_READ_START, errNo);
- removeConcurrentNum(filePath, true);
+ removeConcurrentAccess(filePath);
break;
case LogCenterConstants.FD_API_TYPE_WRITE_START:
FileAccess writeAccess = new FileAccess(filePath, pid,
tid, fd, apiType, eventTime);
- if(checkConcurrentWrite(filePath)) {
- writeAccess.setAlreadyWriting(true);
+
+ if (isLockWaitingAccessor(pid, tid)) {
+ addEndAccessData(pid, tid, fd, filePath, eventTime, size,
+ LogCenterConstants.FD_API_TYPE_LOCK_WAIT_START, 0);
+ addStartAccessData(new FileAccess(filePath, pid, tid, fd,
+ LogCenterConstants.FD_API_TYPE_LOCK_START, eventTime));
+ }else{
+ if(checkConcurrentAccess(filePath)) {
+ writeAccess.setWarning();
+ SummaryDataManager.getInstance().getWarningDataMaker().makeData(
+ logData,
+ FilePageLabels.FILE_CAHRT_PROCESS_ID + pid + ", " +
+ FilePageLabels.FILE_CAHRT_THREAD_ID + tid,
+ WarningCase.CONCURRENT_ACCESS.getType());
+ }
}
addStartAccessData(writeAccess);
break;
case LogCenterConstants.FD_API_TYPE_WRITE_END:
addEndAccessData(pid, tid, fd, filePath, eventTime,
size, LogCenterConstants.FD_API_TYPE_WRITE_START, errNo);
- removeConcurrentNum(filePath, false);
+ removeConcurrentAccess(filePath);
break;
case LogCenterConstants.FD_API_TYPE_LOCK_START:
- addStartAccessData(new FileAccess(filePath, pid, tid, fd,
- apiType, eventTime));
+ if(getCurrentLockNum(filePath) > 0) {
+ addLockWaitingAccessor(pid, tid);
+ addStartAccessData(new FileAccess(filePath, pid, tid, fd,
+ LogCenterConstants.FD_API_TYPE_LOCK_WAIT_START, eventTime));
+ } else {
+ addStartAccessData(new FileAccess(filePath, pid, tid, fd,
+ apiType, eventTime));
+ }
break;
case LogCenterConstants.FD_API_TYPE_LOCK_END:
+ removeLockNum(filePath);
addEndAccessData(pid, tid, fd, filePath, eventTime,
size, LogCenterConstants.FD_API_TYPE_LOCK_START, errNo);
break;
}
// in case of file read/write/lock probe/system call
- // TODO: refactoring search way
public void addEndAccessData(int pid, int tid, long fd, String filePath,
long endTime, long fileSize, int apiType, long errNo) {
for (int i = 0; i < fileAccessList.size(); i++) {
}
/**
- * Check if it is concurrent reading
+ * Check if it is concurrent access
* @param concurrentKey
* @return
*/
- private boolean checkConcurrentRead(String concurrentKey) {
+ private boolean checkConcurrentAccess(String concurrentKey) {
int num = 0;
- if(concurrentReadNumMap.containsKey(concurrentKey)) {
- num = concurrentReadNumMap.get(concurrentKey);
+ if(concurrentAccessNumMap.containsKey(concurrentKey)) {
+ num = concurrentAccessNumMap.get(concurrentKey);
}
- concurrentReadNumMap.put(concurrentKey, num+1);
+ concurrentAccessNumMap.put(concurrentKey, num+1);
if(num > 0) {
return true;
}else {
return false;
}
-
}
/**
- * Check if it is concurrent writing
+ * Remove concurrent read or write number
* @param concurrentKey
- * @return
+ * @param isRead
*/
- private boolean checkConcurrentWrite(String concurrentKey) {
+ private void removeConcurrentAccess(String concurrentKey) {
+ if (concurrentAccessNumMap.containsKey(concurrentKey)) {
+ int num = concurrentAccessNumMap.get(concurrentKey);
+ if (num != 0) {
+ concurrentAccessNumMap.put(concurrentKey, num - 1);
+ } // else, no need to update concurrent read num
+ } else {
+ DA_LOG.error("Couldn't get concurrent access!, key :"
+ + concurrentKey);
+ }
+ }
+
+ private int getCurrentLockNum(String lockKey) {
int num = 0;
- if(concurrentWriteNumMap.containsKey(concurrentKey)) {
- num = concurrentWriteNumMap.get(concurrentKey);
+ if(lockNumMap.containsKey(lockKey)) {
+ num = lockNumMap.get(lockKey);
+ lockNumMap.put(lockKey, num+1);
}
- concurrentWriteNumMap.put(concurrentKey, num+1);
- if(num > 0) {
- return true;
- }else {
- return false;
+ lockNumMap.put(lockKey, num+1);
+ System.out.println("num:" + num);
+ return num;
+ }
+
+ private void removeLockNum(String lockKey) {
+ int num = 0;
+ if(lockNumMap.containsKey(lockKey)) {
+ num = lockNumMap.get(lockKey);
+ lockNumMap.put(lockKey, num-1);
+ } else {
+ DA_LOG.error("Couldn't get current lock num!, key :" + lockKey);
}
}
- /**
- * Remove concurrent read or write number
- * @param concurrentKey
- * @param isRead
- */
- private void removeConcurrentNum(String concurrentKey, boolean isRead) {
- if(isRead) { // concurrent read
- if(concurrentReadNumMap.containsKey(concurrentKey)) {
- int num = concurrentReadNumMap.get(concurrentKey);
- if(num != 0){
- concurrentReadNumMap.put(concurrentKey, num-1);
- } //else, no need to update concurrent read num
- }else{
- DA_LOG.error("Couldn't get concurrent read num!, key :" + concurrentKey);
- }
- }else{ // concurrent write
- if(concurrentWriteNumMap.containsKey(concurrentKey)) {
- int num = concurrentWriteNumMap.get(concurrentKey);
- if(num != 0){
- concurrentWriteNumMap.put(concurrentKey, num-1);
- } //else, no need to update concurrent write num
- }else{
- DA_LOG.error("Couldn't get current concurrent write num!, key :" + concurrentKey);
- }
+ private void addLockWaitingAccessor(int pid, int tid) {
+ HashSet<Object> set = new HashSet<Object>();
+ set.add(pid);
+ set.add(tid);
+ lockWaitingAccessor.add(set);
+ }
+
+ private boolean isLockWaitingAccessor(int pid, int tid) {
+ HashSet<Object> set = new HashSet<Object>();
+ set.add(pid);
+ set.add(tid);
+ if(lockWaitingAccessor.contains(set)) {
+ lockWaitingAccessor.remove(set);
+ return true;
}
+ return false;
}
+
private void checkFileAnalysisLimit() {
if ( (fileAccessList.size() > DALimit.MAX_FILE_ACCESS_COUNT
|| fileStatusList.size() > DALimit.MAX_FILE_STATUS_COUNT)) {
private boolean isAlreadyReading = false;
private boolean isAlreadyWriting = false;
private boolean isAlreadyLocking = false;
+ private boolean isWarning = false;
public FileAccess(String filePath, int pid, int tid, int apiType, long startTime) {
this.filePath = filePath;
this.fileSize = fileSize;
}
+ public void setWarning() {
+ this.isWarning = true;
+ }
+
+ public boolean isWarning() {
+ return isWarning;
+ }
}
CLOSED_NETWORK_FD(4, SummaryLabels.WARNING_CASE_PRE_FIX,
SummaryLabels.WARNING_CASE_POST_CLOSED_FD_FOR_FAILED_FD,
- SummaryLabels.WARNING_CASE_BRIEF_CLOSED_FD_FOR_FAILED_FD);
+ SummaryLabels.WARNING_CASE_BRIEF_CLOSED_FD_FOR_FAILED_FD),
+
+ CONCURRENT_ACCESS(5, SummaryLabels.WARNING_CASE_PRE_FIX,
+ SummaryLabels.WARNING_CASE_POST_CONCURRENT_ACCESS,
+ SummaryLabels.WARNING_CASE_BRIEF_CONCURRENT_ACCESS);
private final int type;
private final String prefix;
return JOINABLE_LEAK.getShortMessage();
} else if (CLOSED_NETWORK_FD.getType() == type) {
return CLOSED_NETWORK_FD.getShortMessage();
+ } else if (CONCURRENT_ACCESS.getType() == type) {
+ return CONCURRENT_ACCESS.getShortMessage();
} else {
return CommonConstants.EMPTY;
}
return JOINABLE_LEAK.getMessage(key);
} else if (CLOSED_NETWORK_FD.getType() == type) {
return CLOSED_NETWORK_FD.getMessage(key);
+ } else if (CONCURRENT_ACCESS.getType() == type) {
+ return CONCURRENT_ACCESS.getMessage(key);
} else {
return CommonConstants.EMPTY;
}