[RELEASE] DA 2.4.2
authorMaria Guseva <m.guseva@samsung.com>
Fri, 25 Nov 2016 08:18:28 +0000 (17:18 +0900)
committerMaria Guseva <m.guseva@samsung.com>
Fri, 25 Nov 2016 08:22:06 +0000 (17:22 +0900)
- Fix UI Event list not shown due to NullPointerException (regression in DA 2.4.1)
- Fix empty heap chart for main executable (regression in DA 2.4.0)
- Fix JIRA defects:
  SPTSDKUX-2495: DA Launch Delayed too much
  SPTSDKUX-2722: Capture icon is not add screenshot tab for second time tracing

Change-Id: I460e24b6472ab7d5d77abb8cf15cb73bc55a0c34

12 files changed:
org.tizen.dynamicanalyzer.common.test/pom.xml
org.tizen.dynamicanalyzer.common/src/org/tizen/dynamicanalyzer/util/InternalLogger.java
org.tizen.dynamicanalyzer.test/pom.xml
org.tizen.dynamicanalyzer.workbench.product/dynamicanalyzer.product
org.tizen.dynamicanalyzer.workbench.product/pom.xml
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/setting/SettingDataManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/setting/UILayoutDataManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/memory/data/MemoryDataManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/widgets/table/DATableComposite.java
package/changelog
package/pkginfo.manifest
pom.xml

index eb433d6..fcbc7aa 100644 (file)
@@ -6,7 +6,7 @@
        <parent>
                <artifactId>dynamic-analyzer</artifactId>
                <groupId>org.tizen.dynamicanalyzer</groupId>
-               <version>2.4.1-SNAPSHOT</version>
+               <version>2.4.2-SNAPSHOT</version>
                <relativePath>..</relativePath>
        </parent>
        <groupId>org.tizen.dynamicanalyzer</groupId>
index 77e47ec..5f38983 100644 (file)
@@ -36,16 +36,33 @@ import java.util.ArrayList;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
+import java.util.concurrent.ArrayBlockingQueue;
+import java.util.concurrent.BlockingQueue;
 
 import org.tizen.common.core.application.InstallPathConfig;
 import org.tizen.dynamicanalyzer.constant.CommonConstants;
 
