File : changed some chart UI 79/26479/1
authorhyeran74.kim <hyeran74.kim@samsung.com>
Mon, 25 Aug 2014 06:09:42 +0000 (15:09 +0900)
committerhyeran74.kim <hyeran74.kim@samsung.com>
Mon, 25 Aug 2014 06:09:42 +0000 (15:09 +0900)
removed other API bar on the chart
changed color of status and access bar on the chart
display warning when the case of the concurrent read/write

Change-Id: I438ed8536d51965c7283f50c7767e5854d992e30
Signed-off-by: hyeran74.kim <hyeran74.kim@samsung.com>
13 files changed:
org.tizen.dynamicanalyzer.appearance/src/org/tizen/dynamicanalyzer/resources/ColorResources.java
org.tizen.dynamicanalyzer.appearance/src/org/tizen/dynamicanalyzer/theme/DAThemeWhite.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/logparser/LogCenterConstants.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/FilePageLabels.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/FilePageLabels.properties
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/SummaryLabels.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/SummaryLabels.properties
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/FileChart.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/FileChartBoard.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/FileAccess.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/summary/warning/WarningCase.java

index 4fb6456..a1d71c3 100755 (executable)
@@ -315,6 +315,8 @@ public class ColorResources {
        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
index 08276a1..c078afa 100644 (file)
@@ -325,12 +325,15 @@ public class DAThemeWhite extends DATheme {
                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$
index 1b2eaab..1f75f90 100644 (file)
@@ -125,6 +125,8 @@ public class LogCenterConstants {
        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;
index aebcdc9..ac24ba3 100644 (file)
@@ -44,7 +44,8 @@ public class FilePageLabels extends NLS {
        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;
        
@@ -70,6 +71,7 @@ public class FilePageLabels extends NLS {
        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;
index 8dbb225..0b33e6f 100644 (file)
@@ -10,7 +10,8 @@ FILE_API_LIST_VIEW_PARAMETER=Parameter
 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
 
@@ -38,6 +39,7 @@ FILE_CHART_TOOLTIP_USED=USED
 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
index 9a8f9d9..1dfa797 100644 (file)
@@ -54,6 +54,8 @@ public class SummaryLabels extends NLS {
        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;
 
index ed9264d..801d020 100644 (file)
@@ -28,6 +28,8 @@ WARNING_CASE_POST_FIX_NO_OPERATION=> File closed without accessing it. It is rec
 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=<
 
index c000960..35f15cd 100644 (file)
@@ -59,7 +59,8 @@ public class FileChart {
        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;
        
@@ -75,14 +76,14 @@ public class FileChart {
        }
        
        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) {
@@ -115,6 +116,13 @@ public class FileChart {
                                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;
                        
@@ -148,7 +156,7 @@ public class FileChart {
                        }
                        DAChartSeriesItem seriesItem  = new DAChartSeriesItem(time,
                                        DAChartSeriesItem.SERIES_AREA_BAR, color, color, apiName);
-                       accessSeries.addSeriesItem(seriesItem);
+                       accessSeries.addSeriesItem(seriesItem);*/
                }
                chart.redraw();
        }
@@ -173,17 +181,17 @@ public class FileChart {
                        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{
@@ -204,17 +212,17 @@ public class FileChart {
                                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{
@@ -247,6 +255,20 @@ public class FileChart {
                                                        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;
                        }
                }
                
@@ -410,11 +432,11 @@ public class FileChart {
                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
index 48b6297..e5033ce 100644 (file)
@@ -54,7 +54,6 @@ import org.tizen.dynamicanalyzer.ui.file.model.FileAccess;
 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;
@@ -155,6 +154,7 @@ public class FileChartBoard extends DAChartBoard {
                                                event.getFdValue(), event.getFilePath(),
                                                event.getFileSize(), event.isTarget(), parentChartIndex);
                                parent.addChild(child);
+                               parent.setChartIndex(parentChartIndex);
                                createChartItem(null, parent);
                                createChartItem(parent, child);
                                chartList.add(parent);
@@ -165,7 +165,7 @@ public class FileChartBoard extends DAChartBoard {
                                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);
@@ -261,7 +261,9 @@ public class FileChartBoard extends DAChartBoard {
         */
        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.
@@ -322,7 +324,7 @@ public class FileChartBoard extends DAChartBoard {
                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() });
        }
        
index 6a11e48..1a80c72 100644 (file)
@@ -109,6 +109,16 @@ public class FileApiDB extends DBTable {
                        + 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 "
@@ -178,6 +188,27 @@ public class FileApiDB extends DBTable {
                }
                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,
index c24a488..1174603 100644 (file)
@@ -30,6 +30,7 @@ package org.tizen.dynamicanalyzer.ui.file.manager;
 import java.util.ArrayList;
 
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Queue;
@@ -46,6 +47,7 @@ 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.resources.ImageResources;
 import org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants;
 import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
@@ -57,6 +59,7 @@ import org.tizen.dynamicanalyzer.ui.file.model.FileAccess;
 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;
@@ -81,6 +84,9 @@ public class FileDataMaker {
        // (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>();
@@ -170,7 +176,7 @@ public class FileDataMaker {
                                                        input.getTime(), input.getFileSize(), input.getSize(),
                                                        input.getArgs(), input.getReturn(), input.getErrno(),
                                                        true);
-                                       addFileEvent(fileEventList, event);
+                                       addFileEvent(fileEventList, event, input);
                                }
                                
                                // TODO temp code       
@@ -220,7 +226,7 @@ public class FileDataMaker {
                                                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);
@@ -228,7 +234,7 @@ public class FileDataMaker {
                                                                if(sysLockedFd.contains(fd)) {
                                                                        sysLockedFd.remove(fd);
                                                                }
-                                                               addFileEvent(fileEventList, event);
+                                                               addFileEvent(fileEventList, event, null);
                                                        }
                                                        break;
                                                case LogCenterConstants.FD_API_TYPE_LOCK_START:
@@ -239,14 +245,14 @@ public class FileDataMaker {
                                                                                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:
@@ -258,10 +264,10 @@ public class FileDataMaker {
                                                                                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;
@@ -281,11 +287,11 @@ public class FileDataMaker {
                                                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;
@@ -312,7 +318,7 @@ public class FileDataMaker {
         * @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();
@@ -359,34 +365,67 @@ public class FileDataMaker {
                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;
@@ -406,7 +445,6 @@ public class FileDataMaker {
        }
 
        // 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++) {
@@ -483,68 +521,79 @@ public class FileDataMaker {
        }
        
        /**
-        * 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)) { 
index 0ecb1e7..be49768 100644 (file)
@@ -45,6 +45,7 @@ public class FileAccess {
        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;
@@ -185,4 +186,11 @@ public class FileAccess {
                this.fileSize = fileSize;
        }
        
+       public void setWarning() {
+               this.isWarning = true;
+       }
+       
+       public boolean isWarning() {
+               return isWarning;
+       }
 }
index d7c383d..a008154 100644 (file)
@@ -45,7 +45,11 @@ public enum WarningCase {
        
        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;
@@ -81,6 +85,8 @@ public enum WarningCase {
                        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;
                }
@@ -95,6 +101,8 @@ public enum WarningCase {
                        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;
                }