File : deal with if there is no releasing file locked when closing the file 48/26948/1
authorhyeran74.kim <hyeran74.kim@samsung.com>
Tue, 2 Sep 2014 04:51:56 +0000 (13:51 +0900)
committerhyeran74.kim <hyeran74.kim@samsung.com>
Tue, 2 Sep 2014 04:51:56 +0000 (13:51 +0900)
Change-Id: If24fae9fed1bdb5651c062cdfbce7c68e76ac464
Signed-off-by: hyeran74.kim <hyeran74.kim@samsung.com>
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/DALimit.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/communicator/Communicator30.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/manager/FileDataMaker.java

index 1e895b2..6ba68f8 100644 (file)
@@ -59,7 +59,7 @@ public class DALimit {
        public static final int MAX_LEAK_CHECK_BUFFER_SIZE = (int) Math.pow(2, 20); // 1,048,576
 
        // File Analysis
-       public static final int MAX_FILE_STATUS_COUNT = (int) Math.pow(2, 10); // 102400
-       public static final int MAX_FILE_ACCESS_COUNT =(int) Math.pow(2, 10); // 102400
+       public static final int MAX_FILE_STATUS_COUNT = ((int) Math.pow(2, 10))*100; // 102400 // 102400
+       public static final int MAX_FILE_ACCESS_COUNT = ((int) Math.pow(2, 10))*100; // 102400 // 102400
        public static final int MAX_STRING_LENGTH = 12;
 }
index 265eb03..b39b9f0 100755 (executable)
@@ -360,9 +360,9 @@ public class Communicator30 extends BaseCommunicator {
                                } else if (appType.contains(AppInfo.APPTYPE_WEB)) {
                                        appInst.setApplicationType(ApplicationInst.APPTYPE_WEB);
                                        appInst.setApplicationId(app.getAppId());
-//                             } else if (appType.contains(AppInfo.APPTYPE_CAPP)) {
-//                                     appInst.setApplicationType(ApplicationInst.APPTYPE_TIZEN);
-//                                     appInst.setApplicationId(app.getAppId());
+                               } else if (appType.contains(AppInfo.APPTYPE_CAPP)) {
+                                       appInst.setApplicationType(ApplicationInst.APPTYPE_TIZEN);
+                                       appInst.setApplicationId(app.getAppId());
                                } else {
                                        appInst.setApplicationType(ApplicationInst.APPTYPE_COMMON_EXEC);
                                        appInst.setApplicationId(CommonConstants.EMPTY);
index f143984..13f2da4 100644 (file)
@@ -80,8 +80,6 @@ public class FileDataMaker {
        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>>();
@@ -95,20 +93,19 @@ public class FileDataMaker {
        // 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) {
@@ -155,32 +152,22 @@ public class FileDataMaker {
                                        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);
                        }
                }
 
@@ -201,10 +188,7 @@ public class FileDataMaker {
                                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"
@@ -362,6 +346,12 @@ public class FileDataMaker {
                        }
                        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,
@@ -416,7 +406,7 @@ public class FileDataMaker {
                        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));
@@ -556,7 +546,7 @@ public class FileDataMaker {
                }
        }
        
-       private int getCurrentLockNum(String lockKey) {
+       private int addCurrentLock(String lockKey) {
                int num = 0;
                if(lockNumMap.containsKey(lockKey)) {
                        num = lockNumMap.get(lockKey);
@@ -566,6 +556,14 @@ public class FileDataMaker {
                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)) {