[Feature] timeline : data module of the timeline page was modified to use the DB 73/21173/1
authorjungwook.ryu <jungwook.ryu@samsung.com>
Fri, 16 May 2014 01:54:19 +0000 (10:54 +0900)
committerjungwook.ryu <jungwook.ryu@samsung.com>
Fri, 16 May 2014 01:55:06 +0000 (10:55 +0900)
Change-Id: Ic9e504a1935d1d40da21a27664c56c8470d03b16
Signed-off-by: jungwook.ryu <jungwook.ryu@samsung.com>
49 files changed:
org.tizen.dynamicanalyzer.appearance/src/org/tizen/dynamicanalyzer/resources/ColorResources.java
org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/chart/DAChart.java
org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/chart/DAChartRenderer.java
org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/chartBoard/DAChartBoard.java
org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/chartBoard/DAChartBoardItemCell.java
org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/helper/ColorResources.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/database/DBConstants.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/database/SqlConnectionManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/TimelineChartLabels.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/TimelineChartLabels.properties
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/ui/chart/GLFPSChart.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/ui/chart/GLFrameRateChart.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/ui/chart/GLFrameTimeChart.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/CPUDBInserter.java [new file with mode: 0644]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/CPUDBTable.java [new file with mode: 0644]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/CustomDataDBInserter.java [new file with mode: 0644]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/CustomDataDBTable.java [new file with mode: 0644]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/EnergyDBTable.java [new file with mode: 0644]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/EnergyDataDBInserter.java [new file with mode: 0644]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/ProcessDataDBInserter.java [new file with mode: 0644]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/ProcessLoadDBTable.java [new file with mode: 0644]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/ScreenShotDBInserter.java [new file with mode: 0644]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/ScreenShotDBTable.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/SystemDataDBInserter.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/SystemDataDBTable.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/UIEventDBInserter.java [new file with mode: 0644]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/UIEventDBTable.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/CPUChart.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/CPUCoreChart.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/CPUFrequencyChart.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/DeviceChart.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/DiskIOChart.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/EnergyChart.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/FileChart.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/HeapChart.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/NetworkIOChart.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/ProcessMemoryChart.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/ProcessesChartRenderer.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/ScreenshotChart.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/SystemMemoryChart.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/TimelineChart.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/UIEventChart.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/UserCustomChart.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/common/TimelineChartManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/common/TimelineConstants.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/common/TimelineView.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/logparser/CustomLogParser.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/logparser/DeviceLogParser.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/utils/AnalyzerUtil.java

