Function Profiling : save callstack information to DB in runtime, enable binary setti... 08/22208/1
authorwoojin <woojin2.jung@samsung.com>
Fri, 30 May 2014 02:08:13 +0000 (11:08 +0900)
committerwoojin <woojin2.jung@samsung.com>
Fri, 30 May 2014 02:08:13 +0000 (11:08 +0900)
1. save callstackdata, callstackunit to DB in runtime, remove unnecessary callstackdata from memory
2. enable function profiling / callstack for libraries set in binary setting.

Change-Id: I1805563f02089356985b0f6e94d618284301c7c6
Signed-off-by: woojin <woojin2.jung@samsung.com>
17 files changed:
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/AnalyzerConstants.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/AnalyzerManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/handlers/OpenTraceHandler.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/sql/SqlManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/callstack/BaseCallstackManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/callstack/SWAPCallStackManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/logparser/SWAPLogParser.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/info/callstack/CallStackInserter.java [new file with mode: 0644]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/info/callstack/CallStackManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/info/callstack/CallstackTable.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/range/RangeDataManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/summary/profiling/FunctionUsageProfiler.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/summary/profiling/ProfileDataMaker.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/summary/profiling/ProfilingTable.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/StopLogProcessor.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/ConfigurationDialogDataManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/ConfigurationDialogFeaturesTable.java

index 5e0f54a..185433f 100644 (file)
@@ -316,6 +316,11 @@ public class AnalyzerConstants {
        public final static int MSG_SWAP_INST_REMOVE_ACK = 0x1009;
        public final static int MSG_WAIT_ACK = 0x1010;
 
+       // function entry/exit
+       public final static int FUNCTION_TYPE_APPINST = 0x0001;
+       public final static int FUNCTION_TYPE_SYSCALL = 0x0003;
+       public final static int FUNCTION_TYPE_FILE = 0x0004;
+
        public final static int TYPE_TABLE_CALLSTACK = 0x0001;
        public final static int TYPE_TABLE_FAILED = 0x0002;
        public final static int TYPE_TABLE_LEAK = 0x0004;
index 12ecdc1..fc7a819 100755 (executable)
@@ -79,7 +79,7 @@ public class AnalyzerManager {
        private static FailedChecker calledChecker = new FailedChecker();
        private static WarningChecker warningChecker = new WarningChecker();
        private static CallStackManager callstackManager = new CallStackManager();
-       private static SWAPCallStackManager swapCallstackManager = new SWAPCallStackManager();
+       private static SWAPCallStackManager swapCallstackManager = new SWAPCallStackManager(false);
 
        private static Timer screenshotTimer = null;
 
index f2263be..f9e411a 100644 (file)
@@ -121,8 +121,9 @@ public class OpenTraceHandler extends AbstractHandler {
                }
 
                int percent = OpenTraceProgressManager.getInstance().getPercent();
-               if (loadInfos() && loadCallStackData() && loadCallStackApis()
+               if (loadInfos() && loadCallStackApis()
                                && loadProfilingData() && loadProfilingChildData() &&
+                               // loadCallStackData() &&
                                // loadLeakData() &&
                                // loadFailedData() &&
                                loadImageSet()) {
@@ -492,4 +493,4 @@ public class OpenTraceHandler extends AbstractHandler {
                        }
                });
        }
-}
+}
\ No newline at end of file
index 1cb10f8..92c2534 100755 (executable)
@@ -38,13 +38,12 @@ import java.sql.SQLWarning;
 import java.sql.Statement;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
 import org.tizen.dynamicanalyzer.common.AnalyzerManager;
 import org.tizen.dynamicanalyzer.common.GlobalInformation;
-import org.tizen.dynamicanalyzer.communicator.DACommunicator;
 import org.tizen.dynamicanalyzer.constant.CommonConstants;
 import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
 import org.tizen.dynamicanalyzer.project.Project;