-public class InternalLogger {
+public class InternalLogger implements Runnable {
        public enum testState {
                START, END
        };
        
        private static InternalLogger instance;
+
+       /**
+        * working thread, takes messages from queue and prints them
+        */
+       private static Thread logThread;
+       /**
+        * capacity of the message queue
+        */
+       private static final int MSG_QUEUE_CAPACITY = 256;
+       /**
+        * message queue, blocks caller thread on put() if it is full and on take()
+        * if it is empty
+        */
+       private static final BlockingQueue<Message> msgQueue = new ArrayBlockingQueue<Message>(
+                       MSG_QUEUE_CAPACITY);
        
        // Log level
        public final static int ERROR = 0;
@@ -54,8 +71,7 @@ public class InternalLogger {
        public final static int CHECK = 3;
        public final static int DEBUG = 4;
        public final static int PERFORMANCE = 5;
-       
-       private final static int PERFORMANCE_TEST_COUNT = 20;
+
        private final static String PERFORMANCE_TEST_NAME = "DA performance test";
        
        private final static String TABSPACE = "    ";
@@ -66,8 +82,7 @@ public class InternalLogger {
                        + CommonConstants.SPACE;
 
        private int logLevel;   // INFO(release), DEBUG & CHECK(develop), PERFORMANCE(test)
-//     private String userKey = null;
-       private SimpleDateFormat dateFormat;
+       private SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
        
        private File outputFile = null;
        private FileWriter fileWriter = null;
@@ -83,20 +98,40 @@ public class InternalLogger {
        private HashMap<String, Long> totalSpentTimeMap;
        private HashMap<String, List<Long>> subThreadStartTimeMap;
        private HashMap<String, Integer> subThreadStartCountMap;
-       
-       public InternalLogger() {
-               init();
-       }
-       
-       public synchronized static InternalLogger getInstance() {
-               if(instance == null) {
-                       instance = new InternalLogger();
+
+       /**
+        * Class representing logging message.
+        */
+       private static class Message {
+               /**
+                * logging type
+                */
+               public int type;
+               /**
+                * message object
+                */
+               public Object obj;
+
+               /**
+                * Constructs new instance with given logging type and message object.
+                *
+                * @param type logging type
+                * @param obj message object
+                */
+               public Message(int type, Object obj) {
+                       this.type = type;
+                       this.obj = obj;
                }
-               return instance;
        }
        
-       private void init() {
-               dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
+       static {
+               instance = new InternalLogger();
+               logThread = new Thread(null, instance, "InternalLogger Thread");
+               logThread.start();
+       }
+
+       public static InternalLogger getInstance() {
+               return instance;
        }
        
        public boolean checkLevel(int currentLogLevel) {
@@ -149,14 +184,28 @@ public class InternalLogger {
                bufWriter = null;
                printWriter = null;
        }
-       
+
+       /**
+        * Tries to put message into message queue.
+        *
+        * @param type type of log message
+        * @param obj message object to put into queue
+        */
+       private void tryPutMessage(int type, Object obj) {
+               try {
+                       msgQueue.put(new Message(type, obj));
+               } catch (InterruptedException e) {
+                       e.printStackTrace();
+               }
+       }
+
        public void printLog() {
-               System.out.println();
+               tryPutMessage(INFO, CommonConstants.NEW_LINE);
        }
        
        public void printLog(boolean applyNewLine, int logType, Object msg) {
                if (applyNewLine == false) {
-                       System.out.print(msg);
+                       tryPutMessage(logType, msg);
                } else {
                        if (msg instanceof Throwable) {
                                Throwable e = (Throwable)msg;
@@ -177,62 +226,46 @@ public class InternalLogger {
                                        }
                                }
 
-                               System.err.println(exceptionMsg);
-                       } else {
-                               if (logType == PERFORMANCE) {
-                                       if (printWriter == null) {
-                                               return;
-                                       }
-                                       
-                                       printWriter.println(msg);
-                                       printWriter.checkError();
-                               } else {
-                                       StringBuilder logMsg = new StringBuilder();
-                                       switch (logType) {
-                                       case ERROR:
+                               msg = exceptionMsg;
+                               logType = ERROR;
+                       } else if (logType != PERFORMANCE) {
+                               StringBuilder logMsg = new StringBuilder();
+                               switch (logType) {
+                                       case ERROR :
                                                logMsg.append("[ERROR] ");
                                                break;
-                                       case WARNING:
+                                       case WARNING :
                                                logMsg.append("[WARNING] ");
                                                break;
-                                       case INFO:
+                                       case INFO :
                                                logMsg.append("[INFO] ");
                                                break;
-                                       case CHECK:
+                                       case CHECK :
                                                logMsg.append("[CHECK] ");
                                                break;
-                                       case DEBUG:
+                                       case DEBUG :
                                                logMsg.append("[DEBUG] ");
                                                break;
-                                       default:
+                                       default :
                                                break;
-                                       }
-                                       
-                                       logMsg.append(dateFormat.format(new Date()));
-                                       logMsg.append(SEPARATOR_PIPE);
-                                       if (logType != ERROR)
-                                               logMsg.append(getCallerInfo());
-                                       logMsg.append(String.valueOf(msg));
-                                       
-                                       if (logType == ERROR) {
-                                               logMsg.append(getCallstackInfo());
-                                               System.err.println(logMsg);
-                                       } else {
-                                               System.out.println(logMsg);
-                                       }
                                }
+
+                               logMsg.append(dateFormat.format(new Date()));
+                               logMsg.append(SEPARATOR_PIPE);
+                               if (logType != ERROR)
+                                       logMsg.append(getCallerInfo());
+                               logMsg.append(String.valueOf(msg));
+
+                               if (logType == ERROR)
+                                       logMsg.append(getCallstackInfo());
+
+                               msg = logMsg;
                        }
+
+                       tryPutMessage(logType, msg + CommonConstants.NEW_LINE);
                }
        }
        
-//     public void printLog(int logType, String userKey, Object msg) {
-//             if (this.userKey.equals(userKey)) {
-//                     printLog(logType, msg);
-//             } else {
-//                     return;
-//             }
-//     }
-       
        private String getCallerInfo() {
                String msg = null;
                StackTraceElement[] trace = new Throwable().getStackTrace();
@@ -285,23 +318,6 @@ public class InternalLogger {
                }
        }
        
-//     public void performance(String key, String folderPath, testState state) {
-//             if (checkLevel(PERFORMANCE)) {
-//                     switch (state) {
-//                     case START:
-//                             performanceStart(key, folderPath);
-//                             break;
-//                     case END:
-//                             performanceEnd(key);
-//                             break;
-//                     default:
-//                             break;
-//                     }
-//             } else {
-//                     return;
-//             }
-//     }
-       
        public void performance(String key, String testStep, String description) {
                if (checkLevel(PERFORMANCE)) {  
                        String msg = performanceNormal(key, description);
@@ -414,8 +430,6 @@ public class InternalLogger {
                        long startTime = startTimes.remove(startTimes.size() - 1);
                        long spendTime = nanoTime - startTime;
                        long totalTime = totalSpentTimeMap.get(key) + spendTime;
-//                     int totalCount = testTotalCountMap.get(key) + 1;        
-//                     testTotalCountMap.put(key, totalCount);
                        testCountMap.put(key, count -1);
                        totalSpentTimeMap.put(key, totalTime);
                        
@@ -467,36 +481,6 @@ public class InternalLogger {
                return msg;
        }
        
-       private CharSequence makeCommonLog(int logType, String logMessage) {
-               StringBuilder msg = new StringBuilder();
-               switch (logType) {
-               case ERROR:
-                       msg.append("[ERROR] ");
-                       break;
-               case WARNING:
-                       msg.append("[WARNING] ");
-                       break;
-               case CHECK:
-                       msg.append("[CHECK] ");
-                       break;
-               case INFO:
-                       msg.append("[INFO] ");
-                       break;
-               case DEBUG:
-                       msg.append("[DEBUG] ");
-                       break;
-               default:
-                       break;
-               }
-               
-               msg.append(dateFormat.format(new Date()));
-               msg.append(SEPARATOR_PIPE);
-               msg.append(getCallerInfo());
-               msg.append(logMessage);
-               
-               return msg;
-       }
-       
        public CharSequence makeTestLog(String testStep, String message) {
                StringBuilder msg = new StringBuilder();
                msg.append("<testcase step=\"");
@@ -507,15 +491,35 @@ public class InternalLogger {
                return msg;
        }
        
-//     public void setPerformanceSaveFilename(String filename) {
-//             performanceSaveFilename = filename;
-//     }
-       
        public void setLogLevel(int logLevel) {
                this.logLevel = logLevel;
        }
        
-//     public void setUserKey(String userKey) {
-//             this.userKey = userKey;
-//     }
+       @Override
+       public void run() {
+               try {
+                       while (true) {
+                               Message message = msgQueue.take();
+                               switch (message.type) {
+                                       case ERROR :
+                                               System.err.print(message.obj);
+                                               break;
+
+                                       case PERFORMANCE :
+                                               if (printWriter == null)
+                                                       break;
+
+                                               printWriter.println(message.obj);
+                                               printWriter.checkError();
+                                               break;
+
+                                       default :
+                                               System.out.print(message.obj);
+                                               break;
+                               }
+                       }
+               } catch (InterruptedException e) {
+                       e.printStackTrace();
+               }
+       }
 }
index 6ede5f2..90cc029 100644 (file)
@@ -6,7 +6,7 @@
        <parent>
                <artifactId>dynamic-analyzer</artifactId>
                <groupId>org.tizen.dynamicanalyzer</groupId>
-               <version>2.4.1-SNAPSHOT</version>
+               <version>2.4.2-SNAPSHOT</version>
                <relativePath>..</relativePath>
        </parent>
        <groupId>org.tizen.dynamicanalyzer</groupId>
index 2acdc1a..b5e83e2 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?pde version="3.5"?>
 
-<product name="%DynamicAnalyzer" uid="org.tizen.dynamicanalyzer.workbench.product" id="org.tizen.dynamicanalyzer.workbench.product" application="org.tizen.dynamicanalyzer.workbench.application" version="2.4.1.qualifier" useFeatures="true" includeLaunchers="true">
+<product name="%DynamicAnalyzer" uid="org.tizen.dynamicanalyzer.workbench.product" id="org.tizen.dynamicanalyzer.workbench.product" application="org.tizen.dynamicanalyzer.workbench.application" version="2.4.2.qualifier" useFeatures="true" includeLaunchers="true">
 
    <aboutInfo>
       <image path="icons/about_tizen_sdk.png"/>
index 2a0216a..249a3e4 100644 (file)
@@ -8,13 +8,13 @@
        <parent>
                <artifactId>dynamic-analyzer</artifactId>
                <groupId>org.tizen.dynamicanalyzer</groupId>
-               <version>2.4.1-SNAPSHOT</version>
+               <version>2.4.2-SNAPSHOT</version>
                <relativePath>..</relativePath>
        </parent>
 
        <groupId>org.tizen.dynamicanalyzer</groupId>
        <artifactId>org.tizen.dynamicanalyzer.workbench.product</artifactId>
-       <version>2.4.1-SNAPSHOT</version>
+       <version>2.4.2-SNAPSHOT</version>
        <packaging>eclipse-repository</packaging>
 
        <properties>
index ba07d52..e9b43a5 100644 (file)
@@ -676,10 +676,15 @@ public enum SettingDataManager {
                                TimelinePage timelinePage = (TimelinePage) baseView.getTopComposite();
                                timelinePage.getTimelineChartView().showScreenshotChart(enable);
 
-                               if (enable)
+                               if (enable) {
                                        target.addSelectedFlatFeature(FlatFeature.SCREENSHOT.getName());
-                               else
+                                       UILayoutDataManager.INSTANCE
+                                                       .addSelectedChart(FlatFeature.SCREENSHOT.getChart());
+                               } else {
                                        target.removeSelectedFlatFeature(FlatFeature.SCREENSHOT.getName());
+                                       UILayoutDataManager.INSTANCE
+                                                       .removeSelectedChart(FlatFeature.SCREENSHOT.getChart());
+                               }
                        }
                }
        }
index 002326f..f8b48fd 100644 (file)
@@ -153,9 +153,27 @@ public enum UILayoutDataManager {
                writeLayoutFile();
        }
 
+       /**
+        * Adds chart with a specified name to a list of selected charts.
+        *
+        * @param chartName name of the chart to add
+        * @return {@code true} on success
+        */
        public boolean addSelectedChart(String chartName) {
                boolean ret = selectedChartSet.add(chartName);
                writeLayoutFile();
                return ret;
        }
+
+       /**
+        * Removes chart with a specified name from a list of selected charts.
+        *
+        * @param chartName name of the chart to remove
+        * @return {@code true} on success
+        */
+       public boolean removeSelectedChart(String chartName) {
+               boolean ret = selectedChartSet.remove(chartName);
+               writeLayoutFile();
+               return ret;
+       }
 }
index 0942dc9..03563de 100644 (file)
@@ -141,8 +141,8 @@ public class MemoryDataManager extends PageDataManager {
                String keystring = String.format("%d-%d", pid, address);\r
                \r
                int binaryId = Global.getBinaryID(pid, tracetime, log.getCallerPcAddr());\r
-               String appname = Global.getCurrentDeviceInfo().getSelectedAppID();\r
-               \r
+               String appname = Global.getCurrentApplication().getExecBinaryPath();\r
+\r
                if(log.getLibName().endsWith(appname)) {\r
                        binaryId = AnalyzerConstants.MAIN_EXECUTABLE_ID;\r
                }\r
index fa5dbcc..c6b05d4 100755 (executable)
@@ -1177,8 +1177,10 @@ public abstract class DATableComposite extends Composite {
         * @param enable flag indicates whether filtering items should be enabled
         */
        private void enableFiltering(boolean enable) {
+               if (null == popupMenu || null == popupMenu.getChildren())
+                       return;
                for (DAPopupMenuItem item : popupMenu.getChildren()) {
-                       if (item.getText() == null)
+                       if (item == null || item.getText() == null)
                                //To prevent NullPointerException
                                continue;
                        if (item.getText().startsWith(POPUP_FILTER_BY))
index ad3c480..71009b3 100644 (file)
@@ -1,3 +1,10 @@
+* 2.4.2
+- Fix UI Event list not shown due to NullPointerException (regression in DA 2.4.1)
+- Fix empty heap chart for main executable (regression in DA 2.4.0)
+- Fix JIRA defects:
+  SPTSDKUX-2495: DA Launch Delayed too much
+  SPTSDKUX-2722: Capture icon is not add screenshot tab for second time tracing
+== Maria Guseva <m.guseva@samsung.com> November 25, 2016
 * 2.4.1
 - Add support for multi-application packages
 - Fix Persistent Allocations table update after filtering
index 652a0e1..20466a5 100644 (file)
@@ -1,5 +1,5 @@
 Source:dynamic-analyzer
-Version:2.4.1
+Version:2.4.2
 Maintainer:Gihun Chang <gihun.chang@samsung.com>, WooJin Jung <woojin2.jung@samsung.com>, Jaewon Lim <jaewon81.lim@samsung.com>, Seokgil Kang <seokgil.kang@samsung.com>
 
 Package:dynamic-analyzer-product
diff --git a/pom.xml b/pom.xml
index ee2c1db..8d3d43d 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
        <modelVersion>4.0.0</modelVersion>
        <groupId>org.tizen.dynamicanalyzer</groupId>
        <artifactId>dynamic-analyzer</artifactId>
-       <version>2.4.1-SNAPSHOT</version>
+       <version>2.4.2-SNAPSHOT</version>
        <packaging>pom</packaging>
 
        <modules>