index d8833a2..f930fda 100755 (executable)
@@ -365,6 +365,7 @@ public class ColorResources {
        public static Color SERIES_COLOR_CPU_SYSTEM = getColor("seriesColorCPUSystem"); //$NON-NLS-1$\r
        public static Color SERIES_COLOR_CPU_APP = getColor("seriesColorCPUApp"); //$NON-NLS-1$\r
 \r
+       public final static int MAX_SERIES_COLOR_COUNT = 4;\r
        public static Color SERIES_COLOR_CPUCORE_CORE0 = getColor("seriesColorCPUCoreCore0"); //$NON-NLS-1$\r
        public static Color SERIES_COLOR_CPUCORE_CORE1 = getColor("seriesColorCPUCoreCore1"); //$NON-NLS-1$\r
        public static Color SERIES_COLOR_CPUCORE_CORE2 = getColor("seriesColorCPUCoreCore2"); //$NON-NLS-1$\r
index 8c60366..e228ff6 100644 (file)
@@ -4,6 +4,7 @@
  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Contact: 
+ * Jungwook Ryu <jungwook.ryu@samsung.com>
  * yeongtaik byeon <yeongtaik.byeon@samsung.com>
  * Juyoung Kim <j0.kim@samsung.com>
  *
@@ -61,6 +62,7 @@ public class DAChart extends Canvas {
        private static Color[] seriesColors;
        private static final int autoColorSize = 10;
        private int autoColorIndex = 0;
+       private boolean isSelected = false;
 
        private DAChart(Composite parent) {
                super(parent, SWT.TRANSPARENT | SWT.DOUBLE_BUFFERED | SWT.NO_BACKGROUND);
@@ -236,6 +238,15 @@ public class DAChart extends Canvas {
                this.chartRenderer = chartRenderer;
        }
 
+       public void setSelectCell(boolean selectCell) {
+               this.isSelected = selectCell;
+               this.redraw();
+       }
+       
+       public boolean isSelected() {
+               return this.isSelected;
+       }
+       
        private Listener chartTooltipListener = new Listener() {
                @Override
                public void handleEvent(Event event) {
index 47ff285..6c9a59e 100644 (file)
@@ -4,6 +4,7 @@
  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Contact: 
+ * Jungwook Ryu <jungwook.ryu@samsung.com>
  * yeongtaik byeon <yeongtaik.byeon@samsung.com>
  * Sanghyun Lee <sanghyunnim.lee@samsung.com>
  * Juyoung Kim <j0.kim@samsung.com>
@@ -103,20 +104,20 @@ public class DAChartRenderer {
                }
                plot = chart.getPlot();
                r = chart.getClientArea();
-
-               // draw background Image
-               Image backImage = plot.getBackgroundImage();
-               if (backImage != null) {
-                       Rectangle rect = backImage.getBounds();
-                       gc.drawImage(backImage, rect.x, rect.y, rect.width, rect.height,
-                                       r.x, r.y, r.width, r.height);
+               
+               if (chart.isSelected()) {
+                       gc.setForeground(ColorResources.CHART_BACKGROUND_SELECTED_TOP);
+                       gc.setBackground(ColorResources.CHART_BACKGROUND_SELECTED_BOTTOM);
+               } else {
+                       gc.setForeground(ColorResources.CHART_BACKGROUND_NORMAL_TOP);
+                       gc.setBackground(ColorResources.CHART_BACKGROUND_NORMAL_BOTTOM);
                }
-
+               gc.fillGradientRectangle(r.x, r.y, r.width, r.height, false);
+               
                if (seriesList == null) {
                        return false;
                }
 
-
                if (plot.getAutoHeightRange() == AutoRangeType.SEMI_AUTO
                                || plot.getAutoHeightRange() == AutoRangeType.AUTO) {
                        double maxY = 0;
index 2e53b21..830f6ee 100644 (file)
@@ -4,6 +4,7 @@
  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Contact: 
+ * Jungwook Ryu <jungwook.ryu@samsung.com>
  * yeongtaik byeon <yeongtaik.byeon@samsung.com>
  * Juyoung Kim <j0.kim@samsung.com>
  *
@@ -193,6 +194,10 @@ public class DAChartBoard extends Composite {
                itemListScrollComp.addControlListener(new ControlListener() {
                        @Override
                        public void controlResized(ControlEvent e) {
+                               if (chartSeriesMaker != null) {
+                                   chartSeriesMaker.makeChartSeries(translateSecToMicroSec(getVisibleStartTime()), 
+                                               translateSecToMicroSec(getVisibleEndTime()));
+                               }
                                setChartAxis();
                        }
 
@@ -372,6 +377,11 @@ public class DAChartBoard extends Composite {
                @Override
                public void widgetSelected() {
                        boardManager.scaleChanged(scale.getSelection());
+                       if (chartSeriesMaker != null) {
+                           chartSeriesMaker.makeChartSeries(translateSecToMicroSec(getVisibleStartTime()), 
+                                       translateSecToMicroSec(getVisibleEndTime()));
+                       }
+                       setChartAxis();
                        callBackScaleChanged();
                }
        };
@@ -381,6 +391,11 @@ public class DAChartBoard extends Composite {
                public void widgetSelected(SelectionEvent e) {
                        int sel = hScroll.getSelection();
                        boardManager.scrollbarSelectionChanged(sel);
+                       if (chartSeriesMaker != null) {
+                           chartSeriesMaker.makeChartSeries(translateSecToMicroSec(getVisibleStartTime()), 
+                                       translateSecToMicroSec(getVisibleEndTime()));
+                       }
+                       setChartAxis();
                        callBackScrollChanged();
                }
 
@@ -401,10 +416,6 @@ public class DAChartBoard extends Composite {
        }
        
        private void setChartAxis() {
-               if (chartSeriesMaker != null) {
-                   chartSeriesMaker.makeChartSeries((long)(getVisibleStartTime() * 1000000.0), 
-                           (long)(getVisibleEndTime() * 1000000.0));
-               }
                itemList.setChartAxis(getVisibleStartTime(), getVisibleEndTime());
        }
 
@@ -508,11 +519,6 @@ public class DAChartBoard extends Composite {
                if (lifecycleBar != null) {
                        lifecycleBar.setTotalEndTime(endTime);
                }
-               
-               if (chartSeriesMaker != null) {
-                       chartSeriesMaker.makeChartSeries((long)(getVisibleStartTime() * 1000000.0), 
-                           (long)(getVisibleEndTime() * 1000000.0));
-               }
        }
 
        private void markerContentsClear() {
@@ -737,7 +743,11 @@ public class DAChartBoard extends Composite {
                        }
                }
        };
-
+       
+       private long translateSecToMicroSec(double sec) {
+               return (long)(sec * 1000000.0);
+       }
+       
        public void hideItem(int index) {
                itemList.hideItem(index);
                itemList.setSize(itemListScrollComp.getClientArea().width,
index df5b258..cfba807 100644 (file)
@@ -308,6 +308,7 @@ public class DAChartBoardItemCell extends Composite {
                }
                redrawFoldBackground();
                nameCell.redraw();
+               chartCell.setSelectCell(selectCell);
        }
 
        private void redrawFoldBackground() {
index dc941be..1cea4fa 100644 (file)
@@ -4,6 +4,7 @@
  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
  *\r
  * Contact: \r
+ * Jungwook Ryu <jungwook.ryu@samsung.com>\r
  * Jooyoul Lee <jy.exe.lee@samsung.com>\r
  * Juyoung Kim <j0.kim@samsung.com>\r
  *\r
@@ -62,6 +63,15 @@ public class ColorResources {
                        "timeline_bg", new RGB(247, 247, 247)); //$NON-NLS-1$\r
 \r
        // chart\r
+       public static Color CHART_BACKGROUND_NORMAL_TOP = getColor(\r
+                       "chart_background_normal_top", new RGB(244, 249, 251));\r
+       public static Color CHART_BACKGROUND_NORMAL_BOTTOM = getColor(\r
+                       "chart_background_normal_bottom", new RGB(229, 238, 240));\r
+       public static Color CHART_BACKGROUND_SELECTED_TOP = getColor(\r
+                       "chart_background_selected_top", new RGB(216, 250, 255));\r
+       public static Color CHART_BACKGROUND_SELECTED_BOTTOM = getColor(\r
+                       "chart_background_selected_bottom", new RGB(190, 247, 255));\r
+       \r
        public static Color CHART_NAME_BACK_START = getColor(\r
                        "chart_name_back_start", new RGB(215, 215, 215)); //$NON-NLS-1$\r
        public static Color CHART_NAME_BACK_END = getColor(\r
index db8387f..e8610ea 100644 (file)
@@ -25,7 +25,8 @@ public class DBConstants {
        public static final String BIGBIG_TEXT = "VARCHAR(" + BIGBIG_TEXT_LEN + ")";//$NON-NLS-1$
        public static final String INTEGER = "INTEGER";//$NON-NLS-1$
        public static final String LONG = "BIGINT";//$NON-NLS-1$
-
+       public static final String FLOAT = "DOUBLE";
+       
        // common column name
        public static final String COMMON_COLUMN_RID = "Rid";//$NON-NLS-1$
        public static final String COMMON_COLUMN_ID = "Id";//$NON-NLS-1$
index f61911f..5710241 100644 (file)
@@ -178,6 +178,14 @@ public class SqlConnectionManager {
                                                                        } else {
                                                                                prep.setLong(i + 1, (Long) col);
                                                                        }
+                                                               } else if (columnType.get(i).equals(DBConstants.FLOAT)) { 
+                                                                   if (col == null) {
+                                       DA_LOG.error("[ERR] FLOAT column data is null !!");
+                                                                               isPrepared = false;
+                                                                               break;
+                                                                       } else {
+                                                                               prep.setFloat(i + 1, (Float) col);
+                                                                       }
                                                                } else {
                                                                        DA_LOG.error("not supported DB column type!!");
                                                                        isPrepared = false;
@@ -296,6 +304,9 @@ public class SqlConnectionManager {
                                                        } else if (rsMetaData.getColumnTypeName(i)
                                                                        .contains(DBConstants.VARCHAR)) {
                                                                rowData.add(rs.getString(i));
+                                                       } else if (rsMetaData.getColumnTypeName(i)
+                                    .contains(DBConstants.FLOAT)) {
+                                                           rowData.add(new Float(rs.getFloat(i)));
                                                        } else {
                                                                DA_LOG.error("undefined type : "
                                                                                + rsMetaData.getColumnTypeName(i));
index adf9c93..4edb31c 100644 (file)
@@ -86,6 +86,7 @@ public class TimelineChartLabels extends NLS {
        public static String DEVICE_CHART_SERIES_CAMERA;
        
        public static String ENERGY_CHART_TITLE;
+       public static String ENERGY_CHART_SERIES;
        
        public static String TIMELINE_TICK_ADD;
        
index 177e814..18483bd 100644 (file)
@@ -75,10 +75,6 @@ public class GLFPSChart extends TimelineChart {
                return item;
        }
 
-       @Override
-       public void parseLogPackage(LogPackage logPack) {
-       }
-
        public void addData(final int frameNumber, long elapsedTime,
                        boolean drawError) {
                double fps = Math.round(1000.0 / elapsedTime);
index 1503e13..ffa3c8f 100644 (file)
@@ -83,7 +83,6 @@ public class GLFrameRateChart extends TimelineChart {
                return item;
        }
 
-       @Override
        public void parseLogPackage(LogPackage logPack) {
                Logs logs = logPack.getLogs(DataChannelConstants.MSG_DATA_SYSTEM);
                if (logs == null) {
index b69bbbb..33396e6 100644 (file)
@@ -73,11 +73,7 @@ public class GLFrameTimeChart extends TimelineChart {
 
                return item;
        }
-
-       @Override
-       public void parseLogPackage(LogPackage logPack) {
-       }
-
+       
        public void addData(final int frameNumber, long frameTime, boolean drawError) {
                double fps = Math.round(1000 / (double) frameTime);
                if (drawError) {
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/CPUDBInserter.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/CPUDBInserter.java
new file mode 100644 (file)
index 0000000..fc6ee07
--- /dev/null
@@ -0,0 +1,91 @@
+/*
+ *  Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * Jungwook Ryu <jungwook.ryu@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.timeline;
+
+import java.util.List;
+
+import org.tizen.dynamicanalyzer.common.AnalyzerManager;
+import org.tizen.dynamicanalyzer.swap.logparser.ReadBlockingQueue;
+import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineChartManager;
+
+public class CPUDBInserter implements Runnable {
+       private static ReadBlockingQueue<List<List<Object>>> cpuDataQueue = new ReadBlockingQueue<List<List<Object>>>();
+
+       private static volatile Thread inserterThread = null;
+
+       public static void startThread() {
+               if (inserterThread == null || !inserterThread.isAlive()) {
+                       synchronized (CPUDBInserter.class) {
+                               if (inserterThread == null || !inserterThread.isAlive()) {
+                                       inserterThread = new Thread(null,
+                                                       new CPUDBInserter());
+                                       inserterThread.start();
+                               }
+                       }
+               }
+       }
+
+       public static void stopThread() {
+               if (inserterThread != null && inserterThread.isAlive()) {
+                       try {
+                               sendNotify();
+                               inserterThread.join(AnalyzerManager.THREAD_JOIN_WAIT_TIME);
+                       } catch (InterruptedException e) {
+                               e.printStackTrace();
+                       }
+               }
+       }
+
+       public static void pushContextData(List<List<Object>> data) {
+               cpuDataQueue.offer(data);
+       }
+
+       public static void clear() {
+               stopThread();
+       }
+
+       @Override
+       public void run() {
+               while (!AnalyzerManager.isExit()) {
+                       List<List<Object>> cpuData = cpuDataQueue.poll();
+                       
+                       if (cpuData != null && cpuData.size() != 0) {
+                               for (int i = 0; i < cpuData.size(); i++) {
+                                   List<Object> row = cpuData.get(i);
+                               }
+                               TimelineChartManager.getInstance().getCPUTable().insertData(cpuData);
+                       }
+               }
+       }
+
+       public static void sendNotify() {
+               synchronized (cpuDataQueue) {
+                   cpuDataQueue.notifyAll();
+               }
+       }
+
+}
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/CPUDBTable.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/CPUDBTable.java
new file mode 100644 (file)
index 0000000..e3a26dd
--- /dev/null
@@ -0,0 +1,85 @@
+/*
+ *  Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * Jungwook Ryu <jungwook.ryu@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.timeline;
+
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.util.List;
+
+import org.tizen.dynamicanalyzer.database.DBColumn;
+import org.tizen.dynamicanalyzer.database.DBConstants;
+import org.tizen.dynamicanalyzer.database.DBTable;
+
+public class CPUDBTable extends DBTable {
+       private static final String TABLENAME = "TIMELINE_CPU";
+       
+       public static enum COLUMN {
+               TIME,
+               CORE_NUM,
+               CPU_LOAD,
+               CPU_FREQUENCY
+       }
+       
+       public static final String TIME = "TIME";
+       public static final String CORE_NUM = "CORE_NUM";
+       public static final String CPU_LOAD = "CPU_LOAD";
+       public static final String CPU_FREQUENCY = "CPU_FREQUENCY";
+
+       @Override
+       public String getTableName() {
+               return TABLENAME;
+       }
+
+       public CPUDBTable() {
+               addColumn(new DBColumn(TIME, DBConstants.NOT_NULL, DBConstants.LONG));
+               addColumn(new DBColumn(CORE_NUM, DBConstants.NOT_NULL, DBConstants.INTEGER));
+               addColumn(new DBColumn(CPU_LOAD, DBConstants.NOT_NULL, DBConstants.FLOAT));
+               addColumn(new DBColumn(CPU_FREQUENCY, DBConstants.NOT_NULL, DBConstants.FLOAT));
+       }
+       
+       @Override
+       public boolean prepare(PreparedStatement prep, List<Object> rowData) {
+               boolean isPrepared = true;
+
+               int columnsize = getColumnSize();
+               if (columnsize != rowData.size()) {
+                       isPrepared = false;
+               } else {
+                       try {
+                               prep.setLong(1, (Long) (rowData.get(0)));
+                               prep.setInt(2, (Integer) (rowData.get(1)));
+                               prep.setFloat(3, (Float) (rowData.get(2)));
+                               prep.setFloat(4, (Float) (rowData.get(3)));     
+                       } catch (SQLException e) {
+                               e.printStackTrace();
+                               isPrepared = false;
+                       }
+               }
+
+               return isPrepared;
+       }
+}
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/CustomDataDBInserter.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/CustomDataDBInserter.java
new file mode 100644 (file)
index 0000000..fa7848d
--- /dev/null
@@ -0,0 +1,90 @@
+/*
+ *  Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * Jungwook Ryu <jungwook.ryu@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.timeline;
+
+import java.util.List;
+
+import org.tizen.dynamicanalyzer.common.AnalyzerManager;
+import org.tizen.dynamicanalyzer.swap.logparser.ReadBlockingQueue;
+import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineChartManager;
+
+public class CustomDataDBInserter implements Runnable {
+    private static ReadBlockingQueue<List<List<Object>>> customDataQueue = new ReadBlockingQueue<List<List<Object>>>();
+
+    private static volatile Thread inserterThread = null;
+
+    public static void startThread() {
+        if (inserterThread == null || !inserterThread.isAlive()) {
+            synchronized (CustomDataDBInserter.class) {
+                if (inserterThread == null || !inserterThread.isAlive()) {
+                    inserterThread = new Thread(null,
+                            new CustomDataDBInserter());
+                    inserterThread.start();
+                }
+            }
+        }
+    }
+
+    public static void stopThread() {
+        if (inserterThread != null && inserterThread.isAlive()) {
+            try {
+                sendNotify();
+                inserterThread.join(AnalyzerManager.THREAD_JOIN_WAIT_TIME);
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
+    public static void pushContextData(List<List<Object>> data) {
+        customDataQueue.offer(data);
+    }
+
+    public static void clear() {
+        stopThread();
+    }
+
+    @Override
+    public void run() {
+        while (!AnalyzerManager.isExit()) {
+            List<List<Object>> customData = customDataQueue.poll();
+            
+            if (customData != null && customData.size() != 0) {
+                    for (int i = 0; i < customData.size(); i++) {
+                        List<Object> row = customData.get(i);
+                    }
+                TimelineChartManager.getInstance().getCustomDataTable().insertData(customData);
+            }
+        }
+    }
+
+    public static void sendNotify() {
+        synchronized (customDataQueue) {
+            customDataQueue.notifyAll();
+        }
+    }
+}
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/CustomDataDBTable.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/CustomDataDBTable.java
new file mode 100644 (file)
index 0000000..a137060
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+ *  Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * Jungwook Ryu <jungwook.ryu@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.timeline;
+
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.util.List;
+
+import org.tizen.dynamicanalyzer.database.DBColumn;
+import org.tizen.dynamicanalyzer.database.DBConstants;
+import org.tizen.dynamicanalyzer.database.DBTable;
+
+public class CustomDataDBTable extends DBTable {
+       private static final String TABLENAME = "TIMELINE_CUSTOM_DATA";
+       
+       public static enum COLUMN {
+               TIME,
+               CHART_HANDLE,
+               CHART_VALUE
+       }
+       
+       public static final String TIME = "TIME";
+       public static final String CHART_HANDLE = "CHART_HANDLE";
+       public static final String CHART_VALUE = "CHART_VALUE";
+
+       @Override
+       public String getTableName() {
+               return TABLENAME;
+       }
+
+       public CustomDataDBTable() {
+               addColumn(new DBColumn(TIME, DBConstants.NOT_NULL, DBConstants.LONG));
+               addColumn(new DBColumn(CHART_HANDLE, DBConstants.NOT_NULL, DBConstants.INTEGER));
+               addColumn(new DBColumn(CHART_VALUE, DBConstants.NOT_NULL, DBConstants.FLOAT));
+       }
+       
+       @Override
+       public boolean prepare(PreparedStatement prep, List<Object> rowData) {
+               boolean isPrepared = true;
+
+               int columnsize = getColumnSize();
+               if (columnsize != rowData.size()) {
+                       isPrepared = false;
+               } else {
+                       try {
+                               prep.setLong(1, (Long) (rowData.get(0)));
+                               prep.setInt(2, (Integer) (rowData.get(1)));
+                               prep.setFloat(3, (Float) (rowData.get(2)));
+                       } catch (SQLException e) {
+                               e.printStackTrace();
+                               isPrepared = false;
+                       }
+               }
+
+               return isPrepared;
+       }
+}
\ No newline at end of file
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/EnergyDBTable.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/EnergyDBTable.java
new file mode 100644 (file)
index 0000000..edbec16
--- /dev/null
@@ -0,0 +1,85 @@
+/*
+ *  Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * Jungwook Ryu <jungwook.ryu@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.timeline;
+
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.util.List;
+
+import org.tizen.dynamicanalyzer.database.DBColumn;
+import org.tizen.dynamicanalyzer.database.DBConstants;
+import org.tizen.dynamicanalyzer.database.DBTable;
+
+public class EnergyDBTable extends DBTable {
+       private static final String TABLENAME = "TIMELINE_ENERGY";
+       
+       public static enum COLUMN {
+               TIME,
+               DEVICE_NUM,
+               ENERGY_USAGE_DEVICE,
+               ENERGY_USAGE_APP
+       }
+       
+       public static final String TIME = "TIME";
+       public static final String DEVICE_NUM = "DEVICE_NUM";
+       public static final String ENERGY_USAGE_DEVICE = "ENERGY_USAGE_DEVICE";
+       public static final String ENERGY_USAGE_APP = "ENERGY_USAGE_APP";
+
+       @Override
+       public String getTableName() {
+               return TABLENAME;
+       }
+
+       public EnergyDBTable() {
+               addColumn(new DBColumn(TIME, DBConstants.NOT_NULL, DBConstants.LONG));
+               addColumn(new DBColumn(DEVICE_NUM, DBConstants.NOT_NULL, DBConstants.INTEGER));
+               addColumn(new DBColumn(ENERGY_USAGE_DEVICE, DBConstants.NOT_NULL, DBConstants.INTEGER));
+               addColumn(new DBColumn(ENERGY_USAGE_APP, DBConstants.NOT_NULL, DBConstants.INTEGER));
+       }
+       
+       @Override
+       public boolean prepare(PreparedStatement prep, List<Object> rowData) {
+               boolean isPrepared = true;
+
+               int columnsize = getColumnSize();
+               if (columnsize != rowData.size()) {
+                       isPrepared = false;
+               } else {
+                       try {
+                               prep.setLong(1, (Long) (rowData.get(0)));
+                               prep.setInt(2, (Integer) (rowData.get(1)));
+                               prep.setInt(3, (Integer) (rowData.get(2)));
+                               prep.setInt(4, (Integer) (rowData.get(3)));
+                       } catch (SQLException e) {
+                               e.printStackTrace();
+                               isPrepared = false;
+                       }
+               }
+
+               return isPrepared;
+       }
+}
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/EnergyDataDBInserter.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/EnergyDataDBInserter.java
new file mode 100644 (file)
index 0000000..8e534e8
--- /dev/null
@@ -0,0 +1,90 @@
+/*
+ *  Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * Jungwook Ryu <jungwook.ryu@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.timeline;
+
+import java.util.List;
+
+import org.tizen.dynamicanalyzer.common.AnalyzerManager;
+import org.tizen.dynamicanalyzer.swap.logparser.ReadBlockingQueue;
+import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineChartManager;
+
+public class EnergyDataDBInserter implements Runnable {
+       private static ReadBlockingQueue<List<List<Object>>> energyDataQueue = new ReadBlockingQueue<List<List<Object>>>();
+
+       private static volatile Thread inserterThread = null;
+
+       public static void startThread() {
+               if (inserterThread == null || !inserterThread.isAlive()) {
+                       synchronized (EnergyDataDBInserter.class) {
+                               if (inserterThread == null || !inserterThread.isAlive()) {
+                                       inserterThread = new Thread(null,
+                                                       new EnergyDataDBInserter());
+                                       inserterThread.start();
+                               }
+                       }
+               }
+       }
+
+       public static void stopThread() {
+               if (inserterThread != null && inserterThread.isAlive()) {
+                       try {
+                               sendNotify();
+                               inserterThread.join(AnalyzerManager.THREAD_JOIN_WAIT_TIME);
+                       } catch (InterruptedException e) {
+                               e.printStackTrace();
+                       }
+               }
+       }
+
+       public static void pushContextData(List<List<Object>> data) {
+               energyDataQueue.offer(data);
+       }
+
+       public static void clear() {
+               stopThread();
+       }
+
+       @Override
+       public void run() {
+               while (!AnalyzerManager.isExit()) {
+                       List<List<Object>> energyData = energyDataQueue.poll();
+                       
+                       if (energyData != null && energyData.size() != 0) {
+                               for (int i = 0; i < energyData.size(); i++) {
+                                   List<Object> row = energyData.get(i);
+                               }
+                               TimelineChartManager.getInstance().getEnergyTable().insertData(energyData);
+                       }
+               }
+       }
+
+       public static void sendNotify() {
+               synchronized (energyDataQueue) {
+                   energyDataQueue.notifyAll();
+               }
+       }
+}
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/ProcessDataDBInserter.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/ProcessDataDBInserter.java
new file mode 100644 (file)
index 0000000..2d51ab5
--- /dev/null
@@ -0,0 +1,91 @@
+/*
+ *  Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * Jungwook Ryu <jungwook.ryu@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.timeline;
+
+import java.util.List;
+
+import org.tizen.dynamicanalyzer.common.AnalyzerManager;
+import org.tizen.dynamicanalyzer.swap.logparser.ReadBlockingQueue;
+import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineChartManager;
+
+public class ProcessDataDBInserter implements Runnable {
+       private static ReadBlockingQueue<List<List<Object>>> processDataQueue = new ReadBlockingQueue<List<List<Object>>>();
+
+       private static volatile Thread inserterThread = null;
+
+       public static void startThread() {
+               if (inserterThread == null || !inserterThread.isAlive()) {
+                       synchronized (ProcessDataDBInserter.class) {
+                               if (inserterThread == null || !inserterThread.isAlive()) {
+                                       inserterThread = new Thread(null,
+                                                       new ProcessDataDBInserter());
+                                       inserterThread.start();
+                               }
+                       }
+               }
+       }
+
+       public static void stopThread() {
+               if (inserterThread != null && inserterThread.isAlive()) {
+                       try {
+                               sendNotify();
+                               inserterThread.join(AnalyzerManager.THREAD_JOIN_WAIT_TIME);
+                       } catch (InterruptedException e) {
+                               e.printStackTrace();
+                       }
+               }
+       }
+
+       public static void pushContextData(List<List<Object>> data) {
+               processDataQueue.offer(data);
+       }
+
+       public static void clear() {
+               stopThread();
+       }
+
+       @Override
+       public void run() {
+               while (!AnalyzerManager.isExit()) {
+                       List<List<Object>> processData = processDataQueue.poll();
+                       
+                       if (processData != null && processData.size() != 0) {
+                               for (int i = 0; i < processData.size(); i++) {
+                                   List<Object> row = processData.get(i);
+                               }
+                               TimelineChartManager.getInstance().getProcessTable().insertData(processData);
+                       }
+               }
+       }
+
+       public static void sendNotify() {
+               synchronized (processDataQueue) {
+                   processDataQueue.notifyAll();
+               }
+       }
+
+}
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/ProcessLoadDBTable.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/ProcessLoadDBTable.java
new file mode 100644 (file)
index 0000000..5c03f86
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+ *  Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * Jungwook Ryu <jungwook.ryu@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.timeline;
+
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.util.List;
+
+import org.tizen.dynamicanalyzer.database.DBColumn;
+import org.tizen.dynamicanalyzer.database.DBConstants;
+import org.tizen.dynamicanalyzer.database.DBTable;
+
+public class ProcessLoadDBTable extends DBTable {
+       private static final String TABLENAME = "TIMELINE_PROCESS_LOAD";
+       
+       public static enum COLUMN {
+               TIME,
+               PID,
+               CPU_LOAD,
+       }
+       
+       public static final String TIME = "TIME";
+       public static final String PID = "CORE_NUM";
+       public static final String CPU_LOAD = "CPU_LOAD";
+
+       @Override
+       public String getTableName() {
+               return TABLENAME;
+       }
+
+       public ProcessLoadDBTable() {
+               addColumn(new DBColumn(TIME, DBConstants.NOT_NULL, DBConstants.LONG));
+               addColumn(new DBColumn(PID, DBConstants.NOT_NULL, DBConstants.INTEGER));
+               addColumn(new DBColumn(CPU_LOAD, DBConstants.NOT_NULL, DBConstants.FLOAT));
+       }
+       
+       @Override
+       public boolean prepare(PreparedStatement prep, List<Object> rowData) {
+               boolean isPrepared = true;
+
+               int columnsize = getColumnSize();
+               if (columnsize != rowData.size()) {
+                       isPrepared = false;
+               } else {
+                       try {
+                               prep.setLong(1, (Long) (rowData.get(0)));
+                               prep.setInt(2, (Integer) (rowData.get(1)));
+                               prep.setFloat(3, (Float) (rowData.get(2)));
+                       } catch (SQLException e) {
+                               e.printStackTrace();
+                               isPrepared = false;
+                       }
+               }
+
+               return isPrepared;
+       }
+}
\ No newline at end of file
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/ScreenShotDBInserter.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/ScreenShotDBInserter.java
new file mode 100644 (file)
index 0000000..df7a0bb
--- /dev/null
@@ -0,0 +1,92 @@
+/*
+ *  Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * Jungwook Ryu <jungwook.ryu@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.timeline;
+
+import java.util.List;
+
+import org.tizen.dynamicanalyzer.common.AnalyzerManager;
+import org.tizen.dynamicanalyzer.swap.logparser.ReadBlockingQueue;
+import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineChartManager;
+
+public class ScreenShotDBInserter implements Runnable {
+       private static ReadBlockingQueue<List<List<Object>>> screenShotDataQueue = new ReadBlockingQueue<List<List<Object>>>();
+
+       private static volatile Thread inserterThread = null;
+
+       public static void startThread() {
+               if (inserterThread == null || !inserterThread.isAlive()) {
+                       synchronized (ScreenShotDBInserter.class) {
+                               if (inserterThread == null || !inserterThread.isAlive()) {
+                                       inserterThread = new Thread(null,
+                                                       new ScreenShotDBInserter());
+                                       inserterThread.start();
+                               }
+                       }
+               }
+       }
+
+       public static void stopThread() {
+               if (inserterThread != null && inserterThread.isAlive()) {
+                       try {
+                               sendNotify();
+                               inserterThread.join(AnalyzerManager.THREAD_JOIN_WAIT_TIME);
+                       } catch (InterruptedException e) {
+                               e.printStackTrace();
+                       }
+               }
+       }
+
+       public static void pushContextData(List<List<Object>> data) {
+               screenShotDataQueue.offer(data);
+       }
+
+       public static void clear() {
+               stopThread();
+       }
+
+       @Override
+       public void run() {
+               while (!AnalyzerManager.isExit()) {
+                       List<List<Object>> screenShotData = screenShotDataQueue.poll();
+                       
+                       if (screenShotData != null && screenShotData.size() != 0) {
+                               for (int i = 0; i < screenShotData.size(); i++) {
+                                   List<Object> row = screenShotData.get(i);
+                               }
+                               TimelineChartManager.getInstance().getScreenShotTable().insertData(screenShotData);
+                       }
+               }
+       }
+
+       public static void sendNotify() {
+               synchronized (screenShotDataQueue) {
+                   screenShotDataQueue.notifyAll();
+               }
+       }
+
+}
+
index 7c61534..cdf115b 100644 (file)
@@ -1,6 +1,33 @@
+/*
+ *  Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * Jungwook Ryu <jungwook.ryu@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.timeline;
 
 import java.sql.PreparedStatement;
+import java.sql.SQLException;
 import java.util.List;
 
 import org.tizen.dynamicanalyzer.database.DBColumn;
@@ -10,6 +37,8 @@ import org.tizen.dynamicanalyzer.database.DBTable;
 public class ScreenShotDBTable extends DBTable {
        private static final String TABLENAME = "TIMELINE_SCREENSHOT";
        
+       private final static int MAX_IMAGEPATH_LEN = 1024; 
+       
        public static enum COLUMN {
                TIME,
                IMAGE_FILE_PATH,
@@ -27,14 +56,29 @@ public class ScreenShotDBTable extends DBTable {
 
        public ScreenShotDBTable() {
                addColumn(new DBColumn(TIME, DBConstants.NOT_NULL, DBConstants.LONG));
-               addColumn(new DBColumn(IMAGE_FILE_PATH, DBConstants.NOT_NULL, DBConstants.TEXT));       // TODO integer -> float
+               addColumn(new DBColumn(IMAGE_FILE_PATH, DBConstants.NOT_NULL, DBConstants.VARCHAR, MAX_IMAGEPATH_LEN));
                addColumn(new DBColumn(IMAGE_ORIENTATION, DBConstants.NOT_NULL, DBConstants.INTEGER));
        }
 
        @Override
        public boolean prepare(PreparedStatement prep, List<Object> rowData) {
-               // TODO Auto-generated method stub
-               return false;
+               boolean isPrepared = true;
+
+               int columnsize = getColumnSize();
+               if (columnsize != rowData.size()) {
+                       isPrepared = false;
+               } else {
+                       try {
+                               prep.setLong(1, (Long) (rowData.get(0)));
+                               prep.setString(2, (String) (rowData.get(1)));
+                               prep.setInt(3, (Integer) (rowData.get(2)));
+                       } catch (SQLException e) {
+                               e.printStackTrace();
+                               isPrepared = false;
+                       }
+               }
+
+               return isPrepared;
        }
 }
 
index a61fa6d..51b5788 100644 (file)
@@ -1,3 +1,29 @@
+/*
+ *  Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * Jungwook Ryu <jungwook.ryu@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.timeline;
 
 import java.util.List;
index 2848306..7ca42d0 100644 (file)
@@ -38,11 +38,46 @@ public class SystemDataDBTable extends DBTable {
        private static final String TABLENAME = "TIMELINE_SYSTEM_DATA";
 
        public static enum COLUMN {
-               TIME, CPU_LOAD_APP, PROCESS_COUNT, HEAP_ALLOCATION_TOTAL, HEAP_ALLOCATION_APP, MEMORY_VIRTUAL, MEMORY_RESIDENT, MEMORY_SHARED, MEMORY_PSS, MEMORY_TOTAL_SYSTEM, MEMORY_USAGE_SYSTEM, NETWORK_SIZE_SEND, NETWORK_SIZE_RECEIVE, DEVICE_STATUS_WIFI, DEVICE_STATUS_BLUETOOTH, DEVICE_STATUS_GPS, DEVICE_STATUS_BRIGHTNESS, DEVICE_STATUS_DNET, DEVICE_STATUS_CAMERA, DEVICE_STATUS_SOUND, DEVICE_STATUS_AUDIO, DEVICE_STATUS_VIBRATION, DEVICE_STATUS_VOLTAGE, DEVICE_STATUS_RSSI, DEVICE_STATUS_VIDEO, DEVICE_STATUS_CALL, DISK_TOTAL_USAGE, DISK_IO_READ_SIZE, DISK_IO_READ_SECTOR, DISK_IO_WRITE_SIZE, DISK_IO_WRITE_SECTOR, ENERGY_USAGE, FD_COUNT, FD_ACTIVITY
+               TIME,
+               CPU_LOAD_APP,
+               CPU_LOAD_TOTAL,
+               PROCESS_COUNT,
+               HEAP_ALLOCATION_TOTAL,
+               HEAP_ALLOCATION_APP,
+               MEMORY_VIRTUAL,
+               MEMORY_RESIDENT,
+               MEMORY_SHARED,
+               MEMORY_PSS,
+               MEMORY_TOTAL_SYSTEM,
+               MEMORY_USAGE_SYSTEM,
+               NETWORK_SIZE_SEND,
+               NETWORK_SIZE_RECEIVE,
+               DEVICE_STATUS_WIFI,
+               DEVICE_STATUS_BLUETOOTH,
+               DEVICE_STATUS_GPS,
+               DEVICE_STATUS_BRIGHTNESS,
+               DEVICE_STATUS_DNET,
+               DEVICE_STATUS_CAMERA,
+               DEVICE_STATUS_SOUND,
+               DEVICE_STATUS_AUDIO,
+               DEVICE_STATUS_VIBRATION,
+               DEVICE_STATUS_VOLTAGE,
+               DEVICE_STATUS_RSSI,
+               DEVICE_STATUS_VIDEO,
+               DEVICE_STATUS_CALL,
+               DISK_TOTAL_USAGE,
+               DISK_IO_READ_SIZE,
+               DISK_IO_READ_SECTOR,
+               DISK_IO_WRITE_SIZE,
+               DISK_IO_WRITE_SECTOR,
+               ENERGY_USAGE,
+               FD_COUNT,
+               FD_ACTIVITY
        }
 
        public static final String TIME = "TIME";
        public static final String CPU_LOAD_APP = "CPU_LOAD_APP";
+       public static final String CPU_LOAD_TOTAL = "CPU_LOAD_TOTAL";
        public static final String PROCESS_COUNT = "PROCESS_COUNT";
        public static final String HEAP_ALLOCATION_TOTAL = "HEAP_ALLOCATION_TOTAL";
        public static final String HEAP_ALLOCATION_APP = "HEAP_ALLOCATION_APP";
@@ -82,73 +117,41 @@ public class SystemDataDBTable extends DBTable {
        }
 
        public SystemDataDBTable() {
-               addColumn(new DBColumn(TIME, DBConstants.NOT_NULL, DBConstants.LONG));
-               addColumn(new DBColumn(CPU_LOAD_APP, DBConstants.NOT_NULL,
-                               DBConstants.INTEGER)); // TODO integer -> float
-               addColumn(new DBColumn(PROCESS_COUNT, DBConstants.NOT_NULL,
-                               DBConstants.INTEGER));
-               addColumn(new DBColumn(HEAP_ALLOCATION_TOTAL, DBConstants.NOT_NULL,
-                               DBConstants.LONG));
-               addColumn(new DBColumn(HEAP_ALLOCATION_APP, DBConstants.NOT_NULL,
-                               DBConstants.LONG));
-               addColumn(new DBColumn(MEMORY_VIRTUAL, DBConstants.NOT_NULL,
-                               DBConstants.INTEGER));
-               addColumn(new DBColumn(MEMORY_RESIDENT, DBConstants.NOT_NULL,
-                               DBConstants.INTEGER));
-               addColumn(new DBColumn(MEMORY_SHARED, DBConstants.NOT_NULL,
-                               DBConstants.INTEGER));
-               addColumn(new DBColumn(MEMORY_PSS, DBConstants.NOT_NULL,
-                               DBConstants.INTEGER));
-               addColumn(new DBColumn(MEMORY_TOTAL_SYSTEM, DBConstants.NOT_NULL,
-                               DBConstants.LONG)); // 10
-               addColumn(new DBColumn(MEMORY_USAGE_SYSTEM, DBConstants.NOT_NULL,
-                               DBConstants.LONG));
-               addColumn(new DBColumn(NETWORK_SIZE_SEND, DBConstants.NOT_NULL,
-                               DBConstants.INTEGER));
-               addColumn(new DBColumn(NETWORK_SIZE_RECEIVE, DBConstants.NOT_NULL,
-                               DBConstants.INTEGER));
-               addColumn(new DBColumn(DEVICE_STATUS_WIFI, DBConstants.NOT_NULL,
-                               DBConstants.INTEGER));
-               addColumn(new DBColumn(DEVICE_STATUS_BLUETOOTH, DBConstants.NOT_NULL,
-                               DBConstants.INTEGER));
-               addColumn(new DBColumn(DEVICE_STATUS_GPS, DBConstants.NOT_NULL,
-                               DBConstants.INTEGER));
-               addColumn(new DBColumn(DEVICE_STATUS_BRIGHTNESS, DBConstants.NOT_NULL,
-                               DBConstants.INTEGER));
-               addColumn(new DBColumn(DEVICE_STATUS_DNET, DBConstants.NOT_NULL,
-                               DBConstants.INTEGER));
-               addColumn(new DBColumn(DEVICE_STATUS_CAMERA, DBConstants.NOT_NULL,
-                               DBConstants.INTEGER));
-               addColumn(new DBColumn(DEVICE_STATUS_SOUND, DBConstants.NOT_NULL,
-                               DBConstants.INTEGER)); // 20
-               addColumn(new DBColumn(DEVICE_STATUS_AUDIO, DBConstants.NOT_NULL,
-                               DBConstants.INTEGER));
-               addColumn(new DBColumn(DEVICE_STATUS_VIBRATION, DBConstants.NOT_NULL,
-                               DBConstants.INTEGER));
-               addColumn(new DBColumn(DEVICE_STATUS_VOLTAGE, DBConstants.NOT_NULL,
-                               DBConstants.INTEGER));
-               addColumn(new DBColumn(DEVICE_STATUS_RSSI, DBConstants.NOT_NULL,
-                               DBConstants.INTEGER));
-               addColumn(new DBColumn(DEVICE_STATUS_VIDEO, DBConstants.NOT_NULL,
-                               DBConstants.INTEGER));
-               addColumn(new DBColumn(DEVICE_STATUS_CALL, DBConstants.NOT_NULL,
-                               DBConstants.INTEGER));
-               addColumn(new DBColumn(DISK_TOTAL_USAGE, DBConstants.NOT_NULL,
-                               DBConstants.INTEGER));
-               addColumn(new DBColumn(DISK_IO_READ_SIZE, DBConstants.NOT_NULL,
-                               DBConstants.INTEGER));
-               addColumn(new DBColumn(DISK_IO_READ_SECTOR, DBConstants.NOT_NULL,
-                               DBConstants.INTEGER));
-               addColumn(new DBColumn(DISK_IO_WRITE_SIZE, DBConstants.NOT_NULL,
-                               DBConstants.INTEGER)); // 30
-               addColumn(new DBColumn(DISK_IO_WRITE_SECTOR, DBConstants.NOT_NULL,
-                               DBConstants.INTEGER));
-               addColumn(new DBColumn(ENERGY_USAGE, DBConstants.NOT_NULL,
-                               DBConstants.INTEGER));
-               // addColumn(new DBColumn(FD_COUNT, DBConstants.NOT_NULL,
-               // DBConstants.INTEGER));
-               // addColumn(new DBColumn(FD_ACTIVITY, DBConstants.NOT_NULL,
-               // DBConstants.INTEGER));
+               addColumn(new DBColumn(TIME, DBConstants.NOT_NULL, DBConstants.LONG));                  // 1
+               addColumn(new DBColumn(CPU_LOAD_APP, DBConstants.EMPTY, DBConstants.FLOAT));
+               addColumn(new DBColumn(CPU_LOAD_TOTAL, DBConstants.EMPTY, DBConstants.FLOAT));
+               addColumn(new DBColumn(PROCESS_COUNT, DBConstants.EMPTY, DBConstants.INTEGER));
+               addColumn(new DBColumn(HEAP_ALLOCATION_TOTAL, DBConstants.EMPTY, DBConstants.LONG));
+               addColumn(new DBColumn(HEAP_ALLOCATION_APP, DBConstants.EMPTY, DBConstants.LONG));
+               addColumn(new DBColumn(MEMORY_VIRTUAL, DBConstants.EMPTY, DBConstants.INTEGER));
+               addColumn(new DBColumn(MEMORY_RESIDENT, DBConstants.EMPTY, DBConstants.INTEGER));
+               addColumn(new DBColumn(MEMORY_SHARED, DBConstants.EMPTY, DBConstants.INTEGER));
+               addColumn(new DBColumn(MEMORY_PSS, DBConstants.EMPTY, DBConstants.INTEGER));                    // 10
+               addColumn(new DBColumn(MEMORY_TOTAL_SYSTEM, DBConstants.EMPTY, DBConstants.LONG));
+               addColumn(new DBColumn(MEMORY_USAGE_SYSTEM, DBConstants.EMPTY, DBConstants.LONG));
+               addColumn(new DBColumn(NETWORK_SIZE_SEND, DBConstants.EMPTY, DBConstants.INTEGER));
+               addColumn(new DBColumn(NETWORK_SIZE_RECEIVE, DBConstants.EMPTY, DBConstants.INTEGER));
+               addColumn(new DBColumn(DEVICE_STATUS_WIFI, DBConstants.EMPTY, DBConstants.INTEGER));
+               addColumn(new DBColumn(DEVICE_STATUS_BLUETOOTH, DBConstants.EMPTY, DBConstants.INTEGER));
+               addColumn(new DBColumn(DEVICE_STATUS_GPS, DBConstants.EMPTY, DBConstants.INTEGER));
+               addColumn(new DBColumn(DEVICE_STATUS_BRIGHTNESS, DBConstants.EMPTY, DBConstants.INTEGER));
+               addColumn(new DBColumn(DEVICE_STATUS_DNET, DBConstants.EMPTY, DBConstants.INTEGER));
+               addColumn(new DBColumn(DEVICE_STATUS_CAMERA, DBConstants.EMPTY, DBConstants.INTEGER));  // 20
+               addColumn(new DBColumn(DEVICE_STATUS_SOUND, DBConstants.EMPTY, DBConstants.INTEGER));
+               addColumn(new DBColumn(DEVICE_STATUS_AUDIO, DBConstants.EMPTY, DBConstants.INTEGER));
+               addColumn(new DBColumn(DEVICE_STATUS_VIBRATION, DBConstants.EMPTY, DBConstants.INTEGER));
+               addColumn(new DBColumn(DEVICE_STATUS_VOLTAGE, DBConstants.EMPTY, DBConstants.INTEGER));
+               addColumn(new DBColumn(DEVICE_STATUS_RSSI, DBConstants.EMPTY, DBConstants.INTEGER));
+               addColumn(new DBColumn(DEVICE_STATUS_VIDEO, DBConstants.EMPTY, DBConstants.INTEGER));
+               addColumn(new DBColumn(DEVICE_STATUS_CALL, DBConstants.EMPTY, DBConstants.INTEGER));
+               addColumn(new DBColumn(DISK_TOTAL_USAGE, DBConstants.EMPTY, DBConstants.INTEGER));
+               addColumn(new DBColumn(DISK_IO_READ_SIZE, DBConstants.EMPTY, DBConstants.INTEGER));
+               addColumn(new DBColumn(DISK_IO_READ_SECTOR, DBConstants.EMPTY, DBConstants.INTEGER));   // 30
+               addColumn(new DBColumn(DISK_IO_WRITE_SIZE, DBConstants.EMPTY, DBConstants.INTEGER));
+               addColumn(new DBColumn(DISK_IO_WRITE_SECTOR, DBConstants.EMPTY, DBConstants.INTEGER));
+               addColumn(new DBColumn(ENERGY_USAGE, DBConstants.EMPTY, DBConstants.INTEGER));
+//             addColumn(new DBColumn(FD_COUNT, DBConstants.NOT_NULL, DBConstants.INTEGER));
+//             addColumn(new DBColumn(FD_ACTIVITY, DBConstants.NOT_NULL, DBConstants.INTEGER));
        }
 
        @Override
@@ -161,18 +164,17 @@ public class SystemDataDBTable extends DBTable {
                } else {
                        try {
                                prep.setLong(1, (Long) (rowData.get(0)));
-                               prep.setInt(2, (Integer) (rowData.get(1)));
-                               prep.setInt(3, (Integer) (rowData.get(2)));
-                               prep.setLong(4, (Long) (rowData.get(3)));
+                               prep.setFloat(2, (Float) (rowData.get(1)));
+                               prep.setFloat(3, (Float) (rowData.get(2)));
+                               prep.setInt(4, (Integer) (rowData.get(3)));     
                                prep.setLong(5, (Long) (rowData.get(4)));
-                               prep.setInt(6, (Integer) (rowData.get(5)));
+                               prep.setLong(6, (Long) (rowData.get(5)));
                                prep.setInt(7, (Integer) (rowData.get(6)));
                                prep.setInt(8, (Integer) (rowData.get(7)));
                                prep.setInt(9, (Integer) (rowData.get(8)));
-                               prep.setLong(10, (Long) (rowData.get(9)));
+                               prep.setInt(10, (Integer) (rowData.get(9)));
                                prep.setLong(11, (Long) (rowData.get(10)));
-
-                               prep.setInt(12, (Integer) (rowData.get(11)));
+                               prep.setLong(12, (Long) (rowData.get(11)));
                                prep.setInt(13, (Integer) (rowData.get(12)));
                                prep.setInt(14, (Integer) (rowData.get(13)));
                                prep.setInt(15, (Integer) (rowData.get(14)));
@@ -193,6 +195,7 @@ public class SystemDataDBTable extends DBTable {
                                prep.setInt(30, (Integer) (rowData.get(29)));
                                prep.setInt(31, (Integer) (rowData.get(30)));
                                prep.setInt(32, (Integer) (rowData.get(31)));
+                               prep.setInt(33, (Integer) (rowData.get(32)));
                        } catch (SQLException e) {
                                e.printStackTrace();
                                isPrepared = false;
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/UIEventDBInserter.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/UIEventDBInserter.java
new file mode 100644 (file)
index 0000000..79c97cb
--- /dev/null
@@ -0,0 +1,91 @@
+/*
+ *  Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * Jungwook Ryu <jungwook.ryu@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.timeline;
+
+import java.util.List;
+
+import org.tizen.dynamicanalyzer.common.AnalyzerManager;
+import org.tizen.dynamicanalyzer.swap.logparser.ReadBlockingQueue;
+import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineChartManager;
+
+public class UIEventDBInserter implements Runnable {
+       private static ReadBlockingQueue<List<List<Object>>> uiEventDataQueue = new ReadBlockingQueue<List<List<Object>>>();
+
+       private static volatile Thread inserterThread = null;
+
+       public static void startThread() {
+               if (inserterThread == null || !inserterThread.isAlive()) {
+                       synchronized (UIEventDBInserter.class) {
+                               if (inserterThread == null || !inserterThread.isAlive()) {
+                                       inserterThread = new Thread(null,
+                                                       new UIEventDBInserter());
+                                       inserterThread.start();
+                               }
+                       }
+               }
+       }
+
+       public static void stopThread() {
+               if (inserterThread != null && inserterThread.isAlive()) {
+                       try {
+                               sendNotify();
+                               inserterThread.join(AnalyzerManager.THREAD_JOIN_WAIT_TIME);
+                       } catch (InterruptedException e) {
+                               e.printStackTrace();
+                       }
+               }
+       }
+
+       public static void pushContextData(List<List<Object>> data) {
+           uiEventDataQueue.offer(data);
+       }
+
+       public static void clear() {
+               stopThread();
+       }
+
+       @Override
+       public void run() {
+               while (!AnalyzerManager.isExit()) {
+                       List<List<Object>> uiEventData = uiEventDataQueue.poll();
+                       
+                       if (uiEventData != null && uiEventData.size() != 0) {
+                               for (int i = 0; i < uiEventData.size(); i++) {
+                                   List<Object> row = uiEventData.get(i);
+                               }
+                               TimelineChartManager.getInstance().getUIEventTable().insertData(uiEventData);
+                       }
+               }
+       }
+
+       public static void sendNotify() {
+               synchronized (uiEventDataQueue) {
+                   uiEventDataQueue.notifyAll();
+               }
+       }
+
+}
index 584508e..6fe846c 100644 (file)
@@ -1,6 +1,33 @@
+/*
+ *  Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * Jungwook Ryu <jungwook.ryu@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.timeline;
 
 import java.sql.PreparedStatement;
+import java.sql.SQLException;
 import java.util.List;
 
 import org.tizen.dynamicanalyzer.database.DBColumn;
@@ -10,6 +37,8 @@ import org.tizen.dynamicanalyzer.database.DBTable;
 public class UIEventDBTable extends DBTable {
        private static final String TABLENAME = "TIMELINE_UIEVENT";
        
+       private final static int MAX_INFO_LEN = 256; 
+       
        public static enum COLUMN {
                TIME,
                EVENT_TYPE,
@@ -39,13 +68,32 @@ public class UIEventDBTable extends DBTable {
                addColumn(new DBColumn(DETAIL_TYPE, DBConstants.NOT_NULL, DBConstants.INTEGER));
                addColumn(new DBColumn(POINT_X, DBConstants.NOT_NULL, DBConstants.INTEGER));
                addColumn(new DBColumn(POINT_Y, DBConstants.NOT_NULL, DBConstants.INTEGER));
-               addColumn(new DBColumn(INFO_STRING, DBConstants.NOT_NULL, DBConstants.TEXT));
+               addColumn(new DBColumn(INFO_STRING, DBConstants.NOT_NULL, DBConstants.VARCHAR, MAX_INFO_LEN));
                addColumn(new DBColumn(INFO_INTEGER, DBConstants.NOT_NULL, DBConstants.INTEGER));
        }
 
        @Override
        public boolean prepare(PreparedStatement prep, List<Object> rowData) {
-               // TODO Auto-generated method stub
-               return false;
+               boolean isPrepared = true;
+
+               int columnsize = getColumnSize();
+               if (columnsize != rowData.size()) {
+                       isPrepared = false;
+               } else {
+                       try {
+                               prep.setLong(1, (Long) (rowData.get(0)));
+                               prep.setInt(2, (Integer) (rowData.get(1)));
+                               prep.setInt(3, (Integer) (rowData.get(2)));
+                               prep.setInt(4, (Integer) (rowData.get(3)));
+                               prep.setInt(5, (Integer) (rowData.get(4)));
+                               prep.setString(6, (String) (rowData.get(5)));
+                               prep.setInt(7, (Integer) (rowData.get(6)));
+                       } catch (SQLException e) {
+                               e.printStackTrace();
+                               isPrepared = false;
+                       }
+               }
+
+               return isPrepared;
        }
 }
index 9d80e9e..391310b 100644 (file)
@@ -4,6 +4,7 @@
  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Contact: 
+ * Jungwook Ryu <jungwook.ryu@samsung.com>
  * Sanghyun Lee <sanghyunnim.lee@samsung.com>
  * Juyoung Kim <j0.kim@samsung.com>
  *
 
 package org.tizen.dynamicanalyzer.ui.timeline.chart;
 
+import java.util.Collection;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
 import org.eclipse.swt.widgets.Display;
-import org.tizen.dynamicanalyzer.constant.CommonConstants;
 import org.tizen.dynamicanalyzer.nl.TimelineChartLabels;
 import org.tizen.dynamicanalyzer.resources.ColorResources;
 import org.tizen.dynamicanalyzer.resources.FontResources;
 import org.tizen.dynamicanalyzer.resources.ImageResources;
 import org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants;
-import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
-import org.tizen.dynamicanalyzer.swap.logparser.Logs;
-import org.tizen.dynamicanalyzer.swap.model.data.LogData;
-import org.tizen.dynamicanalyzer.swap.model.data.SystemData;
 import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseEventListener;
 import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseTrackAdapter;
+import org.tizen.dynamicanalyzer.ui.timeline.ProcessLoadDBTable;
+import org.tizen.dynamicanalyzer.ui.timeline.SystemDataDBTable;
 import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
 import org.tizen.dynamicanalyzer.utils.Formatter;
 import org.tizen.dynamicanalyzer.widgets.chart.DAChart;
@@ -112,44 +112,47 @@ public class CPUChart extends TimelineChart {
        }
 
        @Override
-       public void parseLogPackage(LogPackage logPack) {
-               Logs logs = logPack.getLogs(probeType);
-               if (logs == null) {
-                       return;
-               }
-
-               List<LogData> logDataList = logs.getRawLogs();
-
-               for (LogData logData : logDataList) {
-                       parseLog((SystemData) logData);
-               }
-       }
-
-       private void parseLog(SystemData logData) {
-               double time = logData.getTime() / TimelineConstants.MEGA_DOUBLE;
-
-               /* app load */
-               try {
-                       double appCpuRate = logData.getAppCpuUsage();
-                       appLoadSeries.addSeriesItem(new DAChartSeriesItem(time, appCpuRate,
-                                       Formatter.toPercentageFormat(appCpuRate)));
-               } catch (NumberFormatException ne) {
-                       ne.printStackTrace();
-               }
-
-               /* total load */
-               try {
-                       String[] cpuRates = logData.getCpuLoad().split(","); //$NON-NLS-1$
-                       double systemAvgLoad = Double
-                                       .parseDouble(cpuRates[cpuRates.length - 1]);
-                       totalLoadSeries
-                                       .addSeriesItem(new DAChartSeriesItem(time, systemAvgLoad,
-                                                       Formatter.toPercentageFormat(systemAvgLoad)));
-               } catch (NumberFormatException ne) {
-                       ne.printStackTrace();
-               }
-
-               if (processItem == null) {
+       public void inputChartSeries(List<Object> dataList) {
+               appLoadSeries.clear();
+               totalLoadSeries.clear();
+               Collection<DAChartSeries> processSeries = childSeriesMap.values();
+               if (processSeries != null) {
+                   Iterator<DAChartSeries> iter = processSeries.iterator();
+                   while (iter.hasNext()) {
+                       iter.next().clear();
+                   }
+               }
+               
+               @SuppressWarnings("unchecked")
+               List<List<Object>> systemData = (List<List<Object>>)dataList.get(TimelineConstants.SYSTEM_DB_DATA);
+               @SuppressWarnings("unchecked")
+               Map<Integer, List<List<Object>>> processDataMap = (Map<Integer, List<List<Object>>>)dataList.get(TimelineConstants.PROCESS_DB_DATA);
+               
+               /*
+                * Construct CPU Chart
+                */
+               for (int i = 0; i < systemData.size(); i++) {
+                       List<Object> row = systemData.get(i);
+                       double time = (Long)row.get(SystemDataDBTable.COLUMN.TIME.ordinal())
+                               / TimelineConstants.MEGA_DOUBLE;
+                       
+                       try {
+                           double appCpuRate = (Float)row.get(SystemDataDBTable.COLUMN.CPU_LOAD_APP.ordinal());
+                           double systemAvgLoad = (Float)row.get(SystemDataDBTable.COLUMN.CPU_LOAD_TOTAL.ordinal());
+                       
+                           appLoadSeries.addSeriesItem(new DAChartSeriesItem(time, appCpuRate,
+                                                                             Formatter.toPercentageFormat(appCpuRate)));
+                           totalLoadSeries.addSeriesItem(new DAChartSeriesItem(time, systemAvgLoad,
+                                                                               Formatter.toPercentageFormat(systemAvgLoad)));
+                       } catch (NumberFormatException ne) {
+                           ne.printStackTrace();
+                       }
+               }
+                       
+               /*
+                * Construct Process Chart
+                */
+               if (processItem == null) {
                        Display.getDefault().syncExec(new Runnable() {
                                @Override
                                public void run() {
@@ -189,41 +192,40 @@ public class CPUChart extends TimelineChart {
                        });
                }
 
-               /* processes load */
-               String[] processLoadDatas = logData.getProcessLoad().split(
-                               CommonConstants.COMMA);
-
+               Iterator<Integer> iter = processDataMap.keySet().iterator();
                int prevChildSize = childSeriesMap.size();
-               for (int i = 0; i < processLoadDatas.length; i++) {
-                       String processLoad = processLoadDatas[i];
-                       if (processLoad == null || processLoad.isEmpty()) {
-                               continue;
-                       }
-                       int pid = Integer.parseInt(processLoad);
-                       double load = Double.parseDouble(processLoadDatas[++i]);
-
-                       DAChartSeries series = childSeriesMap.get(pid);
-
-                       if (series == null) {
-                               if (load != 0) {
-                                       DAChartSeries newSeries = new DAChartSeries(
-                                                       Integer.toString(pid),
-                                                       DAChartSeries.SERIES_STYLE_NONE,
-                                                       ColorResources.SERIES_COLOR_CPU_SYSTEM);
-                                       newSeries.addSeriesItem(new DAChartSeriesItem(time, load,
-                                                       Formatter.toPercentageFormat(load)));
-                                       try {
-                                               processItem.getChart().addSeries(newSeries);
-                                       } catch (NullPointerException e) {
-                                               e.printStackTrace();
+               while (iter.hasNext()) {
+                       Integer pid = iter.next();
+                       List<List<Object>> data = processDataMap.get(pid);
+                       for (int i = 0; i < data.size(); i++) {
+                               List<Object> oneTime = data.get(i);
+                               double time = (Long)oneTime.get(ProcessLoadDBTable.COLUMN.TIME.ordinal())
+                                               / TimelineConstants.MEGA_DOUBLE;
+                               double load = (Float)oneTime.get(ProcessLoadDBTable.COLUMN.CPU_LOAD.ordinal());
+                               
+                               DAChartSeries series = childSeriesMap.get(pid);
+                               if (series == null) {
+                                       if (load != 0) {
+                                               DAChartSeries newSeries = new DAChartSeries(
+                                                               Integer.toString(pid),
+                                                               DAChartSeries.SERIES_STYLE_NONE,
+                                                               ColorResources.SERIES_COLOR_CPU_SYSTEM);
+                                               newSeries.addSeriesItem(new DAChartSeriesItem(time, load,
+                                                               Formatter.toPercentageFormat(load)));
+                                               try {
+                                                       processItem.getChart().addSeries(newSeries);
+                                               } catch (NullPointerException e) {
+                                                       e.printStackTrace();
+                                               }
+
+                                               childSeriesMap.put(pid, newSeries);
                                        }
-
-                                       childSeriesMap.put(pid, newSeries);
+                               } else {
+                                       series.addSeriesItem(new DAChartSeriesItem(time, load,
+                                                       Formatter.toPercentageFormat(load)));
                                }
-                       } else {
-                               series.addSeriesItem(new DAChartSeriesItem(time, load,
-                                               Formatter.toPercentageFormat(load)));
-                       }
+                       }
+                       
                }
 
                if (prevChildSize != childSeriesMap.size()) {
index 6f84cce..347d687 100644 (file)
@@ -4,6 +4,7 @@
  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Contact: 
+ * Jungwook Ryu <jungwook.ryu@samsung.com>
  * Sanghyun Lee <sanghyunnim.lee@samsung.com>
  * Juyoung Kim <j0.kim@samsung.com>
  *
@@ -31,16 +32,11 @@ import java.util.List;
 
 import org.eclipse.swt.graphics.Color;
 import org.tizen.dynamicanalyzer.common.GlobalInformation;
-import org.tizen.dynamicanalyzer.communicator.DACommunicator;
-import org.tizen.dynamicanalyzer.constant.CommonConstants;
 import org.tizen.dynamicanalyzer.nl.TimelineChartLabels;
 import org.tizen.dynamicanalyzer.resources.ColorResources;
 import org.tizen.dynamicanalyzer.resources.ImageResources;
 import org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants;
-import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
-import org.tizen.dynamicanalyzer.swap.logparser.Logs;
-import org.tizen.dynamicanalyzer.swap.model.data.LogData;
-import org.tizen.dynamicanalyzer.swap.model.data.SystemData;
+import org.tizen.dynamicanalyzer.ui.timeline.CPUDBTable;
 import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
 import org.tizen.dynamicanalyzer.utils.Formatter;
 import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot.AutoRangeType;
@@ -87,47 +83,46 @@ public class CPUCoreChart extends TimelineChart {
                return item;
        }
 
-       private void parseLog(SystemData logData) {
-               try {
-                       if (coreSize == TimelineConstants.NOT_INITED) {
-                               coreSize = GlobalInformation.getCurrentDeviceInfo().getTargetInfo()
-                                               .getCpuCount();
-                               for (int i = 0; i < coreSize; i++) {
-                                       DAChartSeries chartSeries = new DAChartSeries(
-                                                       TimelineChartLabels.CPU_CORE_CHART_SERIES_NAME_CORE
-                                                       + i, DAChartSeries.SERIES_STYLE_LINE,
-                                                       coreChartSeriesColors[i % 4]);
-                                       chart.addSeries(chartSeries);
-                                       coreChartSeriesList.add(chartSeries);
-                               }
+       @Override
+       public void inputChartSeries(List<Object> dataList) {
+               if (coreSize == TimelineConstants.NOT_INITED) {
+                       if (GlobalInformation.getCurrentDeviceInfo() == null) {
+                               return;
                        }
-                       
-                       double time = logData.getTime() / TimelineConstants.MEGA_DOUBLE;
-                       String[] cpuRates = logData.getCpuLoad().split(
-                                       CommonConstants.COMMA);
-
+                       coreSize = GlobalInformation.getCurrentDeviceInfo().getTargetInfo()
+                                       .getCpuCount();
                        for (int i = 0; i < coreSize; i++) {
-                               double value = Double.parseDouble(cpuRates[i]);
-                               coreChartSeriesList.get(i).addSeriesItem(
-                                               new DAChartSeriesItem(time, value, Formatter
-                                                               .toPercentageFormat(value)));
+                               DAChartSeries chartSeries = new DAChartSeries(
+                                               TimelineChartLabels.CPU_CORE_CHART_SERIES_NAME_CORE + i,
+                                               DAChartSeries.SERIES_STYLE_LINE,
+                                               coreChartSeriesColors[i % ColorResources.MAX_SERIES_COLOR_COUNT]);
+                               chart.addSeries(chartSeries);
+                               coreChartSeriesList.add(chartSeries);
                        }
-               } catch (NumberFormatException ne) {
-                       ne.printStackTrace();
                }
-       }
 
-       @Override
-       public void parseLogPackage(LogPackage logPack) {
-               Logs logs = logPack.getLogs(probeType);
-               if (logs == null) {
-                       return;
+               for (int i = 0; i < coreChartSeriesList.size(); i++) {
+                       coreChartSeriesList.get(i).clear();
                }
 
-               List<LogData> logDataList = logs.getRawLogs();
+               @SuppressWarnings("unchecked")
+               List<List<Object>> data = (List<List<Object>>) dataList.get(TimelineConstants.CPU_DB_DATA);
+
+               // data.size() == coreSize
+               for (int i = 0; i < data.size(); i++) {
+                       List<Object> row = data.get(i);
+                       for (int ii = 0; ii < row.size(); ii++) {
+                               @SuppressWarnings("unchecked")
+                               List<Object> oneTime = (List<Object>) row.get(ii);
+                               double time = (Long) oneTime.get(CPUDBTable.COLUMN.TIME
+                                               .ordinal()) / TimelineConstants.MEGA_DOUBLE;
+                               double cpuLoad = (Float) oneTime.get(CPUDBTable.COLUMN.CPU_LOAD
+                                               .ordinal());
 
-               for (LogData logData : logDataList) {
-                       parseLog((SystemData) logData);
+                               coreChartSeriesList.get(i).addSeriesItem(
+                                               new DAChartSeriesItem(time, cpuLoad, Formatter
+                                                               .toPercentageFormat(cpuLoad)));
+                       }
                }
        }
 
index 14909c1..9a8b124 100644 (file)
@@ -4,6 +4,7 @@
  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Contact: 
+ * Jungwook Ryu <jungwook.ryu@samsung.com>
  * Sanghyun Lee <sanghyunnim.lee@samsung.com>
  * Juyoung Kim <j0.kim@samsung.com>
  *
@@ -31,16 +32,11 @@ import java.util.List;
 
 import org.eclipse.swt.graphics.Color;
 import org.tizen.dynamicanalyzer.common.GlobalInformation;
-import org.tizen.dynamicanalyzer.communicator.DACommunicator;
-import org.tizen.dynamicanalyzer.constant.CommonConstants;
 import org.tizen.dynamicanalyzer.nl.TimelineChartLabels;
 import org.tizen.dynamicanalyzer.resources.ColorResources;
 import org.tizen.dynamicanalyzer.resources.ImageResources;
 import org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants;
-import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
-import org.tizen.dynamicanalyzer.swap.logparser.Logs;
-import org.tizen.dynamicanalyzer.swap.model.data.LogData;
-import org.tizen.dynamicanalyzer.swap.model.data.SystemData;
+import org.tizen.dynamicanalyzer.ui.timeline.CPUDBTable;
 import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
 import org.tizen.dynamicanalyzer.utils.Formatter;
 import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeries;
@@ -48,88 +44,90 @@ import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeriesItem;
 import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
 import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardItem;
 
+
 public class CPUFrequencyChart extends TimelineChart {
-       private static CPUFrequencyChart instance = null;
+    private static CPUFrequencyChart instance = null;
 
-       private int coreSize = TimelineConstants.NOT_INITED;
-       private List<DAChartSeries> coreFrequencyChartSeriesList = new ArrayList<DAChartSeries>();
-       private Color[] coreChartSeriesColors = new Color[] {
-                       ColorResources.SERIES_COLOR_CPUCORE_CORE0,
-                       ColorResources.SERIES_COLOR_CPUCORE_CORE1,
-                       ColorResources.SERIES_COLOR_CPUCORE_CORE2,
-                       ColorResources.SERIES_COLOR_CPUCORE_CORE3 };
+    private int coreSize = TimelineConstants.NOT_INITED;
+    private List<DAChartSeries> coreFrequencyChartSeriesList = new ArrayList<DAChartSeries>();
+    private Color[] coreChartSeriesColors = new Color[] {
+            ColorResources.SERIES_COLOR_CPUCORE_CORE0, ColorResources.SERIES_COLOR_CPUCORE_CORE1,
+            ColorResources.SERIES_COLOR_CPUCORE_CORE2, ColorResources.SERIES_COLOR_CPUCORE_CORE3 };
 
-       public static CPUFrequencyChart getInstance() {
-               if (instance == null) {
-                       instance = new CPUFrequencyChart();
-               }
+    public static CPUFrequencyChart getInstance() {
+        if (instance == null) {
+            instance = new CPUFrequencyChart();
+        }
 
-               return instance;
-       }
+        return instance;
+    }
 
-       private CPUFrequencyChart() {
-               chartType = TimelineConstants.CHART_TYPE_CPU_FREQUENCY;
-               probeType = DataChannelConstants.MSG_DATA_SYSTEM;
-               chartName = TimelineChartLabels.CPU_FREQUENCY_CHART_TITLE;
-               chartIcon = ImageResources.CHART_CPU_FREQUENCY;
-               addIcon = ImageResources.ADD_CHART_CPU_FREQUENCY;
-       }
+    private CPUFrequencyChart() {
+        chartType = TimelineConstants.CHART_TYPE_CPU_FREQUENCY;
+        probeType = DataChannelConstants.MSG_DATA_SYSTEM;
+        chartName = TimelineChartLabels.CPU_FREQUENCY_CHART_TITLE;
+        chartIcon = ImageResources.CHART_CPU_FREQUENCY;
+        addIcon = ImageResources.ADD_CHART_CPU_FREQUENCY;
+    }
 
-       @Override
-       public DAChartBoardItem createBoardItem(DAChartBoard board) {
-               DAChartBoardItem item = super.createBoardItem(board);
+    @Override
+    public DAChartBoardItem createBoardItem(DAChartBoard board) {
+        DAChartBoardItem item = super.createBoardItem(board);
 
-               chart.getPlot().setAxisUnit("Hz");
-               chart.getPlot().setShowAxis(true);
+        chart.getPlot().setAxisUnit("Hz");
+        chart.getPlot().setShowAxis(true);
+        return item;
+    }
 
-               return item;
-       }
+    @Override
+    public void inputChartSeries(List<Object> dataList) {
+        if (coreSize == TimelineConstants.NOT_INITED) {
+            if (GlobalInformation.getCurrentDeviceInfo() == null) {
+                return;
+            }
+            coreSize = GlobalInformation.getCurrentDeviceInfo().getTargetInfo().getCpuCount();
+            for (int i = 0; i < coreSize; i++) {
+                DAChartSeries chartSeries =
+                        new DAChartSeries(TimelineChartLabels.CPU_CORE_CHART_SERIES_NAME_CORE + i,
+                                          DAChartSeries.SERIES_STYLE_LINE,
+                                          coreChartSeriesColors[i % ColorResources.MAX_SERIES_COLOR_COUNT]);
+                chart.addSeries(chartSeries);
+                coreFrequencyChartSeriesList.add(chartSeries);
+            }
+        }
 
-       @Override
-       public void parseLogPackage(LogPackage logPack) {
-               Logs logs = logPack.getLogs(probeType);
-               if(logs == null) {
-                       return;
-               }
-               
-               List<LogData> logList = logs.getRawLogs();
-               for (LogData logData : logList) {
-                       parseLog((SystemData)logData);
-               }
-       }
+        for (int i = 0; i < coreFrequencyChartSeriesList.size(); i++) {
+            coreFrequencyChartSeriesList.get(i).clear();
+        }
+        
+        @SuppressWarnings("unchecked")
+        List<List<Object>> data = (List<List<Object>>) dataList.get(TimelineConstants.CPU_DB_DATA);
 
-       private void parseLog(SystemData logData) {
-               try {
-                       if (coreSize == TimelineConstants.NOT_INITED) {
-                               coreSize = GlobalInformation.getCurrentDeviceInfo().getTargetInfo()
-                                               .getCpuCount();
-                               for (int i = 0; i < coreSize; i++) {
-                                       DAChartSeries chartSeries = new DAChartSeries(
-                                                       TimelineChartLabels.CPU_CORE_CHART_SERIES_NAME_CORE
-                                                       + i, DAChartSeries.SERIES_STYLE_LINE,
-                                                       coreChartSeriesColors[i % 4]);
-                                       chart.addSeries(chartSeries);
-                                       coreFrequencyChartSeriesList.add(chartSeries);
-                               }
-                       }
-                       
-                       double time = logData.getTime() / TimelineConstants.MEGA_DOUBLE;
-                       String[] cpuFreqs = logData.getCpuFrequency().split(
-                                       CommonConstants.COMMA);
+        // data.size() == coreSize
+        for (int i = 0; i < data.size(); i++) {
+            List<Object> row = data.get(i);
+            for (int ii = 0; ii < row.size(); ii++) {
+                @SuppressWarnings("unchecked")
+                List<Object> oneTime = (List<Object>) row.get(ii);
+                double time =
+                        (Long) oneTime.get(CPUDBTable.COLUMN.TIME.ordinal())
+                                / TimelineConstants.MEGA_DOUBLE;
+                double freq = getCPUFrequencyHz((Float) oneTime.get(CPUDBTable.COLUMN.CPU_FREQUENCY.ordinal()));
+                coreFrequencyChartSeriesList
+                        .get(i)
+                        .addSeriesItem(new DAChartSeriesItem(time, freq, Formatter.toHzFormat(freq)));
+            }
+        }
+    }
 
-                       for (int i = 0; i < coreSize; i++) {
-                               double freq = Double.parseDouble(cpuFreqs[i]) * 1000.0;
-                               coreFrequencyChartSeriesList.get(i).addSeriesItem(
-                                               new DAChartSeriesItem(time, freq, Formatter
-                                                               .toHzFormat(freq)));
-                       }
-               } catch (NumberFormatException ne) {
-                       ne.printStackTrace();
-               }
-       }@Override
-       public void clear() {
-               super.clear();
-               coreSize = TimelineConstants.NOT_INITED;
-               coreFrequencyChartSeriesList.clear();
-       }
+    @Override
+    public void clear() {
+        super.clear();
+        coreSize = TimelineConstants.NOT_INITED;
+        coreFrequencyChartSeriesList.clear();
+    }
+    
+    private double getCPUFrequencyHz(double kHz) {
+       return kHz * 1000.0;
+    }
 }
index 883b66a..fcd1185 100644 (file)
@@ -6,13 +6,8 @@ import org.tizen.dynamicanalyzer.nl.TimelineChartLabels;
 import org.tizen.dynamicanalyzer.resources.ColorResources;
 import org.tizen.dynamicanalyzer.resources.ImageResources;
 import org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants;
-import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
-import org.tizen.dynamicanalyzer.swap.logparser.Logs;
-import org.tizen.dynamicanalyzer.swap.model.data.LogData;
-import org.tizen.dynamicanalyzer.swap.model.data.SystemData;
 import org.tizen.dynamicanalyzer.ui.timeline.SystemDataDBTable;
 import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
-import org.tizen.dynamicanalyzer.utils.Formatter;
 import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot.AutoRangeType;
 import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeries;
 import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeriesItem;
@@ -103,13 +98,16 @@ public class DeviceChart extends TimelineChart {
        }
        
        @Override
-       public void inputChartSeries(List<List<Object>> data) {
+       public void inputChartSeries(List<Object> dataList) {
                wifiSeries.clear();
                bluetoothSeries.clear();
                gpsSeries.clear();
                dnetSeries.clear();
                cameraSeries.clear();
                
+               @SuppressWarnings("unchecked")
+               List<List<Object>> data = (List<List<Object>>)dataList.get(TimelineConstants.SYSTEM_DB_DATA);
+               
                for (int i = 0; i < data.size(); i++) {
                        List<Object> row = data.get(i);
                        double time = (Long)row.get(SystemDataDBTable.COLUMN.TIME.ordinal())
@@ -132,8 +130,4 @@ public class DeviceChart extends TimelineChart {
                                        CAMERA_STATES[camera]));
                }
        }
-       
-       @Override
-       public void parseLogPackage(LogPackage logPack) {
-       }
 }
index ae2873c..69724c3 100644 (file)
@@ -4,6 +4,7 @@
  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Contact: 
+ * Jungwook Ryu <jungwook.ryu@samsung.com>
  * Sanghyun Lee <sanghyunnim.lee@samsung.com>
  * Juyoung Kim <j0.kim@samsung.com>
  *
@@ -32,10 +33,6 @@ import org.tizen.dynamicanalyzer.nl.TimelineChartLabels;
 import org.tizen.dynamicanalyzer.resources.ColorResources;
 import org.tizen.dynamicanalyzer.resources.ImageResources;
 import org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants;
-import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
-import org.tizen.dynamicanalyzer.swap.logparser.Logs;
-import org.tizen.dynamicanalyzer.swap.model.data.LogData;
-import org.tizen.dynamicanalyzer.swap.model.data.SystemData;
 import org.tizen.dynamicanalyzer.ui.timeline.SystemDataDBTable;
 import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
 import org.tizen.dynamicanalyzer.utils.Formatter;
@@ -96,10 +93,13 @@ public class DiskIOChart extends TimelineChart {
        }
        
        @Override
-       public void inputChartSeries(List<List<Object>> data) {
+       public void inputChartSeries(List<Object> dataList) {
                readSeries.clear();
                writeSeries.clear();
                
+               @SuppressWarnings("unchecked")
+               List<List<Object>> data = (List<List<Object>>)dataList.get(TimelineConstants.SYSTEM_DB_DATA);
+               
                for (int i = 0; i < data.size(); i++) {
                        List<Object> row = data.get(i);
                        double time = (Long)row.get(SystemDataDBTable.COLUMN.TIME.ordinal())
@@ -107,24 +107,10 @@ public class DiskIOChart extends TimelineChart {
                        int readSize = (Integer)row.get(SystemDataDBTable.COLUMN.DISK_IO_READ_SIZE.ordinal());
                        int writeSize = (Integer)row.get(SystemDataDBTable.COLUMN.DISK_IO_WRITE_SIZE.ordinal());
                
-                       readSeries.addSeriesItem(new DAChartSeriesItem(time, readSize,
-                               Formatter.toByteFormat(readSize)));
-                       writeSeries.addSeriesItem(new DAChartSeriesItem(time, writeSize,
-                               Formatter.toByteFormat(writeSize)));
+                       readSeries.addSeriesItem(new DAChartSeriesItem(time, readSize,
+                               Formatter.toByteFormat(readSize)));
+                       writeSeries.addSeriesItem(new DAChartSeriesItem(time, writeSize,
+                               Formatter.toByteFormat(writeSize)));
                }
        }
-
-       @Override
-       public void parseLogPackage(LogPackage logPack) {
-//             Logs logs = logPack.getLogs(probeType);
-//             if (logs == null) {
-//                     return;
-//             }
-//
-//             List<LogData> logList = logs.getRawLogs();
-//
-//             for (LogData logData : logList) {
-//                     parseLog((SystemData) logData);
-//             }
-       }
 }
index a685233..87b31a9 100644 (file)
+
+
 package org.tizen.dynamicanalyzer.ui.timeline.chart;
 
 import java.util.ArrayList;
 import java.util.List;
 
-import org.tizen.dynamicanalyzer.constant.CommonConstants;
 import org.tizen.dynamicanalyzer.common.GlobalInformation;
 import org.tizen.dynamicanalyzer.communicator.DACommunicator;
+import org.tizen.dynamicanalyzer.constant.CommonConstants;
 import org.tizen.dynamicanalyzer.nl.TimelineChartLabels;
 import org.tizen.dynamicanalyzer.resources.ColorResources;
 import org.tizen.dynamicanalyzer.resources.FontResources;
 import org.tizen.dynamicanalyzer.resources.ImageResources;
 import org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants;
-import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
-import org.tizen.dynamicanalyzer.swap.logparser.Logs;
-import org.tizen.dynamicanalyzer.swap.model.data.LogData;
-import org.tizen.dynamicanalyzer.swap.model.data.SystemData;
 import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseEventListener;
 import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseTrackAdapter;
+import org.tizen.dynamicanalyzer.ui.timeline.EnergyDBTable;
+import org.tizen.dynamicanalyzer.ui.timeline.SystemDataDBTable;
 import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
+import org.tizen.dynamicanalyzer.util.DALogger;
 import org.tizen.dynamicanalyzer.widgets.chart.DAChart;
 import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot.AutoRangeType;
 import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotTooltip;
 import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeries;
 import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeriesItem;
-import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot.AutoRangeType;
 import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
 import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardItem;
 import org.tizen.dynamicanalyzer.widgets.helper.Formatter;
 import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenu;
 
+
 public class EnergyChart extends TimelineChart {
-       private static EnergyChart instance = null;
-       private static final String UNIT = "A";
-
-       private DAChartSeries energyUsageSeries;
-       private List<DAChartSeries> deviceUsageSeriesList;
-       private List<DAChartSeries> deviceUsagePerAppSeriesList;
-       
-       private boolean isInitialized = false;
-       private DAChartBoardItem appUsageItem;
-
-       public static EnergyChart getInstance() {
-               if (instance == null) {
-                       instance = new EnergyChart();
-               }
-
-               return instance;
-       }
-
-       private EnergyChart() {
-               chartType = TimelineConstants.CHART_TYPE_ENERGY;
-               probeType = DataChannelConstants.MSG_DATA_SYSTEM;
-               chartName = TimelineChartLabels.ENERGY_CHART_TITLE;
-               chartIcon = ImageResources.CHART_ENERGY;
-               addIcon = ImageResources.ADD_CHART_ENERGY;
-
-               // FIXME
-               energyUsageSeries = new DAChartSeries("Energy usage",
-                               DAChartSeries.SERIES_STYLE_LINE, ColorResources.RED);
-               deviceUsageSeriesList = new ArrayList<DAChartSeries>();
-               deviceUsagePerAppSeriesList = new ArrayList<DAChartSeries>();
-       }
-
-       @Override
-       public DAChartBoardItem createBoardItem(DAChartBoard board) {
-               DAChartBoardItem item = super.createBoardItem(board);
-
-               chart.addSeries(energyUsageSeries);
-
-               chart.getPlot().setAxisUnit(UNIT);
-               chart.getPlot().setAxisUnitType(DAChartPlot.UnitType.MICRO_DECIMAL);
-               chart.getPlot().setShowAxis(true);
-
-               appUsageItem = new DAChartBoardItem(item, "App usage");
-               DAChart appUsageChart = appUsageItem.getChart();
-               DAChartPlot appUsageChartPlot = appUsageChart.getPlot();
-               DAChartPlotTooltip tooltip = new DAChartPlotTooltip(-1);
-
-               appUsageChartPlot.setBackgroundImage(ImageResources.BG_GRADIENT);
-               appUsageChartPlot.setAutoHeightRange(AutoRangeType.SEMI_AUTO);
-               tooltip.setFont(FontResources.CHART_TOOLTIP_FONT);
-               appUsageChartPlot.setTooltip(tooltip);
-               appUsageChartPlot.setAxisUnit(UNIT);
-               appUsageChartPlot.setAxisUnitType(DAChartPlot.UnitType.MICRO_DECIMAL);
-               appUsageChartPlot.setShowAxis(true);
-               appUsageChartPlot.setMarkers(board.getMarkers());
-
-               initPopupMenu(board, new DAPopupMenu(appUsageChart));
-
-               TimelineChartMouseEventListener timelineChartMouseEventListener = new TimelineChartMouseEventListener(
-                               popupMenu, board.getTimeline());
-               appUsageChart.addMouseListener(timelineChartMouseEventListener);
-               appUsageChart.addMouseMoveListener(timelineChartMouseEventListener);
-               appUsageChart.addMouseTrackListener(new TimelineChartMouseTrackAdapter(
-                               board.getTimeline()));
-
-               return item;
-       }
-
-       @Override
-       public void parseLogPackage(LogPackage logPack) {
-               Logs logs = logPack.getLogs(probeType);
-               if (logs == null) {
-                       return;
-               }
-
-               List<LogData> logList = logs.getLogs();
-               for (LogData logData : logList) {
-                       parseLog((SystemData) logData);
-               }
-       }
-
-       private void parseLog(SystemData logData) {
-               try {
-                       if (!isInitialized) {
-                               String[] deviceList = GlobalInformation.getCurrentDeviceInfo()
-                                               .getTargetInfo().getDevices()
-                                               .split(CommonConstants.COMMA);
-                               for (String device : deviceList) {
-                                       deviceUsageSeriesList.add(new DAChartSeries(device,
-                                                       DAChartSeries.SERIES_STYLE_LINE));
-                                       deviceUsagePerAppSeriesList.add(new DAChartSeries(device,
-                                                       DAChartSeries.SERIES_STYLE_LINE));
-                               }
-
-                               for (DAChartSeries series : deviceUsageSeriesList) {
-                                       chart.addSeries(series);
-                               }
-                               for (DAChartSeries series : deviceUsagePerAppSeriesList) {
-                                       appUsageItem.getChart().addSeries(series);
-                               }
-
-                               isInitialized = true;
-                       }
-
-                       double time = logData.getTime() / TimelineConstants.MEGA_DOUBLE;
-                       int energyUsage = logData.getEnergyUsage();
-                       String[] deviceEnergyUsages = logData.getDeviceEnergyUsage().split(
-                                       CommonConstants.COMMA);
-                       String[] deviceEnergyUsagesPerApp = logData
-                                       .getApplicationEnergyUsage().split(CommonConstants.COMMA);
-
-                       energyUsageSeries.addSeriesItem(new DAChartSeriesItem(time,
-                                       energyUsage, Formatter
-                                                       .convertMicroDecimalPrefix(energyUsage) + UNIT));
-                       for (int i = 0; i < deviceEnergyUsages.length; i++) {
-                               double usage = Double.parseDouble(deviceEnergyUsages[i]);
-                               deviceUsageSeriesList.get(i).addSeriesItem(
-                                               new DAChartSeriesItem(time, usage, Formatter
-                                                               .convertMicroDecimalPrefix(usage) + UNIT));
-                       }
-                       
-                       for (int i = 0; i < deviceEnergyUsagesPerApp.length; i++) {
-                               double usage = Double.parseDouble(deviceEnergyUsagesPerApp[i]);
-                               deviceUsagePerAppSeriesList.get(i).addSeriesItem(
-                                               new DAChartSeriesItem(time, usage, Formatter
-                                                               .convertMicroDecimalPrefix(usage) + UNIT));
-                       }
-
-               } catch (NumberFormatException ne) {
-                       ne.printStackTrace();
-               }
-       }
-
-       @Override
-       public void clear() {
-               super.clear();
-               deviceUsageSeriesList.clear();
-               deviceUsagePerAppSeriesList.clear();
-
-               isInitialized = false;
-       }
+    private static EnergyChart instance = null;
+    private static final String UNIT = "A";
+
+    private DAChartSeries energyUsageSeries;
+    private List<DAChartSeries> deviceUsageSeriesList;
+    private List<DAChartSeries> deviceUsagePerAppSeriesList;
+
+    private boolean isInitialized = false;
+    private DAChartBoardItem appUsageItem;
+
+    public static EnergyChart getInstance() {
+        if (instance == null) {
+            instance = new EnergyChart();
+        }
+
+        return instance;
+    }
+
+    private EnergyChart() {
+        chartType = TimelineConstants.CHART_TYPE_ENERGY;
+        probeType = DataChannelConstants.MSG_DATA_SYSTEM;
+        chartName = TimelineChartLabels.ENERGY_CHART_TITLE;
+        chartIcon = ImageResources.CHART_ENERGY;
+        addIcon = ImageResources.ADD_CHART_ENERGY;
+
+        DALogger.getInstance().check("This line was comment.(//FIXME)");
+        energyUsageSeries =
+                new DAChartSeries(TimelineChartLabels.ENERGY_CHART_SERIES, DAChartSeries.SERIES_STYLE_LINE,
+                                  ColorResources.RED);
+        deviceUsageSeriesList = new ArrayList<DAChartSeries>();
+        deviceUsagePerAppSeriesList = new ArrayList<DAChartSeries>();
+    }
+
+    @Override
+    public DAChartBoardItem createBoardItem(DAChartBoard board) {
+        DAChartBoardItem item = super.createBoardItem(board);
+
+        chart.addSeries(energyUsageSeries);
+
+        chart.getPlot().setAxisUnit(UNIT);
+        chart.getPlot().setAxisUnitType(DAChartPlot.UnitType.MICRO_DECIMAL);
+        chart.getPlot().setShowAxis(true);
+
+        appUsageItem = new DAChartBoardItem(item, "App usage");
+        DAChart appUsageChart = appUsageItem.getChart();
+        DAChartPlot appUsageChartPlot = appUsageChart.getPlot();
+        DAChartPlotTooltip tooltip = new DAChartPlotTooltip(-1);
+
+        appUsageChartPlot.setBackgroundImage(ImageResources.BG_GRADIENT);
+        appUsageChartPlot.setAutoHeightRange(AutoRangeType.SEMI_AUTO);
+        tooltip.setFont(FontResources.CHART_TOOLTIP_FONT);
+        appUsageChartPlot.setTooltip(tooltip);
+        appUsageChartPlot.setAxisUnit(UNIT);
+        appUsageChartPlot.setAxisUnitType(DAChartPlot.UnitType.MICRO_DECIMAL);
+        appUsageChartPlot.setShowAxis(true);
+        appUsageChartPlot.setMarkers(board.getMarkers());
+
+        initPopupMenu(board, new DAPopupMenu(appUsageChart));
+
+        TimelineChartMouseEventListener timelineChartMouseEventListener =
+                new TimelineChartMouseEventListener(popupMenu, board.getTimeline());
+        appUsageChart.addMouseListener(timelineChartMouseEventListener);
+        appUsageChart.addMouseMoveListener(timelineChartMouseEventListener);
+        appUsageChart
+                .addMouseTrackListener(new TimelineChartMouseTrackAdapter(board.getTimeline()));
+
+        return item;
+    }
+
+    @Override
+    public void inputChartSeries(List<Object> dataList) {
+        energyUsageSeries.clear();
+        for (int i = 0; i < deviceUsageSeriesList.size(); i++) {
+            deviceUsageSeriesList.get(i).clear();
+        }
+        for (int i = 0; i < deviceUsagePerAppSeriesList.size(); i++) {
+            deviceUsagePerAppSeriesList.get(i).clear();
+        }
+
+        try {
+            if (!isInitialized) {
+                if (GlobalInformation.getCurrentDeviceInfo() == null) {
+                    return;
+                }
+                String[] deviceList =
+                        GlobalInformation.getCurrentDeviceInfo().getTargetInfo().getDevices()
+                                .split(CommonConstants.COMMA);
+                for (String device : deviceList) {
+                    deviceUsageSeriesList.add(new DAChartSeries(device,
+                                                                DAChartSeries.SERIES_STYLE_LINE));
+                    deviceUsagePerAppSeriesList
+                            .add(new DAChartSeries(device, DAChartSeries.SERIES_STYLE_LINE));
+                }
+
+                for (DAChartSeries series : deviceUsageSeriesList) {
+                    chart.addSeries(series);
+                }
+                for (DAChartSeries series : deviceUsagePerAppSeriesList) {
+                    appUsageItem.getChart().addSeries(series);
+                }
+
+                isInitialized = true;
+            }
+            
+            @SuppressWarnings("unchecked")
+            List<List<Object>> systemData = (List<List<Object>>) dataList.get(TimelineConstants.SYSTEM_DB_DATA);
+            @SuppressWarnings("unchecked")
+            List<List<Object>> energyData = (List<List<Object>>) dataList.get(TimelineConstants.ENERGY_DB_DATA);
+
+            for (int i = 0; i < systemData.size(); i++) {
+                List<Object> row = systemData.get(i);
+                double time =
+                        (Long) row.get(SystemDataDBTable.COLUMN.TIME.ordinal())
+                                / TimelineConstants.MEGA_DOUBLE;
+
+                try {
+                    int energyUsage =
+                            (Integer) row.get(SystemDataDBTable.COLUMN.ENERGY_USAGE.ordinal());
+
+                    energyUsageSeries
+                            .addSeriesItem(new DAChartSeriesItem(time, energyUsage, Formatter
+                                    .convertMicroDecimalPrefix(energyUsage) + UNIT));
+                } catch (NumberFormatException ne) {
+                    ne.printStackTrace();
+                }
+            }
+
+            for (int i = 0; i < energyData.size(); i++) {
+                List<Object> row = energyData.get(i);
+                DAChartSeries deviceUsageSeries = deviceUsageSeriesList.get(i);
+                for (int ii = 0; ii < row.size(); ii++) {
+                    @SuppressWarnings("unchecked")
+                    List<Object> oneTime = (List<Object>) row.get(ii);
+                    double time =
+                            (Long) oneTime.get(EnergyDBTable.COLUMN.TIME.ordinal())
+                                    / TimelineConstants.MEGA_DOUBLE;
+                    double usage =
+                            (Integer) oneTime.get(EnergyDBTable.COLUMN.ENERGY_USAGE_DEVICE
+                                    .ordinal());
+                    double usageApp =
+                            (Integer) oneTime.get(EnergyDBTable.COLUMN.ENERGY_USAGE_APP.ordinal());
+
+                    deviceUsageSeries
+                            .addSeriesItem(new DAChartSeriesItem(time, usage, Formatter
+                                                   .convertMicroDecimalPrefix(usage) + UNIT));
+                    deviceUsageSeries
+                            .addSeriesItem(new DAChartSeriesItem(time, usage, Formatter
+                                                   .convertMicroDecimalPrefix(usageApp) + UNIT));
+                }
+            }
+        } catch (NumberFormatException ne) {
+            ne.printStackTrace();
+        }
+    }
+
+    @Override
+    public void clear() {
+        super.clear();
+        deviceUsageSeriesList.clear();
+        deviceUsagePerAppSeriesList.clear();
+
+        isInitialized = false;
+    }
 }
index e3b5f52..3b0ef41 100644 (file)
@@ -4,6 +4,7 @@
  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Contact: 
+ * Jungwook Ryu <jungwook.ryu@samsung.com>
  * Sanghyun Lee <sanghyunnim.lee@samsung.com>
  * Juyoung Kim <j0.kim@samsung.com>
  *
@@ -36,9 +37,6 @@ import org.tizen.dynamicanalyzer.nl.TimelineChartLabels;
 import org.tizen.dynamicanalyzer.resources.ColorResources;
 import org.tizen.dynamicanalyzer.resources.ImageResources;
 import org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants;
-import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
-import org.tizen.dynamicanalyzer.swap.logparser.Logs;
-import org.tizen.dynamicanalyzer.swap.model.data.LogData;
 import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
 import org.tizen.dynamicanalyzer.util.DALogger;
 import org.tizen.dynamicanalyzer.utils.Formatter;
@@ -49,267 +47,228 @@ import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeriesItem;
 import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
 import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardItem;
 
+
 public class FileChart extends TimelineChart {
-       private static final DALogger DA_LOG = DALogger.getInstance();
-       
-       private static class FDCountData {
-               private int type;
-               private double time;
-               private long data;
-
-               private FDCountData(int type, double time, long data) {
-                       this.type = type;
-                       this.time = time;
-                       this.data = data;
-               }
-       }
-
-       private static final int PERMIT = 1;
-       private Semaphore semaphore = new Semaphore(PERMIT);
-
-       private static volatile FileChart instance = null;
-
-       private static final int MIN_FDCOUNT = 5;
-       private static final int MIN_READ_WRITE_BYTE = 0;
-
-       private static final int TYPE_FDCOUNT = 0;
-       private static final int TYPE_READ = 1;
-       private static final int TYPE_WRITE = 2;
-
-       private long maxFDCount = MIN_FDCOUNT;
-       private double maxReadWrite = MIN_READ_WRITE_BYTE;
-       private int fdCount = 0;
-
-       private List<Double> deviceLogTimeList = new ArrayList<Double>();
-       private Map<Double, Integer> fdCountSeriesItemIndexMap = new HashMap<Double, Integer>();
-       private Map<Double, Integer> deviceTimeIndexMap = new HashMap<Double, Integer>();
-       private List<FDCountData> fileDataQ = new ArrayList<FDCountData>();
-
-       private DAChartSeries readSeries;
-       private DAChartSeries writeSeries;
-       private DAChartSeries fdCountSeries;
-
-       public static FileChart getInstance() {
-               if (instance == null) {
-                       synchronized (FileChart.class) {
-                               if (instance == null) {
-                                       instance = new FileChart();
-                               }
-                       }
-               }
-
-               return instance;
-       }
-
-       private FileChart() {
-               chartType = TimelineConstants.CHART_TYPE_FILE;
-               probeType = DataChannelConstants.MSG_DATA_SYSTEM;
-               chartName = TimelineChartLabels.FILE_CHART_TITLE;
-               chartIcon = ImageResources.CHART_FILE;
-               addIcon = ImageResources.ADD_CHART_FILE;
-
-               readSeries = new DAChartSeries(
-                               TimelineChartLabels.FILE_CHART_SERIES_NAME_READ,
-                               DAChartSeries.SERIES_STYLE_BAR,
-                               ColorResources.SERIES_COLOR_FILE_READ);
-               readSeries.setBarAlign(DAChartSeries.SERIES_BAR_ALIGN_CENTER);
-               writeSeries = new DAChartSeries(
-                               TimelineChartLabels.FILE_CHART_SERIES_NAME_WRITE,
-                               DAChartSeries.SERIES_STYLE_BAR,
-                               ColorResources.SERIES_COLOR_FILE_WRITE);
-               writeSeries.setBarAlign(DAChartSeries.SERIES_BAR_ALIGN_CENTER);
-               fdCountSeries = new DAChartSeries(
-                               TimelineChartLabels.FILE_CHART_SERIES_NAME_FD_COUNT,
-                               DAChartSeries.SERIES_STYLE_STEP,
-                               ColorResources.SERIES_COLOR_FILE_FD);
-       }
-
-       @Override
-       public DAChartBoardItem createBoardItem(DAChartBoard board) {
-               DAChartBoardItem item = super.createBoardItem(board);
-
-               chart.addSeries(readSeries);
-               chart.addSeries(fdCountSeries);
-               chart.addSeries(writeSeries);
-
-               chart.getPlot().setAutoHeightRange(AutoRangeType.MANUAL);
-               chart.getPlot().setSeriesHeightRange(true);
-               chart.getPlot().setAxisUnit("B");
-               chart.getPlot().setSecondAxisUnit("");
-               chart.getPlot().setAxisUnitType(DAChartPlot.UnitType.BINARY);
-               chart.getPlot().setShowAxis(true);
-
-               fdCountSeries.setEndY(maxFDCount);
-               readSeries.setEndY(maxReadWrite);
-               writeSeries.setEndY(maxReadWrite);
-
-               return item;
-       }
-
-       @Override
-       public void clear() {
-               super.clear();
-               fdCount = 0;
-               maxFDCount = MIN_FDCOUNT;
-               maxReadWrite = MIN_READ_WRITE_BYTE;
-               deviceLogTimeList.clear();
-               fdCountSeriesItemIndexMap.clear();
-               deviceTimeIndexMap.clear();
-               getFileDataQ().clear();
-
-               fdCountSeries.addSeriesItem(new DAChartSeriesItem(0, 0, "0"));
-       }
-
-       @Override
-       public void parseLogPackage(LogPackage logPack) {
-               Logs logs = logPack.getLogs(probeType);
-               if (logs == null) {
-                       return;
-               }
-
-               List<LogData> logList = logs.getRawLogs();
-               for (LogData log : logList) {
-                       double time = log.getTime();
-
-                       int size = deviceLogTimeList.size();
-                       int index = (int) (time / TimelineConstants.MEGA_DOUBLE);
-
-                       if (index - size > 4) {
-                               continue;
-                       }
-                       if (size <= index) {
-                               for (int i = size; i <= index; i++) {
-                                       deviceLogTimeList.add(Double.NaN);
-                               }
-                       }
-                       deviceLogTimeList.set(index, time);
-
-                       updateRW(time);
-               }
-       }
-
-       private void updateRW(double time) {
-               readSeries.addSeriesItem(new DAChartSeriesItem(time
-                               / TimelineConstants.MEGA_DOUBLE, 0, Formatter.toByteFormat(0)));
-               writeSeries.addSeriesItem(new DAChartSeriesItem(time
-                               / TimelineConstants.MEGA_DOUBLE, 0, Formatter.toByteFormat(0)));
-
-               deviceTimeIndexMap.put(time, readSeries.getSeriesItemList().size() - 1);
-               doQJob();
-       }
-
-       private void doQJob() {
-               try {
-                       semaphore.acquire();
-                       if (getFileDataQ().size() != 0) {
-                               int deviceTimeIndex = getDeviceTimeIndexByTime(getFileDataQ()
-                                               .get(0).time / TimelineConstants.MEGA_DOUBLE);
-                               if (deviceTimeIndex == -1) {
-                                       return;
-                               } else {
-                                       double deviceTime = deviceLogTimeList.get(deviceTimeIndex);
-                                       switch (getFileDataQ().get(0).type) {
-                                       case TYPE_FDCOUNT:
-                                               fdCount += getFileDataQ().get(0).data;
-
-                                               Integer fdCountSeriesItemIndex = fdCountSeriesItemIndexMap
-                                                               .get(deviceTime);
-                                               if (fdCountSeriesItemIndex == null) {
-                                                       fdCountSeries.addSeriesItem(new DAChartSeriesItem(
-                                                                       deviceTime / TimelineConstants.MEGA_DOUBLE,
-                                                                       fdCount, String.valueOf(fdCount)));
-                                                       fdCountSeriesItemIndexMap
-                                                                       .put(deviceTime, fdCountSeries
-                                                                                       .getSeriesItemList().size() - 1);
-                                               } else {
-                                                       DAChartSeriesItem item = fdCountSeries
-                                                                       .getSeriesItemList().get(
-                                                                                       fdCountSeriesItemIndex);
-                                                       item.setY(fdCount);
-                                                       item.setTooltipText(String.valueOf(fdCount));
-                                               }
-
-                                               if (fdCount > maxFDCount) {
-                                                       maxFDCount = fdCount;
-                                                       fdCountSeries.setEndY(maxFDCount * 1.1 + 1);
-                                               }
-                                               break;
-                                       case TYPE_READ:
-                                               DAChartSeriesItem readItem = readSeries
-                                                               .getSeriesItemList().get(
-                                                                               deviceTimeIndexMap.get(deviceTime));
-                                               double readSum = readItem.getY()
-                                                               + getFileDataQ().get(0).data;
-                                               readItem.setY(readSum);
-                                               readItem.setTooltipText(Formatter.toByteFormat(readSum));
-                                               if (readSum > maxReadWrite) {
-                                                       maxReadWrite = readSum;
-                                                       readSeries.setEndY(maxReadWrite * 1.1);
-                                                       writeSeries.setEndY(maxReadWrite * 1.1);
-                                               }
-                                               break;
-                                       case TYPE_WRITE:
-                                               DAChartSeriesItem writeItem = writeSeries
-                                                               .getSeriesItemList().get(
-                                                                               deviceTimeIndexMap.get(deviceTime));
-                                               double writeSum = writeItem.getY()
-                                                               + getFileDataQ().get(0).data;
-                                               writeItem.setY(writeSum);
-                                               writeItem.setTooltipText(Formatter
-                                                               .toByteFormat(writeSum));
-                                               if (writeSum > maxReadWrite) {
-                                                       maxReadWrite = writeSum;
-                                                       readSeries.setEndY(maxReadWrite * 1.1);
-                                                       writeSeries.setEndY(maxReadWrite * 1.1);
-                                               }
-                                               break;
-                                       default:
-                                               DA_LOG.debug("wrong file api type");//$NON-NLS-1$
-                                       }
-
-                                       getFileDataQ().remove(0);
-                               }
-                       }
-               } catch (InterruptedException e) {
-                       // TODO Auto-generated catch block
-                       e.printStackTrace();
-               } finally {
-                       semaphore.release();
-               }
-
-       }
-
-       private List<FDCountData> getFileDataQ() {
-               return fileDataQ;
-       }
-
-       public void setFDCount(int count, double time) {
-               getFileDataQ().add(new FDCountData(TYPE_FDCOUNT, time, count));
-               doQJob();
-       }
-
-       public void setReadByte(long size, double time) {
-               getFileDataQ().add(new FDCountData(TYPE_READ, time, size));
-               doQJob();
-       }
-
-       public void setWriteByte(long size, double time) {
-               getFileDataQ().add(new FDCountData(TYPE_WRITE, time, size));
-               doQJob();
-       }
-
-       private int getDeviceTimeIndexByTime(double time) {
-               int flat = (int) time;
-               int i;
-               for (i = flat; i < deviceLogTimeList.size(); i++) {
-                       Double deviceLogTime = deviceLogTimeList.get(i);
-                       if (deviceLogTime.isNaN() || deviceLogTime < time) {
-                               continue;
-                       }
-
-                       return i;
-               }
-
-               return -1;
-       }
+    private static final DALogger DA_LOG = DALogger.getInstance();
+
+    private static class FDCountData {
+        private int type;
+        private double time;
+        private long data;
+
+        private FDCountData(int type, double time, long data) {
+            this.type = type;
+            this.time = time;
+            this.data = data;
+        }
+    }
+
+    private static final int PERMIT = 1;
+    private Semaphore semaphore = new Semaphore(PERMIT);
+
+    private static volatile FileChart instance = null;
+
+    private static final int MIN_FDCOUNT = 5;
+    private static final int MIN_READ_WRITE_BYTE = 0;
+
+    private static final int TYPE_FDCOUNT = 0;
+    private static final int TYPE_READ = 1;
+    private static final int TYPE_WRITE = 2;
+
+    private long maxFDCount = MIN_FDCOUNT;
+    private double maxReadWrite = MIN_READ_WRITE_BYTE;
+    private int fdCount = 0;
+
+    private List<Double> deviceLogTimeList = new ArrayList<Double>();
+    private Map<Double, Integer> fdCountSeriesItemIndexMap = new HashMap<Double, Integer>();
+    private Map<Double, Integer> deviceTimeIndexMap = new HashMap<Double, Integer>();
+    private List<FDCountData> fileDataQ = new ArrayList<FDCountData>();
+
+    private DAChartSeries readSeries;
+    private DAChartSeries writeSeries;
+    private DAChartSeries fdCountSeries;
+
+    public static FileChart getInstance() {
+        if (instance == null) {
+            synchronized (FileChart.class) {
+                if (instance == null) {
+                    instance = new FileChart();
+                }
+            }
+        }
+
+        return instance;
+    }
+
+    private FileChart() {
+        chartType = TimelineConstants.CHART_TYPE_FILE;
+        probeType = DataChannelConstants.MSG_DATA_SYSTEM;
+        chartName = TimelineChartLabels.FILE_CHART_TITLE;
+        chartIcon = ImageResources.CHART_FILE;
+        addIcon = ImageResources.ADD_CHART_FILE;
+
+        readSeries =
+                new DAChartSeries(TimelineChartLabels.FILE_CHART_SERIES_NAME_READ,
+                                  DAChartSeries.SERIES_STYLE_BAR,
+                                  ColorResources.SERIES_COLOR_FILE_READ);
+        readSeries.setBarAlign(DAChartSeries.SERIES_BAR_ALIGN_CENTER);
+        writeSeries =
+                new DAChartSeries(TimelineChartLabels.FILE_CHART_SERIES_NAME_WRITE,
+                                  DAChartSeries.SERIES_STYLE_BAR,
+                                  ColorResources.SERIES_COLOR_FILE_WRITE);
+        writeSeries.setBarAlign(DAChartSeries.SERIES_BAR_ALIGN_CENTER);
+        fdCountSeries =
+                new DAChartSeries(TimelineChartLabels.FILE_CHART_SERIES_NAME_FD_COUNT,
+                                  DAChartSeries.SERIES_STYLE_STEP,
+                                  ColorResources.SERIES_COLOR_FILE_FD);
+    }
+
+    @Override
+    public DAChartBoardItem createBoardItem(DAChartBoard board) {
+        DAChartBoardItem item = super.createBoardItem(board);
+
+        chart.addSeries(readSeries);
+        chart.addSeries(fdCountSeries);
+        chart.addSeries(writeSeries);
+
+        chart.getPlot().setAutoHeightRange(AutoRangeType.MANUAL);
+        chart.getPlot().setSeriesHeightRange(true);
+        chart.getPlot().setAxisUnit("B");
+        chart.getPlot().setSecondAxisUnit("");
+        chart.getPlot().setAxisUnitType(DAChartPlot.UnitType.BINARY);
+        chart.getPlot().setShowAxis(true);
+
+        fdCountSeries.setEndY(maxFDCount);
+        readSeries.setEndY(maxReadWrite);
+        writeSeries.setEndY(maxReadWrite);
+
+        return item;
+    }
+
+    @Override
+    public void clear() {
+        super.clear();
+        fdCount = 0;
+        maxFDCount = MIN_FDCOUNT;
+        maxReadWrite = MIN_READ_WRITE_BYTE;
+        deviceLogTimeList.clear();
+        fdCountSeriesItemIndexMap.clear();
+        deviceTimeIndexMap.clear();
+        getFileDataQ().clear();
+
+        fdCountSeries.addSeriesItem(new DAChartSeriesItem(0, 0, "0"));
+    }
+
+    private void processFileDataFromQueue() {
+        try {
+            semaphore.acquire();
+            if (getFileDataQ().size() != 0) {
+               // "getFileDataQ().get(0)" means that getting top data from file data queue.
+                int deviceTimeIndex =
+                        getDeviceTimeIndexByTime(getFileDataQ().get(0).time
+                                / TimelineConstants.MEGA_DOUBLE);
+                if (deviceTimeIndex == -1) {
+                    return;
+                } else {
+                    double deviceTime = deviceLogTimeList.get(deviceTimeIndex);
+                    switch (getFileDataQ().get(0).type) {
+                        case TYPE_FDCOUNT:
+                            fdCount += getFileDataQ().get(0).data;
+
+                            Integer fdCountSeriesItemIndex =
+                                    fdCountSeriesItemIndexMap.get(deviceTime);
+                            if (fdCountSeriesItemIndex == null) {
+                                fdCountSeries.addSeriesItem(new DAChartSeriesItem(deviceTime
+                                        / TimelineConstants.MEGA_DOUBLE, fdCount, String
+                                        .valueOf(fdCount)));
+                                fdCountSeriesItemIndexMap.put(deviceTime, fdCountSeries
+                                        .getSeriesItemList().size() - 1);
+                            } else {
+                                DAChartSeriesItem item =
+                                        fdCountSeries.getSeriesItemList()
+                                                .get(fdCountSeriesItemIndex);
+                                item.setY(fdCount);
+                                item.setTooltipText(String.valueOf(fdCount));
+                            }
+
+                            if (fdCount > maxFDCount) {
+                                maxFDCount = fdCount;
+                                fdCountSeries.setEndY(maxFDCount * 1.1 + 1);
+                            }
+                            break;
+                        case TYPE_READ:
+                            DAChartSeriesItem readItem =
+                                    readSeries.getSeriesItemList().get(deviceTimeIndexMap
+                                                                               .get(deviceTime));
+                            double readSum = readItem.getY() + getFileDataQ().get(0).data;
+                            readItem.setY(readSum);
+                            readItem.setTooltipText(Formatter.toByteFormat(readSum));
+                            if (readSum > maxReadWrite) {
+                                maxReadWrite = readSum;
+                                readSeries.setEndY(maxReadWrite * 1.1);
+                                writeSeries.setEndY(maxReadWrite * 1.1);
+                            }
+                            break;
+                        case TYPE_WRITE:
+                            DAChartSeriesItem writeItem =
+                                    writeSeries.getSeriesItemList().get(deviceTimeIndexMap
+                                                                                .get(deviceTime));
+                            double writeSum = writeItem.getY() + getFileDataQ().get(0).data;
+                            writeItem.setY(writeSum);
+                            writeItem.setTooltipText(Formatter.toByteFormat(writeSum));
+                            if (writeSum > maxReadWrite) {
+                                maxReadWrite = writeSum;
+                                readSeries.setEndY(maxReadWrite * 1.1);
+                                writeSeries.setEndY(maxReadWrite * 1.1);
+                            }
+                            break;
+                        default:
+                            DA_LOG.debug("wrong file api type");//$NON-NLS-1$
+                    }
+
+                    getFileDataQ().remove(0);
+                }
+            }
+        } catch (InterruptedException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        } finally {
+            semaphore.release();
+        }
+
+    }
+
+    private List<FDCountData> getFileDataQ() {
+        return fileDataQ;
+    }
+
+    public void setFDCount(int count, double time) {
+        getFileDataQ().add(new FDCountData(TYPE_FDCOUNT, time, count));
+        processFileDataFromQueue();
+    }
+
+    public void setReadByte(long size, double time) {
+        getFileDataQ().add(new FDCountData(TYPE_READ, time, size));
+        processFileDataFromQueue();
+    }
+
+    public void setWriteByte(long size, double time) {
+        getFileDataQ().add(new FDCountData(TYPE_WRITE, time, size));
+        processFileDataFromQueue();
+    }
+
+    private int getDeviceTimeIndexByTime(double time) {
+        int flat = (int) time;
+        int i;
+        for (i = flat; i < deviceLogTimeList.size(); i++) {
+            Double deviceLogTime = deviceLogTimeList.get(i);
+            if (deviceLogTime.isNaN() || deviceLogTime < time) {
+                continue;
+            }
+
+            return i;
+        }
+
+        return -1;
+    }
 }
index 3674563..1dd47d7 100644 (file)
@@ -4,6 +4,7 @@
  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Contact: 
+ * Jungwook Ryu <jungwook.ryu@samsung.com>
  * Sanghyun Lee <sanghyunnim.lee@samsung.com>
  * Juyoung Kim <j0.kim@samsung.com>
  *
@@ -33,11 +34,6 @@ import org.tizen.dynamicanalyzer.nl.TimelineChartLabels;
 import org.tizen.dynamicanalyzer.resources.ColorResources;
 import org.tizen.dynamicanalyzer.resources.ImageResources;
 import org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants;
-import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
-import org.tizen.dynamicanalyzer.swap.logparser.Logs;
-import org.tizen.dynamicanalyzer.swap.model.data.LogData;
-import org.tizen.dynamicanalyzer.swap.model.data.MemoryData;
-import org.tizen.dynamicanalyzer.swap.model.data.SystemData;
 import org.tizen.dynamicanalyzer.ui.timeline.SystemDataDBTable;
 import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
 import org.tizen.dynamicanalyzer.utils.Formatter;
@@ -48,16 +44,11 @@ import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
 import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardItem;
 
 public class HeapChart extends TimelineChart {
-       private static final int MEM_API_TYPE_ALLOC = 0;
-       private static final int MEM_API_TYPE_FREE = 1;
-       private static final int MEM_API_TYPE_MANAGE = 2;
-       private static final int MEM_USER = 2;
 
        private static HeapChart instance = null;
 
        private DAChartSeries totalAllocationSeries;
        private DAChartSeries userAllocationSeries;
-       private double allocByte = 0;
        private HashMap<Long, Long> allocationSeriesDataSetMap = new HashMap<Long, Long>();
 
        public static HeapChart getInstance() {
@@ -100,121 +91,34 @@ public class HeapChart extends TimelineChart {
        }
 
        @Override
-       public void inputChartSeries(List<List<Object>> data) {
-//             totalAllocationSeries.clear();
-//             userAllocationSeries.clear();
-//             
-//             for (int i = 0; i < data.size(); i++) {
-//                     List<Object> row = data.get(i);
-//                     double time = (Long)row.get(SystemDataDBTable.COLUMN.TIME.ordinal())
-//                             / TimelineConstants.MEGA_DOUBLE;
-//                     double totalAlloc = (Long)row.get(SystemDataDBTable.COLUMN.HEAP_ALLOCATION_TOTAL.ordinal());
-//                     double userAlloc = (Long)row.get(SystemDataDBTable.COLUMN.HEAP_ALLOCATION_APP.ordinal());
-//             
-//                     totalAllocationSeries.addSeriesItem(new DAChartSeriesItem(
-//                             time, totalAlloc, Formatter.toByteFormat(totalAlloc)));
-//
-//                     userAllocationSeries.addSeriesItem(new DAChartSeriesItem(time,
-//                             userAlloc, Formatter.toByteFormat(allocByte)));
-//             }
-       }
-
-       
-       @Override
-       public void parseLogPackage(LogPackage logPack) {
-               Logs memoryLogs = logPack
-                               .getLogs(DataChannelConstants.MSG_PROBE_MEMORY);
-               Logs deviceLogs = logPack.getLogs(probeType);
-
-               List<LogData> memoryLogList = memoryLogs == null ? null : memoryLogs
-                               .getRawLogs();
-               List<LogData> deviceLogList = deviceLogs == null ? null : deviceLogs
-                               .getRawLogs();
-
-               parseLog(memoryLogList, deviceLogList);
-       }
-
-       private void parseLog(List<LogData> memoryLogList,
-                       List<LogData> deviceLogList) {
-               /* user alloc */
-               try {
-                       if (memoryLogList != null) {
-                               int size = memoryLogList.size();
-                               for (int i = 0; i < size; i++) {
-                                       MemoryData logData = (MemoryData) memoryLogList.get(i);
-                                       int memApiType = logData.getMemoryApiType();
-                                       int internalFlag = logData.getInternalCall();
-                                       long errorNo = logData.getErrno();
-
-                                       if (errorNo == 0 && MEM_USER == internalFlag) {
-                                               if (MEM_API_TYPE_ALLOC == memApiType
-                                                               || MEM_API_TYPE_FREE == memApiType
-                                                               || MEM_API_TYPE_MANAGE == memApiType) {
-
-                                                       addNewSeriesUserAllocData(memApiType, logData);
-                                               }
-                                       }
-                               }
-                       }
-               } catch (NumberFormatException ne) {
-                       ne.printStackTrace();
-               }
-
-               /* total alloc */
-               try {
-                       if (deviceLogList != null) {
-                               int size = deviceLogList.size();
-                               for (int i = 0; i < size; i++) {
-                                       SystemData log = (SystemData) deviceLogList.get(i);
-
-                                       double time = log.getTime() / TimelineConstants.MEGA_DOUBLE;
-                                       double totalAlloc = log.getTotalAllocSize() + allocByte;
-                                       totalAllocationSeries.addSeriesItem(new DAChartSeriesItem(
-                                                       time, totalAlloc, Formatter
-                                                                       .toByteFormat(totalAlloc)));
-
-                                       userAllocationSeries
-                                                       .addSeriesItem(new DAChartSeriesItem(time,
-                                                                       allocByte, Formatter
-                                                                                       .toByteFormat(allocByte)));
-                               }
-                       }
-               } catch (NumberFormatException ne) {
-                       ne.printStackTrace();
-               }
-       }
-
-       private void addNewSeriesUserAllocData(int fdApiType, MemoryData log) {
-               long size = 0;
-
-               long address = log.getAddress();
-               if (address == 0) {
-                       return;
-               }
-
-               if (MEM_API_TYPE_ALLOC == fdApiType) {
-                       try {
-                               size = log.getSize();
-
-                               allocByte += size;
-                               allocationSeriesDataSetMap.put(address, size);
-                       } catch (NumberFormatException ne) {
-                               ne.printStackTrace();
-                       }
-               } else if (MEM_API_TYPE_FREE == fdApiType) {
-                       if (!allocationSeriesDataSetMap.containsKey(address)) {
-                               return;
-                       }
-                       size = allocationSeriesDataSetMap.get(address);
-
-                       allocByte -= size;
+       public void inputChartSeries(List<Object> dataList) {
+               totalAllocationSeries.clear();
+               userAllocationSeries.clear();
+
+               @SuppressWarnings("unchecked")
+               List<List<Object>> data = (List<List<Object>>) dataList.get(0);
+
+               for (int i = 0; i < data.size(); i++) {
+                       List<Object> row = data.get(i);
+                       double time = (Long) row.get(SystemDataDBTable.COLUMN.TIME
+                                       .ordinal()) / TimelineConstants.MEGA_DOUBLE;
+                       double totalAlloc = (Long) row
+                                       .get(SystemDataDBTable.COLUMN.HEAP_ALLOCATION_TOTAL
+                                                       .ordinal());
+                       double userAlloc = (Long) row
+                                       .get(SystemDataDBTable.COLUMN.HEAP_ALLOCATION_APP.ordinal());
+
+                       totalAllocationSeries.addSeriesItem(new DAChartSeriesItem(time,
+                                       totalAlloc, Formatter.toByteFormat(totalAlloc)));
+
+                       userAllocationSeries.addSeriesItem(new DAChartSeriesItem(time,
+                                       userAlloc, Formatter.toByteFormat(userAlloc)));
                }
        }
 
        @Override
        public void clear() {
                super.clear();
-               allocByte = 0;
                allocationSeriesDataSetMap.clear();
        }
 }
index 0edcc16..ab7eaa1 100644 (file)
@@ -4,6 +4,7 @@
  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Contact: 
+ * Jungwook Ryu <jungwook.ryu@samsung.com>
  * Sanghyun Lee <sanghyunnim.lee@samsung.com>
  * Juyoung Kim <j0.kim@samsung.com>
  *
@@ -32,7 +33,6 @@ import org.tizen.dynamicanalyzer.nl.TimelineChartLabels;
 import org.tizen.dynamicanalyzer.resources.ColorResources;
 import org.tizen.dynamicanalyzer.resources.ImageResources;
 import org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants;
-import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
 import org.tizen.dynamicanalyzer.ui.timeline.SystemDataDBTable;
 import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
 import org.tizen.dynamicanalyzer.utils.Formatter;
@@ -91,10 +91,13 @@ public class NetworkIOChart extends TimelineChart {
        }
        
        @Override
-       public void inputChartSeries(List<List<Object>> data) {
+       public void inputChartSeries(List<Object> dataList) {
                sendSeries.clear();
                receiveSeries.clear();
                
+               @SuppressWarnings("unchecked")
+               List<List<Object>> data = (List<List<Object>>)dataList.get(TimelineConstants.SYSTEM_DB_DATA);
+               
                for (int i = 0; i < data.size(); i++) {
                        List<Object> row = data.get(i);
                        double time = (Long)row.get(SystemDataDBTable.COLUMN.TIME.ordinal())
@@ -109,32 +112,4 @@ public class NetworkIOChart extends TimelineChart {
                                receiveSize, Formatter.toByteFormat(receiveSize)));
                }
        }
-
-       @Override
-       public void parseLogPackage(LogPackage logPack) {
-//             Logs logs = logPack.getLogs(probeType);
-//             if (logs == null) {
-//                     return;
-//             }
-//
-//             List<LogData> logList = logs.getRawLogs();
-//
-//             for (LogData logData : logList) {
-//                     parseLog((SystemData) logData);
-//             }
-       }
-
-//     private void parseLog(SystemData log) {
-//             try {
-//                     double time = log.getTime() / TimelineConstants.MEGA_DOUBLE;
-//                     int sendSize = log.getNetworkSendSize();
-//                     int receiveSize = log.getNetworkReceiveSize();
-//                     sendSeries.addSeriesItem(new DAChartSeriesItem(time, sendSize,
-//                                     Formatter.toByteFormat(sendSize)));
-//                     receiveSeries.addSeriesItem(new DAChartSeriesItem(time, receiveSize,
-//                                     Formatter.toByteFormat(receiveSize)));
-//
-//             } catch (NumberFormatException ne) {
-//             }
-//     }
 }
index 6d39e6d..0114b07 100644 (file)
@@ -4,6 +4,7 @@
  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Contact: 
+ * Jungwook Ryu <jungwook.ryu@samsung.com>
  * Sanghyun Lee <sanghyunnim.lee@samsung.com>
  * Juyoung Kim <j0.kim@samsung.com>
  *
@@ -32,7 +33,6 @@ import org.tizen.dynamicanalyzer.nl.TimelineChartLabels;
 import org.tizen.dynamicanalyzer.resources.ColorResources;
 import org.tizen.dynamicanalyzer.resources.ImageResources;
 import org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants;
-import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
 import org.tizen.dynamicanalyzer.ui.timeline.SystemDataDBTable;
 import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
 import org.tizen.dynamicanalyzer.utils.Formatter;
@@ -94,11 +94,14 @@ public class ProcessMemoryChart extends TimelineChart {
        }
        
        @Override
-       public void inputChartSeries(List<List<Object>> data) {
+       public void inputChartSeries(List<Object> dataList) {
                VSSMemorySeries.clear();
                RSSMemorySeries.clear();
                PSSMemorySeries.clear();
                
+               @SuppressWarnings("unchecked")
+               List<List<Object>> data = (List<List<Object>>)dataList.get(TimelineConstants.SYSTEM_DB_DATA);
+               
                for (int i = 0; i < data.size(); i++) {
                        List<Object> row = data.get(i);
                        double time = (Long)row.get(SystemDataDBTable.COLUMN.TIME.ordinal()) 
@@ -115,53 +118,4 @@ public class ProcessMemoryChart extends TimelineChart {
                                Formatter.toByteFormat(pssMemory)));
                }
        }
-       
-       @Override
-       public void parseLogPackage(LogPackage logPack) {
-//             Logs logs = logPack.getLogs(probeType);
-//             if(logs == null) {
-//                     return;
-//             }
-//             
-//             List<LogData> logList = logs.getRawLogs();
-//
-//             for (LogData logData : logList) {
-//                     parseLog((SystemData)logData);
-//             }
-       }
-       
-//     private void parseLog(SystemData logData) {
-//             /* VSS */
-//             try {
-//                     double time = logData.getTime() / TimelineConstants.MEGA_DOUBLE;
-//                     int value = logData.getVirtualMemory();
-//
-//                     VSSMemorySeries.addSeriesItem(new DAChartSeriesItem(time, value,
-//                                     Formatter.toByteFormat(value)));
-//             } catch (NumberFormatException ne) {
-//                     ne.printStackTrace();
-//             }
-//
-//             /* RSS */
-//             try {
-//                     double time = logData.getTime() / TimelineConstants.MEGA_DOUBLE;
-//                     int value = logData.getResidentMemory();
-//
-//                     RSSMemorySeries.addSeriesItem(new DAChartSeriesItem(time, value,
-//                                     Formatter.toByteFormat(value)));
-//             } catch (NumberFormatException ne) {
-//                     ne.printStackTrace();
-//             }
-//
-//             /* PSS */
-//             try {
-//                     double time = logData.getTime() / TimelineConstants.MEGA_DOUBLE;
-//                     int value = logData.getPssMemory();
-//
-//                     PSSMemorySeries.addSeriesItem(new DAChartSeriesItem(time, value,
-//                                     Formatter.toByteFormat(value)));
-//             } catch (NumberFormatException ne) {
-//                     ne.printStackTrace();
-//             }
-//     }
 }
index 30daf25..530e310 100644 (file)
@@ -4,6 +4,7 @@
  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Contact: 
+ * Jungwook Ryu <jungwook.ryu@samsung.com>
  * Sanghyun Lee <sanghyunnim.lee@samsung.com>
  * Juyoung Kim <j0.kim@samsung.com>
  *
index 3f0dca3..16f4d54 100644 (file)
@@ -4,6 +4,7 @@
  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Contact: 
+ * Jungwook Ryu <jungwook.ryu@samsung.com>
  * Sanghyun Lee <sanghyunnim.lee@samsung.com>
  * Juyoung Kim <j0.kim@samsung.com>
  *
@@ -34,16 +35,10 @@ import org.eclipse.swt.graphics.Image;
 import org.eclipse.swt.widgets.Display;
 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.nl.TimelineChartLabels;
 import org.tizen.dynamicanalyzer.resources.ImageResources;
 import org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants;
-import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
-import org.tizen.dynamicanalyzer.swap.logparser.Logs;
-import org.tizen.dynamicanalyzer.swap.model.data.LogData;
-import org.tizen.dynamicanalyzer.swap.model.data.ScreenShotData;
-import org.tizen.dynamicanalyzer.ui.info.screenshot.SocketClient;
+import org.tizen.dynamicanalyzer.ui.timeline.ScreenShotDBTable;
 import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
 import org.tizen.dynamicanalyzer.widgets.chart.DAChart;
 import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeries;
@@ -94,57 +89,41 @@ public class ScreenshotChart extends TimelineChart {
        }
 
        @Override
-       public void parseLogPackage(LogPackage logPack) {
-               Logs logs = logPack.getLogs(probeType);
-               if(logs == null) {
-                       return;
-               }
-               
-               List<LogData> logList = logs.getRawLogs();
-
-               for (LogData logData : logList) {
-                       parseLog((ScreenShotData)logData);
-               }
-       }
-
-       private void parseLog(ScreenShotData logData) {
-               try {
-                       double time = logData.getTime() / TimelineConstants.MEGA_DOUBLE;
-
-                       String imagePath = AnalyzerManager.getProject().getSavePath()
-                                       + File.separator + AnalyzerConstants.IMAGE_FOLDER_NAME
-                                       + File.separator
-                                       + AnalyzerConstants.SMALL_IMAGE_FOLDER_NAME;
-                       String imagePathLog;
-                       
-                       if(DACommunicator.isTargetEmulator() 
-                                       && SocketClient.getInstance().isConnected()) {
-                               imagePathLog = GlobalInformation.getCurrentDeviceInfo()
-                                               .emulatorScreenshot.getFilePath(); 
-                       } else {
-                               imagePathLog = logData.getImageFilePath();
-                       }
-                       String[] splitedImagePathLog = imagePathLog.split("/"); //$NON-NLS-1$
-                       String fileName = splitedImagePathLog[splitedImagePathLog.length - 1];
-                       imagePath += File.separator + fileName;
-
-                       int orientation = logData.getOrientation();
-                       int yPostion;
-                       if (orientation == 0 || orientation == 180) { //$NON-NLS-1$ //$NON-NLS-2$
-                               yPostion = 10;
-                       } else {
-                               yPostion = 23;
-                       }
-
-                       Thread createImageThread = new Thread(null, new CreateImageThread(
-                                       imagePath, time, yPostion), "small image getter thread");
-                       createImageThread.start();
-               } catch (NumberFormatException ne) {
+       public void inputChartSeries(List<Object> dataList) {
+               screenshotSeries.clear();
+               
+               @SuppressWarnings("unchecked")
+               List<List<Object>> data = (List<List<Object>>)dataList.get(TimelineConstants.SCREENSHOT_DB_DATA);
+               try {
+                   for (int i = 0; i < data.size(); i++) {
+                       List<Object> row = data.get(i);
+                       double time = (Long)row.get(ScreenShotDBTable.COLUMN.TIME.ordinal())
+                               / TimelineConstants.MEGA_DOUBLE;
+                       String fileName = (String)row.get(ScreenShotDBTable.COLUMN.IMAGE_FILE_PATH.ordinal());
+                       int orientation = (Integer)row.get(ScreenShotDBTable.COLUMN.IMAGE_ORIENTATION.ordinal());
+               
+                       String imagePath = AnalyzerManager.getProject().getSavePath()
+                               + File.separator + AnalyzerConstants.IMAGE_FOLDER_NAME
+                               + File.separator
+                               + AnalyzerConstants.SMALL_IMAGE_FOLDER_NAME
+                               + File.separator 
+                               + fileName;
+                       int yPostion;
+                       if (orientation == 0 || orientation == 180) { //$NON-NLS-1$ //$NON-NLS-2$
+                               yPostion = 10;
+                       } else {
+                               yPostion = 23;
+                       }
+                       
+                       Thread createImageThread = new Thread(null, new CreateImageThread(
+                               imagePath, time, yPostion), "small image getter thread");
+                       createImageThread.start();
+                   }
+               } catch (NumberFormatException ne) {
                        ne.printStackTrace();
                }
        }
-
+       
        private class CreateImageThread extends Thread {
                private String imagePath;
                private double time;
index 104571a..ccc14db 100644 (file)
@@ -4,6 +4,7 @@
  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Contact: 
+ * Jungwook Ryu <jungwook.ryu@samsung.com>
  * Sanghyun Lee <sanghyunnim.lee@samsung.com>
  * Juyoung Kim <j0.kim@samsung.com>
  *
@@ -32,7 +33,6 @@ import org.tizen.dynamicanalyzer.nl.TimelineChartLabels;
 import org.tizen.dynamicanalyzer.resources.ColorResources;
 import org.tizen.dynamicanalyzer.resources.ImageResources;
 import org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants;
-import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
 import org.tizen.dynamicanalyzer.ui.timeline.SystemDataDBTable;
 import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
 import org.tizen.dynamicanalyzer.utils.Formatter;
@@ -85,7 +85,7 @@ public class SystemMemoryChart extends TimelineChart {
                chart.addSeries(totalSeries);
                chart.addSeries(systemSeries);
                chart.addSeries(processSeries);
-
+               
                chart.getPlot().setAxisUnit("B");
                chart.getPlot().setAxisUnitType(DAChartPlot.UnitType.BINARY);
                chart.getPlot().setShowAxis(true);
@@ -94,67 +94,28 @@ public class SystemMemoryChart extends TimelineChart {
        }
 
        @Override
-       public void inputChartSeries(List<List<Object>> data) {
+       public void inputChartSeries(List<Object> dataList) {
                processSeries.clear();
                systemSeries.clear();
                totalSeries.clear();
        
-       for (int i = 0; i < data.size(); i++) {
-           List<Object> row = data.get(i);
-           double time = (Long)row.get(SystemDataDBTable.COLUMN.TIME.ordinal()) 
-                       / TimelineConstants.MEGA_DOUBLE;
-           int processUsageMemory = (Integer)row.get(SystemDataDBTable.COLUMN.MEMORY_RESIDENT.ordinal());
-           long systemUsageMemory = (Long)row.get(SystemDataDBTable.COLUMN.MEMORY_USAGE_SYSTEM.ordinal());
-           long totalMemory = (Long)row.get(SystemDataDBTable.COLUMN.MEMORY_TOTAL_SYSTEM.ordinal());
-           
-           processSeries.addSeriesItem(new DAChartSeriesItem(time, processUsageMemory,
-                                       Formatter.toByteFormat(processUsageMemory)));
-           systemSeries.addSeriesItem(new DAChartSeriesItem(time, systemUsageMemory,
-                                       Formatter.toByteFormat(systemUsageMemory)));
-           totalSeries.addSeriesItem(new DAChartSeriesItem(time, totalMemory,
-                                       Formatter.toByteFormat(totalMemory)));
-       }
-       }
-       
-       @Override
-       public void parseLogPackage(LogPackage logPack) {
-//             Logs logs = logPack.getLogs(probeType);
-//             if(logs == null) {
-//                     return;
-//             }
-//             
-//             List<LogData> logList = logs.getRawLogs();
-//
-//             for (LogData logData : logList) {
-//                     parseLog((SystemData)logData);
-//             }
+               @SuppressWarnings("unchecked")
+               List<List<Object>> data = (List<List<Object>>)dataList.get(0);
+               
+               for (int i = 0; i < data.size(); i++) {
+                   List<Object> row = data.get(i);
+                   double time = (Long)row.get(SystemDataDBTable.COLUMN.TIME.ordinal()) 
+                               / TimelineConstants.MEGA_DOUBLE;
+                   int processUsageMemory = (Integer)row.get(SystemDataDBTable.COLUMN.MEMORY_RESIDENT.ordinal());
+                   long systemUsageMemory = (Long)row.get(SystemDataDBTable.COLUMN.MEMORY_USAGE_SYSTEM.ordinal());
+                   long totalMemory = (Long)row.get(SystemDataDBTable.COLUMN.MEMORY_TOTAL_SYSTEM.ordinal());
+                   
+                   processSeries.addSeriesItem(new DAChartSeriesItem(time, processUsageMemory,
+                                       Formatter.toByteFormat(processUsageMemory)));
+                   systemSeries.addSeriesItem(new DAChartSeriesItem(time, systemUsageMemory,
+                                       Formatter.toByteFormat(systemUsageMemory)));
+                   totalSeries.addSeriesItem(new DAChartSeriesItem(time, totalMemory,
+                                       Formatter.toByteFormat(totalMemory)));
+               }
        }
-
-//     private void parseLog(SystemData log) {
-//             /* process */
-//             try {
-//                     double time = log.getTime() / TimelineConstants.MEGA_DOUBLE;
-//                     int usage = log.getResidentMemory();
-//                     processSeries.addSeriesItem(new DAChartSeriesItem(time, usage,
-//                                     Formatter.toByteFormat(usage)));
-//             } catch (NumberFormatException ne) {
-//                     ne.printStackTrace();
-//             }
-//
-//             /* system & total */
-//             try {
-//                     double time = log.getTime() / TimelineConstants.MEGA_DOUBLE;
-//
-//                     long usage = log.getSystemMemoryUsed();
-//                     double total = (double) AnalyzerManager.getProject()
-//                                     .getSystemMemorySize();
-//
-//                     systemSeries.addSeriesItem(new DAChartSeriesItem(time, usage,
-//                                     Formatter.toByteFormat(usage)));
-//                     totalSeries.addSeriesItem(new DAChartSeriesItem(time, total,
-//                                     Formatter.toByteFormat(total)));
-//             } catch (NumberFormatException ne) {
-//                     ne.printStackTrace();
-//             }
-//     }
 }
index d6d0b2c..867e0e6 100644 (file)
@@ -4,6 +4,7 @@
  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Contact: 
+ * Jungwook Ryu <jungwook.ryu@samsung.com>
  * Sanghyun Lee <sanghyunnim.lee@samsung.com>
  * Juyoung Kim <j0.kim@samsung.com>
  *
@@ -32,7 +33,6 @@ import org.eclipse.swt.graphics.Image;
 import org.tizen.dynamicanalyzer.nl.TimelineChartLabels;
 import org.tizen.dynamicanalyzer.resources.FontResources;
 import org.tizen.dynamicanalyzer.resources.ImageResources;
-import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
 import org.tizen.dynamicanalyzer.ui.common.PopupAnalysisMenuItemClickListener;
 import org.tizen.dynamicanalyzer.ui.common.PopupClearMenuItemClickListener;
 import org.tizen.dynamicanalyzer.ui.common.PopupEndMenuItemClickListener;
@@ -58,9 +58,9 @@ public abstract class TimelineChart {
        protected Image addIcon;
        protected DAPopupMenu popupMenu;
 
-       public abstract void parseLogPackage(LogPackage logPack);
+//     public abstract void parseLogPackage(LogPackage logPack);
        
-       public void inputChartSeries(List<List<Object>> data) {}
+       public void inputChartSeries(List<Object> dataList){}
        
        public DAChartBoardItem createBoardItem(final DAChartBoard chartBoard) {
                DAChartBoardItem item = new DAChartBoardItem(chartBoard, chartName,
index 96d27d6..a7b7b29 100644 (file)
@@ -4,6 +4,7 @@
  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Contact: 
+ * Jungwook Ryu <jungwook.ryu@samsung.com>
  * Sanghyun Lee <sanghyunnim.lee@samsung.com>
  * Juyoung Kim <j0.kim@samsung.com>
  *
@@ -34,15 +35,11 @@ import org.tizen.dynamicanalyzer.resources.ColorResources;
 import org.tizen.dynamicanalyzer.resources.FontResources;
 import org.tizen.dynamicanalyzer.resources.ImageResources;
 import org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants;
-import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
-import org.tizen.dynamicanalyzer.swap.logparser.Logs;
-import org.tizen.dynamicanalyzer.swap.model.data.LogData;
-import org.tizen.dynamicanalyzer.swap.model.data.UIEventData;
 import org.tizen.dynamicanalyzer.ui.common.UIEventChartContextMenuItem;
+import org.tizen.dynamicanalyzer.ui.timeline.UIEventDBTable;
 import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
 import org.tizen.dynamicanalyzer.ui.timeline.uievent.UIEventListDialog;
 import org.tizen.dynamicanalyzer.util.WorkbenchUtil;
-import org.tizen.dynamicanalyzer.util.DALogger;
 import org.tizen.dynamicanalyzer.widgets.chart.DAChart;
 import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeries;
 import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeriesItem;
@@ -52,8 +49,6 @@ import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenuItem;
 import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenuListener;
 
 public class UIEventChart extends TimelineChart {
-       private static final DALogger DA_LOG = DALogger.getInstance();
-       
        private static UIEventChart instance = null;
 
        private DAChartSeries touchEventSeries;
@@ -141,40 +136,42 @@ public class UIEventChart extends TimelineChart {
 
                return item;
        }
-
+       
        @Override
-       public void parseLogPackage(LogPackage logPack) {
-               Logs logs = logPack.getLogs(probeType);
-               if(logs == null) {
-                       return;
-               }
-               
-               List<LogData> logList = logs.getRawLogs();
-
-               for (LogData logData : logList) {
-                       parseLog((UIEventData)logData);
-               }
-       }
-
-       private void parseLog(UIEventData logData) {
-               try {
-                       double time = logData.getTime() / TimelineConstants.MEGA_DOUBLE;
-                       int eventType = logData.getEventType();
-                       switch (eventType) {
+       public void inputChartSeries(List<Object> dataList) {
+               touchEventSeries.clear();
+               gestureEventSeries.clear();
+               orientationEventSeries.clear();
+               
+               @SuppressWarnings("unchecked")
+               List<List<Object>> data = (List<List<Object>>)dataList.get(0);
+               
+               for (int i = 0; i < data.size(); i++) {
+                       List<Object> row = data.get(i);
+                       double time = (Long)row.get(UIEventDBTable.COLUMN.TIME.ordinal())
+                               / TimelineConstants.MEGA_DOUBLE;
+                       int eventType = (Integer)row.get(UIEventDBTable.COLUMN.EVENT_TYPE.ordinal());
+                       int detailType = (Integer)row.get(UIEventDBTable.COLUMN.DETAIL_TYPE.ordinal());
+                       int pointX = (Integer)row.get(UIEventDBTable.COLUMN.POINT_X.ordinal());
+                       int pointY = (Integer)row.get(UIEventDBTable.COLUMN.POINT_Y.ordinal());
+                       String info1 = (String)row.get(UIEventDBTable.COLUMN.INFO_STRING.ordinal());
+                       int info2 = (Integer)row.get(UIEventDBTable.COLUMN.INFO_INTEGER.ordinal());
+                       
+                       switch (eventType) {
                        case TYPE_TOUCH:
-                               String info = EnumTouchStatus.values()[logData.getDetailType()]
+                               String info = EnumTouchStatus.values()[detailType]
                                                .getStatus() + NEW_LINE + "X : "//$NON-NLS-1$
-                                               + logData.getX() + " Y : "//$NON-NLS-1$
-                                               + logData.getY();
+                                               + pointX + " Y : "//$NON-NLS-1$
+                                               + pointY;
                                touchEventSeries.addSeriesItem(new DAChartSeriesItem(time, 0,
                                                info));
                                break;
                        case TYPE_GESTURE:
                                gestureEventSeries.addSeriesItem(new DAChartSeriesItem(time, 0,
-                                               getGestureInfo(logData.getDetailType(), logData)));
+                                               getGestureInfo(detailType, pointX, pointY, info1, info2)));
                                break;
                        case TYPE_ORIENTATION:
-                               int status = Integer.parseInt(logData.getInfo1());
+                               int status = Integer.parseInt(info1);
                                orientationEventSeries.addSeriesItem(new DAChartSeriesItem(
                                                time, 0, TimelineChartLabels.UIEVENT_ORIENTATION
                                                                + "   "//$NON-NLS-1$
@@ -182,13 +179,12 @@ public class UIEventChart extends TimelineChart {
                                                                                .getStatus()));
                                break;
                        default:
-                               DA_LOG.error("event type error");//$NON-NLS-1$
+                               System.out.println("UIEventChart.java : event type error");//$NON-NLS-1$
                                return;
                        }
-               } catch (NumberFormatException ne) {
-                       ne.printStackTrace();
-               }
+               }
        }
+       
 
        private enum EnumTouchStatus {
                PRESSED(TimelineChartLabels.UIEVENT_TOUCH_LONG_PRESSED),
@@ -228,23 +224,26 @@ public class UIEventChart extends TimelineChart {
                        return status;
                }
        }
-
-       private String getGestureInfo(int detailType, UIEventData logData) {
-               String info = CommonConstants.EMPTY;
+       
+       /*
+        * Need to test this function
+        */
+       private String getGestureInfo(int detailType, int pointX, int pointY, String info1, int info2) {
+           String info = CommonConstants.EMPTY;
                switch (detailType) {
                case GESTURE_TYPE_FLICK:
                        info = TimelineChartLabels.UIEVENT_GESTURE_FLICK
                                        + "    "//$NON-NLS-1$
-                                       + getFlickDirection(logData.getInfo2())
+                                       + getFlickDirection(info2)
                                        + NEW_LINE
                                        + TimelineChartLabels.UIEVENT_INFO_DISTANCE
                                        + " X : "//$NON-NLS-1$
-                                       + logData.getX() + NEW_LINE
+                                       + pointX + NEW_LINE
                                        + TimelineChartLabels.UIEVENT_INFO_DISTANCE
                                        + " Y : "//$NON-NLS-1$
-                                       + logData.getY() + NEW_LINE
+                                       + pointY + NEW_LINE
                                        + TimelineChartLabels.UIEVENT_INFO_DURATION + " : " //$NON-NLS-1$
-                                       + logData.getInfo1();
+                                       + info1;
                        break;
                case GESTURE_TYPE_LONG_PRESS:
                        info = TimelineChartLabels.UIEVENT_GESTURE_LONG_PRESS
@@ -252,55 +251,55 @@ public class UIEventChart extends TimelineChart {
                                        + NEW_LINE
                                        + TimelineChartLabels.UIEVENT_INFO_MOVE_ALLOWANCE
                                        + " : "//$NON-NLS-1$
-                                       + logData.getX() + NEW_LINE
+                                       + pointX + NEW_LINE
                                        + TimelineChartLabels.UIEVENT_INFO_TOUCH_COUNT
                                        + " : "//$NON-NLS-1$
-                                       + logData.getInfo2() + NEW_LINE
+                                       + info2 + NEW_LINE
                                        + TimelineChartLabels.UIEVENT_INFO_DURATION + " : " //$NON-NLS-1$
-                                       + logData.getInfo1();
+                                       + info1;
                        break;
                case GESTURE_TYPE_PANNING:
                        info = TimelineChartLabels.UIEVENT_GESTURE_PANNING + NEW_LINE
                                        + TimelineChartLabels.UIEVENT_INFO_TOUCH_COUNT + " : "//$NON-NLS-1$
-                                       + logData.getInfo2();
+                                       + info2;
                        break;
                case GESTURE_TYPE_PINCH:
                        info = TimelineChartLabels.UIEVENT_GESTURE_PINCH
                                        + NEW_LINE
                                        + TimelineChartLabels.UIEVENT_INFO_CENTER
                                        + " X : "//$NON-NLS-1$
-                                       + logData.getX() + NEW_LINE
+                                       + pointX + NEW_LINE
                                        + TimelineChartLabels.UIEVENT_INFO_CENTER
                                        + " Y : "//$NON-NLS-1$
-                                       + logData.getY() + NEW_LINE
+                                       + pointY + NEW_LINE
                                        + TimelineChartLabels.UIEVENT_INFO_DISTANCE + " : "//$NON-NLS-1$
-                                       + logData.getInfo1();
+                                       + info1;
                        break;
                case GESTURE_TYPE_ROTATION:
                        info = TimelineChartLabels.UIEVENT_GESTURE_ROTATION + NEW_LINE
                                        + TimelineChartLabels.UIEVENT_INFO_DISTANCE
                                        + " : "//$NON-NLS-1$
-                                       + logData.getInfo1()
+                                       + info1
                                        + TimelineChartLabels.UIEVENT_INFO_ANGLE + " : "//$NON-NLS-1$
-                                       + logData.getInfo2();
+                                       + info2;
                        break;
                case GESTURE_TYPE_TAP:
                        info = TimelineChartLabels.UIEVENT_GESTURE_TAP
                                        + "     "//$NON-NLS-1$
                                        + TimelineChartLabels.UIEVENT_INFO_COUNT
                                        + " : "//$NON-NLS-1$
-                                       + logData.getY() + NEW_LINE
+                                       + pointY + NEW_LINE
                                        + TimelineChartLabels.UIEVENT_INFO_MOVE_ALLOWANCE
                                        + " : "//$NON-NLS-1$
-                                       + logData.getX() + NEW_LINE
+                                       + pointX + NEW_LINE
                                        + TimelineChartLabels.UIEVENT_INFO_TAP_INTERVAL
                                        + " : "//$NON-NLS-1$
-                                       + logData.getInfo1() + NEW_LINE
+                                       + info1 + NEW_LINE
                                        + TimelineChartLabels.UIEVENT_INFO_TOUCH_COUNT + " : "//$NON-NLS-1$
-                                       + logData.getInfo2();
+                                       + info2;
                        break;
                default:
-                       DA_LOG.debug("wrong gesture type");//$NON-NLS-1$
+                       System.out.println("UIEventChart.java wrong gesture type");//$NON-NLS-1$
                }
 
                return info;
index 83a57e5..26349e6 100755 (executable)
@@ -4,6 +4,7 @@
  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Contact: 
+ * Jungwook Ryu <jungwook.ryu@samsung.com>
  * Sanghyun Lee <sanghyunnim.lee@samsung.com>
  * Juyoung Kim <j0.kim@samsung.com>
  *
@@ -29,12 +30,7 @@ package org.tizen.dynamicanalyzer.ui.timeline.chart;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
 import org.tizen.dynamicanalyzer.resources.ImageResources;
-import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
-import org.tizen.dynamicanalyzer.swap.logparser.Logs;
-import org.tizen.dynamicanalyzer.swap.model.data.LogData;
-import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
 import org.tizen.dynamicanalyzer.widgets.chart.DAChart;
 import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeries;
 import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
@@ -72,29 +68,29 @@ public class UserCustomChart extends TimelineChart {
                return item;
        }
 
-       @Override
-       public void parseLogPackage(LogPackage logPack) {
-               Logs logs = logPack.getLogs(LogCenterConstants.LOG_DEVICE);
-               if(logs == null) {
-                       return;
-               }
-               
-               List<LogData> logDataList = logs.getRawLogs();
-
-               if (logDataList.size() <= 0) {
-                       return;
-               }
-               parseLog(logDataList.get(logDataList.size() - 1));
-       }
-
-       private void parseLog(LogData logData) {
-               try {
-                       double time = logData.getTime() / TimelineConstants.MEGA_DOUBLE;
-                       chart.getPlot().setValidEndX(time);
-               } catch (NumberFormatException ne) {
-                       ne.printStackTrace();
-               }
-       }
+//     @Override
+//     public void parseLogPackage(LogPackage logPack) {
+//             Logs logs = logPack.getLogs(LogCenterConstants.LOG_DEVICE);
+//             if(logs == null) {
+//                     return;
+//             }
+//             
+//             List<LogData> logDataList = logs.getRawLogs();
+//
+//             if (logDataList.size() <= 0) {
+//                     return;
+//             }
+//             parseLog(logDataList.get(logDataList.size() - 1));
+//     }
+//
+//     private void parseLog(LogData logData) {
+//             try {
+//                     double time = logData.getTime() / TimelineConstants.MEGA_DOUBLE;
+//                     chart.getPlot().setValidEndX(time);
+//             } catch (NumberFormatException ne) {
+//                     ne.printStackTrace();
+//             }
+//     }
 
        public void addSeries(DAChartSeries series) {
                chart.addSeries(series);
index 10bf22e..e84daef 100644 (file)
@@ -4,6 +4,7 @@
  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Contact: 
+ * Jungwook Ryu <jungwook.ryu@samsung.com>
  * Sanghyun Lee <sanghyunnim.lee@samsung.com>
  * Juyoung Kim <j0.kim@samsung.com>
  *
  * 
  */
 
+
 package org.tizen.dynamicanalyzer.ui.timeline.common;
 
+import java.io.File;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 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.database.DBTable;
 import org.tizen.dynamicanalyzer.nl.ConfigureLabels;
 import org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants;
@@ -39,12 +46,25 @@ import org.tizen.dynamicanalyzer.swap.logparser.Logs;
 import org.tizen.dynamicanalyzer.swap.logparser.PageDataManager;
 import org.tizen.dynamicanalyzer.swap.model.data.LogData;
 import org.tizen.dynamicanalyzer.swap.model.data.MemoryData;
+import org.tizen.dynamicanalyzer.swap.model.data.ScreenShotData;
 import org.tizen.dynamicanalyzer.swap.model.data.SystemData;
+import org.tizen.dynamicanalyzer.swap.model.data.UIEventData;
 import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseEventListener;
 import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseTrackAdapter;
+import org.tizen.dynamicanalyzer.ui.info.screenshot.SocketClient;
+import org.tizen.dynamicanalyzer.ui.timeline.CPUDBInserter;
+import org.tizen.dynamicanalyzer.ui.timeline.CPUDBTable;
+import org.tizen.dynamicanalyzer.ui.timeline.CustomDataDBTable;
+import org.tizen.dynamicanalyzer.ui.timeline.EnergyDBTable;
+import org.tizen.dynamicanalyzer.ui.timeline.EnergyDataDBInserter;
+import org.tizen.dynamicanalyzer.ui.timeline.ProcessDataDBInserter;
+import org.tizen.dynamicanalyzer.ui.timeline.ProcessLoadDBTable;
+import org.tizen.dynamicanalyzer.ui.timeline.ScreenShotDBInserter;
 import org.tizen.dynamicanalyzer.ui.timeline.ScreenShotDBTable;
 import org.tizen.dynamicanalyzer.ui.timeline.SystemDataDBInserter;
 import org.tizen.dynamicanalyzer.ui.timeline.SystemDataDBTable;
+import org.tizen.dynamicanalyzer.ui.timeline.UIEventDBInserter;
+import org.tizen.dynamicanalyzer.ui.timeline.UIEventDBTable;
 import org.tizen.dynamicanalyzer.ui.timeline.chart.CPUChart;
 import org.tizen.dynamicanalyzer.ui.timeline.chart.CPUCoreChart;
 import org.tizen.dynamicanalyzer.ui.timeline.chart.CPUFrequencyChart;
@@ -61,7 +81,6 @@ import org.tizen.dynamicanalyzer.ui.timeline.chart.TimelineChart;
 import org.tizen.dynamicanalyzer.ui.timeline.chart.UIEventChart;
 import org.tizen.dynamicanalyzer.ui.timeline.chart.UserCustomChart;
 import org.tizen.dynamicanalyzer.ui.timeline.logparser.CustomLogParser;
-import org.tizen.dynamicanalyzer.ui.timeline.logparser.DeviceLogParser;
 import org.tizen.dynamicanalyzer.ui.timeline.logparser.LifecycleLogParser;
 import org.tizen.dynamicanalyzer.ui.toolbar.ConfigureManager;
 import org.tizen.dynamicanalyzer.util.DALogger;
@@ -76,457 +95,706 @@ public class TimelineChartManager extends PageDataManager implements IDAChartSer
        private static final DALogger DA_LOG = DALogger.getInstance();
        private static TimelineChartManager instance = null;
 
-       private boolean newCustomChart = false;
-       private List<TimelineChart> chartList;
-       private ArrayList<TimelineChart> newChartList;
-       private List<TimelineChart> selectedChartList;
-       private HashMap<String, TimelineChart> chartInstanceMapNameKey;
-       private HashMap<Integer, TimelineChart> chartInstanceMapTypeKey;
-
-       private HashMap<Long, UserCustomChart> customChartMap;
-       private DAChartBoard chartBoard = null;
-
-       private DeviceLogParser deviceLogParser = null;
-       private CustomLogParser customLogParser = null;
-       private final LifecycleLogParser lifecycleLogParser = LifecycleLogParser
-                       .getInstance();
-
-       /*
-        * Data for Refactoring
-        */
-       private SystemDataDBTable systemDataTable = null;
-       private ScreenShotDBTable screenShotDBTable = null;
-       private static final int MEM_API_TYPE_ALLOC = 0;
-       private static final int MEM_API_TYPE_FREE = 1;
-       private static final int MEM_API_TYPE_MANAGE = 2;
-       private static final int MEM_USER = 2;
-       private long allocByte = 0;
-       private HashMap<Long, Long> allocationSeriesDataSetMap = new HashMap<Long, Long>();
-       private ArrayList<List<Object>> systemDataList;
-       private ArrayList<List<Object>> screenShotList;
-       
-       
-       public static TimelineChartManager getInstance() {
-               if (instance == null) {
-                       instance = new TimelineChartManager();
-               }
-               return instance;
-       }
-
-       private TimelineChartManager() {
-               chartList = new ArrayList<TimelineChart>();
-               newChartList = new ArrayList<TimelineChart>();
-               selectedChartList = new ArrayList<TimelineChart>();
-               chartInstanceMapNameKey = new HashMap<String, TimelineChart>();
-               chartInstanceMapTypeKey = new HashMap<Integer, TimelineChart>();
-               customChartMap = new HashMap<Long, UserCustomChart>();
-               
-               deviceLogParser = new DeviceLogParser(this);
-               customLogParser = new CustomLogParser(this);
-               
-               systemDataTable = new SystemDataDBTable();
-               addDBTable(systemDataTable);
-               systemDataList = new ArrayList<List<Object>>();
-               
-               initChartMap(CPUChart.getInstance());
-               initChartMap(CPUCoreChart.getInstance());
-               initChartMap(CPUFrequencyChart.getInstance());
-               initChartMap(HeapChart.getInstance());
-               initChartMap(ProcessMemoryChart.getInstance());
-               initChartMap(SystemMemoryChart.getInstance());
-               initChartMap(FileChart.getInstance());
-               initChartMap(ScreenshotChart.getInstance());
-               initChartMap(UIEventChart.getInstance());
-               initChartMap(DiskIOChart.getInstance());
-               initChartMap(NetworkIOChart.getInstance());
-               initChartMap(DeviceChart.getInstance());
-               initChartMap(EnergyChart.getInstance());
-
-               loadSavedChartList();
-               loadSelectedChartList();
-       }
-
-       public void setChartTimelineChartBoard(DAChartBoard board) {
-               chartBoard = board;
-       }
-
-       private void loadSavedChartList() {
-               String savedChartNameList = ConfigureManager.getInstance().getValue(
-                               ConfigureLabels.CONFIGUREMANAGER_CHART_AVAILABLE_ITEM_LIST);
-               String[] chartNameList = savedChartNameList.split(","); //$NON-NLS-1$
-               int size = chartNameList.length;
-
-               if (size > 1) {
-                       for (int i = 0; i < size; i++) {
-                               TimelineChart chart = getChartInstance(chartNameList[i]);
-                               if (chart != null) {
-                                       chartList.add(chart);
-                               }
-                       }
-               } else {
-                       for (TimelineChart chart : chartInstanceMapNameKey.values()) {
-                               chartList.add(chart);
-                       }
-               }
-       }
-
-       private void loadSelectedChartList() {
-               String strSaveSelectedItems = ConfigureManager.getInstance().getValue(
-                               ConfigureLabels.CONFIGUREMANAGER_CHART_SELECTED_ITEM_LIST);
-               if (strSaveSelectedItems.equalsIgnoreCase("")) {//$NON-NLS-1$
-                       selectedChartList.addAll(chartList);
-               } else {
-                       String[] savedSelectedChartNameList = strSaveSelectedItems
-                                       .split(","); //$NON-NLS-1$
-                       int size = savedSelectedChartNameList.length;
-                       if (size != 0) {
-                               for (int i = 0; i < size; i++) {
-                                       TimelineChart chart = getChartInstance(savedSelectedChartNameList[i]);
-                                       if (chart != null) {
-                                               selectedChartList.add(chart);
-                                       }
-                               }
-                       }
-               }
-       }
-
-       public void setChartList(List<TimelineChart> chartList) {
-               this.chartList.clear();
-               this.chartList.addAll(chartList);
-       }
-
-       public void setSelectedChartList(List<TimelineChart> chartList) {
-               this.selectedChartList.clear();
-               this.selectedChartList.addAll(chartList);
-       }
-
-       public List<TimelineChart> getChartList() {
-               return chartList;
-       }
-
-       public List<TimelineChart> getSelectedChartList() {
-               return selectedChartList;
-       }
-
-       private TimelineChart getChartInstance(String chartName) {
-               return chartInstanceMapNameKey.get(chartName);
-       }
-
-       public TimelineChart getChartInstance(int chartType) {
-               TimelineChart chart = chartInstanceMapTypeKey.get(chartType);
-
-               if (chart == null) {
-                       chart = customChartMap.get(chartType);
-               }
-
-               return chart;
-       }
-
-       private void initChartMap(TimelineChart chart) {
-               chartInstanceMapNameKey.put(chart.getChartName(), chart);
-               chartInstanceMapTypeKey.put(chart.getChartType(), chart);
-       }
-
-       public void addCustomChart(UserCustomChart customChart) {
-               long chartType = customChart.getChartType();
-               if (!customChartMap.containsKey(chartType)) {
-                       customChartMap.put(chartType, customChart);
-                       chartList.add(customChart);
-                       if (!newCustomChart) {
-                               newChartList.clear();
-                       }
-                       newChartList.add(customChart);
-                       newCustomChart = true;
-
-                       StringBuffer strSaveChartNameList = new StringBuffer(""); //$NON-NLS-1$
-
-                       for (int i = 0; i < chartList.size(); i++) {
-                               strSaveChartNameList.append(chartList.get(i).getChartName());
-                               strSaveChartNameList.append(","); //$NON-NLS-1$
-                       }
-
-                       ConfigureManager.getInstance().setValue(
-                                       ConfigureLabels.CONFIGUREMANAGER_CHART_AVAILABLE_ITEM_LIST,
-                                       strSaveChartNameList.toString());
-               }
-       }
-
-       public List<DAChartSeries> getDAChartSeriesList(int chartType) {
-               return getChartInstance(chartType).getBaseDASeriesList();
-       }
-
-       @SuppressWarnings("unchecked")
-       public void addNewCustomChart() {
-               if (newCustomChart) {
-                       List<TimelineChart> newChartList = (List<TimelineChart>) this.newChartList
-                                       .clone();
-                       this.newChartList.clear();
-                       newCustomChart = false;
-                       for (TimelineChart chart : newChartList) {
-                               selectedChartList.add(chart);
-                               DAChartBoardItem item = chart.createBoardItem(chartBoard);
-
-                               DAChart chartWidget = item.getChart();
-                               chartWidget.getPlot().setAxisRangeX(
-                                               chartBoard.getVisibleStartTime(),
-                                               chartBoard.getVisibleEndTime());
-
-                               chartWidget.getPlot().setMarkers(chartBoard.getMarkers());
-                               TimelineChartMouseEventListener timelineChartMouseEventListener = new TimelineChartMouseEventListener(
-                                               chart.getPopupMenu(), chartBoard.getTimeline());
-                               chartWidget.addMouseListener(timelineChartMouseEventListener);
-                               chartWidget
-                                               .addMouseMoveListener(timelineChartMouseEventListener);
-                               chartWidget
-                                               .addMouseTrackListener(new TimelineChartMouseTrackAdapter(
-                                                               chartBoard.getTimeline()));
-                       }
-
-                       StringBuffer selectedChartNameList = new StringBuffer(""); //$NON-NLS-1$
-                       for (TimelineChart selectedChart : selectedChartList) {
-                               selectedChartNameList.append(selectedChart.getChartName());
-                               selectedChartNameList.append(","); //$NON-NLS-1$
-                       }
-                       ConfigureManager.getInstance().setValue(
-                                       ConfigureLabels.CONFIGUREMANAGER_CHART_SELECTED_ITEM_LIST,
-                                       selectedChartNameList.toString());
-
-                       // AnalyzerUtil.getTimelineComposite().resetItems();
-               }
-
-               for (TimelineChart timelineChart : chartList) {
-                       if (timelineChart instanceof UserCustomChart) {
-                               UserCustomChart customChart = (UserCustomChart) timelineChart;
-                               ArrayList<DAChartSeries> tempSeriesList = (ArrayList<DAChartSeries>) customChart
-                                               .getTempSeries().clone();
-                               ((UserCustomChart) timelineChart).getTempSeries().clear();
-                               for (DAChartSeries series : tempSeriesList) {
-                                       customChart.addSeries(series);
-                               }
-                       }
-
-                       timelineChart.update();
-               }
-       }
-
-       public void clear() {
-               if (null == chartList || 0 == chartList.size()) {
-                       return;
-               }
-
-               for (TimelineChart timelineChart : chartList) {
-                       timelineChart.clear();
-               }
-
-               chartList.clear();
-               selectedChartList.clear();
-               loadSavedChartList();
-               loadSelectedChartList();
-               customChartMap.clear();
-               customLogParser.clear();
-               
-               allocByte = 0;
-               allocationSeriesDataSetMap.clear();
-               systemDataList.clear();
-       }
-
-       @Override
-       public void run() {
-               while (!AnalyzerManager.isExit()) {
-                       LogPackage pack = pollPack();
-                       if (null == pack) // stop thread
-                               break;
-                       
-                       /*
-                        * 1. Make SystemDataTable column
-                        */
-                       Logs systemLogs = pack.getLogs(DataChannelConstants.MSG_DATA_SYSTEM);
-                       Logs memoryLogs = pack.getLogs(DataChannelConstants.MSG_PROBE_MEMORY);
-                       makeSystemDataTableData(systemLogs, memoryLogs);
-                       
-                       if (systemLogs != null && !systemLogs.getRawLogs().isEmpty()) {
-                               deviceLogParser.parseLogPackage(pack);
-                       }
-
-                       if (memoryLogs != null && !memoryLogs.getRawLogs().isEmpty()) {
-                               HeapChart.getInstance().parseLogPackage(pack);
-                       }
-
-                       Logs recorderLogs = pack
-                                       .getLogs(DataChannelConstants.MSG_PROBE_UIEVENT);
-                       if (recorderLogs != null && !recorderLogs.getRawLogs().isEmpty()) {
-                               UIEventChart.getInstance().parseLogPackage(pack);
-                       }
-
-                       Logs customLogs = pack
-                                       .getLogs(DataChannelConstants.MSG_PROBE_CUSTOM);
-                       if (customLogs != null && !customLogs.getRawLogs().isEmpty()) {
-                               customLogParser.parseLogPackage(pack);
-                       }
-                       
-                       Logs screenShotLogs = pack.
-                                       getLogs(DataChannelConstants.MSG_PROBE_SCREENSHOT);
-                       if (screenShotLogs != null
-                                       && !screenShotLogs.getRawLogs().isEmpty()) {
-                               ScreenshotChart.getInstance().parseLogPackage(pack);
-                       }
-                       
-                       
-                       Logs lifecycleLogs = pack
-                                       .getLogs(DataChannelConstants.MSG_PROBE_LIFECYCLE);
-                       if (lifecycleLogs != null && !lifecycleLogs.getRawLogs().isEmpty()) {
-                               lifecycleLogParser.parseLogPackage(pack);
-                       }
-               }
-
-               /* log for debug */
-               DA_LOG.debug(getName() + " thread end!!"); //$NON-NLS-1$
-       }
-       
-       private void makeSystemDataTableData(Logs systemLogs, Logs memoryLogs) {
-               List<LogData> memoryLogList = memoryLogs == null ? null : memoryLogs.getRawLogs();
-               List<LogData> systemLogList = systemLogs == null ? null : systemLogs.getRawLogs();
-               
-               if (memoryLogList != null) {
-                               int size = memoryLogList.size();
-                               for (int i = 0; i < size; i++) {
-                                       MemoryData logData = (MemoryData) memoryLogList.get(i);
-                                       int memApiType = logData.getMemoryApiType();
-                                       int internalFlag = logData.getInternalCall();
-                                       long errorNo = logData.getErrno();
-       
-                                       if (errorNo == 0 && MEM_USER == internalFlag) {
-                                               if (MEM_API_TYPE_ALLOC == memApiType
-                                                               || MEM_API_TYPE_FREE == memApiType
-                                                               || MEM_API_TYPE_MANAGE == memApiType) {
-       
-                                                       addNewSeriesUserAllocData(memApiType, logData);
-                                               }
-                                       }
-                               }
-               }
-               if (systemLogList != null) {
-                       int size = systemLogList.size();
-                       for (int i = 0; i < size; i++) {
-                               SystemData log = (SystemData) systemLogList.get(i);
-                       
-                                       ArrayList<Object> dbSystemData = new ArrayList<Object>();
-                                       dbSystemData.add(new Long(log.getTime()));
-                                       dbSystemData.add(new Integer((int)log.getAppCpuUsage()));       // TODO change float
-                                       dbSystemData.add(new Integer(log.getProcessCount()));
-                                       dbSystemData.add(new Long(log.getTotalAllocSize() + allocByte));
-                                       dbSystemData.add(new Long(allocByte));
-                                       dbSystemData.add(new Integer(log.getVirtualMemory()));
-                                       dbSystemData.add(new Integer(log.getResidentMemory()));
-                                       dbSystemData.add(new Integer(log.getSharedMemory()));
-                                       dbSystemData.add(new Integer(log.getPssMemory()));
-                                       dbSystemData.add(new Long(log.getSystemMemoryTotal()));
-                                       dbSystemData.add(new Long(log.getSystemMemoryUsed()));
-                                       dbSystemData.add(new Integer(log.getNetworkSendSize()));
-                                       dbSystemData.add(new Integer(log.getNetworkReceiveSize()));
-                                       dbSystemData.add(new Integer(log.getWifi()));
-                                       dbSystemData.add(new Integer(log.getBtStatus()));
-                                       dbSystemData.add(new Integer(log.getGpsStatus()));
-                                       dbSystemData.add(new Integer(log.getBrightness()));
-                                       dbSystemData.add(new Integer(log.getDnet()));
-                                       dbSystemData.add(new Integer(log.getCamera()));
-                                       dbSystemData.add(new Integer(log.getSound()));  //20
-                                       dbSystemData.add(new Integer(log.getAudio()));
-                                       dbSystemData.add(new Integer(log.getVibration()));
-                                       dbSystemData.add(new Integer(log.getVoltage()));
-                                       dbSystemData.add(new Integer(log.getRssi()));
-                                       dbSystemData.add(new Integer(log.getVideo()));
-                                       dbSystemData.add(new Integer(log.getCall()));
-                                       dbSystemData.add(new Integer(log.getTotalUsedDrive()));
-                                       dbSystemData.add(new Integer(log.getDiskReadSize()));
-                                       dbSystemData.add(new Integer(log.getDiskReadSectorCount()));
-                                       dbSystemData.add(new Integer(log.getDiskWriteSize()));  //30
-                                       dbSystemData.add(new Integer(log.getDiskWrittenSectorCount()));
-                                       dbSystemData.add(new Integer(log.getEnergyUsage()));
-                                       
-                                       systemDataList.add(dbSystemData);
-                       }
-               }
-               
-                       @SuppressWarnings("unchecked")
-                       List<List<Object>> clist = (List<List<Object>>) systemDataList.clone();
-                       systemDataList.clear();
-                       
-                       SystemDataDBInserter.pushContextData(clist);
-                       SystemDataDBInserter.startThread();
-       }
-       
-       
-       private void addNewSeriesUserAllocData(int fdApiType, MemoryData log) {
-               long size = 0;
-
-               long address = log.getAddress();
-               if (address == 0) {
-                       return;
-               }
-
-               if (MEM_API_TYPE_ALLOC == fdApiType) {
-                       try {
-                               size = log.getSize();
-
-                               allocByte += size;
-                               allocationSeriesDataSetMap.put(address, size);
-                       } catch (NumberFormatException ne) {
-                               ne.printStackTrace();
-                       }
-               } else if (MEM_API_TYPE_FREE == fdApiType) {
-                       if (!allocationSeriesDataSetMap.containsKey(address)) {
-                               return;
-                       }
-                       size = allocationSeriesDataSetMap.get(address);
-
-                       allocByte -= size;
-               }
-       }
-       
-       public DBTable getSystemDataTable() {
-               return systemDataTable;
-       }
-       
-       public List<List<Object>> getSystemDataFromDB(long start, long end) {
-       String where = "where TIME BETWEEN " + start  + " AND " + end;
-       return systemDataTable.selectData(null, where);
-    }
-       
-       @Override
-       public void makeChartSeries(long startTime, long endTime) {
-               /*
-                * 1. Get DB data 
-                */
-               List<List<Object>> systemDBData = getSystemDataFromDB(startTime, endTime);
-               
-               /*
-                * 2. Make series of chart
-                */
-               if (systemDBData != null) {
-                       for (TimelineChart chart : chartList) {
-                               if (chart.getProbeType() == DataChannelConstants.MSG_DATA_SYSTEM) {
-                                       chart.inputChartSeries(systemDBData);
-                               }
-                       }
-               }
-       }
-}
+    private boolean newCustomChart = false;
+    private List<TimelineChart> chartList;
+    private ArrayList<TimelineChart> newChartList;
+    private List<TimelineChart> selectedChartList;
+    private HashMap<String, TimelineChart> chartInstanceMapNameKey;
+    private HashMap<Integer, TimelineChart> chartInstanceMapTypeKey;
+
+    private HashMap<Long, UserCustomChart> customChartMap;
+    private DAChartBoard chartBoard = null;
+
+    private CustomLogParser customLogParser = null;
+    private final LifecycleLogParser lifecycleLogParser = LifecycleLogParser.getInstance();
+
+    private SystemDataDBTable systemDataTable = null;
+    private CPUDBTable cpuDBTable = null;
+    private ProcessLoadDBTable processLoadDBTable = null;
+    private EnergyDBTable energyDBTable = null;
+    private ScreenShotDBTable screenShotDBTable = null;
+    private UIEventDBTable uiEventDBTable = null;
+    private CustomDataDBTable customDataDBTable = null;
+
+    private static final int MEM_API_TYPE_ALLOC = 0;
+    private static final int MEM_API_TYPE_FREE = 1;
+    private static final int MEM_API_TYPE_MANAGE = 2;
+    private static final int MEM_USER = 2;
+    private long allocByte = 0;
+    private HashMap<Long, Long> allocationSeriesDataSetMap = new HashMap<Long, Long>();
+
+    public static TimelineChartManager getInstance() {
+        if (instance == null) {
+            instance = new TimelineChartManager();
+        }
+        return instance;
+    }
 
-/*
- * Logging DB data
- */
-//System.err.println("\nstartTime : " + startTime + ", endTime : " + endTime);
-//if (systemDBData != null) {
-//     for (int i = 0; i < systemDBData.size(); i++) {
-//             List<Object> row = systemDBData.get(i);
-//             if (row != null) {
-//                 for (int j = 0; j < row.size(); j++) {
-//                             System.err.print(row.get(j) + ",");
-//                 }
-//                 System.err.println();
-//             }
-//     }
-//} else {
-//    System.err.println("systemDBData is null!!");
-//}
+    private TimelineChartManager() {
+        chartList = new ArrayList<TimelineChart>();
+        newChartList = new ArrayList<TimelineChart>();
+        selectedChartList = new ArrayList<TimelineChart>();
+        chartInstanceMapNameKey = new HashMap<String, TimelineChart>();
+        chartInstanceMapTypeKey = new HashMap<Integer, TimelineChart>();
+        customChartMap = new HashMap<Long, UserCustomChart>();
+
+        customLogParser = new CustomLogParser(this);
+
+        systemDataTable = new SystemDataDBTable();
+        cpuDBTable = new CPUDBTable();
+        processLoadDBTable = new ProcessLoadDBTable();
+        energyDBTable = new EnergyDBTable();
+        uiEventDBTable = new UIEventDBTable();
+        screenShotDBTable = new ScreenShotDBTable();
+        customDataDBTable = new CustomDataDBTable();
+        addDBTable(systemDataTable);
+        addDBTable(cpuDBTable);
+        addDBTable(processLoadDBTable);
+        addDBTable(energyDBTable);
+        addDBTable(uiEventDBTable);
+        addDBTable(screenShotDBTable);
+        addDBTable(customDataDBTable);
+        
+        initChartMap(CPUChart.getInstance());
+        initChartMap(CPUCoreChart.getInstance());
+        initChartMap(CPUFrequencyChart.getInstance());
+        initChartMap(HeapChart.getInstance());
+        initChartMap(ProcessMemoryChart.getInstance());
+        initChartMap(SystemMemoryChart.getInstance());
+        initChartMap(FileChart.getInstance());
+        initChartMap(ScreenshotChart.getInstance());
+        initChartMap(UIEventChart.getInstance());
+        initChartMap(DiskIOChart.getInstance());
+        initChartMap(NetworkIOChart.getInstance());
+        initChartMap(DeviceChart.getInstance());
+        initChartMap(EnergyChart.getInstance());
+
+        loadSavedChartList();
+        loadSelectedChartList();
+    }
+
+    public void setChartTimelineChartBoard(DAChartBoard board) {
+        chartBoard = board;
+    }
+
+    private void loadSavedChartList() {
+        String savedChartNameList =
+                ConfigureManager.getInstance()
+                        .getValue(ConfigureLabels.CONFIGUREMANAGER_CHART_AVAILABLE_ITEM_LIST);
+        String[] chartNameList = savedChartNameList.split(","); //$NON-NLS-1$
+        int size = chartNameList.length;
+
+        if (size > 1) {
+            for (int i = 0; i < size; i++) {
+                TimelineChart chart = getChartInstance(chartNameList[i]);
+                if (chart != null) {
+                    chartList.add(chart);
+                }
+            }
+        } else {
+            for (TimelineChart chart : chartInstanceMapNameKey.values()) {
+                chartList.add(chart);
+            }
+        }
+    }
+
+    private void loadSelectedChartList() {
+        String strSaveSelectedItems =
+                ConfigureManager.getInstance()
+                        .getValue(ConfigureLabels.CONFIGUREMANAGER_CHART_SELECTED_ITEM_LIST);
+        if (strSaveSelectedItems.equalsIgnoreCase("")) {//$NON-NLS-1$
+            selectedChartList.addAll(chartList);
+        } else {
+            String[] savedSelectedChartNameList = strSaveSelectedItems.split(","); //$NON-NLS-1$
+            int size = savedSelectedChartNameList.length;
+            if (size != 0) {
+                for (int i = 0; i < size; i++) {
+                    TimelineChart chart = getChartInstance(savedSelectedChartNameList[i]);
+                    if (chart != null) {
+                        selectedChartList.add(chart);
+                    }
+                }
+            }
+        }
+    }
+
+    public void setChartList(List<TimelineChart> chartList) {
+        this.chartList.clear();
+        this.chartList.addAll(chartList);
+    }
+
+    public void setSelectedChartList(List<TimelineChart> chartList) {
+        this.selectedChartList.clear();
+        this.selectedChartList.addAll(chartList);
+    }
+
+    public List<TimelineChart> getChartList() {
+        return chartList;
+    }
+
+    public List<TimelineChart> getSelectedChartList() {
+        return selectedChartList;
+    }
+
+    private TimelineChart getChartInstance(String chartName) {
+        return chartInstanceMapNameKey.get(chartName);
+    }
+
+    public TimelineChart getChartInstance(int chartType) {
+        TimelineChart chart = chartInstanceMapTypeKey.get(chartType);
+
+        if (chart == null) {
+            chart = customChartMap.get(chartType);
+        }
+
+        return chart;
+    }
+
+    private void initChartMap(TimelineChart chart) {
+        chartInstanceMapNameKey.put(chart.getChartName(), chart);
+        chartInstanceMapTypeKey.put(chart.getChartType(), chart);
+    }
+
+    public void addCustomChart(UserCustomChart customChart) {
+        long chartType = customChart.getChartType();
+        if (!customChartMap.containsKey(chartType)) {
+            customChartMap.put(chartType, customChart);
+            chartList.add(customChart);
+            if (!newCustomChart) {
+                newChartList.clear();
+            }
+            newChartList.add(customChart);
+            newCustomChart = true;
+
+            StringBuffer strSaveChartNameList = new StringBuffer(""); //$NON-NLS-1$
+
+            for (int i = 0; i < chartList.size(); i++) {
+                strSaveChartNameList.append(chartList.get(i).getChartName());
+                strSaveChartNameList.append(","); //$NON-NLS-1$
+            }
+
+            ConfigureManager.getInstance()
+                    .setValue(ConfigureLabels.CONFIGUREMANAGER_CHART_AVAILABLE_ITEM_LIST,
+                              strSaveChartNameList.toString());
+        }
+    }
+
+    public List<DAChartSeries> getDAChartSeriesList(int chartType) {
+        return getChartInstance(chartType).getBaseDASeriesList();
+    }
+
+    @SuppressWarnings("unchecked")
+    public void addNewCustomChart() {
+        if (newCustomChart) {
+            List<TimelineChart> newChartList = (List<TimelineChart>) this.newChartList.clone();
+            this.newChartList.clear();
+            newCustomChart = false;
+            for (TimelineChart chart : newChartList) {
+                selectedChartList.add(chart);
+                DAChartBoardItem item = chart.createBoardItem(chartBoard);
+
+                DAChart chartWidget = item.getChart();
+                chartWidget.getPlot().setAxisRangeX(chartBoard.getVisibleStartTime(),
+                                                    chartBoard.getVisibleEndTime());
+
+                chartWidget.getPlot().setMarkers(chartBoard.getMarkers());
+                TimelineChartMouseEventListener timelineChartMouseEventListener =
+                        new TimelineChartMouseEventListener(chart.getPopupMenu(),
+                                                            chartBoard.getTimeline());
+                chartWidget.addMouseListener(timelineChartMouseEventListener);
+                chartWidget.addMouseMoveListener(timelineChartMouseEventListener);
+                chartWidget.addMouseTrackListener(new TimelineChartMouseTrackAdapter(chartBoard
+                        .getTimeline()));
+            }
+
+            StringBuffer selectedChartNameList = new StringBuffer(""); //$NON-NLS-1$
+            for (TimelineChart selectedChart : selectedChartList) {
+                selectedChartNameList.append(selectedChart.getChartName());
+                selectedChartNameList.append(","); //$NON-NLS-1$
+            }
+            ConfigureManager.getInstance()
+                    .setValue(ConfigureLabels.CONFIGUREMANAGER_CHART_SELECTED_ITEM_LIST,
+                              selectedChartNameList.toString());
+
+            // AnalyzerUtil.getTimelineComposite().resetItems();
+        }
+
+        for (TimelineChart timelineChart : chartList) {
+            if (timelineChart instanceof UserCustomChart) {
+                UserCustomChart customChart = (UserCustomChart) timelineChart;
+                ArrayList<DAChartSeries> tempSeriesList =
+                        (ArrayList<DAChartSeries>) customChart.getTempSeries().clone();
+                ((UserCustomChart) timelineChart).getTempSeries().clear();
+                for (DAChartSeries series : tempSeriesList) {
+                    customChart.addSeries(series);
+                }
+            }
+
+            timelineChart.update();
+        }
+    }
+
+    public void clear() {
+        if (null == chartList || 0 == chartList.size()) {
+            return;
+        }
+
+        for (TimelineChart timelineChart : chartList) {
+            timelineChart.clear();
+        }
+
+        chartList.clear();
+        selectedChartList.clear();
+        loadSavedChartList();
+        loadSelectedChartList();
+        customChartMap.clear();
+        customLogParser.clear();
+
+        allocByte = 0;
+        allocationSeriesDataSetMap.clear();
+    }
+
+    @Override
+    public void run() {
+        while (!AnalyzerManager.isExit()) {
+            LogPackage pack = pollPack();
+            if (null == pack) // stop thread
+                break;
+
+            /*
+             * 1. Make SystemDataTable column
+             */
+            Logs systemLogs = pack.getLogs(DataChannelConstants.MSG_DATA_SYSTEM);
+            Logs memoryLogs = pack.getLogs(DataChannelConstants.MSG_PROBE_MEMORY);
+            Logs uiEventLogs = pack.getLogs(DataChannelConstants.MSG_PROBE_UIEVENT);
+            Logs screenShotLogs = pack.getLogs(DataChannelConstants.MSG_PROBE_SCREENSHOT);
+            makeSystemDataTableData(systemLogs, memoryLogs);
+            makeUIEventDBTableData(uiEventLogs);
+            makeScreenShotDBTableData(screenShotLogs);
+
+
+            Logs customLogs = pack.getLogs(DataChannelConstants.MSG_PROBE_CUSTOM);
+            if (customLogs != null && !customLogs.getRawLogs().isEmpty()) {
+                customLogParser.parseLogPackage(pack);
+              }
+            Logs lifecycleLogs = pack.getLogs(DataChannelConstants.MSG_PROBE_LIFECYCLE);
+            if (lifecycleLogs != null && !lifecycleLogs.getRawLogs().isEmpty()) {
+                lifecycleLogParser.parseLogPackage(pack);
+            }
+        }
+
+        /* log for debug */
+        DA_LOG.debug(getName() + " thread end!!"); //$NON-NLS-1$
+    }
+
+    private void makeSystemDataTableData(Logs systemLogs, Logs memoryLogs) {
+        int coreSize = GlobalInformation.getCurrentDeviceInfo().getTargetInfo().getCpuCount();
+
+        List<LogData> memoryLogList = memoryLogs == null ? null : memoryLogs.getRawLogs();
+        List<LogData> systemLogList = systemLogs == null ? null : systemLogs.getRawLogs();
+
+        if (memoryLogList != null) {
+            int size = memoryLogList.size();
+            for (int i = 0; i < size; i++) {
+                MemoryData logData = (MemoryData) memoryLogList.get(i);
+                int memApiType = logData.getMemoryApiType();
+                int internalFlag = logData.getInternalCall();
+                long errorNo = logData.getErrno();
+
+                if (errorNo == 0 && MEM_USER == internalFlag) {
+                    if (MEM_API_TYPE_ALLOC == memApiType || MEM_API_TYPE_FREE == memApiType
+                            || MEM_API_TYPE_MANAGE == memApiType) {
+
+                        addNewSeriesUserAllocData(memApiType, logData);
+                    }
+                }
+            }
+        }
+        
+        if (systemLogList != null) {
+            ArrayList<List<Object>> systemDataList = new ArrayList<List<Object>>();
+            ArrayList<List<Object>> cpuDataList = new ArrayList<List<Object>>();
+            ArrayList<List<Object>> processDataList = new ArrayList<List<Object>>();
+            ArrayList<List<Object>> energyDataList = new ArrayList<List<Object>>();
+            int size = systemLogList.size();
+            for (int i = 0; i < size; i++) {
+                SystemData log = (SystemData) systemLogList.get(i);
+
+                /*
+                 * Make CPU Table data
+                 */
+                String[] cpuLoads = log.getCpuLoad().split(CommonConstants.COMMA);
+                double cpuLoadSum = 0.0;
+                
+                // logic
+                String[] cpuFrequencies = log.getCpuFrequency().split(CommonConstants.COMMA);
+                for (int ii = 0; ii < coreSize; ii++) {
+                    double cpuLoad = Double.parseDouble(cpuLoads[ii]);
+                    cpuLoadSum += cpuLoad;
+                    double cpuFrequency = Double.parseDouble(cpuFrequencies[ii]);
+                    ArrayList<Object> dbCPUData = new ArrayList<Object>();
+                    dbCPUData.add(new Long(log.getTime()));
+                    dbCPUData.add(new Integer(ii));
+                    dbCPUData.add(new Float(cpuLoad));
+                    dbCPUData.add(new Float(cpuFrequency));
+                    cpuDataList.add(dbCPUData);
+                }
+                
+                double systemAvgCPULoad = cpuLoadSum / coreSize;
+                ArrayList<Object> dbSystemData = new ArrayList<Object>();
+                dbSystemData.add(new Long(log.getTime()));
+                dbSystemData.add(new Float(log.getAppCpuUsage()));
+                dbSystemData.add(new Float(systemAvgCPULoad));
+                dbSystemData.add(new Integer(log.getProcessCount()));
+                dbSystemData.add(new Long(log.getTotalAllocSize() + allocByte));
+                dbSystemData.add(new Long(allocByte));
+                dbSystemData.add(new Integer(log.getVirtualMemory()));
+                dbSystemData.add(new Integer(log.getResidentMemory()));
+                dbSystemData.add(new Integer(log.getSharedMemory()));
+                dbSystemData.add(new Integer(log.getPssMemory()));
+                dbSystemData.add(new Long(log.getSystemMemoryTotal()));
+                dbSystemData.add(new Long(log.getSystemMemoryUsed()));
+                dbSystemData.add(new Integer(log.getNetworkSendSize()));
+                dbSystemData.add(new Integer(log.getNetworkReceiveSize()));
+                dbSystemData.add(new Integer(log.getWifi()));
+                dbSystemData.add(new Integer(log.getBtStatus()));
+                dbSystemData.add(new Integer(log.getGpsStatus()));
+                dbSystemData.add(new Integer(log.getBrightness()));
+                dbSystemData.add(new Integer(log.getDnet()));
+                dbSystemData.add(new Integer(log.getCamera()));
+                dbSystemData.add(new Integer(log.getSound())); // 20
+                dbSystemData.add(new Integer(log.getAudio()));
+                dbSystemData.add(new Integer(log.getVibration()));
+                dbSystemData.add(new Integer(log.getVoltage()));
+                dbSystemData.add(new Integer(log.getRssi()));
+                dbSystemData.add(new Integer(log.getVideo()));
+                dbSystemData.add(new Integer(log.getCall()));
+                dbSystemData.add(new Integer(log.getTotalUsedDrive()));
+                dbSystemData.add(new Integer(log.getDiskReadSize()));
+                dbSystemData.add(new Integer(log.getDiskReadSectorCount()));
+                dbSystemData.add(new Integer(log.getDiskWriteSize())); // 30
+                dbSystemData.add(new Integer(log.getDiskWrittenSectorCount()));
+                dbSystemData.add(new Integer(log.getEnergyUsage()));
+
+                systemDataList.add(dbSystemData);
+
+                /*
+                 * Make Process Table data
+                 */
+                String[] processLoadDatas = log.getProcessLoad().split(CommonConstants.COMMA);
+                for (int ii = 0; ii < processLoadDatas.length; ii++) {
+                    String processLoad = processLoadDatas[ii];
+                    if (processLoad == null || processLoad.isEmpty()) {
+                        continue;
+                    }
+                    int pid = Integer.parseInt(processLoad);
+                    double load = Double.parseDouble(processLoadDatas[++ii]);
+                    ArrayList<Object> dbProcessData = new ArrayList<Object>();
+                    dbProcessData.add(new Long(log.getTime()));
+                    dbProcessData.add(new Integer(pid));
+                    dbProcessData.add(new Float(load));
+                    processDataList.add(dbProcessData);
+                }
+
+                /*
+                 * Make Energy Table data
+                 */
+                String[] deviceEnergyUsages =
+                        log.getDeviceEnergyUsage().split(CommonConstants.COMMA);
+                String[] deviceEnergyUsagesPerApp =
+                        log.getApplicationEnergyUsage().split(CommonConstants.COMMA);
+                for (int ii = 0; ii < deviceEnergyUsages.length; ii++) {
+                    double usage = Double.parseDouble(deviceEnergyUsages[ii]);
+                    double usagePerApp = Double.parseDouble(deviceEnergyUsagesPerApp[ii]);
+                    ArrayList<Object> dbEnergyData = new ArrayList<Object>();
+                    dbEnergyData.add(new Long(log.getTime()));
+                    dbEnergyData.add(new Integer(ii));
+                    dbEnergyData.add(new Integer((int)usage)); // TODO change float
+                    dbEnergyData.add(new Integer((int)usagePerApp)); // TODO change float
+                    energyDataList.add(dbEnergyData);
+                }
+            }
+            SystemDataDBInserter.pushContextData(systemDataList);
+            SystemDataDBInserter.startThread();
+            CPUDBInserter.pushContextData(cpuDataList);
+            CPUDBInserter.startThread();
+            ProcessDataDBInserter.pushContextData(processDataList);
+            ProcessDataDBInserter.startThread();
+            EnergyDataDBInserter.pushContextData(energyDataList);
+            EnergyDataDBInserter.startThread();
+        }
+    }
+
+    private void makeUIEventDBTableData(Logs uiEventLogs) {
+        List<LogData> uiEventLogList = uiEventLogs == null ? null : uiEventLogs.getRawLogs();
+        if (uiEventLogList != null) {
+               ArrayList<List<Object>> uiEventDataList = new ArrayList<List<Object>>();
+            int size = uiEventLogList.size();
+            for (int i = 0; i < size; i++) {
+                UIEventData log = (UIEventData) uiEventLogList.get(i);
+                ArrayList<Object> dbUIEventData = new ArrayList<Object>();
+
+                dbUIEventData.add(new Long(log.getTime()));
+                dbUIEventData.add(new Integer(log.getEventType()));
+                dbUIEventData.add(new Integer(log.getDetailType()));
+                dbUIEventData.add(new Integer(log.getX()));
+                dbUIEventData.add(new Integer(log.getY()));
+                dbUIEventData.add(log.getInfo1());
+                dbUIEventData.add(new Integer(log.getInfo2()));
+
+                uiEventDataList.add(dbUIEventData);
+              }
+            
+            UIEventDBInserter.pushContextData(uiEventDataList);
+            UIEventDBInserter.startThread();
+        }
+    }
+
+    private void makeScreenShotDBTableData(Logs screenShotLogs) {
+        List<LogData> screenShotLogList =
+                screenShotLogs == null ? null : screenShotLogs.getRawLogs();
+        if (screenShotLogList != null) {
+               ArrayList<List<Object>> screenShotDataList = new ArrayList<List<Object>>();
+            int size = screenShotLogList.size();
+            for (int i = 0; i < size; i++) {
+                ScreenShotData log = (ScreenShotData) screenShotLogList.get(i);
+                ArrayList<Object> dbScreenShotData = new ArrayList<Object>();
+                String imagePathLog = null;
+                if (DACommunicator.isTargetEmulator() && SocketClient.getInstance().isConnected()) {
+                    imagePathLog =
+                               GlobalInformation.getCurrentDeviceInfo().emulatorScreenshot.getFilePath();
+                } else {
+                    imagePathLog = log.getImageFilePath();
+                }
+                String[] splitedImagePathLog = imagePathLog.split(File.separator); //$NON-NLS-1$
+                String fileName = splitedImagePathLog[splitedImagePathLog.length - 1];
+
+                dbScreenShotData.add(new Long(log.getTime()));
+                dbScreenShotData.add(fileName);
+                dbScreenShotData.add(new Integer(log.getOrientation()));
+
+                screenShotDataList.add(dbScreenShotData);
+            }
+
+            ScreenShotDBInserter.pushContextData(screenShotDataList);
+            ScreenShotDBInserter.startThread();
+        }
+    }
+
+    private void addNewSeriesUserAllocData(int fdApiType, MemoryData log) {
+        long size = 0;
+
+        long address = log.getAddress();
+        if (address == 0) {
+            return;
+        }
+
+        if (MEM_API_TYPE_ALLOC == fdApiType) {
+            try {
+                size = log.getSize();
+
+                allocByte += size;
+                allocationSeriesDataSetMap.put(address, size);
+            } catch (NumberFormatException ne) {
+                ne.printStackTrace();
+            }
+        } else if (MEM_API_TYPE_FREE == fdApiType) {
+            if (!allocationSeriesDataSetMap.containsKey(address)) {
+                return;
+            }
+            size = allocationSeriesDataSetMap.get(address);
+
+            allocByte -= size;
+        }
+    }
+
+    public DBTable getSystemDataTable() {
+        return systemDataTable;
+    }
+
+    public DBTable getCPUTable() {
+        return cpuDBTable;
+    }
+
+    public DBTable getUIEventTable() {
+        return uiEventDBTable;
+    }
+
+    public DBTable getProcessTable() {
+        return processLoadDBTable;
+    }
+
+    public DBTable getEnergyTable() {
+        return energyDBTable;
+    }
+
+    public DBTable getScreenShotTable() {
+        return screenShotDBTable;
+    }
+
+    public DBTable getCustomDataTable() {
+        return customDataDBTable;
+    }
+    
+    public List<List<Object>> getSystemDataFromDB(long start, long end) {
+        String where =
+                "where TIME BETWEEN " + start + " AND " + end + " ORDER BY "
+                        + SystemDataDBTable.TIME;
+        List<List<Object>> result = systemDataTable.selectData(null, where);
+
+        if (result != null) {
+            return result;
+        } else {
+            return new ArrayList<List<Object>>();
+        }
+    }
+
+    public List<List<Object>> getCPUDataFromDB(long start, long end) {
+        List<List<Object>> processedResult = new ArrayList<List<Object>>();
+        String where =
+                "where TIME BETWEEN " + start + " AND " + end + " ORDER BY " + CPUDBTable.TIME;
+        List<List<Object>> queryResult = cpuDBTable.selectData(null, where);
+        if (queryResult == null) {
+            return processedResult;
+        }
+
+        int cpuCount = GlobalInformation.getCurrentDeviceInfo().getTargetInfo().getCpuCount();
+        for (int i = 0; i < cpuCount; i++) {
+            List<Object> cpuLoads = new ArrayList<Object>();
+            processedResult.add(cpuLoads);
+        }
+        for (int i = 0; i < queryResult.size(); i++) {
+            List<Object> row = queryResult.get(i);
+            int coreNum = (Integer) row.get(CPUDBTable.COLUMN.CORE_NUM.ordinal());
+            processedResult.get(coreNum).add(row);
+        }
+        return processedResult;
+    }
+
+    public Map<Integer, List<List<Object>>> getProcessDataFromDB(long start, long end) {
+        Map<Integer, List<List<Object>>> processedResult =
+                new HashMap<Integer, List<List<Object>>>();
+
+        String where =
+                "where TIME BETWEEN " + start + " AND " + end + " ORDER BY "
+                        + ProcessLoadDBTable.TIME;
+        List<List<Object>> queryResult = processLoadDBTable.selectData(null, where);
+        if (queryResult == null) {
+            return processedResult;
+        }
+
+        for (int i = 0; i < queryResult.size(); i++) {
+            List<Object> row = queryResult.get(i);
+            Integer pid = (Integer) row.get(ProcessLoadDBTable.COLUMN.PID.ordinal());
+            List<List<Object>> processData = processedResult.get(pid);
+            if (processData == null) {
+                processData = new ArrayList<List<Object>>();
+                processedResult.put(pid, processData);
+            }
+            processData.add(row);
+        }
+        return processedResult;
+    }
+
+    public List<List<Object>> getEnergyDataFromDB(long start, long end) {
+        List<List<Object>> processedResult = new ArrayList<List<Object>>();
+
+        String where =
+                "where TIME BETWEEN " + start + " AND " + end + " ORDER BY " + EnergyDBTable.TIME;
+        List<List<Object>> queryResult = energyDBTable.selectData(null, where);
+        if (queryResult == null) {
+            return processedResult;
+        }
+
+        int deviceCount = GlobalInformation.getCurrentDeviceInfo().getTargetInfo().getDeviceCount();
+        for (int i = 0; i < deviceCount; i++) {
+            List<Object> energyPerDevice = new ArrayList<Object>();
+            processedResult.add(energyPerDevice);
+        }
+        for (int i = 0; i < queryResult.size(); i++) {
+            List<Object> row = queryResult.get(i);
+            int deviceNum = (Integer) row.get(EnergyDBTable.COLUMN.DEVICE_NUM.ordinal());
+            processedResult.get(deviceNum).add(row);
+        }
+        return processedResult;
+    }
+
+    public List<List<Object>> getUIEventDataFromDB(long start, long end) {
+        String where =
+                "where TIME BETWEEN " + start + " AND " + end + " ORDER BY " + UIEventDBTable.TIME;
+        List<List<Object>> result = uiEventDBTable.selectData(null, where);
+
+        if (result != null) {
+            return result;
+        } else {
+            return new ArrayList<List<Object>>();
+        }
+    }
+
+    public List<List<Object>> getScreenShotDataFromDB(long start, long end) {
+        String where =
+                "where TIME BETWEEN " + start + " AND " + end + " ORDER BY "
+                        + ScreenShotDBTable.TIME;
+        List<List<Object>> result = screenShotDBTable.selectData(null, where);
+
+        if (result != null) {
+            return result;
+        } else {
+            return new ArrayList<List<Object>>();
+        }
+    }
+
+    public List<List<Object>> getCustomDataFromDB(long start, long end) {
+        String where =
+                "where TIME BETWEEN " + start + " AND " + end + " ORDER BY "
+                        + CustomDataDBTable.TIME;
+        List<List<Object>> result = customDataDBTable.selectData(null, where);
+
+        if (result != null) {
+            return result;
+        } else {
+            return new ArrayList<List<Object>>();
+        }
+    }
+
+    @Override
+    public void makeChartSeries(long startTime, long endTime) {
+        /*
+         * 1. Get DB data
+         */
+        List<List<Object>> systemDBData = getSystemDataFromDB(startTime, endTime);
+        List<List<Object>> cpuDBData = getCPUDataFromDB(startTime, endTime);
+        Map<Integer, List<List<Object>>> processDBData = getProcessDataFromDB(startTime, endTime);
+        List<List<Object>> energyDBData = getEnergyDataFromDB(startTime, endTime);
+        List<List<Object>> uiEventDBData = getUIEventDataFromDB(startTime, endTime);
+        List<List<Object>> screenShotDBData = getScreenShotDataFromDB(startTime, endTime);
+        List<List<Object>> customDBData = getCustomDataFromDB(startTime, endTime);
+
+        /*
+         * 2. Make series of chart
+         */
+        for (TimelineChart chart : chartList) {
+            if (chart.getProbeType() == DataChannelConstants.MSG_DATA_SYSTEM) {
+                List<Object> dataList = new ArrayList<Object>();
+                dataList.add(systemDBData);
+                dataList.add(cpuDBData);
+                dataList.add(processDBData);
+                dataList.add(energyDBData);
+                chart.inputChartSeries(dataList);
+            } else if (chart.getProbeType() == DataChannelConstants.MSG_PROBE_UIEVENT) {
+                List<Object> dataList = new ArrayList<Object>();
+                dataList.add(uiEventDBData);
+                chart.inputChartSeries(dataList);
+            } else if (chart.getProbeType() == DataChannelConstants.MSG_PROBE_SCREENSHOT) {
+                List<Object> dataList = new ArrayList<Object>();
+                dataList.add(screenShotDBData);
+                chart.inputChartSeries(dataList);
+            }
+        }
+
+        /*
+         * 3. Make series of custom chart
+         */
+        customLogParser.inputChartSeries(customDBData);
+    }
+}
index e5143f7..38aafce 100644 (file)
@@ -50,4 +50,12 @@ public class TimelineConstants {
        public static final long KILO_LONG = 1000;
 
        public static final int NOT_INITED = -1;
+       
+       /* Index of "Pack of database data" */
+       public static final int SYSTEM_DB_DATA = 0;
+       public static final int CPU_DB_DATA = 1;
+       public static final int PROCESS_DB_DATA = 2;
+       public static final int ENERGY_DB_DATA = 3;
+       public static final int UIEVENT_DB_DATA = 0;    // same with SYSTEM_DB_DATA
+       public static final int SCREENSHOT_DB_DATA = 0; // same with SYSTEM_DB_DATA, UIEVENT_DB_DATA
 }
index e2e84bd..c082445 100644 (file)
@@ -4,6 +4,7 @@
  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Contact: 
+ * Jungwook Ryu <jungwook.ryu@samsung.com>
  * Sanghyun Lee <sanghyunnim.lee@samsung.com>
  * Juyoung Kim <j0.kim@samsung.com>
  *
@@ -49,8 +50,8 @@ import org.tizen.dynamicanalyzer.ui.timeline.TimelinePage;
 import org.tizen.dynamicanalyzer.ui.timeline.chart.TimelineChart;
 import org.tizen.dynamicanalyzer.ui.timeline.logparser.LifecycleLogParser;
 import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
-import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
 import org.tizen.dynamicanalyzer.util.DALogger;
+import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
 import org.tizen.dynamicanalyzer.widgets.chart.DAChart;
 import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotIntervalMarker;
 import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
@@ -141,6 +142,9 @@ public class TimelineView extends DAViewComposite {
        @Override
        public void updateView(DAViewData data) {
                if (data instanceof DASelectionData) {
+                       timelineChartManager.makeChartSeries(AnalyzerUtil.translateSecToMicroSec(chartBoard.getVisibleStartTime()), 
+                                       AnalyzerUtil.translateSecToMicroSec(chartBoard.getVisibleEndTime()));
+                       
                        DASelectionData selData = (DASelectionData) data;
 
                        long start = selData.getStartTime();
@@ -152,7 +156,7 @@ public class TimelineView extends DAViewComposite {
                        if (startTime.equals(endTime)) {
                                middleTime = startTime;
                        }
-
+                       
                        chartBoard.setVisibleMiddleTime(middleTime);
                        DAChartPlotIntervalMarker intervalMarker = (DAChartPlotIntervalMarker) chartBoard
                                        .getMarkers().get(UICommonConstants.SELECTION_MARKER_INDEX);
@@ -162,6 +166,9 @@ public class TimelineView extends DAViewComposite {
 
        @Override
        public void updateView() {
+               timelineChartManager.makeChartSeries(AnalyzerUtil.translateSecToMicroSec(chartBoard.getVisibleStartTime()), 
+                               AnalyzerUtil.translateSecToMicroSec(chartBoard.getVisibleEndTime()));
+               
                if (ToolbarArea.getInstance() == null) {
                        DA_LOG.debug("toolbar area is null");//$NON-NLS-1$
                        return;
index dde5924..e41b73e 100755 (executable)
@@ -4,6 +4,7 @@
  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Contact: 
+ * Jungwook Ryu <jungwook.ryu@samsung.com>
  * Sanghyun Lee <sanghyunnim.lee@samsung.com>
  * Juyoung Kim <j0.kim@samsung.com>
  *
  * 
  */
 
+
 package org.tizen.dynamicanalyzer.ui.timeline.logparser;
 
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -37,6 +40,8 @@ import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
 import org.tizen.dynamicanalyzer.swap.logparser.Logs;
 import org.tizen.dynamicanalyzer.swap.model.data.CustomData;
 import org.tizen.dynamicanalyzer.swap.model.data.LogData;
+import org.tizen.dynamicanalyzer.ui.timeline.CustomDataDBInserter;
+import org.tizen.dynamicanalyzer.ui.timeline.CustomDataDBTable;
 import org.tizen.dynamicanalyzer.ui.timeline.chart.UserCustomChart;
 import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineChartManager;
 import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
@@ -44,134 +49,162 @@ import org.tizen.dynamicanalyzer.util.DALogger;
 import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeries;
 import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeriesItem;
 
+
 public class CustomLogParser {
        private static final DALogger DA_LOG = DALogger.getInstance();
        
-       private static final String API_NAME_CREATE_CHART = "da_create_chart"; //$NON-NLS-1$
-       private static final String API_NAME_CREATE_SERIES = "da_create_series"; //$NON-NLS-1$
-       private static final String API_NAME_CREATE_DEFAULT_SERIES = "da_create_default_series"; //$NON-NLS-1$
-       private static final String API_NAME_DA_LOG = "da_log"; //$NON-NLS-1$
-       private static final String API_NAME_TIMER_THREAD = "timerThread"; //$NON-NLS-1$
-
-       private static final int CUSTOM_COLOR_AUTO = 0;
-       private static final int CUSTOM_COLOR_BLUE = 1;
-       private static final int CUSTOM_COLOR_GREEN = 2;
-       private static final int CUSTOM_COLOR_RED = 3;
-       private static final int CUSTOM_COLOR_BROWN = 4;
-       private static final int CUSTOM_COLOR_PURPLE = 5;
-       private static final int CUSTOM_COLOR_NAVY = 6;
-       private static final int CUSTOM_COLOR_CHOCOLATE = 7;
-       private static final int CUSTOM_COLOR_INDIGO = 8;
-       private static final int CUSTOM_COLOR_MAGNETA = 9;
-       private static final int CUSTOM_COLOR_TEAL = 10;
-
-       private TimelineChartManager chartManager = null;
-       private Map<Long, DAChartSeries> customChartSeriesMap = new HashMap<Long, DAChartSeries>();
-       
-       public CustomLogParser(TimelineChartManager parent) {
-               chartManager = parent;
-       }
-
-       public void parseLogPackage(LogPackage logPack) {
-               Logs logs = logPack.getLogs(DataChannelConstants.MSG_PROBE_CUSTOM);
-               List<LogData> logList = logs.getRawLogs();
-
-               for (LogData log : logList) {
-                       parseLog((CustomData) log);
-               }
-       }
-
-       private void parseLog(CustomData log) {
-               String apiName = log.getApiName();
-
-               if (apiName.equals(API_NAME_CREATE_CHART)) {
-                       long chartHandle = Long.parseLong(log.getReturn());
-                       String chartName = log.getName();
-                       chartManager.addCustomChart(new UserCustomChart((int) chartHandle,
-                                       chartName));
-               } else if (apiName.equals(API_NAME_CREATE_SERIES)) {
-                       int chartType = log.getHandle();
-                       UserCustomChart chart = (UserCustomChart) chartManager
-                                       .getChartInstance(chartType);
-                       if (chart == null) {
-                               DA_LOG.debug("unrecognized chart handle"); //$NON-NLS-1$
-                               return;
-                       }
-
-                       long seriesHandle = Long.parseLong(log.getReturn());
-                       int seriesStyle = log.getType();
-                       String seriesName = log.getName();
-                       int colorIndex = log.getColor();
-                       if (colorIndex == CUSTOM_COLOR_AUTO) {
-                               colorIndex = chart.getUnusedColorIndex();
-                       }
-                       Color seriesColor = getCustomColor(colorIndex);
-                       if (seriesColor == null) {
-                               DA_LOG.debug("undefined custom color"); //$NON-NLS-1$
-                               return;
-                       }
-
-                       DAChartSeries series = new DAChartSeries(seriesName, seriesStyle,
-                                       seriesColor);
-                       chart.addTempSeries(series, colorIndex);
-                       customChartSeriesMap.put(seriesHandle, series);
-               } else if (apiName.equals(API_NAME_CREATE_DEFAULT_SERIES)) {
-                       int chartType = log.getType();
-                       UserCustomChart chart = (UserCustomChart) chartManager
-                                       .getChartInstance(chartType);
-                       if (chart == null) {
-                               DA_LOG.debug("unrecognized chart handle"); //$NON-NLS-1$
-                               return;
-                       }
-
-                       long seriesHandle = Long.parseLong(log.getReturn());
-                       int colorIndex = chart.getUnusedColorIndex();
-                       String seriesName = log.getName();
-
-                       DAChartSeries series = new DAChartSeries(seriesName,
-                                       DAChartSeries.SERIES_STYLE_LINE, getCustomColor(colorIndex));
-                       chart.addTempSeries(series, colorIndex);
-                       customChartSeriesMap.put(seriesHandle, series);
-               } else if (apiName.equals(API_NAME_DA_LOG)
-                               || apiName.equals(API_NAME_TIMER_THREAD)) {
-                       long seriesHandle = log.getHandle();
-                       double time = Double.parseDouble(Long.toString(log.getTime()))
-                                       / TimelineConstants.MEGA_DOUBLE;
-                       double value = log.getValue();
-                       DAChartSeries series = customChartSeriesMap.get(seriesHandle);
-                       series.addSeriesItem(new DAChartSeriesItem(time, value, String
-                                       .valueOf(value)));
-               }
-       }
-
-       public void clear() {
-               customChartSeriesMap.clear();
-       }
-
-       private Color getCustomColor(int colorType) {
-               switch (colorType) {
-               case CUSTOM_COLOR_BLUE:
-                       return ColorResources.BLUE;
-               case CUSTOM_COLOR_GREEN:
-                       return ColorResources.GREEN;
-               case CUSTOM_COLOR_RED:
-                       return ColorResources.RED;
-               case CUSTOM_COLOR_BROWN:
-                       return ColorResources.BROWN;
-               case CUSTOM_COLOR_PURPLE:
-                       return ColorResources.PURPLE;
-               case CUSTOM_COLOR_NAVY:
-                       return ColorResources.NAVY;
-               case CUSTOM_COLOR_CHOCOLATE:
-                       return ColorResources.CHOCOLATE;
-               case CUSTOM_COLOR_INDIGO:
-                       return ColorResources.INDIGO;
-               case CUSTOM_COLOR_MAGNETA:
-                       return ColorResources.MAGNETA;
-               case CUSTOM_COLOR_TEAL:
-                       return ColorResources.TEAL;
-               default:
-                       return null;
-               }
-       }
+    private static final String API_NAME_CREATE_CHART = "da_create_chart"; //$NON-NLS-1$
+    private static final String API_NAME_CREATE_SERIES = "da_create_series"; //$NON-NLS-1$
+    private static final String API_NAME_CREATE_DEFAULT_SERIES = "da_create_default_series"; //$NON-NLS-1$
+    private static final String API_NAME_DA_LOG = "da_log"; //$NON-NLS-1$
+    private static final String API_NAME_TIMER_THREAD = "timerThread"; //$NON-NLS-1$
+
+    private static final int CUSTOM_COLOR_AUTO = 0;
+    private static final int CUSTOM_COLOR_BLUE = 1;
+    private static final int CUSTOM_COLOR_GREEN = 2;
+    private static final int CUSTOM_COLOR_RED = 3;
+    private static final int CUSTOM_COLOR_BROWN = 4;
+    private static final int CUSTOM_COLOR_PURPLE = 5;
+    private static final int CUSTOM_COLOR_NAVY = 6;
+    private static final int CUSTOM_COLOR_CHOCOLATE = 7;
+    private static final int CUSTOM_COLOR_INDIGO = 8;
+    private static final int CUSTOM_COLOR_MAGNETA = 9;
+    private static final int CUSTOM_COLOR_TEAL = 10;
+
+    private TimelineChartManager chartManager = null;
+    private Map<Long, DAChartSeries> customChartSeriesMap = new HashMap<Long, DAChartSeries>();
+
+    public CustomLogParser(TimelineChartManager parent) {
+        chartManager = parent;
+    }
+
+    public void parseLogPackage(LogPackage logPack) {
+        Logs logs = logPack.getLogs(DataChannelConstants.MSG_PROBE_CUSTOM);
+        List<LogData> logList = logs.getRawLogs();
+
+        List<List<Object>> customDataList = new ArrayList<List<Object>>(); 
+        for (LogData log : logList) {
+            parseLog((CustomData)log, customDataList);
+        }
+
+        /*
+         * Add to CustomDataDB
+         */
+        CustomDataDBInserter.pushContextData(customDataList);
+        CustomDataDBInserter.startThread();
+    }
+
+    private void parseLog(CustomData log, List<List<Object>> customDataList) {
+        String apiName = log.getApiName();
+
+        if (apiName.equals(API_NAME_CREATE_CHART)) {
+            long chartHandle = Long.parseLong(log.getReturn());
+            String chartName = log.getName();
+            chartManager.addCustomChart(new UserCustomChart((int) chartHandle, chartName));
+        } else if (apiName.equals(API_NAME_CREATE_SERIES)) {
+            int chartType = log.getHandle();
+            UserCustomChart chart = (UserCustomChart) chartManager.getChartInstance(chartType);
+            if (chart == null) {
+                 DA_LOG.debug("CustomLogParser.java : unrecognized chart handle"); //$NON-NLS-1$
+                return;
+            }
+
+            long seriesHandle = Long.parseLong(log.getReturn());
+            int seriesStyle = log.getType();
+            String seriesName = log.getName();
+            int colorIndex = log.getColor();
+            if (colorIndex == CUSTOM_COLOR_AUTO) {
+                colorIndex = chart.getUnusedColorIndex();
+            }
+            Color seriesColor = getCustomColor(colorIndex);
+            if (seriesColor == null) {
+                 DA_LOG.debug("CustomLogParser.java : undefined custom color"); //$NON-NLS-1$
+                return;
+            }
+
+            DAChartSeries series = new DAChartSeries(seriesName, seriesStyle, seriesColor);
+            chart.addTempSeries(series, colorIndex);
+            customChartSeriesMap.put(seriesHandle, series);
+        } else if (apiName.equals(API_NAME_CREATE_DEFAULT_SERIES)) {
+            int chartType = log.getType();
+            UserCustomChart chart = (UserCustomChart) chartManager.getChartInstance(chartType);
+            if (chart == null) {
+                 DA_LOG.debug("unrecognized chart handle"); //$NON-NLS-1$
+                return;
+            }
+
+            long seriesHandle = Long.parseLong(log.getReturn());
+            int colorIndex = chart.getUnusedColorIndex();
+            String seriesName = log.getName();
+
+            DAChartSeries series =
+                    new DAChartSeries(seriesName, DAChartSeries.SERIES_STYLE_LINE,
+                                      getCustomColor(colorIndex));
+            chart.addTempSeries(series, colorIndex);
+            customChartSeriesMap.put(seriesHandle, series);
+        } else if (apiName.equals(API_NAME_DA_LOG) || apiName.equals(API_NAME_TIMER_THREAD)) {
+            long seriesHandle = log.getHandle();
+            double time =
+                    Double.parseDouble(Long.toString(log.getTime()))
+                            / TimelineConstants.MEGA_DOUBLE;
+            double value = log.getValue();
+
+            /*
+             * Make data to insert CustomDB
+             */
+            ArrayList<Object> dbCustomData = new ArrayList<Object>();
+            dbCustomData.add(new Long(log.getTime()));
+            dbCustomData.add(new Integer(log.getHandle()));
+            dbCustomData.add(new Float(log.getValue()));
+            customDataList.add(dbCustomData);
+
+            DAChartSeries series = customChartSeriesMap.get(seriesHandle);
+//            series.addSeriesItem(new DAChartSeriesItem(time, value, String.valueOf(value)));
+        }
+    }
+
+    public void clear() {
+        customChartSeriesMap.clear();
+    }
+
+    private Color getCustomColor(int colorType) {
+        switch (colorType) {
+            case CUSTOM_COLOR_BLUE:
+                return ColorResources.BLUE;
+            case CUSTOM_COLOR_GREEN:
+                return ColorResources.GREEN;
+            case CUSTOM_COLOR_RED:
+                return ColorResources.RED;
+            case CUSTOM_COLOR_BROWN:
+                return ColorResources.BROWN;
+            case CUSTOM_COLOR_PURPLE:
+                return ColorResources.PURPLE;
+            case CUSTOM_COLOR_NAVY:
+                return ColorResources.NAVY;
+            case CUSTOM_COLOR_CHOCOLATE:
+                return ColorResources.CHOCOLATE;
+            case CUSTOM_COLOR_INDIGO:
+                return ColorResources.INDIGO;
+            case CUSTOM_COLOR_MAGNETA:
+                return ColorResources.MAGNETA;
+            case CUSTOM_COLOR_TEAL:
+                return ColorResources.TEAL;
+            default:
+                return null;
+        }
+    }
+
+    public void inputChartSeries(List<List<Object>> customDBData) {
+        for (int i = 0; i < customDBData.size(); i++) {
+            List<Object> row = customDBData.get(i);
+
+            double time = (Long)row.get(CustomDataDBTable.COLUMN.TIME.ordinal())
+                    / TimelineConstants.MEGA_DOUBLE;
+            long seriesHandle = (Integer)row.get(CustomDataDBTable.COLUMN.CHART_HANDLE.ordinal());
+            double value = (Float)row.get(CustomDataDBTable.COLUMN.CHART_VALUE.ordinal());
+            
+            DAChartSeries series = customChartSeriesMap.get(seriesHandle);
+            series.addSeriesItem(new DAChartSeriesItem(time, value, String.valueOf(value)));
+        }
+    }
 }
index 017c7a4..d1a4b03 100644 (file)
@@ -1,33 +1,17 @@
 package org.tizen.dynamicanalyzer.ui.timeline.logparser;
 
-import java.util.List;
-
 import org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants;
 import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
 import org.tizen.dynamicanalyzer.swap.logparser.Logs;
 import org.tizen.dynamicanalyzer.ui.opengl.ui.chart.GLFrameRateChart;
-import org.tizen.dynamicanalyzer.ui.timeline.chart.TimelineChart;
-import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineChartManager;
 
 public class DeviceLogParser {
-       private TimelineChartManager timelineChartManager = null;
        private GLFrameRateChart frameRateChart = GLFrameRateChart.getInstance();
 
-       public DeviceLogParser(TimelineChartManager parent) {
-               timelineChartManager = parent;
-       }
-
        public void parseLogPackage(LogPackage logPack) {
                Logs deviceLogs = logPack.getLogs(DataChannelConstants.MSG_DATA_SYSTEM);
                if (deviceLogs != null && deviceLogs.getRawLogs() != null
                                && deviceLogs.getRawLogs().size() > 0) {
-                       List<TimelineChart> chartList = timelineChartManager.getChartList();
-                       for (TimelineChart chart : chartList) {
-                               if (chart.getProbeType() == DataChannelConstants.MSG_DATA_SYSTEM) {
-                                       chart.parseLogPackage(logPack);
-                               }
-                       }
-
                        frameRateChart.parseLogPackage(logPack);
                }
        }
index f5de68b..936d53d 100755 (executable)
@@ -471,4 +471,8 @@ public class AnalyzerUtil {
                }
                return returnStr;
        }
+       
+       public static long translateSecToMicroSec(double sec) {
+               return (long)(sec * 1000000.0);
+       }
 }