@@ -801,7 +800,7 @@ public class SqlManager {
                for (int i = 0; i < pids.size(); i++) {
                        ProfileDataMaker profiler = FunctionUsageProfiler.getInstance()
                                        .getProfileDataMakerByPid(pids.get(i));
-                       HashMap<Integer, ProfilingData> profilingDataMap = profiler
+                       Map<Integer, ProfilingData> profilingDataMap = profiler
                                        .getProfilingDataMap();
                        List<ProfilingData> pDataList = new ArrayList<ProfilingData>();
                        pDataList.addAll(profilingDataMap.values());
@@ -836,7 +835,7 @@ public class SqlManager {
                for (int i = 0; i < pids.size(); i++) {
                        ProfileDataMaker profiler = FunctionUsageProfiler.getInstance()
                                        .getProfileDataMakerByPid(pids.get(i));
-                       HashMap<String, ProfilingChildData> profilingDataMap = profiler
+                       Map<String, ProfilingChildData> profilingDataMap = profiler
                                        .getChildListMap();
                        List<ProfilingChildData> pDataList = new ArrayList<ProfilingChildData>();
                        pDataList.addAll(profilingDataMap.values());
index 65cdf9a..7805286 100644 (file)
@@ -4,6 +4,7 @@
  * Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Contact: 
+ * WooJin Jung <woojin2.jung@samsung.com> 
  * Jooyoul Lee <jy.exe.lee@samsung.com>
  * Juyoung Kim <j0.kim@samsung.com>
  *
@@ -28,21 +29,31 @@ package org.tizen.dynamicanalyzer.swap.callstack;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
-import java.util.TreeMap;
+import java.util.Map;
+import java.util.NavigableMap;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentSkipListMap;
 
 import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
 import org.tizen.dynamicanalyzer.common.AnalyzerManager;
 import org.tizen.dynamicanalyzer.common.GlobalInformation;
-import org.tizen.dynamicanalyzer.communicator.DACommunicator;
+import org.tizen.dynamicanalyzer.common.SymbolManager;
 import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
+import org.tizen.dynamicanalyzer.nl.InformationViewLabels;
 import org.tizen.dynamicanalyzer.project.AppInfo;
+import org.tizen.dynamicanalyzer.swap.channel.control.BinaryInfo;
+import org.tizen.dynamicanalyzer.swap.channel.data.LibraryObject;
 import org.tizen.dynamicanalyzer.swap.channel.data.ProcessInfo;
 import org.tizen.dynamicanalyzer.swap.channel.data.ProcessInfoPackage;
 import org.tizen.dynamicanalyzer.swap.model.data.LogData;
+import org.tizen.dynamicanalyzer.swap.platform.BinarySettingManager;
 import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackData;
+import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackInserter;
 import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackUnit;
 import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackItem;
 import org.tizen.dynamicanalyzer.ui.summary.profiling.ProfileDataMaker;
+import org.tizen.dynamicanalyzer.util.DALogger;
+import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
 
 public abstract class BaseCallstackManager {
        protected class DuplicateUserCall {
@@ -71,12 +82,16 @@ public abstract class BaseCallstackManager {
                }
        }
 
-       protected HashMap<Integer, HashMap<Long, CallStackUnit>> callstackApiAddrByPidMap = new HashMap<Integer, HashMap<Long, CallStackUnit>>();
-       protected HashMap<Integer, CallStackData> callstackDataBySeqMap = new HashMap<Integer, CallStackData>();
+       protected ConcurrentHashMap<Integer, ConcurrentHashMap<Long, CallStackUnit>> callstackApiAddrByPidMap = new ConcurrentHashMap<Integer, ConcurrentHashMap<Long, CallStackUnit>>();
+       protected ConcurrentHashMap<Integer, CallStackData> callstackDataBySeqMap = new ConcurrentHashMap<Integer, CallStackData>();
        protected String userFunctionBin = null;
        protected HashMap<Integer, List<CallStackItem>> userCallstackByTidMap = new HashMap<Integer, List<CallStackItem>>();
        protected HashMap<Integer, DuplicateUserCall> dupUserCallByTidMap = new HashMap<Integer, DuplicateUserCall>();
-       protected HashMap<Integer, TreeMap<Long, Integer>> seqTimeByTidMap = new HashMap<Integer, TreeMap<Long, Integer>>();
+       protected HashMap<Integer, ConcurrentSkipListMap<Long, Integer>> seqTimeByTidMap = new HashMap<Integer, ConcurrentSkipListMap<Long, Integer>>();
+       
+       protected CallStackInserter callstackInserter = null;
+       
+       protected static final DALogger DA_LOG = DALogger.getInstance();        
        
        abstract public void makeUserCallstack(LogData log,
                        ProfileDataMaker profiler);
@@ -85,6 +100,22 @@ public abstract class BaseCallstackManager {
 
        abstract public boolean isIrregularUserCall(LogData input);
 
+       public void offerCallStackUnit(CallStackUnit csu) {
+               if (callstackInserter != null) {
+                       callstackInserter.startInserterThread();
+                       callstackInserter.offerCallstackUnit(csu);
+               }
+               return;
+       }
+       
+       public void offerCallStackData(CallStackData csd) {
+               if (callstackInserter != null) {
+                       callstackInserter.startInserterThread();
+                       callstackInserter.offerCallstackData(csd);
+               }
+               return;         
+       }
+       
        public List<Integer> getPidsOfCallstackApiAddrMap() {
                ArrayList<Integer> pids = new ArrayList<Integer>();
                pids.addAll(callstackApiAddrByPidMap.keySet());
@@ -92,21 +123,21 @@ public abstract class BaseCallstackManager {
                return pids;
        }
        
-       public HashMap<Long, CallStackUnit> getCallStackApiAddrByPidMap(int pid) {
+       public Map<Long, CallStackUnit> getCallStackApiAddrByPidMap(int pid) {
                if (null == callstackApiAddrByPidMap) {
-                       callstackApiAddrByPidMap = new HashMap<Integer, HashMap<Long, CallStackUnit>>();
+                       callstackApiAddrByPidMap = new ConcurrentHashMap<Integer, ConcurrentHashMap<Long, CallStackUnit>>();
                }
-               HashMap<Long, CallStackUnit> callstackApiByAddrMap = callstackApiAddrByPidMap.get(pid);
+               ConcurrentHashMap<Long, CallStackUnit> callstackApiByAddrMap = callstackApiAddrByPidMap.get(pid);
                if(null == callstackApiByAddrMap) {
-                       callstackApiByAddrMap = new HashMap<Long, CallStackUnit>();
+                       callstackApiByAddrMap = new ConcurrentHashMap<Long, CallStackUnit>();
                        callstackApiAddrByPidMap.put(pid, callstackApiByAddrMap);
                }
                return callstackApiByAddrMap;
        }
 
-       public HashMap<Integer, CallStackData> getCallStackDataBySeqMap() {
+       public Map<Integer, CallStackData> getCallStackDataBySeqMap() {
                if (null == callstackDataBySeqMap) {
-                       callstackDataBySeqMap = new HashMap<Integer, CallStackData>();
+                       callstackDataBySeqMap = new ConcurrentHashMap<Integer, CallStackData>();
                }
                return callstackDataBySeqMap;
        }
@@ -118,13 +149,13 @@ public abstract class BaseCallstackManager {
                return dupUserCallByTidMap;
        }
 
-       public TreeMap<Long, Integer> getSeqTimeByTidMap(int tid) {
+       public NavigableMap<Long, Integer> getSeqTimeByTidMap(int tid) {
                if (null == seqTimeByTidMap) {
-                       seqTimeByTidMap = new HashMap<Integer, TreeMap<Long, Integer>>();
+                       seqTimeByTidMap = new HashMap<Integer, ConcurrentSkipListMap<Long, Integer>>();
                }
-               TreeMap<Long, Integer> seqByTimeMap = seqTimeByTidMap.get(tid);
+               ConcurrentSkipListMap<Long, Integer> seqByTimeMap = seqTimeByTidMap.get(tid);
                if(null == seqByTimeMap) {
-                       seqByTimeMap = new TreeMap<Long, Integer>();
+                       seqByTimeMap = new ConcurrentSkipListMap<Long, Integer>();
                        seqTimeByTidMap.put(tid, seqByTimeMap);
                }
                return seqByTimeMap;
@@ -184,7 +215,7 @@ public abstract class BaseCallstackManager {
        }
 
        public long getPCAddrBySeq(int seq) {
-               HashMap<Integer, CallStackData> cdMap = getCallStackDataBySeqMap();
+               Map<Integer, CallStackData> cdMap = getCallStackDataBySeqMap();
                if (null == cdMap) {
                        return -1;
                }
@@ -199,5 +230,134 @@ public abstract class BaseCallstackManager {
                return addrs.get(0);
        }
 
+       // TODO: remove unnecessary lines       
+       // callstack symbol format : path(functionName
+       // ex. /usr/lib/libpthread.so(pthread_create
+       public String getCallStackSymbol(long addr, int pid, long time) {
+               String functionName = null;
+               String symbol = null;
+               ProcessInfoPackage processInfoPkg = AnalyzerManager
+                               .getProject().getProcessInfoPackage(pid);
+               ProcessInfo processInfo = processInfoPkg.getProcessInfo(time);          
+
+               if (addr >= processInfo.getLowestAddress()
+                               && addr <= processInfo.getHighestAddress()) { // application binary
+                       String baseAddr = Long.toString(processInfo.getLowestAddress());
+                       String pcStr = Long.toString(addr);
+                       BinaryInfo binInfo = processInfo.getTargetBinary(addr);
+                       if(binInfo != null) {
+                               String localPath = binInfo.getTempBinaryPath();
+                               boolean isPieBuild = true;
+                               if (binInfo.getType() != 1) {
+                                       isPieBuild = false;
+                               }
+                               functionName = SymbolManager.addr2func(localPath, pcStr, isPieBuild,
+                                               baseAddr);
+                       }
+                       if (null == functionName || functionName.isEmpty()
+                                       || functionName.equals("_end")) { //$NON-NLS-1$
+                               functionName = InformationViewLabels.CALLSTACK_TABLE_UNKNOWN_FUNCTION;
+//                             ApiNameManager.getApiId(functionName);
+                       } else {
+                               String prevFunctionName = functionName;
+                               functionName = SymbolManager
+                                               .demanglingFunctionName(prevFunctionName);
+//                             ApiNameManager.getApiId(functionName);
+                       }
+                       // need to be checked again - in case pid is not main application
+                       symbol = getUserFunctionPosition(pid, time)
+                                       + AnalyzerConstants.CALLSTACK_API_TOKEN_STRING
+                                       + functionName;
+               } else {
+                       HashMap<String, BinaryInfo> binInfoMap = BinarySettingManager
+                                       .getInstance().getTargetBinInfoMap();
+//                     List<String> binPaths = new ArrayList<String>();
+//                     binPaths.addAll(binInfoMap.keySet());
+
+                       List<LibraryObject> libObjs = processInfo.getLibObjs();
+//                     HashMap<String, LibraryObject> libHash = processInfo
+//                                     .getLibObjHash();
+                       LibraryObject libraryObject = null;
+                       int size = libObjs.size();
+                       for (int i = 0; i < size; i++) {
+//                             String binPath = binPaths.get(i);
+                               LibraryObject libObj = libObjs.get(i);
+//                             if (null == libObj) {
+//                                     continue;
+//                             }
+                               long lowAddr = libObj.getLowestAddress();
+                               long highAddr = libObj.getHighestAddress();
+
+                               /** for debug */
+/*                             if (lowAddr > pcAddr || highAddr < pcAddr) {
+                                       System.out.print(sampleLog.getId() 
+                                                       + "lib : " + libObj.getLibPath() + " ==> ");
+                                       AnalyzerUtil.printHexdecimal(lowAddr);
+                                       System.out.print(" < ");
+                                       AnalyzerUtil.printHexdecimal(pcAddr);
+                                       System.out.print(" < ");
+                                       AnalyzerUtil.printHexdecimal(highAddr);
+                                       System.out.println();
+                               }
+*/
+                               if (addr >= lowAddr && addr <= highAddr) {
+                                       libraryObject = libObj;
+                                       break;
+                               }
+                               else {
+//                                     System.out.print(sampleLog.getId() 
+//                                                     + "lib : " + libObj.getLibPath() + " ==> ");
+//                                     AnalyzerUtil.printHexdecimal(lowAddr);
+//                                     System.out.print(" < ");
+//                                     AnalyzerUtil.printHexdecimal(pcAddr);
+//                                     System.out.print(" < ");
+//                                     AnalyzerUtil.printHexdecimal(highAddr);
+//                                     System.out.println();                                   
+                               }
+                       }
+                       if (null != libraryObject) {
+                               String path = libraryObject.getLibPath();
+                               BinaryInfo binInfo = binInfoMap.get(path);
+                               if (null != binInfo) {
+                                       String localPath = binInfo.getTempBinaryPath();                                 
+                                       String baseAddr = Long.toString(libraryObject
+                                                       .getLowestAddress());
+                                       String pcStr = Long.toString(addr);
+                                       boolean isPieBuild = true;
+                                       if (binInfo.getType() != 1) {
+                                               isPieBuild = false;
+                                       }
+                                       functionName = SymbolManager.addr2func(localPath, pcStr,
+                                                       isPieBuild, baseAddr);
+                                       if (null == functionName || functionName.isEmpty()
+                                                       || functionName.equals("_end")) { //$NON-NLS-1$
+                                               functionName = InformationViewLabels.CALLSTACK_TABLE_UNKNOWN_FUNCTION;
+//                                             ApiNameManager.getApiId(functionName);
+                                       } else {
+                                               String prevFunctionName = functionName;
+                                               functionName = SymbolManager
+                                                               .demanglingFunctionName(prevFunctionName);
+//                                             ApiNameManager.getApiId(functionName);
+                                       }
+                                       // need to be checked again - in case pid is not main application
+                               } else {
+                                       functionName = InformationViewLabels.CALLSTACK_TABLE_UNKNOWN_FUNCTION;
+                               }
+                               symbol = path + AnalyzerConstants.CALLSTACK_API_TOKEN_STRING
+                                               + functionName;
+                       } else {
+                               DA_LOG.debug("binary for the sample pc is not found :" + AnalyzerUtil.toHexdecimal(addr)); //$NON-NLS-1$
+                               symbol = InformationViewLabels.CALLSTACK_TABLE_UNKNOWN_LIBRARY
+                                               + AnalyzerConstants.CALLSTACK_API_TOKEN_STRING
+                                               + AnalyzerUtil.toHexdecimal(addr);
+//                                             + InformationViewLabels.CALLSTACK_TABLE_UNKNOWN_FUNCTION;                               
+                       }
+               }
+
+               AnalyzerManager.getFuncNameMapByPid(pid)
+                       .put(addr, functionName);
+               return symbol;
+       }       
+       
        abstract public void clear();
 }
index a953e59..9b6c17e 100644 (file)
@@ -33,13 +33,13 @@ import static org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants.M
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
-import java.util.TreeMap;
+import java.util.Map;
+import java.util.NavigableMap;
 
 import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
 import org.tizen.dynamicanalyzer.common.AnalyzerManager;
 import org.tizen.dynamicanalyzer.common.GlobalInformation;
 import org.tizen.dynamicanalyzer.common.SymbolManager;
-import org.tizen.dynamicanalyzer.communicator.DACommunicator;
 import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
 import org.tizen.dynamicanalyzer.swap.channel.control.BinaryInfo;
 import org.tizen.dynamicanalyzer.swap.channel.data.ProcessInfo;
@@ -48,28 +48,29 @@ import org.tizen.dynamicanalyzer.swap.model.data.LogData;
 import org.tizen.dynamicanalyzer.swap.model.data.ProbeCommonData;
 import org.tizen.dynamicanalyzer.swap.model.data.ProfileData;
 import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackData;
+import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackInserter;
 import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackItem;
 import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackUnit;
 import org.tizen.dynamicanalyzer.ui.summary.profiling.ProfileDataMaker;
-import org.tizen.dynamicanalyzer.util.DALogger;
 import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
 
 public class SWAPCallStackManager extends BaseCallstackManager {
-       private static final DALogger DA_LOG = DALogger.getInstance();
+       
+       // callstackdata made in range analysis should not be saved to DB 
+       public SWAPCallStackManager(boolean isRange) {
+               if (!isRange) {
+                       callstackInserter = CallStackInserter.getInstance();
+               } else {
+                       callstackInserter = null;
+               }
+       }
 
        public void makeUserCallstack(LogData input, ProfileDataMaker profiler) {
                ProfileData log = (ProfileData) input;
                int pid = log.getPid();
                long time = log.getTime();
 
-               HashMap<Long, CallStackUnit> addrMap = getCallStackApiAddrByPidMap(pid);
-               boolean isPieBuild = AnalyzerUtil.isPieBuild(pid, time);
-               String baseAddr = Long.toString(AnalyzerManager.getProject()
-                               .getBaseAddress(pid, time));
-               String sourceBinPath = AnalyzerUtil.getBinarySourcePath(pid, time);
-               if (null == sourceBinPath || sourceBinPath.isEmpty()) {
-                       return;
-               }
+               Map<Long, CallStackUnit> addrMap = getCallStackApiAddrByPidMap(pid);
 
                int seq = log.getSeq();
                int tid = log.getTid();
@@ -77,19 +78,16 @@ public class SWAPCallStackManager extends BaseCallstackManager {
                long selfAddr = log.getPcAddr();
                long callerAddr = log.getCallerPcAddr();
 
-               String strSelfAddr = Long.toString(selfAddr);
-               String strCallerAddr = Long.toString(callerAddr);
-
                CallStackData callstackData = new CallStackData(seq);
                CallStackUnit selfCallstackUnit = addrMap.get(selfAddr);
 
                if (null == selfCallstackUnit) {
-                       String strSelfFuncName = SymbolManager.addr2func(sourceBinPath,
-                                       strSelfAddr, isPieBuild, baseAddr);
-                       String strSelfSymbol = getUserFunctionPosition(pid, time)
+                       String strSelfFuncName = log.getApiName();
+                       String strSelfSymbol = log.getBinaryPath()
                                        + AnalyzerConstants.CALLSTACK_API_TOKEN_STRING
                                        + strSelfFuncName;
                        selfCallstackUnit = new CallStackUnit(selfAddr, strSelfSymbol, log);
+                       offerCallStackUnit(selfCallstackUnit);
                        addrMap.put(selfAddr, selfCallstackUnit);
                }
 
@@ -98,17 +96,14 @@ public class SWAPCallStackManager extends BaseCallstackManager {
 
                List<CallStackItem> userCallstack = getUserCallstack(tid);
                int size = userCallstack.size();
-               TreeMap<Long, Integer> seqByTimeMap = getSeqTimeByTidMap(tid);
+               NavigableMap<Long, Integer> seqByTimeMap = getSeqTimeByTidMap(tid);
 
                CallStackUnit callerCallstackUnit = addrMap.get(callerAddr);
                if (null == callerCallstackUnit) {
-                       String strCallerFuncName = SymbolManager.addr2func(sourceBinPath,
-                                       strCallerAddr, isPieBuild, baseAddr);
-                       String strCallerSymbol = getUserFunctionPosition(pid, time)
-                                       + AnalyzerConstants.CALLSTACK_API_TOKEN_STRING
-                                       + strCallerFuncName;
+                       String strCallerSymbol = getCallStackSymbol(callerAddr, pid, time);
                        callerCallstackUnit = new CallStackUnit(callerAddr,
                                        strCallerSymbol, log);
+                       offerCallStackUnit(callerCallstackUnit);
                        addrMap.put(callerAddr, callerCallstackUnit);
                }
 
@@ -129,6 +124,7 @@ public class SWAPCallStackManager extends BaseCallstackManager {
                                                                LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR,
                                                                LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_SYMBOL,
                                                                log);
+                                               offerCallStackUnit(defaultCallstackUnit);
                                                addrMap.put(
                                                                LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR,
                                                                defaultCallstackUnit);
@@ -177,6 +173,7 @@ public class SWAPCallStackManager extends BaseCallstackManager {
                                callstackData.getAddrs().add(
                                                userCallstack.get(i).getCallStackUnit().getAddr());
                        }
+                       offerCallStackData(callstackData);
                        getCallStackDataBySeqMap().put(seq, callstackData);
                        seqByTimeMap.put(time, seq);
                } else if (eventType == MSG_FUNCTION_EXIT) {
@@ -231,6 +228,7 @@ public class SWAPCallStackManager extends BaseCallstackManager {
                                        callstackData.getAddrs().add(
                                                        userCallstack.get(i).getCallStackUnit().getAddr());
                                }
+                               offerCallStackData(callstackData);
                                getCallStackDataBySeqMap().put(seq, callstackData);
                                seqByTimeMap.put(time, seq);
                        } else {
@@ -259,35 +257,21 @@ public class SWAPCallStackManager extends BaseCallstackManager {
                        log = (ProbeCommonData) inputData;
                }
 
-               HashMap<Long, CallStackUnit> addrMap = getCallStackApiAddrByPidMap(inputData
-                               .getPid());
+               Map<Long, CallStackUnit> addrMap = 
+                               getCallStackApiAddrByPidMap(inputData.getPid());
                int pid;
                long time;
-               boolean isPieBuild;
-               String baseAddr, sourceBinPath;
                if (isProfileData) {
                        pid = pData.getPid();
                        time = pData.getTime();
-                       isPieBuild = isPieBuild(pid, time);
-                       baseAddr = Long.toString(AnalyzerManager.getProject()
-                                       .getBaseAddress(pid, time));
-                       sourceBinPath = AnalyzerUtil.getBinarySourcePath(pid, time);
                } else {
                        pid = log.getPid();
                        time = log.getTime();
-                       isPieBuild = isPieBuild(pid, time);
-                       baseAddr = Long.toString(AnalyzerManager.getProject()
-                                       .getBaseAddress(pid, time));
-                       sourceBinPath = AnalyzerUtil.getBinarySourcePath(pid, time);
-               }
-
-               if (null == sourceBinPath || sourceBinPath.isEmpty()) {
-                       return;
                }
 
                int seq = inputData.getSeq();
                int tid;
-               long callerAddr;
+               long callerAddr = -1;
                if (isProfileData) {
                        tid = pData.getTid();
                        callerAddr = pData.getCallerPcAddr();
@@ -303,12 +287,12 @@ public class SWAPCallStackManager extends BaseCallstackManager {
                // getCallStackDataBySeqMap().put(seq, callstackData);
                // return;
                // }
-               if (callerAddr < 0) {
+               if (callerAddr < 0) { // TODO: verify which case this is
                        CallStackData callstackData = new CallStackData(seq);
+                       offerCallStackData(callstackData);
                        getCallStackDataBySeqMap().put(seq, callstackData);
                        return;
                }
-               String strCallerAddr = Long.toString(callerAddr);
 
                // System.out.println("tid :" + tid);
                List<CallStackItem> probeCallstack = new ArrayList<CallStackItem>(
@@ -331,6 +315,7 @@ public class SWAPCallStackManager extends BaseCallstackManager {
                                                LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR,
                                                LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_SYMBOL,
                                                inputData);
+                               offerCallStackUnit(defaultCallstackUnit);
                                addrMap.put(
                                                LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR,
                                                defaultCallstackUnit);
@@ -338,13 +323,10 @@ public class SWAPCallStackManager extends BaseCallstackManager {
                } else {
                        CallStackUnit callerCallstackUnit = addrMap.get(callerAddr);
                        if (null == callerCallstackUnit) {
-                               String strCallerFuncName = SymbolManager.addr2func(
-                                               sourceBinPath, strCallerAddr, isPieBuild, baseAddr);
-                               String strCallerSymbol = getUserFunctionPosition(pid, time)
-                                               + AnalyzerConstants.CALLSTACK_API_TOKEN_STRING
-                                               + strCallerFuncName;
+                               String strCallerSymbol = getCallStackSymbol(callerAddr, pid, time);
                                callerCallstackUnit = new CallStackUnit(callerAddr,
                                                strCallerSymbol, inputData);
+                               offerCallStackUnit(callerCallstackUnit);
                                addrMap.put(callerAddr, callerCallstackUnit);
                        }
 
@@ -364,6 +346,7 @@ public class SWAPCallStackManager extends BaseCallstackManager {
                        callstackData.getAddrs().add(
                                        probeCallstack.get(i).getCallStackUnit().getAddr());
                }
+               offerCallStackData(callstackData);
                getCallStackDataBySeqMap().put(seq, callstackData);
 
        }
@@ -371,7 +354,7 @@ public class SWAPCallStackManager extends BaseCallstackManager {
        // check irregular enter/exit log (multiple logs from 1 function call)
        public boolean isIrregularUserCall(LogData log) {
                ProfileData input = (ProfileData) log;
-               HashMap<Long, CallStackUnit> addrMap = getCallStackApiAddrByPidMap(input
+               Map<Long, CallStackUnit> addrMap = getCallStackApiAddrByPidMap(input
                                .getPid());
                HashMap<Integer, DuplicateUserCall> dupUserCallMap = getDupUserCallByTidMap();
 
@@ -460,12 +443,12 @@ public class SWAPCallStackManager extends BaseCallstackManager {
                if (null == processInfo) {
                        return false;
                }
-
-               if (addr >= processInfo.getLowestAddress()
-                               && addr <= processInfo.getHighestAddress()) {
-                       return true;
-               } else {
+               // return true when addr is within memory range of main executable  
+               // or library which is set in the binary setting
+               if (null == processInfo.getTargetBinary(addr)) {
                        return false;
+               } else {
+                       return true;
                }
        }
 
index 4fbd928..6925c2c 100755 (executable)
@@ -4,6 +4,7 @@
  * Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Contact: 
+ * WooJin Jung <woojin2.jung@samsung.com>
  * Jooyoul Lee <jy.exe.lee@samsung.com>
  * Juyoung Kim <j0.kim@samsung.com>
  *
@@ -155,69 +156,66 @@ public class SWAPLogParser implements Runnable {
 
                                if (id != DataChannelConstants.MSG_DATA_SAMPLE) {
                                        ProfileData pData = (ProfileData) log;
-                                       long pcAddr = pData.getPcAddr();
-
-                                       ProcessInfoPackage processInfoPkg = AnalyzerManager
-                                                       .getProject().getProcessInfoPackage(pData.getPid());
-
-                                       String apiName = pData.getApiName();
-                                       if (null == apiName || apiName.isEmpty()
-                                                       || apiName.equals("_end")) { //$NON-NLS-1$
-                                               apiName = getFuncName(pData);
-                                               if (apiName == null
-                                                               || apiName.equals("<unknown function>")) {
-                                                       continue;
-                                               } else {
-                                                       pData.setApiName(apiName);
+                                       System.out.println("@@@@ " + pData.getProbeType() + pData.getProbeSubType() + " @@@@@");
+                                       // function_exit log doesn't have probe type yet                                        
+//                                     if (pData.getProbeType()  
+//                                                     == AnalyzerConstants.FUNCTION_TYPE_APPINST) {
+       
+                                               ProcessInfoPackage processInfoPkg = AnalyzerManager
+                                                               .getProject().getProcessInfoPackage(pData.getPid());
+       
+                                               String apiName = pData.getApiName();
+                                               if (null == apiName || apiName.isEmpty()
+                                                               || apiName.equals("_end")) { //$NON-NLS-1$
+                                                       apiName = getFuncName(pData);
+                                                       if (apiName == null
+                                                                       || apiName.equals("<unknown function>")) {
+                                                               continue;
+                                                       } else {
+                                                               pData.setApiName(apiName);
+                                                       }
                                                }
-                                       }
-
-                                       if (processInfoPkg.isDropLog()) {
-                                               apiName = pData.getApiName();
-                                               if (apiName.contains(OSP_MAIN)) {
-                                                       processInfoPkg.setDropLog(false);
-                                               } else {
-                                                       continue;
+                                               System.out.println("@@@@ " + pData.getApiName() + " @@@@@");
+                                               if (processInfoPkg.isDropLog()) {
+                                                       apiName = pData.getApiName();
+                                                       if (apiName.contains(OSP_MAIN)) {
+                                                               processInfoPkg.setDropLog(false);
+                                                       } else {
+                                                               continue;
+                                                       }
                                                }
-                                       }
-
-                                       // irregular call check still necessary?
-                                       // if (AnalyzerManager.getCallstackManager()
-                                       // .isIrregularUserCall(pData)) {
-                                       // continue;
-                                       // }
-
-                                       ProcessInfo processInfo = processInfoPkg
-                                                       .getProcessInfo(pData.getTime());
-
-                                       // for debug
-                                       // System.out.println(" PROFILE LOG DEBUG = ID: "
-                                       // + pData.getId()
-                                       // + " PC : "
-                                       // + AnalyzerUtil.toHexdecimal(pData.getPcAddr())
-                                       // + " Api : "
-                                       // + pData.getApiName()
-                                       // + " caller :  "
-                                       // + AnalyzerUtil.toHexdecimal(pData.getCallerPcAddr())
-                                       // + "   base addr : "
-                                       // + AnalyzerUtil.toHexdecimal(processInfo
-                                       // .getLowestAddress()));
-
-                                       pushLog(log, logPack);
-                                       if (pcAddr >= processInfo.getLowestAddress()
-                                                       && pcAddr <= processInfo.getHighestAddress()) {
-                                               /* user callstack create by entry and exit */
-                                               AnalyzerManager.getCallstackManager()
-                                                               .makeUserCallstack(
-                                                                               pData,
-                                                                               FunctionUsageProfiler.getInstance()
-                                                                                               .getProfileDataMakerByPid(
-                                                                                                               pData.getPid()));
-                                       } else {
-                                               AnalyzerManager.getCallstackManager()
-                                                               .makeCallstackWithoutBacktrace(pData);
-                                       }
-                               } else {
+       
+                                               // irregular call check still necessary?
+                                               // if (AnalyzerManager.getCallstackManager()
+                                               // .isIrregularUserCall(pData)) {
+                                               // continue;
+                                               // }
+       
+       
+                                               // for debug
+                                               // System.out.println(" PROFILE LOG DEBUG = ID: "
+                                               // + pData.getId()
+                                               // + " PC : "
+                                               // + AnalyzerUtil.toHexdecimal(pData.getPcAddr())
+                                               // + " Api : "
+                                               // + pData.getApiName()
+                                               // + " caller :  "
+                                               // + AnalyzerUtil.toHexdecimal(pData.getCallerPcAddr())
+                                               // + "   base addr : "
+                                               // + AnalyzerUtil.toHexdecimal(processInfo
+                                               // .getLowestAddress()));
+       
+                                               pushLog(log, logPack);
+                                                       AnalyzerManager.getCallstackManager()
+                                                                       .makeUserCallstack(
+                                                                                       pData,
+                                                                                       FunctionUsageProfiler.getInstance()
+                                                                                                       .getProfileDataMakerByPid(
+                                                                                                                       pData.getPid()));
+//                                     } else { // system call enter/exit : not used yet
+//                                             pushLog(log, logPack);
+//                                     }
+                               } else { // sample log
                                        pushLog(log, logPack);
                                }
                        } else if (log instanceof ReplayData) {
@@ -426,6 +424,7 @@ public class SWAPLogParser implements Runnable {
        // System.out.println(" ]");
        // }
 
+       // TODO: remove unnecessary code
        private String getFuncName(ProfileData input) {
                long pcAddr = input.getPcAddr();
                HashMap<Long, String> funcNameMap = AnalyzerManager
@@ -528,6 +527,7 @@ public class SWAPLogParser implements Runnable {
                                        String baseAddr = Long.toString(libraryObject
                                                        .getLowestAddress());
                                        String pcStr = Long.toString(pcAddr);
+                                       input.setBinaryPath(binInfo.getTargetBinaryPath());                                     
                                        boolean isPieBuild = true;
                                        if (binInfo.getType() != 1) {
                                                isPieBuild = false;
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/info/callstack/CallStackInserter.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/info/callstack/CallStackInserter.java
new file mode 100644 (file)
index 0000000..d4481bb
--- /dev/null
@@ -0,0 +1,184 @@
+/*
+ *  Dynamic Analyzer
+ *
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * WooJin Jung <woojin2.jung@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+package org.tizen.dynamicanalyzer.ui.info.callstack;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ConcurrentLinkedQueue;
+
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
+import org.tizen.dynamicanalyzer.constant.CommonConstants;
+import org.tizen.dynamicanalyzer.sql.DBTableInfo;
+import org.tizen.dynamicanalyzer.sql.DBTableManager;
+import org.tizen.dynamicanalyzer.sql.SqlManager;
+
+// TODO: apply new DB schema, class, API
+// inserter thread for callstackdata, callstackunit
+public class CallStackInserter implements Runnable {
+       private static CallStackInserter instance = null;
+       private ConcurrentLinkedQueue<CallStackData> callstackDataQueue = new ConcurrentLinkedQueue<CallStackData>();
+       private ConcurrentLinkedQueue<CallStackUnit> callstackUnitQueue = new ConcurrentLinkedQueue<CallStackUnit>();
+       private static volatile Thread inserterThread = null;
+       private static final int FULL_COUNT = 100;
+       private static boolean stopTrace = false;
+
+       public synchronized static CallStackInserter getInstance() {
+               if (null == instance) {
+                       instance = new CallStackInserter();
+               }
+               return instance;
+       }
+
+       public synchronized void startInserterThread() {
+               if (inserterThread == null) {
+                       stopTrace = false;
+                       inserterThread = new Thread(null, getInstance());
+                       inserterThread.start();
+               }
+
+       }
+
+       public void stopInserterThread() {
+               if (inserterThread != null && inserterThread.isAlive()) {
+                       try {
+                               stopTrace = true;
+                               inserterThread.join(AnalyzerConstants.THREAD_JOIN_WAIT_TIME);
+                               inserterThread = null;
+                       } catch (InterruptedException e) {
+                               e.printStackTrace();
+                       }
+               }
+       }
+
+       private void saveCallStackUnits() {
+               DBTableInfo unitTableInfo = DBTableManager.getInstance().getTableInfo(
+                               DBTableManager.TABLE_INDEX_CALLSTACK_UNITS);
+               List<List<String>> insetData = new ArrayList<List<String>>();
+               String insertQuery = unitTableInfo.insertQuery();
+               CallStackUnit csu = null;
+               int insertCount = FULL_COUNT;
+
+               while ((csu = callstackUnitQueue.poll()) != null) {
+                       List<String> insetRowData = new ArrayList<String>();
+                       try {
+                               insetRowData.add(Long.toString(csu.getAddr()));
+                               insetRowData.add(csu.getSymbol());
+                               insetRowData.add(Integer.toString(csu.getPid()));
+                               insetRowData.add(Long.toString(csu.getTime()));                         
+                       } catch (ArrayIndexOutOfBoundsException e) {
+                               e.printStackTrace();
+                       }
+                       insetData.add(insetRowData);
+                       if ((insertCount-- <= 0) && (stopTrace == false)) {
+                               break;
+                       }
+               }
+               if (insetData.size() > 0) {
+                       SqlManager.getInstance().insertQuery(insertQuery, insetData);
+               }
+       }
+
+       private void saveCallStackData() {
+               DBTableInfo callstackData = DBTableManager.getInstance().getTableInfo(
+                               DBTableManager.TABLE_INDEX_CALLSTACK_DATA);
+               List<List<String>> insetData = new ArrayList<List<String>>();
+               String insertQuery = callstackData.insertQuery();
+               CallStackData csd = null;
+               int insertCount = FULL_COUNT;
+
+               while ((csd = callstackDataQueue.poll()) != null) {
+                       List<String> insetRowData = new ArrayList<String>();
+                       String addrs = makeLongList2String(csd.getAddrs());
+                       try {
+                               insetRowData.add(Integer.toString(csd.getSeq()));
+                               insetRowData.add(addrs);
+                       } catch (ArrayIndexOutOfBoundsException e) {
+                               e.printStackTrace();
+                       }
+                       insetData.add(insetRowData);
+                       if ((insertCount-- <= 0) && (stopTrace == false)) {
+                               break;
+                       }
+               }
+               if (insetData.size() > 0) {
+                       SqlManager.getInstance().insertQuery(insertQuery, insetData);
+               }
+       }
+
+       public void offerCallstackUnit(CallStackUnit csu) {
+               if (null != csu) {
+                       callstackUnitQueue.offer(csu);
+               }
+       }
+
+       public void offerCallstackData(CallStackData csd) {
+               if (null != csd) {
+                       callstackDataQueue.offer(csd);
+               }
+       }
+
+       @Override
+       public void run() {
+               while (!stopTrace) {
+                       if (callstackUnitQueue.size() > FULL_COUNT)
+                               saveCallStackUnits();
+                       if (callstackDataQueue.size() > FULL_COUNT)
+                               saveCallStackData();
+
+                       try {
+                               Thread.sleep(10);
+                       } catch (InterruptedException e) {
+                               e.printStackTrace();
+                       }
+               }
+               saveCallStackUnits();
+               saveCallStackData();
+       }
+
+       public static String makeLongList2String(List<Long> input) {
+               if (null == input || input.isEmpty()) {
+                       return null;
+               }
+       
+               int size = input.size();
+               StringBuffer str = new StringBuffer();
+               for (int i = 0; i < size; i++) {
+                       try {
+                               str.append(input.get(i));
+                       } catch (OutOfMemoryError e) {
+                               e.printStackTrace();
+                       }
+                       if (i + 1 == size) {
+                               break;
+                       } else {
+                               str.append(CommonConstants.SLASH);
+                       }
+               }
+               return str.toString();
+       }
+
+}
\ No newline at end of file
index 3171588..608133b 100644 (file)
@@ -30,6 +30,7 @@ package org.tizen.dynamicanalyzer.ui.info.callstack;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
 import org.tizen.dynamicanalyzer.common.AnalyzerManager;
@@ -41,15 +42,13 @@ import org.tizen.dynamicanalyzer.swap.model.data.LogData;
 import org.tizen.dynamicanalyzer.swap.model.data.ProbeCommonData;
 import org.tizen.dynamicanalyzer.swap.model.data.UserFunctionData;
 import org.tizen.dynamicanalyzer.ui.summary.profiling.ProfileDataMaker;
-import org.tizen.dynamicanalyzer.util.DALogger;
 import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
 
 public class CallStackManager extends BaseCallstackManager {
-       private static final DALogger DA_LOG = DALogger.getInstance();
 
        public void makeUserCallstack(LogData input, ProfileDataMaker profiler) {
                UserFunctionData log = (UserFunctionData) input;
-               HashMap<Long, CallStackUnit> addrMap = getCallStackApiAddrByPidMap(log.getPid());
+               Map<Long, CallStackUnit> addrMap = getCallStackApiAddrByPidMap(log.getPid());
                boolean isPieBuild = AnalyzerUtil.isPieBuild(log.getPid(),
                                log.getTime());
                String baseAddr = Long.toString(AnalyzerManager.getProject()
@@ -215,7 +214,7 @@ public class CallStackManager extends BaseCallstackManager {
        }
 
        public void makeCallstackWithoutBacktrace(LogData inputData) {
-               HashMap<Long, CallStackUnit> addrMap = getCallStackApiAddrByPidMap(inputData.getPid());
+               Map<Long, CallStackUnit> addrMap = getCallStackApiAddrByPidMap(inputData.getPid());
                boolean isPieBuild = AnalyzerUtil.isPieBuild(inputData.getPid(),
                                inputData.getTime());
                String baseAddr = Long.toString(AnalyzerManager.getProject()
@@ -305,7 +304,7 @@ public class CallStackManager extends BaseCallstackManager {
        // check irregular enter/exit log (multiple logs from 1 function call)
        public boolean isIrregularUserCall(LogData data) {
                UserFunctionData input = (UserFunctionData) data;
-               HashMap<Long, CallStackUnit> addrMap = getCallStackApiAddrByPidMap(input.getPid());
+               Map<Long, CallStackUnit> addrMap = getCallStackApiAddrByPidMap(input.getPid());
                HashMap<Integer, DuplicateUserCall> dupUserCallMap = getDupUserCallByTidMap();
 
                boolean isPieBuild = AnalyzerUtil.isPieBuild(input.getPid(),
index 169e159..52682ad 100644 (file)
@@ -4,6 +4,7 @@
  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Contact: 
+ * WooJin Jung <woojin2.jung@samsung.com> 
  * Jooyoul Lee <jy.exe.lee@samsung.com>
  * Juyoung Kim <j0.kim@samsung.com>
  *
@@ -26,8 +27,9 @@
 
 package org.tizen.dynamicanalyzer.ui.info.callstack;
 
-import java.util.HashMap;
+import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
 
 import org.eclipse.nebula.widgets.grid.GridItem;
 import org.eclipse.swt.SWT;
@@ -37,7 +39,9 @@ import org.eclipse.swt.widgets.Composite;
 import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
 import org.tizen.dynamicanalyzer.common.AnalyzerManager;
 import org.tizen.dynamicanalyzer.common.DASelectionData;
+import org.tizen.dynamicanalyzer.constant.CommonConstants;
 import org.tizen.dynamicanalyzer.model.TableInput;
+import org.tizen.dynamicanalyzer.sql.SqlManager;
 import org.tizen.dynamicanalyzer.swap.model.data.LogData;
 import org.tizen.dynamicanalyzer.ui.file.FilePage;
 import org.tizen.dynamicanalyzer.ui.opengl.GLPage;
@@ -47,10 +51,12 @@ import org.tizen.dynamicanalyzer.ui.summary.SummaryPage;
 import org.tizen.dynamicanalyzer.ui.userinterface.UIPage;
 import org.tizen.dynamicanalyzer.ui.widgets.table.DATableComposite;
 import org.tizen.dynamicanalyzer.ui.widgets.table.DATableDataFormat;
+import org.tizen.dynamicanalyzer.util.DALogger;
 import org.tizen.dynamicanalyzer.utils.Formatter;
 import org.tizen.dynamicanalyzer.widgets.da.view.DAViewData;
 
 public class CallstackTable extends DATableComposite {
+       private static final DALogger DA_LOG = DALogger.getInstance();  
 
        public CallstackTable(Composite parent, int compStyle, int tableStyle) {
                super(parent, compStyle, tableStyle);
@@ -132,25 +138,50 @@ public class CallstackTable extends DATableComposite {
                                libName = logData.getLibName();
                        }
 
-                       HashMap<Integer, CallStackData> cdMap = AnalyzerManager
+                       Map<Integer, CallStackData> cdMap = AnalyzerManager
                                        .getCallstackManager().getCallStackDataBySeqMap();
-                       HashMap<Long, CallStackUnit> addrMap = AnalyzerManager
+                       Map<Long, CallStackUnit> addrMap = AnalyzerManager
                                        .getCallstackManager().getCallStackApiAddrByPidMap(pid);
                        if (null == cdMap || null == addrMap) {
                                return;
                        }
                        CallStackData csd = cdMap.get(seqNum);
-                       if (null == csd) {
-                               return;
+                       List<Long> addrs = null;
+                       if (null == csd) { // callstackdata is not in memory, find from DB
+                               // TODO: apply new DB schema
+                               String callstackQuery = "where seqnumber = " + seqNum;
+                               List<List<String>> dbInfo = SqlManager.getInstance()
+                                               .selectQuery(null, new String[] { "callstack" }, 
+                                               "CallstackData", callstackQuery);
+                               if (null == dbInfo || 0 == dbInfo.size() 
+                                               || null == dbInfo.get(0)) { // not found
+                                       return;
+                               }
+                               String strAddrs = dbInfo.get(0).get(0);
+                               if (null == strAddrs) {
+                                       return;
+                               }
+                               String[] splitAddrs = strAddrs.split(CommonConstants.SLASH);
+                               int size = splitAddrs.length;
+                               addrs = new ArrayList<Long>(); 
+                               for (int j = 0; j < size; j++) {
+                                       long addr = Long.parseLong(splitAddrs[j]);
+                                       addrs.add(addr);
+                               }
+                       } else { // callstackdata is in memory
+                               addrs = csd.getAddrs();
                        }
 
-                       List<Long> addrs = csd.getAddrs();
                        int size = addrs.size();
                        for (int i = 0; i < size; i++) {
                                CallStackUnit api = addrMap.get(addrs.get(i));
 
                                String hexAddr = Formatter.toHexString(addrs.get(i).toString());
                                String path = api.getPath();
+                               if (null == path) {
+                                       DA_LOG.debug("callstackunit for addr : " + hexAddr + " not found");
+                                       return;
+                               }
                                // if path has "da_probe.so" then reject
                                if (path.contains(AnalyzerConstants.PROBE_LIB_TIZEN)
                                                || path.contains(AnalyzerConstants.PROBE_LIB_OSP)) {
index 301266c..63fb719 100644 (file)
@@ -4,6 +4,7 @@
  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Contact: 
+ * WooJin Jung <woojin2.jung@samsung.com> 
  * Jooyoul Lee <jy.exe.lee@samsung.com>
  * Juyoung Kim <j0.kim@samsung.com>
  *
@@ -39,8 +40,6 @@ import org.tizen.dynamicanalyzer.sql.SqlManager;
 import org.tizen.dynamicanalyzer.swap.callstack.BaseCallstackManager;
 import org.tizen.dynamicanalyzer.swap.callstack.SWAPCallStackManager;
 import org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants;
-import org.tizen.dynamicanalyzer.swap.channel.data.ProcessInfo;
-import org.tizen.dynamicanalyzer.swap.channel.data.ProcessInfoPackage;
 import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
 import org.tizen.dynamicanalyzer.swap.logparser.Logs;
 import org.tizen.dynamicanalyzer.swap.model.data.LogData;
@@ -86,7 +85,7 @@ public class RangeDataManager implements Runnable {
                leakDetector = new LeakDetector();
                warningChecker = new WarningChecker();
                callstackManager = new CallStackManager();
-               swapCallstackManager = new SWAPCallStackManager();
+               swapCallstackManager = new SWAPCallStackManager(true);
 
                // fileDataMaker = new FileDataMaker(failedChecker, leakDetector,
                // warningChecker);
@@ -438,24 +437,15 @@ public class RangeDataManager implements Runnable {
                                        ProfileDataMaker profileDataMaker = getProfileDataMakerByPid(input
                                                        .getPid());
                                        if (input.getId() != DataChannelConstants.MSG_DATA_SAMPLE) {
-                                               ProcessInfoPackage processInfoPkg = AnalyzerManager
-                                                               .getProject().getProcessInfoPackage(input.getPid());
-                                               ProcessInfo processInfo = processInfoPkg
-                                                               .getProcessInfo(input.getTime());
-                                               long pcAddr = input.getPcAddr();
-                                               if (pcAddr >= processInfo.getLowestAddress()
-                                                               && pcAddr <= processInfo.getHighestAddress()) {
-                                                       /* user callstack create by entry and exit */
+                                               // function_exit log doesn't have probe type yet                                                                                        
+//                                             if (input.getProbeType() 
+//                                                             == AnalyzerConstants.FUNCTION_TYPE_APPINST) {
                                                        swapCallstackManager.makeUserCallstack(input,
                                                                        profileDataMaker);
-                                               } else {
-                                                       swapCallstackManager
-                                                                       .makeCallstackWithoutBacktrace(input);
-                                               }
+//                                             }
                                        } else {
                                                profileDataMaker.makeFunctionUsageProfileData(input);
                                        }
-
                                }
                        }
                }
index 891d541..0e23e6f 100644 (file)
@@ -29,7 +29,11 @@ package org.tizen.dynamicanalyzer.ui.summary.profiling;
 
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
+import java.util.NavigableMap;
+import java.util.SortedMap;
 
 import org.tizen.dynamicanalyzer.common.AnalyzerManager;
 import org.tizen.dynamicanalyzer.constant.CommonConstants;
@@ -105,15 +109,45 @@ public class FunctionUsageProfiler extends PageDataManager {
                                                        ConfigureLabels.FUNCTION_PROFILING_SAMPLING_PERIODIC);
                }
 
-               Logs logs = pack.getLogs(DataChannelConstants.MSG_DATA_SAMPLE);
-               if (null != logs && logs.getRawLogs().size() != 0) {
-                       List<LogData> sample = logs.getLogs();
-                       int size = sample.size();
-                       for (int i = 0; i < size; i++) {
-                               getInstance().getProfileDataMakerByPid(sample.get(i).getPid())
-                                               .makeFunctionUsageProfileData(
-                                                               (ProfileData) sample.get(i));
+               if (ConfigurationDialogDataManager.getInstance() // sampling is on
+                               .getfeatureValue(
+                                               ConfigureLabels.FEATURE_FUNCTION_PROFILING) != 0) {
+                       Logs logs = pack.getLogs(DataChannelConstants.MSG_DATA_SAMPLE);
+                       if (null != logs && logs.getRawLogs().size() != 0) {
+                               List<LogData> sample = logs.getLogs();
+                               int size = sample.size();
+                               for (int i = 0; i < size; i++) {
+                                       ProfileData sampleLog = (ProfileData) sample.get(i);
+                                       getInstance().getProfileDataMakerByPid(
+                                                       sample.get(i).getPid())
+                                                       .makeFunctionUsageProfileData(sampleLog);
+                                       // remove unnecessary callstackdata from memory
+                                       NavigableMap<Long, Integer> seqByTimeMap = 
+                                                       AnalyzerManager.getCallstackManager()
+                                                       .getSeqTimeByTidMap(sampleLog.getTid());
+                                       // find the time of callstackdata which was made 
+                                       // right before the current sample time
+                                       // callstackdatas made before that time is needless                                             
+                                       Long lastTime = seqByTimeMap
+                                                       .floorKey(sampleLog.getTime());
+                                       if (null != lastTime) {
+                                               SortedMap<Long, Integer> headMap = 
+                                                               seqByTimeMap.headMap(lastTime);
+                                               Iterator<Map.Entry<Long, Integer>> itr = headMap
+                                                               .entrySet().iterator();
+                                               while (itr.hasNext()) {
+                                                       Map.Entry<Long, Integer> entry = itr.next();
+                                                       AnalyzerManager.getCallstackManager()
+                                                               .getCallStackDataBySeqMap()
+                                                               .remove(entry.getValue());
+                                                       itr.remove();
+                                               }
+                                       }
+                               }
                        }
+               } else { // sampling is off, callstackdata is not needed in memory
+                       AnalyzerManager.getCallstackManager()
+                               .getCallStackDataBySeqMap().clear();
                }
        }
 }
index f8c65f2..d2dc784 100644 (file)
@@ -32,29 +32,22 @@ import static org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants.M
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
-import java.util.TreeMap;
+import java.util.Map;
+import java.util.NavigableMap;
+import java.util.concurrent.ConcurrentHashMap;
 
 import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
-import org.tizen.dynamicanalyzer.common.AnalyzerManager;
-import org.tizen.dynamicanalyzer.common.SymbolManager;
 import org.tizen.dynamicanalyzer.common.path.PathConstants;
 import org.tizen.dynamicanalyzer.communicator.DACommunicator;
 import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
-import org.tizen.dynamicanalyzer.nl.InformationViewLabels;
 import org.tizen.dynamicanalyzer.swap.callstack.BaseCallstackManager;
-import org.tizen.dynamicanalyzer.swap.channel.control.BinaryInfo;
-import org.tizen.dynamicanalyzer.swap.channel.data.LibraryObject;
-import org.tizen.dynamicanalyzer.swap.channel.data.ProcessInfo;
-import org.tizen.dynamicanalyzer.swap.channel.data.ProcessInfoPackage;
 import org.tizen.dynamicanalyzer.swap.model.data.LogData;
 import org.tizen.dynamicanalyzer.swap.model.data.ProfileData;
 import org.tizen.dynamicanalyzer.swap.model.data.UserFunctionData;
-import org.tizen.dynamicanalyzer.swap.platform.BinarySettingManager;
 import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackData;
 import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackItem;
 import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackUnit;
 import org.tizen.dynamicanalyzer.util.DALogger;
-import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
 import org.tizen.dynamicanalyzer.utils.Formatter;
 
 public class ProfileDataMaker {
@@ -102,13 +95,13 @@ public class ProfileDataMaker {
         * key: seq - value : function usage profiling data hash map all function
         * usage profiling data are in this hash map
         **/
-       private HashMap<Integer, ProfilingData> profilingDataMap = null;
-       private HashMap<String, String> symbolSeqHash = null;
+       private ConcurrentHashMap<Integer, ProfilingData> profilingDataMap = null;
+       private ConcurrentHashMap<String, String> symbolSeqHash = null;
 
        /**
         * key : seq - value : child seq list // all child lists are in this hash
         */
-       private HashMap<String, ProfilingChildData> childListMap = null;
+       private ConcurrentHashMap<String, ProfilingChildData> childListMap = null;
 
        private ProfilingData appBin = null;
        private ProfilingData dependentLib = null;
@@ -170,7 +163,7 @@ public class ProfileDataMaker {
        }
 
        public ProfilingData getProfilingDataByKey(String key) {
-               HashMap<String, String> hash = getSymbolSeqHash();
+               Map<String, String> hash = getSymbolSeqHash();
                String seq = hash.get(key);
                if (null != seq) {
                        return getProfilingDataMap().get(Integer.parseInt(seq));
@@ -178,23 +171,23 @@ public class ProfileDataMaker {
                return null;
        }
 
-       public HashMap<Integer, ProfilingData> getProfilingDataMap() {
+       public Map<Integer, ProfilingData> getProfilingDataMap() {
                if (null == profilingDataMap) {
-                       profilingDataMap = new HashMap<Integer, ProfilingData>();
+                       profilingDataMap = new ConcurrentHashMap<Integer, ProfilingData>();
                }
                return profilingDataMap;
        }
 
-       public HashMap<String, ProfilingChildData> getChildListMap() {
+       public Map<String, ProfilingChildData> getChildListMap() {
                if (null == childListMap) {
-                       childListMap = new HashMap<String, ProfilingChildData>();
+                       childListMap = new ConcurrentHashMap<String, ProfilingChildData>();
                }
                return childListMap;
        }
 
-       public HashMap<String, String> getSymbolSeqHash() {
+       public Map<String, String> getSymbolSeqHash() {
                if (null == symbolSeqHash) {
-                       symbolSeqHash = new HashMap<String, String>();
+                       symbolSeqHash = new ConcurrentHashMap<String, String>();
                }
                return symbolSeqHash;
        }
@@ -271,136 +264,7 @@ public class ProfileDataMaker {
                        }
                }
        }
-
-       public String getSamplePCSymbol(ProfileData sampleLog) {
-               String functionName = null;
-               String symbol = null;
-               long pcAddr = sampleLog.getPcAddr();
-               ProcessInfoPackage processInfoPkg = AnalyzerManager
-                               .getProject().getProcessInfoPackage(sampleLog.getPid());
-               ProcessInfo processInfo = processInfoPkg.getProcessInfo(sampleLog
-                               .getTime());            
-
-               if (pcAddr >= processInfo.getLowestAddress()
-                               && pcAddr <= processInfo.getHighestAddress()) { // application binary
-                       String baseAddr = Long.toString(processInfo.getLowestAddress());
-                       String pcStr = Long.toString(pcAddr);
-                       BinaryInfo binInfo = processInfo.getTargetBinary(pcAddr);
-                       if(binInfo != null) {
-                               String localPath = binInfo.getTempBinaryPath();
-                               boolean isPieBuild = true;
-                               if (binInfo.getType() != 1) {
-                                       isPieBuild = false;
-                               }
-                               functionName = SymbolManager.addr2func(localPath, pcStr, isPieBuild,
-                                               baseAddr);
-                       }
-                       if (null == functionName || functionName.isEmpty()
-                                       || functionName.equals("_end")) { //$NON-NLS-1$
-                               functionName = InformationViewLabels.CALLSTACK_TABLE_UNKNOWN_FUNCTION;
-//                             ApiNameManager.getApiId(functionName);
-                       } else {
-                               String prevFunctionName = functionName;
-                               functionName = SymbolManager
-                                               .demanglingFunctionName(prevFunctionName);
-//                             ApiNameManager.getApiId(functionName);
-                       }
-                       // need to be checked again - in case pid is not main application
-                       symbol = callstackManager.getUserFunctionPosition(
-                                       sampleLog.getPid(), sampleLog.getTime())
-                                       + AnalyzerConstants.CALLSTACK_API_TOKEN_STRING
-                                       + functionName;
-               } else {
-                       HashMap<String, BinaryInfo> binInfoMap = BinarySettingManager
-                                       .getInstance().getTargetBinInfoMap();
-//                     List<String> binPaths = new ArrayList<String>();
-//                     binPaths.addAll(binInfoMap.keySet());
-
-                       List<LibraryObject> libObjs = processInfo.getLibObjs();
-//                     HashMap<String, LibraryObject> libHash = processInfo
-//                                     .getLibObjHash();
-                       LibraryObject libraryObject = null;
-                       int size = libObjs.size();
-                       for (int i = 0; i < size; i++) {
-//                             String binPath = binPaths.get(i);
-                               LibraryObject libObj = libObjs.get(i);
-//                             if (null == libObj) {
-//                                     continue;
-//                             }
-                               long lowAddr = libObj.getLowestAddress();
-                               long highAddr = libObj.getHighestAddress();
-
-                               /** for debug */
-/*                             if (lowAddr > pcAddr || highAddr < pcAddr) {
-                                       System.out.print(sampleLog.getId() 
-                                                       + "lib : " + libObj.getLibPath() + " ==> ");
-                                       AnalyzerUtil.printHexdecimal(lowAddr);
-                                       System.out.print(" < ");
-                                       AnalyzerUtil.printHexdecimal(pcAddr);
-                                       System.out.print(" < ");
-                                       AnalyzerUtil.printHexdecimal(highAddr);
-                                       System.out.println();
-                               }
-*/
-                               if (pcAddr >= lowAddr && pcAddr <= highAddr) {
-                                       libraryObject = libObj;
-                                       break;
-                               }
-                               else {
-//                                     System.out.print(sampleLog.getId() 
-//                                                     + "lib : " + libObj.getLibPath() + " ==> ");
-//                                     AnalyzerUtil.printHexdecimal(lowAddr);
-//                                     System.out.print(" < ");
-//                                     AnalyzerUtil.printHexdecimal(pcAddr);
-//                                     System.out.print(" < ");
-//                                     AnalyzerUtil.printHexdecimal(highAddr);
-//                                     System.out.println();                                   
-                               }
-                       }
-                       if (null != libraryObject) {
-                               String path = libraryObject.getLibPath();
-                               BinaryInfo binInfo = binInfoMap.get(path);
-                               if (null != binInfo) {
-                                       String localPath = binInfo.getTempBinaryPath();                                 
-                                       String baseAddr = Long.toString(libraryObject
-                                                       .getLowestAddress());
-                                       String pcStr = Long.toString(pcAddr);
-                                       boolean isPieBuild = true;
-                                       if (binInfo.getType() != 1) {
-                                               isPieBuild = false;
-                                       }
-                                       functionName = SymbolManager.addr2func(localPath, pcStr,
-                                                       isPieBuild, baseAddr);
-                                       if (null == functionName || functionName.isEmpty()
-                                                       || functionName.equals("_end")) { //$NON-NLS-1$
-                                               functionName = InformationViewLabels.CALLSTACK_TABLE_UNKNOWN_FUNCTION;
-//                                             ApiNameManager.getApiId(functionName);
-                                       } else {
-                                               String prevFunctionName = functionName;
-                                               functionName = SymbolManager
-                                                               .demanglingFunctionName(prevFunctionName);
-//                                             ApiNameManager.getApiId(functionName);
-                                       }
-                                       // need to be checked again - in case pid is not main application
-                               } else {
-                                       functionName = InformationViewLabels.CALLSTACK_TABLE_UNKNOWN_FUNCTION;
-                               }
-                               symbol = path + AnalyzerConstants.CALLSTACK_API_TOKEN_STRING
-                                               + functionName;
-                       } else {
-                               DA_LOG.debug("binary for the sample pc is not found :" + AnalyzerUtil.toHexdecimal(pcAddr)); //$NON-NLS-1$
-                               symbol = InformationViewLabels.CALLSTACK_TABLE_UNKNOWN_LIBRARY
-                                               + AnalyzerConstants.CALLSTACK_API_TOKEN_STRING
-                                               + AnalyzerUtil.toHexdecimal(pcAddr);
-//                                             + InformationViewLabels.CALLSTACK_TABLE_UNKNOWN_FUNCTION;                               
-                       }
-               }
-
-               AnalyzerManager.getFuncNameMapByPid(sampleLog.getPid())
-                       .put(pcAddr, functionName);
-               return symbol;
-       }
-                               
+       
        public void makeFunctionUsageProfileData(ProfileData sampleLog) {
                totalSampleCount++;
                List<Long> addrs = null;
@@ -414,14 +278,15 @@ public class ProfileDataMaker {
                        long callstackTime;
                        Long longTime = null;
                        CallStackData callstackData;
-                       TreeMap<Long, Integer> seqByTimeMap = callstackManager.getSeqTimeByTidMap(tid);
-                       HashMap<Long, CallStackUnit> addrMap = callstackManager
+                       NavigableMap<Long, Integer> seqByTimeMap = callstackManager.getSeqTimeByTidMap(tid);
+                       Map<Long, CallStackUnit> addrMap = callstackManager
                                        .getCallStackApiAddrByPidMap(pid);
 
                        CallStackUnit callstackUnit = addrMap.get(selfAddr);
                        if (null == callstackUnit) {
                                CallStackUnit newCallstackUnit = new CallStackUnit(selfAddr,
-                                               getSamplePCSymbol(sampleLog), sampleLog);
+                                               callstackManager.getCallStackSymbol(selfAddr, pid, sampleTime), sampleLog);
+                               callstackManager.offerCallStackUnit(newCallstackUnit);
                                addrMap.put(selfAddr, newCallstackUnit);                                        
                        }
                        
@@ -460,7 +325,7 @@ public class ProfileDataMaker {
                        addrs = makeCallstackHashAndList(sampleCallstack, sampleLog);
                }
                
-               HashMap<Long, CallStackUnit> addrMap = callstackManager
+               Map<Long, CallStackUnit> addrMap = callstackManager
                                .getCallStackApiAddrByPidMap(pid);
                CallStackUnit inputData = addrMap.get(selfAddr);
                if (null == inputData) {
@@ -510,10 +375,6 @@ public class ProfileDataMaker {
                }
                for (int i = 0; i < size; i++) {
                        CallStackUnit callstackCsa = addrMap.get(addrs.get(i));
-                       // disable inclusive cpu time of dependent library
-                       if (!callstackManager.checkUserCall(callstackCsa.getPath())) {
-                               continue;
-                       }
 
                        if (callstackCsa.getFunctionName().equals(
                                        FunctionUsageProfiler.UNKNOWN)) {
@@ -576,7 +437,7 @@ public class ProfileDataMaker {
        private List<Long> makeCallstackHashAndList(List<String> callstackLog,
                        LogData log) {
                int pid = log.getPid();
-               HashMap<Long, CallStackUnit> addrMap = callstackManager
+               Map<Long, CallStackUnit> addrMap = callstackManager
                                .getCallStackApiAddrByPidMap(pid);
                List<Long> addrs = new ArrayList<Long>();
                int size = callstackLog.size();
@@ -604,6 +465,7 @@ public class ProfileDataMaker {
                                String funcName = callstackLog.get(i + 1);
                                CallStackUnit newCallstackUnit = new CallStackUnit(addr,
                                                funcName, log);
+                               callstackManager.offerCallStackUnit(newCallstackUnit);
                                addrMap.put(addr, newCallstackUnit);
                        }
                }
index 6b7ad3d..3455edd 100644 (file)
@@ -288,17 +288,11 @@ public class ProfilingTable extends DATreeComposite {
 
                // INCLUSIVE
                // cpu time, cpu rate
-               if (inputType == AnalyzerConstants.FUPD_DEPENDENT_LIB) {
-                       text.add(CommonConstants.DASH);
-                       data.add(CommonConstants.ZERO);
-                       text.add(CommonConstants.DASH);
-                       data.add(CommonConstants.ZERO);
-               } else {
-                       text.add(inTime);
-                       data.add(profiler.getCpuTime(input, false));
-                       text.add(inRate + CommonConstants.SPACE + CommonConstants.PERCENT);
-                       data.add(profiler.getCpuTime(input, false));
-               }
+               text.add(inTime);
+               data.add(profiler.getCpuTime(input, false));
+               text.add(inRate + CommonConstants.SPACE + CommonConstants.PERCENT);
+               data.add(profiler.getCpuTime(input, false));
+
                // elapsed time
                text.add(inExeTime);
                data.add(new Long(input.getElapsedTime()));
index 5a64ed1..58624c5 100644 (file)
@@ -35,6 +35,7 @@ import org.tizen.dynamicanalyzer.logparser.LogParser;
 import org.tizen.dynamicanalyzer.project.Project;
 import org.tizen.dynamicanalyzer.sql.SqlManager;
 import org.tizen.dynamicanalyzer.swap.logparser.SWAPLogParser;
+import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackInserter;
 import org.tizen.dynamicanalyzer.ui.page.UpdateViewTimer;
 import org.tizen.dynamicanalyzer.util.DALogger;
 
@@ -116,8 +117,9 @@ public class StopLogProcessor implements Runnable {
                        SqlManager.getInstance().insertProcessInfo();
                        SqlManager.getInstance().saveLeakData();
                        SqlManager.getInstance().saveFailedData();
-                       SqlManager.getInstance().saveCallStackData();
-                       SqlManager.getInstance().saveCallStackUnits();
+//                     SqlManager.getInstance().saveCallStackData();
+//                     SqlManager.getInstance().saveCallStackUnits();
+                       CallStackInserter.getInstance().stopInserterThread();
                        SqlManager.getInstance().saveProfilingData();
                        SqlManager.getInstance().saveProfilingChildData();
                        SqlManager.getInstance().saveApiNames();
index da4afc6..e03fee2 100644 (file)
@@ -145,8 +145,8 @@ public class ConfigurationDialogDataManager {
                return optionalSettingName;
        }
 
-       public long getfeatureValue(String featues) {
-               long swapValue = featuresValueHashMap.get(featues).swapValue;
+       public long getfeatureValue(String features) {
+               long swapValue = featuresValueHashMap.get(features).swapValue;
                return swapValue;
        }
 
@@ -199,14 +199,14 @@ public class ConfigurationDialogDataManager {
        }
 
        public String getOptionFeatureName(String featureName) {
-               String optionFeatusName = CommonConstants.EMPTY;
+               String optionFeaturesName = CommonConstants.EMPTY;
                if (featureName.equals(ConfigureLabels.SNAPSHOT_PERIODIC)) {
-                       optionFeatusName = ConfigureLabels.SNAPSHOT_PERIODIC_AUTO;
+                       optionFeaturesName = ConfigureLabels.SNAPSHOT_PERIODIC_AUTO;
                } else if (featureName.equals(ConfigureLabels.FEATURE_SCREENSHOT)) {
-                       optionFeatusName = ConfigureLabels.SNAPSHOT_PERIODIC;
+                       optionFeaturesName = ConfigureLabels.SNAPSHOT_PERIODIC;
                } else if (featureName
                                .equals(ConfigureLabels.FEATURE_FUNCTION_PROFILING)) {
-                       optionFeatusName = ConfigureLabels.FUNCTION_PROFILING_SAMPLING_PERIODIC;
+                       optionFeaturesName = ConfigureLabels.FUNCTION_PROFILING_SAMPLING_PERIODIC;
                } else if (featureName.equals(ConfigureLabels.FEATURE_SYSTEM)
                                || featureName.equals(ConfigureLabels.FEATURE_SYSTEM_CPU)
                                || featureName.equals(ConfigureLabels.FEATURE_SYSTEM_PROCESSES)
@@ -215,9 +215,9 @@ public class ConfigurationDialogDataManager {
                                || featureName.equals(ConfigureLabels.FEATURE_SYSTEM_NETWORK)
                                || featureName.equals(ConfigureLabels.FEATURE_SYSTEM_DEVICE)
                                || featureName.equals(ConfigureLabels.FEATURE_SYSTEM_ENERGY)) {
-                       optionFeatusName = ConfigureLabels.SYSTEM_INFOMATION_SAMPLING_PERIODIC;
+                       optionFeaturesName = ConfigureLabels.SYSTEM_INFOMATION_SAMPLING_PERIODIC;
                }
-               return optionFeatusName;
+               return optionFeaturesName;
        }
 
        public void setFeaturesSwapValue(String featureName, boolean status) {
@@ -509,8 +509,8 @@ public class ConfigurationDialogDataManager {
                return isChangeValue;
        }
 
-       public String isCheckFeatue(String featueName) {
-               if (AnalyzerConstants.FEATURE_OFF != getfeatureValue(featueName)) {
+       public String isCheckFeature(String featureName) {
+               if (AnalyzerConstants.FEATURE_OFF != getfeatureValue(featureName)) {
                        return ConfigurationDialogFeaturesPage.ITEM_ALL_CHECKED;
                } else {
                        return CommonConstants.EMPTY;
index aa00e18..a0899ca 100644 (file)
@@ -74,24 +74,24 @@ public class ConfigurationDialogFeaturesTable extends DATreeComposite {
                }
        }
 
-       private TreeInput makeInput(String featueName) {
+       private TreeInput makeInput(String featureName) {
                DATableDataFormat tableData = new DATableDataFormat(0);
                List<String> text = new ArrayList<String>();
-               text.add(featueName);
+               text.add(featureName);
 
                String optionColumn = ConfigurationDialogDataManager.getInstance()
-                               .isCheckFeatue(featueName);
+                               .isCheckFeature(featureName);
                String parentFeatureName = ConfigurationDialogDataManager.getInstance()
-                               .getParentFeatureName(featueName);
+                               .getParentFeatureName(featureName);
                if (!parentFeatureName.equals(CommonConstants.EMPTY)) {
                        optionColumn += (ConfigurationDialogFeaturesPage.ITEM_PARENT_FEATURE_NAME_ITEM + parentFeatureName);
                }
 
                String optionFeatureName = ConfigurationDialogDataManager.getInstance()
-                               .getOptionFeatureName(featueName);
+                               .getOptionFeatureName(featureName);
                if (!optionFeatureName.equals(CommonConstants.EMPTY)
                                && ConfigurationDialogDataManager.getInstance()
-                                               .getParentFeatureName(featueName)
+                                               .getParentFeatureName(featureName)
                                                .equals(CommonConstants.EMPTY)) {
                        optionColumn += (ConfigurationDialogFeaturesPage.FEATURE_OPTION_VALUE + ConfigurationDialogDataManager
                                        .getInstance().getOptionText(optionFeatureName));