private Queue<List<FileEvent>> fileLogsQueue = new ConcurrentLinkedQueue<List<FileEvent>>();
// (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 searching entry message from exit message
Map<Integer, FileEvent> entryMap = new HashMap<Integer, FileEvent>();
- // temp
- private List<Long> sentOpenEventList = new ArrayList<Long>();
-
public FileDataMaker() {}
public void clear(){
fileStatusList.clear();
fileAccessList.clear();
fileAccessorMap.clear();
- concurrentReadNumMap.clear();
- concurrentWriteNumMap.clear();
+ concurrentAccessNumMap.clear();
+ lockNumMap.clear();
+ lockWaitingAccessor.clear();
sysCallMap.clear();
accessedFilePathList.clear();
entryMap.clear();
+ sysLockedFd.clear();
}
public void makeData(LogPackage pack) {
SummaryDataManager.getInstance().getFailedApiDataMaker().makeData(input);
}
- long fd = input.getFdValue();
if(input.getFdApiType() == LogCenterConstants.FD_API_TYPE_OPEN){
accessedFilePathList.add(input.getFilePath());
- // TODO temp code
- sentOpenEventList.add(fd);
- }
-
- Logger.debug(">>probe pid:" + input.getPid()
- + ", tid:" + input.getTid() + ", fd:" + input.getFdValue()
- + ", type:" + input.getFdApiType()
- + ", filePath:" + input.getFilePath() + ", err:" + input.getErrno() );
-
- if(sentOpenEventList.contains(fd)) {
- event = new FileEvent(input.getSeq(), input.getFilePath(),
- input.getPid(), input.getTid(), input.getFdValue(),
- input.getFdApiType(), input.getApiId(),
- input.getTime(), input.getFileSize(), input.getSize(),
- input.getArgs(), input.getReturn(), input.getErrno(),
- true);
- addFileEvent(fileEventList, event, input);
}
- // TODO temp code
- if (input.getFdApiType() == LogCenterConstants.FD_API_TYPE_CLOSE) {
- sentOpenEventList.remove(fd);
- }
+ Logger.debug(">>probe pid:" + input.getPid() + ", tid:"
+ + input.getTid() + ", fd:" + input.getFdValue()
+ + ", type:" + input.getFdApiType() + ", filePath:"
+ + input.getFilePath() + ", err:" + input.getErrno());
+
+ event = new FileEvent(input.getSeq(), input.getFilePath(),
+ input.getPid(), input.getTid(), input.getFdValue(),
+ input.getFdApiType(), input.getApiId(),
+ input.getTime(), input.getFileSize(), input.getSize(),
+ input.getArgs(), input.getReturn(), input.getErrno(),
+ true);
+ addFileEvent(fileEventList, event, input);
}
}
int tid = profileData.getTid();
long time = profileData.getTime();
int eventType = profileData.getProbeSubType();
-
- Logger.debug(">> syscall:seq:" + seq + ", pid:" + pid
- + ", tid:" + tid + ", type:" + eventType );
-
+
switch (profileData.getId()) {
case DataChannelConstants.MSG_FUNCTION_ENTRY:
// get file path and FD from args : string of "file_path,fd"
}
addStatusData(new FileStatus(pid, tid, fd, filePath,
apiType, eventTime, errNo));
+ // if it remains lock without lock release
+ if(getCurrentLockNum(filePath) > 0) {
+ removeLockNum(filePath);
+ addEndAccessData(pid, tid, fd, filePath, eventTime, size,
+ LogCenterConstants.FD_API_TYPE_LOCK_START, errNo);
+ }
break;
case LogCenterConstants.FD_API_TYPE_READ_START:
FileAccess readAccess = new FileAccess(filePath, pid,
removeConcurrentAccess(filePath);
break;
case LogCenterConstants.FD_API_TYPE_LOCK_START:
- if(getCurrentLockNum(filePath) > 0) {
+ if(addCurrentLock(filePath) > 0) {
addLockWaitingAccessor(pid, tid);
addStartAccessData(new FileAccess(filePath, pid, tid, fd,
LogCenterConstants.FD_API_TYPE_LOCK_WAIT_START, eventTime));
}
}
- private int getCurrentLockNum(String lockKey) {
+ private int addCurrentLock(String lockKey) {
int num = 0;
if(lockNumMap.containsKey(lockKey)) {
num = lockNumMap.get(lockKey);
return num;
}
+ private int getCurrentLockNum(String lockKey) {
+ int num = 0;
+ if(lockNumMap.containsKey(lockKey)) {
+ num = lockNumMap.get(lockKey);
+ }
+ return num;
+ }
+
private void removeLockNum(String lockKey) {
int num = 0;
if(lockNumMap.containsKey(lockKey)) {