[Title] Function usage profiling inclusive elapsed time added
authorjy.exe.lee <jy.exe.lee@samsung.com>
Tue, 3 Jul 2012 08:08:28 +0000 (17:08 +0900)
committerjy.exe.lee <jy.exe.lee@samsung.com>
Tue, 3 Jul 2012 08:08:28 +0000 (17:08 +0900)
[Type]new feature
[Module] DynamicAnalyzer
[Priority] normal
[CQ#]
[Redmine#]
[Problem]
[Cause]
[Solution]
[TestCase]

org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/SqlManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/handlers/OpenTraceHandler.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/model/FunctionUsageProfilingData.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/SummaryLables.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/SummaryLables.properties
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/tableInfo/DBTableManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/views/summaryPage/FunctionUsageProfilingView.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/widgets/tables/ProfilingTable.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/utils/FunctionUsageProfiler.java

index 8f43973..a03141d 100644 (file)
@@ -439,10 +439,13 @@ public class SqlManager {
                LeakDetector leakDectector = AnalyzerManager.getLeakDectector();
 
                try {
-                       DBTableInfo leakTableInfo = DBTableManager.getLeakData();
+                       DBTableInfo leakTableInfo = DBTableManager.getInstance()
+                                       .getTableInfo(DBTableManager.TABLE_INDEX_LEAK_DATA);
+                       // DBTableInfo leakTableInfo = DBTableManager.getLeakData();
                        String insertQuery = leakTableInfo.insertQuery();
                        //                      String insertQuery = "insert into LeakData values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);"; //$NON-NLS-1$
-                       int size = DBTableManager.getLeakData().getColumnNames().length;
+                       // int size = DBTableManager.getLeakData().getColumnNames().length;
+                       int size = leakTableInfo.getColumnNames().length;
                        PreparedStatement prep = conn.prepareStatement(insertQuery);
 
                        List<LeakData> leakList = leakDectector.getLeakDataList();
@@ -484,11 +487,12 @@ public class SqlManager {
                FailedChecker failedChecker = AnalyzerManager.getFailedChecker();
 
                try {
-                       String[] columns = DBTableManager.commonColumns;
                        List<FailedData> failedList = failedChecker.getFailedList();
-                       DBTableInfo failedTableInfo = DBTableManager.getFailedData();
+                       DBTableInfo failedTableInfo = DBTableManager.getInstance()
+                                       .getTableInfo(DBTableManager.TABLE_INDEX_FAILED_DATA);
                        String insertQuery = failedTableInfo.insertQuery();
                        PreparedStatement prep = conn.prepareStatement(insertQuery);
+                       String[] columns = DBTableManager.commonColumns;
 
                        int size = columns.length;
                        int count = failedList.size();
@@ -525,8 +529,9 @@ public class SqlManager {
                }
 
                try {
-                       DBTableInfo unitData = DBTableManager.getCallStackUnits();
-                       String insertQuery = unitData.insertQuery();
+                       DBTableInfo unitTableInfo = DBTableManager.getInstance()
+                                       .getTableInfo(DBTableManager.TABLE_INDEX_CALLSTACK_UNITS);
+                       String insertQuery = unitTableInfo.insertQuery();
                        PreparedStatement prep = conn.prepareStatement(insertQuery);
 
                        HashMap<Long, CallStackUnit> callstackMap = LogSpliter
@@ -569,7 +574,8 @@ public class SqlManager {
                }
 
                try {
-                       DBTableInfo callstackData = DBTableManager.getCallStackData();
+                       DBTableInfo callstackData = DBTableManager.getInstance()
+                                       .getTableInfo(DBTableManager.TABLE_INDEX_CALLSTACK_DATA);
                        String insertQuery = callstackData.insertQuery();
                        PreparedStatement prep = conn.prepareStatement(insertQuery);
                        Collection<CallStackData> col = LogSpliter
@@ -611,9 +617,9 @@ public class SqlManager {
                }
 
                try {
-                       DBTableInfo appInfoData = DBTableManager.getAppInfo();
+                       DBTableInfo appInfoData = DBTableManager.getInstance()
+                                       .getTableInfo(DBTableManager.TABLE_INDEX_APP_INFO);
                        String insertQuery = appInfoData.insertQuery();
-                       //                      String insertQuery = "insert into AppInfo values (?);"; //$NON-NLS-1$
                        PreparedStatement prep = conn.prepareStatement(insertQuery);
                        List<String> info = AnalyzerManager.getProject().getAppInfo();
                        int size = info.size();
@@ -642,16 +648,32 @@ public class SqlManager {
                }
 
                try {
+                       DBTableManager dbManager = DBTableManager.getInstance();
                        Statement stat = conn.createStatement();
-                       stat.executeUpdate(DBTableManager.getApiCountInfo().createQuery());
-                       stat.executeUpdate(DBTableManager.getAppInfo().createQuery());
-                       stat.executeUpdate(DBTableManager.getCallStackUnits().createQuery());
-                       stat.executeUpdate(DBTableManager.getCallStackData().createQuery());
-                       stat.executeUpdate(DBTableManager.getFailedData().createQuery());
-                       stat.executeUpdate(DBTableManager.getLeakData().createQuery());
-                       stat.executeUpdate(DBTableManager.getProfilingData().createQuery());
-                       stat.executeUpdate(DBTableManager.getProfilingChildData()
+                       stat.executeUpdate(dbManager.getTableInfo(
+                                       DBTableManager.TABLE_INDEX_APP_INFO).createQuery());
+                       stat.executeUpdate(dbManager.getTableInfo(
+                                       DBTableManager.TABLE_INDEX_CALLSTACK_UNITS).createQuery());
+                       stat.executeUpdate(dbManager.getTableInfo(
+                                       DBTableManager.TABLE_INDEX_CALLSTACK_DATA).createQuery());
+                       stat.executeUpdate(dbManager.getTableInfo(
+                                       DBTableManager.TABLE_INDEX_FAILED_DATA).createQuery());
+                       stat.executeUpdate(dbManager.getTableInfo(
+                                       DBTableManager.TABLE_INDEX_LEAK_DATA).createQuery());
+                       stat.executeUpdate(dbManager.getTableInfo(
+                                       DBTableManager.TABLE_INDEX_PROFILING_DATA).createQuery());
+                       stat.executeUpdate(dbManager.getTableInfo(
+                                       DBTableManager.TABLE_INDEX_PROFILING_CHILD_DATA)
                                        .createQuery());
+
+                       // stat.executeUpdate(DBTableManager.getAppInfo().createQuery());
+                       // stat.executeUpdate(DBTableManager.getCallStackUnits().createQuery());
+                       // stat.executeUpdate(DBTableManager.getCallStackData().createQuery());
+                       // stat.executeUpdate(DBTableManager.getFailedData().createQuery());
+                       // stat.executeUpdate(DBTableManager.getLeakData().createQuery());
+                       // stat.executeUpdate(DBTableManager.getProfilingData().createQuery());
+                       // stat.executeUpdate(DBTableManager.getProfilingChildData()
+                       // .createQuery());
                        conn.close();
                } catch (Exception e) {
                        e.printStackTrace();
@@ -820,7 +842,8 @@ public class SqlManager {
                pDataList.addAll(profilingDataMap.values());
 
                try {
-                       DBTableInfo profilingData = DBTableManager.getProfilingData();
+                       DBTableInfo profilingData = DBTableManager.getInstance()
+                                       .getTableInfo(DBTableManager.TABLE_INDEX_PROFILING_DATA);
                        String insertQuery = profilingData.insertQuery();
                        PreparedStatement prep = conn.prepareStatement(insertQuery);
 
@@ -865,8 +888,9 @@ public class SqlManager {
                pDataList.addAll(profilingDataMap.values());
 
                try {
-                       DBTableInfo profilingChildData = DBTableManager
-                                       .getProfilingChildData();
+                       DBTableInfo profilingChildData = DBTableManager.getInstance()
+                                       .getTableInfo(
+                                                       DBTableManager.TABLE_INDEX_PROFILING_CHILD_DATA);
                        String insertQuery = profilingChildData.insertQuery();
                        PreparedStatement prep = conn.prepareStatement(insertQuery);
 
index 69c2766..e425edf 100644 (file)
@@ -24,6 +24,7 @@ import org.tizen.dynamicanalyzer.model.LogCenter;
 import org.tizen.dynamicanalyzer.model.ProfilingChildData;\r
 import org.tizen.dynamicanalyzer.model.Project;\r
 import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;\r
+import org.tizen.dynamicanalyzer.tableInfo.DBTableInfo;\r
 import org.tizen.dynamicanalyzer.tableInfo.DBTableManager;\r
 import org.tizen.dynamicanalyzer.ui.views.CoolbarArea;\r
 import org.tizen.dynamicanalyzer.utils.FailedChecker;\r
@@ -172,14 +173,16 @@ public class OpenTraceHandler extends AbstractHandler {
                        return;\r
                }\r
 \r
-//             HashMap<Long, String> apiHash = LogSpliter.getCallStackApiByAddrMap();\r
-               HashMap<Long, CallStackUnit> apiHash = LogSpliter.getCallStackApiByAddrMap();\r
+               // HashMap<Long, String> apiHash =\r
+               // LogSpliter.getCallStackApiByAddrMap();\r
+               HashMap<Long, CallStackUnit> apiHash = LogSpliter\r
+                               .getCallStackApiByAddrMap();\r
                try {\r
                        while (rs.next()) {\r
                                long addr = rs.getLong("addr"); //$NON-NLS-1$\r
                                String api = rs.getString("api"); //$NON-NLS-1$\r
                                CallStackUnit csa = new CallStackUnit(addr, api);\r
-//                             apiHash.put(addr, api);\r
+                               // apiHash.put(addr, api);\r
                                apiHash.put(addr, csa);\r
                        }\r
                        rs.close();\r
@@ -301,7 +304,9 @@ public class OpenTraceHandler extends AbstractHandler {
        }\r
 \r
        private void loadProfilingData() {\r
-               String tableName = DBTableManager.getProfilingData().getTableName();\r
+               DBTableInfo profilingData = DBTableManager.getInstance().getTableInfo(\r
+                               DBTableManager.TABLE_INDEX_PROFILING_DATA);\r
+               String tableName = profilingData.getTableName();\r
                ResultSet rs = SqlManager.selectAllFromTable(tableName);\r
                FunctionUsageProfiler profiler = AnalyzerManager\r
                                .getFunctionUserProfiler();\r
@@ -309,7 +314,7 @@ public class OpenTraceHandler extends AbstractHandler {
                        return;\r
                }\r
 \r
-               int size = DBTableManager.getProfilingData().getColumnNames().length;\r
+               int size = profilingData.getColumnNames().length;\r
 \r
                try {\r
                        while (rs.next()) {\r
@@ -340,8 +345,9 @@ public class OpenTraceHandler extends AbstractHandler {
        }\r
 \r
        private void loadProfilingChildData() {\r
-               String tableName = DBTableManager.getProfilingChildData()\r
-                               .getTableName();\r
+               DBTableInfo profilingChildData = DBTableManager.getInstance()\r
+                               .getTableInfo(DBTableManager.TABLE_INDEX_PROFILING_CHILD_DATA);\r
+               String tableName = profilingChildData.getTableName();\r
                ResultSet rs = SqlManager.selectAllFromTable(tableName);\r
                FunctionUsageProfiler profiler = AnalyzerManager\r
                                .getFunctionUserProfiler();\r
@@ -349,7 +355,7 @@ public class OpenTraceHandler extends AbstractHandler {
                        return;\r
                }\r
 \r
-               int size = DBTableManager.getProfilingChildData().getColumnNames().length;\r
+               int size = profilingChildData.getColumnNames().length;\r
 \r
                try {\r
                        while (rs.next()) {\r
@@ -379,5 +385,4 @@ public class OpenTraceHandler extends AbstractHandler {
                        e.printStackTrace();\r
                }\r
        }\r
-\r
 }\r
index db304b8..f75d8dc 100644 (file)
@@ -7,7 +7,7 @@ import org.tizen.dynamicanalyzer.AnalyzerManager;
 import org.tizen.dynamicanalyzer.utils.FunctionUsageProfiler;
 
 public class FunctionUsageProfilingData {
-       public static final int DATA_FIELD_SIZE = 8;
+       public static final int DATA_FIELD_SIZE = 9;
        public static final int SEQUENCE_INDEX = 0;
        public static final int NAME_INDEX = 1;
        public static final int EXCOUNT_INDEX = 2;
@@ -16,6 +16,7 @@ public class FunctionUsageProfilingData {
        public static final int PARENT_INDEX = 5;
        public static final int KEY_INDEX = 6;
        public static final int EXE_TIME_INDEX = 7;
+       public static final int INCL_EXE_TIME_INDEX = 8;
 
        private static int internalSeq = 0;
        private int seq = -1;
@@ -27,6 +28,7 @@ public class FunctionUsageProfilingData {
        private String key = null;
        private ProfilingChildData children = null;
        private int exeTime = 0;
+       private int inExeTime = 0;
 
        public FunctionUsageProfilingData(CallStackUnit inputData, boolean isParent) {
                if (isParent) {
@@ -63,6 +65,9 @@ public class FunctionUsageProfilingData {
                if (!input.get(EXE_TIME_INDEX).isEmpty()) {
                        exeTime = Integer.parseInt(input.get(EXE_TIME_INDEX));
                }
+               if (!input.get(INCL_EXE_TIME_INDEX).isEmpty()) {
+                       inExeTime = Integer.parseInt(input.get(INCL_EXE_TIME_INDEX));
+               }
        }
 
        /** using save trace **/
@@ -79,6 +84,7 @@ public class FunctionUsageProfilingData {
                output.set(PARENT_INDEX, parent);
                output.set(KEY_INDEX, key);
                output.set(EXE_TIME_INDEX, Integer.toString(exeTime));
+               output.set(INCL_EXE_TIME_INDEX, Integer.toString(inExeTime));
                return output;
        }
 
@@ -191,6 +197,14 @@ public class FunctionUsageProfilingData {
                return time;
        }
 
+       public void addInclusiveExeTime(int time) {
+               inExeTime += time;
+       }
+
+       public int getInclusiveExeTime() {
+               return inExeTime;
+       }
+
        public boolean isParent() {
                if (getChildData().getChildren().isEmpty()) {
                        return false;
index 2cc4c0a..239c623 100644 (file)
@@ -20,7 +20,8 @@ public class SummaryLables extends NLS {
        public static String FUNCTION_USER_PROFILING_VIEW_INCLUSIVE_CPU_RATE;
        public static String FUNCTION_USER_PROFILING_VIEW_INCLUSIVE_CPU_TIME;
        public static String FUNCTION_USER_PROFILING_VIEW_NAME;
-       public static String FUNCTION_USER_PROFILING_VIEW_ELASPED_TIME;;
+       public static String FUNCTION_USER_PROFILING_VIEW_ELASPED_TIME;
+       public static String FUNCTION_USER_PROFILING_VIEW_INCLUSIVE_ELASPED_TIME;
        public static String FUNCTION_USER_PROFILING_VIEW_TITLE;
 
        public static String WARNING_CASE_BRIEF_DUPLICATE;
index 30aa5e2..714e2b5 100644 (file)
@@ -16,6 +16,7 @@ FUNCTION_USER_PROFILING_VIEW_INCLUSIVE_CPU_RATE=Incl. Cpu Rate
 FUNCTION_USER_PROFILING_VIEW_INCLUSIVE_CPU_TIME=Incl. Cpu Time
 FUNCTION_USER_PROFILING_VIEW_NAME=Name
 FUNCTION_USER_PROFILING_VIEW_ELASPED_TIME=Elapsed Time
+FUNCTION_USER_PROFILING_VIEW_INCLUSIVE_ELASPED_TIME=Incl. Elapsed Time
 FUNCTION_USER_PROFILING_VIEW_TITLE=Function Usage Profiling
 
 WARNING_CASE_BRIEF_DUPLICATE=Duplicate open (re-open without closed)
index 41dd68a..cc08772 100644 (file)
@@ -1,24 +1,31 @@
 package org.tizen.dynamicanalyzer.tableInfo;
 
+import java.util.ArrayList;
+import java.util.List;
+
 public class DBTableManager {
 
-       public static final String TABLE_NAME_API_COUNT_INFO = "ApiCountInfo";
-       public static final String TABLE_NAME_APP_INFO = "AppInfo";
-       public static final String TABLE_NAME_CALLSTACK_UNITS = "CallstackUnits";
-       public static final String TABLE_NAME_CALLSTACK_DATA = "CallstackData";
-       public static final String TABLE_NAME_FAILED_DATA = "FailedData";
-       public static final String TABLE_NAME_LEAK_DATA = "LeakData";
-       public static final String TABLE_NAME_PROFILING_DATA = "ProfilingData";
-       public static final String TABLE_NAME_PROFILING_CHILD_DATA = "ProfilingChildData";
-
-       private static DBTableInfo apiCountInfo = null;
-       private static DBTableInfo appInfo = null;
-       private static DBTableInfo callstackUnits = null;
-       private static DBTableInfo callstackData = null;
-       private static DBTableInfo failedData = null;
-       private static DBTableInfo leakData = null;
-       private static DBTableInfo profilingData = null;
-       private static DBTableInfo profilingChildData = null;
+       public static DBTableManager instance = null;
+
+       private final String TABLE_NAME_APP_INFO = "AppInfo";
+       private final String TABLE_NAME_CALLSTACK_UNITS = "CallstackUnits";
+       private final String TABLE_NAME_CALLSTACK_DATA = "CallstackData";
+       private final String TABLE_NAME_FAILED_DATA = "FailedData";
+       private final String TABLE_NAME_LEAK_DATA = "LeakData";
+       private final String TABLE_NAME_PROFILING_DATA = "ProfilingData";
+       private final String TABLE_NAME_PROFILING_CHILD_DATA = "ProfilingChildData";
+
+       private static List<DBTableInfo> tableInfos;
+
+       public static final int TABLE_INDEX_APP_INFO = 0;
+       public static final int TABLE_INDEX_CALLSTACK_UNITS = 1;
+       public static final int TABLE_INDEX_CALLSTACK_DATA = 2;
+       public static final int TABLE_INDEX_FAILED_DATA = 3;
+       public static final int TABLE_INDEX_LEAK_DATA = 4;
+       public static final int TABLE_INDEX_PROFILING_DATA = 5;
+       public static final int TABLE_INDEX_PROFILING_CHILD_DATA = 6;
+
+       public static int TABLE_COUNT = 7;
 
        public static final String[] commonColumns = { "Rid", "Id", "SeqNumber",
                        "APINmae", "Time", "Pid", "Tid", "InputParm", "Return", "PCAddr",
@@ -31,92 +38,105 @@ public class DBTableManager {
                        "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT",
                        "TEXT" };
 
-       public static DBTableInfo getApiCountInfo() {
-               if (null == apiCountInfo) {
-                       String[] names = { "cid", "name", "count" };
-                       String[] options = { "", "primary key not null", "" };
-                       String[] types = { "INTEGER", "TEXT", "INTEGER" };
-                       apiCountInfo = new DBTableInfo(TABLE_NAME_API_COUNT_INFO, names,
-                                       options, types);
+       public static DBTableManager getInstance() {
+               if (null == instance) {
+                       instance = new DBTableManager();
+                       instance.init();
                }
-               return apiCountInfo;
+               return instance;
        }
 
-       public static DBTableInfo getAppInfo() {
-               if (null == appInfo) {
+       public List<DBTableInfo> getTableInfos() {
+               if (null == tableInfos) {
+                       tableInfos = new ArrayList<DBTableInfo>();
+                       for (int i = 0; i < TABLE_COUNT; i++) {
+                               tableInfos.add(null);
+                       }
+               }
+               return tableInfos;
+       }
+
+       private void init() {
+               // init tableInfo;
+               getTableInfos();
+
+               // "app info" table info block
+               {
                        String[] names = { "info" };
                        String[] options = { "" };
                        String[] types = { "TEXT" };
-                       appInfo = new DBTableInfo(TABLE_NAME_APP_INFO, names, options, types);
+                       DBTableInfo appInfoTableInfo = new DBTableInfo(TABLE_NAME_APP_INFO,
+                                       names, options, types);
+                       tableInfos.set(TABLE_INDEX_APP_INFO, appInfoTableInfo);
                }
-               return appInfo;
-       }
 
-       public static DBTableInfo getCallStackUnits() {
-               if (null == callstackUnits) {
+               // "callstack units" table info block
+               {
                        String[] names = { "addr", "api" };
                        String[] options = { "primary key not null", "" };
                        String[] types = { "INTEGER", "TEXT" };
-                       callstackUnits = new DBTableInfo(TABLE_NAME_CALLSTACK_UNITS, names,
-                                       options, types);
+                       DBTableInfo callstackUnitsTableInfo = new DBTableInfo(
+                                       TABLE_NAME_CALLSTACK_UNITS, names, options, types);
+                       tableInfos
+                                       .set(TABLE_INDEX_CALLSTACK_UNITS, callstackUnitsTableInfo);
                }
-               return callstackUnits;
-       }
 
-       public static DBTableInfo getCallStackData() {
-               if (null == callstackData) {
+               // "callstack data" table info block
+               {
                        String[] names = { "seq", "callstack" };
                        String[] options = { "not null", "" };
                        String[] types = { "INTEGER", "TEXT" };
-                       callstackData = new DBTableInfo(TABLE_NAME_CALLSTACK_DATA, names,
-                                       options, types);
+                       DBTableInfo callstackDataTableInfo = new DBTableInfo(
+                                       TABLE_NAME_CALLSTACK_DATA, names, options, types);
+                       tableInfos.set(TABLE_INDEX_CALLSTACK_DATA, callstackDataTableInfo);
                }
-               return callstackData;
-       }
 
-       public static DBTableInfo getFailedData() {
-               if (null == failedData) {
+               // "failed data" table info block
+               {
                        String[] names = commonColumns;
                        String[] options = commonOptions;
                        String[] types = commonTypes;
-                       failedData = new DBTableInfo(TABLE_NAME_FAILED_DATA, names, options,
-                                       types);
+                       DBTableInfo failedDataTableInfo = new DBTableInfo(
+                                       TABLE_NAME_FAILED_DATA, names, options, types);
+                       tableInfos.set(TABLE_INDEX_FAILED_DATA, failedDataTableInfo);
                }
-               return failedData;
-       }
 
-       public static DBTableInfo getLeakData() {
-               if (null == leakData) {
+               // "leak data" table info block
+               {
                        String[] names = commonColumns;
                        String[] options = commonOptions;
                        String[] types = commonTypes;
-                       leakData = new DBTableInfo(TABLE_NAME_LEAK_DATA, names, options,
-                                       types);
+                       DBTableInfo leakDataTableInfo = new DBTableInfo(
+                                       TABLE_NAME_LEAK_DATA, names, options, types);
+                       tableInfos.set(TABLE_INDEX_LEAK_DATA, leakDataTableInfo);
                }
-               return leakData;
-       }
 
-       public static DBTableInfo getProfilingData() {
-               if (null == profilingData) {
+               // "profiling data" table info block
+               {
                        String[] names = { "seq", "name", "exCount", "inCount",
                                        "callCount", "parent", "key", "exeTime" };
                        String[] options = { "not null", "", "", "", "", "", "", "" };
                        String[] types = { "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT",
                                        "TEXT", "TEXT" };
-                       profilingData = new DBTableInfo(TABLE_NAME_PROFILING_DATA, names,
-                                       options, types);
+                       DBTableInfo profilingDataTableInfo = new DBTableInfo(
+                                       TABLE_NAME_PROFILING_DATA, names, options, types);
+                       tableInfos.set(TABLE_INDEX_PROFILING_DATA, profilingDataTableInfo);
                }
-               return profilingData;
-       }
 
-       public static DBTableInfo getProfilingChildData() {
-               if (null == profilingChildData) {
+               // "profiling child data" table info block
+               {
                        String[] names = { "seq", "childList" };
                        String[] options = { "not null", "" };
                        String[] types = { "TEXT", "TEXT" };
-                       profilingChildData = new DBTableInfo(TABLE_NAME_PROFILING_CHILD_DATA,
-                                       names, options, types);
+                       DBTableInfo profilingChildTableInfo = new DBTableInfo(
+                                       TABLE_NAME_PROFILING_CHILD_DATA, names, options, types);
+                       tableInfos.set(TABLE_INDEX_PROFILING_CHILD_DATA,
+                                       profilingChildTableInfo);
                }
-               return profilingChildData;
        }
+
+       public DBTableInfo getTableInfo(int tableInfoIndex) {
+               return getTableInfos().get(tableInfoIndex);
+       }
+
 }
index f7fc378..ffcc773 100644 (file)
@@ -22,9 +22,11 @@ public class FunctionUsageProfilingView extends DAView {
                        SummaryLables.FUNCTION_USER_PROFILING_VIEW_INCLUSIVE_CPU_TIME,
                        SummaryLables.FUNCTION_USER_PROFILING_VIEW_INCLUSIVE_CPU_RATE,
                        SummaryLables.FUNCTION_USER_PROFILING_VIEW_CALL_COUNT,
-                       SummaryLables.FUNCTION_USER_PROFILING_VIEW_ELASPED_TIME };
-       private int[] columnSizes = { 200, 90, 90, 90, 90, 90, 90 };
-       private boolean[] columnVisibility = { true, true, true, true, true, true, true };
+                       SummaryLables.FUNCTION_USER_PROFILING_VIEW_ELASPED_TIME,
+                       SummaryLables.FUNCTION_USER_PROFILING_VIEW_INCLUSIVE_ELASPED_TIME };
+       private int[] columnSizes = { 200, 90, 90, 90, 90, 90, 90, 90 };
+       private boolean[] columnVisibility = { true, true, true, true, true, true,
+                       true, true };
 
        public FunctionUsageProfilingView(Composite parent, int style) {
                super(parent, style);
index 862bf93..b37da6b 100644 (file)
@@ -42,6 +42,7 @@ public class ProfilingTable extends DATableComposite {
                                AnalyzerConstants.SORT_TYPE_NUM,
                                AnalyzerConstants.SORT_TYPE_NUM,
                                AnalyzerConstants.SORT_TYPE_NUM,
+                               AnalyzerConstants.SORT_TYPE_NUM,
                                AnalyzerConstants.SORT_TYPE_NUM };
                setSortTypes(sortTypes);
                setSelValueIndex(0);
@@ -355,12 +356,14 @@ public class ProfilingTable extends DATableComposite {
                                        .set(FunctionUsageProfilingData.KEY_INDEX, fuData.getKey());
                        inputData.set(FunctionUsageProfilingData.EXE_TIME_INDEX,
                                        Integer.toString(fuData.getExeTime()));
+                       inputData.set(FunctionUsageProfilingData.INCL_EXE_TIME_INDEX,
+                                       Integer.toString(fuData.getExeTime()));
                        tableData.getData().addAll(inputData);
                }
                treeItem.setData(tableData);
 
                tableData.setObject(fuData.getName());
-               String exTime = "0", exRate = "0.00", inTime = "0", inRate = "0.00", callCount = "0", exeTime = "0"; //$NON-NLS-1$
+               String exTime = "0", exRate = "0.00", inTime = "0", inRate = "0.00", callCount = "0", exeTime = "0", inExeTime = "0"; //$NON-NLS-1$
 
                try {
                        exTime = profiler.getCpuTime(fuData, true);
@@ -380,6 +383,13 @@ public class ProfilingTable extends DATableComposite {
                                exeTime = Integer.toString(fuData.getExeTime());
                                exeTime = Formatter.toTimeFormat(exeTime);
                        }
+
+                       if (0 == fuData.getInclusiveExeTime()) {
+                               inExeTime = "-"; //$NON-NLS-1$
+                       } else {
+                               inExeTime = Integer.toString(fuData.getInclusiveExeTime());
+                               inExeTime = Formatter.toTimeFormat(inExeTime);
+                       }
                } catch (NumberFormatException e) {
                        // FIXME
                        e.printStackTrace();
@@ -390,6 +400,7 @@ public class ProfilingTable extends DATableComposite {
                treeItem.setText(4, inRate + " " + AnalyzerConstants.PERCENT); //$NON-NLS-1$
                treeItem.setText(5, callCount);
                treeItem.setText(6, exeTime);
+               treeItem.setText(7, inExeTime);
        }
 
 }
index 6a68dbd..99624d9 100644 (file)
@@ -15,6 +15,39 @@ import org.tizen.dynamicanalyzer.nl.InformationViewLables;
 import org.tizen.dynamicanalyzer.nl.SummaryLables;
 
 public class FunctionUsageProfiler {
+
+       class CallstackTree {
+               FunctionUsageProfilingData me;
+               CallstackTree parent;
+               List<CallstackTree> children = null;
+
+               public CallstackTree(FunctionUsageProfilingData me, CallstackTree parent) {
+                       this.me = me;
+                       this.parent = parent;
+                       children = new ArrayList<FunctionUsageProfiler.CallstackTree>();
+               }
+
+               public void addChild(CallstackTree child) {
+                       children.add(child);
+               }
+
+               public int getInclusiveExeTime() {
+                       int cTime = 0;
+                       for (int i = 0; i < children.size(); i++) {
+                               cTime += children.get(i).getThis().getExeTime();
+                       }
+                       return (me.getExeTime() - cTime);
+               }
+
+               public FunctionUsageProfilingData getThis() {
+                       return me;
+               }
+
+               public CallstackTree getParent() {
+                       return parent;
+               }
+       }
+
        // 0.01 second = 10 ms
        public static final long SAMPLE_TIME = 10;
        public static final String APPLICATION = SummaryLables.FUNCTION_USAGE_PROFILER_APPLICATION;
@@ -22,6 +55,7 @@ public class FunctionUsageProfiler {
        public static final String UNKNOWN = InformationViewLables.CALLSTACK_TABLE_UNKNOWN;
 
        private int totalSampleCount = 0;
+       private CallstackTree current = null;
 
        /**
         * key: seq - value : function usage profiling data hash map all function
@@ -111,6 +145,25 @@ public class FunctionUsageProfiler {
                        }
                        child.addCallCount();
                        child.addExeTime(exeTime);
+
+                       // calculate internal time
+                       if (type == LogCenterConstants.USER_FUNCTION_EVENT_TYPE_EXIT) {
+                               if (null == current) {
+                                       // bug
+                               } else {
+                                       child.addInclusiveExeTime(current.getInclusiveExeTime());
+                                       current = current.getParent();
+                               }
+                       } else {
+                               if (null == current) {
+                                       CallstackTree ct = new CallstackTree(child, null);
+                                       current = ct;
+                               } else {
+                                       CallstackTree ct = new CallstackTree(child, current);
+                                       current.addChild(ct);
+                                       current = ct;
+                               }
+                       }
                }
        }