INTERNAL: modify potential bugs 93/27593/1
authorgreatim <jaewon81.lim@samsung.com>
Tue, 16 Sep 2014 10:09:40 +0000 (19:09 +0900)
committergreatim <jaewon81.lim@samsung.com>
Tue, 16 Sep 2014 10:09:40 +0000 (19:09 +0900)
modify potential bugs

Change-Id: I56c8c37153ccb4f7d9c02e9189dcf28bb0633348
Signed-off-by: greatim <jaewon81.lim@samsung.com>
22 files changed:
org.tizen.dynamicanalyzer.workbench/src/org/tizen/dynamicanalyzer/workbench/Application.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/AnalyzerManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/communicator/Communicator22.java [deleted file]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/communicator/ReceiveCommunicator.java [deleted file]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/database/SqlConnectionManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/logparser/LogParser.java [deleted file]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/logparser/MessageProcess.java [deleted file]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/model/DeviceInfo.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/project/Project.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/sql/DBTableManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/sql/SqlManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/channel/data/BasicDataMessage.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/communicator/Communicator30.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/logparser/MessageParser.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/logparser/SWAPLogParser.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/format/CommonColumns.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/format/LogFormat.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/info/callstack/CallStackManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/kernel/ContextSwitchingChart.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/kernel/data/KernelDataManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/page/UpdateViewTimer.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/StopLogProcessor.java

index 3df0420..629e1ab 100755 (executable)
@@ -127,7 +127,7 @@ public class Application implements IApplication {
                        dialog.setMessage(WorkbenchLabels.TIZEN_SDK_PATH_ERROR);
                        dialog.setIcon(ImageResources.DIALOG_WARNING_ICON);
                        dialog.open();
-                       System.exit(-1);
+                       return IApplication.EXIT_OK;
                }
                
                // TODO : how to set log level?
index cfb0a3b..2261c2d 100755 (executable)
@@ -137,20 +137,22 @@ public class AnalyzerManager {
 
        public static void clear() {
                if (null != project) {
-                       if (!project.isValid()) {
-                               String sourcePath = project.getSavePath();
-                               if (null != sourcePath && !sourcePath.isEmpty()) {
-                                       boolean success = AnalyzerUtil.deleteFile(new File(sourcePath));
-                                       if (success) {
-                                               // logs for debug
-                                               Logger.debug("invalid project deleted!"); //$NON-NLS-1$
-                                       } else {
-                                               Logger.debug("invalid project delete fail..."); //$NON-NLS-1$
+                       synchronized (project) {
+                               if (!project.isValid()) {
+                                       String sourcePath = project.getSavePath();
+                                       if (null != sourcePath && !sourcePath.isEmpty()) {
+                                               boolean success = AnalyzerUtil.deleteFile(new File(sourcePath));
+                                               if (success) {
+                                                       // logs for debug
+                                                       Logger.debug("invalid project deleted!"); //$NON-NLS-1$
+                                               } else {
+                                                       Logger.debug("invalid project delete fail..."); //$NON-NLS-1$
+                                               }
                                        }
                                }
+                               project.dispose();
+                               project = null;
                        }
-                       project.dispose();
-                       project = null;
                }
 
                imageSet = null;
@@ -293,8 +295,7 @@ public class AnalyzerManager {
                if (!AnalyzerManager.isExit()) {
                        Project project = new Project();
                        project.initForTrace();
-                       Logger.performance("TEST", "Start Trace",
-                                       "Create and Initialize Project data");
+                       Logger.performance("TEST", "Start Trace", "Create and Initialize Project data");
                }
 
                if (!AnalyzerManager.isExit()) {
@@ -354,7 +355,11 @@ public class AnalyzerManager {
 
        public static Map<Long, Integer> getFuncIDMapByPid(int pid) {
                if (funcIDMapByPid == null) {
-                       funcIDMapByPid = new ConcurrentHashMap<Integer, ConcurrentHashMap<Long, Integer>>();
+                       synchronized (AnalyzerManager.class) {
+                               if (funcIDMapByPid == null) {
+                                       funcIDMapByPid = new ConcurrentHashMap<Integer, ConcurrentHashMap<Long, Integer>>();
+                               }
+                       }
                }
                ConcurrentHashMap<Long, Integer> funcIDMap = funcIDMapByPid.get(pid);
                if (funcIDMap == null) {
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/communicator/Communicator22.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/communicator/Communicator22.java
deleted file mode 100755 (executable)
index a8e9742..0000000
+++ /dev/null
@@ -1,428 +0,0 @@
-/*
- *  Dynamic Analyzer
- *
- * Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: 
- * Jaewon Lim <jaewon81.lim@samsung.com>
- * Jooyoul Lee <jy.exe.lee@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.communicator;
-
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.OutputStreamWriter;
-import java.net.Socket;
-import java.net.SocketException;
-import java.net.SocketTimeoutException;
-import java.net.UnknownHostException;
-
-import org.eclipse.swt.widgets.Display;
-import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
-import org.tizen.dynamicanalyzer.common.AnalyzerManager;
-import org.tizen.dynamicanalyzer.common.AnalyzerShellCommands;
-import org.tizen.dynamicanalyzer.common.GlobalInformation;
-import org.tizen.dynamicanalyzer.common.HostResult;
-import org.tizen.dynamicanalyzer.constant.CommonConstants;
-import org.tizen.dynamicanalyzer.model.DeviceInfo;
-import org.tizen.dynamicanalyzer.project.AppInfo;
-import org.tizen.dynamicanalyzer.project.PackageInfo;
-import org.tizen.dynamicanalyzer.swap.channel.control.EventObject;
-import org.tizen.dynamicanalyzer.swap.channel.control.ReplayEvent;
-import org.tizen.dynamicanalyzer.swap.logparser.DataManagerRegistry;
-import org.tizen.dynamicanalyzer.ui.page.UpdateViewTimer;
-import org.tizen.dynamicanalyzer.ui.toolbar.ConfigureManager;
-import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
-import org.tizen.dynamicanalyzer.util.CommonUtil;
-import org.tizen.dynamicanalyzer.util.Logger;
-
-public class Communicator22 extends BaseCommunicator {
-       protected int remotePort = -1;
-       private Socket controlSock = null;
-       private BufferedWriter controlWriter = null;
-       private BufferedReader controlReader = null;
-
-       private Socket dataSock = null;
-       private BufferedWriter dataWriter = null;
-       private BufferedReader dataReader = null;
-
-       @Override
-       public HostResult init(DeviceInfo deviceInfo) {
-               controlSock = null;
-               dataSock = null;
-               controlWriter = null;
-               controlReader = null;
-               dataWriter = null;
-               dataReader = null;
-               remotePort = -1;
-               return HostResult.SUCCESS;
-       }
-
-       @Override
-       public HostResult startTrace() {
-               HostResult result = connectionProcess();
-               if (!result.equals(HostResult.SUCCESS)) {
-                       Logger.debug(result.toString());
-                       Display.getDefault().syncExec(new Runnable() {
-                               @Override
-                               public void run() {
-                                       ToolbarArea.getInstance().setStartButtonEnablement(true);
-                                       ToolbarArea.getInstance().setSettingsButtonEnablement(true);
-                               }
-                       });
-                       return result;
-               }
-
-               if (!AnalyzerManager.isExit()) {
-                       result = sendStartMessage();
-                       if (!result.isSuccess()) {
-                               DACommunicator.setRunning(false);
-                               return result;
-                       }
-
-                       ToolbarArea.getInstance().startTimer();
-                       // start data manager threads
-                       DataManagerRegistry.startThreads();
-
-                       /* Timeline */
-                       UpdateViewTimer.start();
-                       Logger.debug("Start recorder, timer, log parser, file, thread, ui, profile , update timer");
-                       result = HostResult.SUCCESS;
-                       result.setMessage("start trace");
-               } else {
-                       result = HostResult.ERR_DA_IS_EXIT;
-               }
-               return result;
-       }
-
-       @Override
-       public HostResult sendConfigurationMessage(DeviceInfo devInfo, int type,
-                       String msg) {
-               long state = ConfigureManager.getInstance().getConfiguration(devInfo);
-               String statestr = Long.toString(state);
-               String message = AnalyzerConstants.MSG_OPTION
-                               + CommonConstants.CMD_SPLIT + statestr.length()
-                               + CommonConstants.CMD_SPLIT + statestr;
-
-               HostResult result = handleControlMessage(message);
-               if (result.equals(HostResult.SUCCESS)) {
-                       Logger.debug("screenshot message ack :" + result.getMessage());
-                       String[] splitResult = result.getMessage().split(
-                                       CommonConstants.CMD_SPLIT_READ);
-                       if (AnalyzerConstants.MSG_OK.equals(splitResult[0])) {
-                               return result;
-                       } else {
-                               result = HostResult.ERR_MSG_RUNTIME_FAIL;
-                               result.setMessage(new String(splitResult[0]));
-                       }
-               }
-               return result;
-       }
-
-       @Override
-       public HostResult stopTrace() {
-               return sendStopMessage();
-       }
-
-       @Override
-       public HostResult exit() {
-               return HostResult.SUCCESS;
-       }
-
-       private HostResult sendStartMessage() {
-               int isArm = 0;
-               int isEmul = 0;
-               int res = 0;
-
-               ReplayEvent rep = new ReplayEvent();
-               rep.getEventObjects().add(new EventObject());
-               rep.getEventObjects().add(new EventObject());
-
-               if (!CommunicatorUtils.isCurrentDeviceArmArch()) {
-                       isArm = 1;
-               }
-
-               DeviceInfo device = GlobalInformation.getCurrentDeviceInfo();
-               if (device == null) {
-                       return HostResult.ERR_DEVICE_IS_NULL;
-               }
-
-               if (device.getIDevice().getSerialNumber()
-                               .startsWith(CommonConstants.EMULATOR)) {
-                       isEmul = 1;
-               }
-
-               PackageInfo pkg = GlobalInformation.getCurrentApplication();
-               if (null == pkg) {
-                       return HostResult.ERR_SELECTED_APP_IS_NULL;
-               }
-               String rearMessage = CommonConstants.EMPTY + res + isEmul + isArm
-                               + CommonConstants.CMD_SPLIT
-                               + ConfigureManager.getInstance().getConfiguration(device)
-                               + CommonConstants.CMD_SPLIT
-                               + pkg.getMainApp().getInfo(AppInfo.PROPERTY.EXEC.index);
-
-               String message = AnalyzerConstants.MSG_START
-                               + CommonConstants.CMD_SPLIT + rearMessage.length()
-                               + CommonConstants.CMD_SPLIT + rearMessage;
-               Logger.debug("Send message :" + message); //$NON-NLS-1$
-
-               HostResult result = handleControlMessage(message);
-               if (result.equals(HostResult.SUCCESS)) {
-                       Logger.debug("start message ack :" + result.getMessage());
-                       String[] splitResult = result.getMessage().split(
-                                       CommonConstants.CMD_SPLIT_READ);
-                       if (AnalyzerConstants.MSG_OK.equals(splitResult[0])) {
-                               return result;
-                       } else {
-                               result = HostResult.ERR_MSG_START_FAIL;
-                               result.setMessage(new String(splitResult[0]));
-                       }
-               }
-               return result;
-       }
-
-       private HostResult sendStopMessage() {
-               HostResult result = null;
-
-               if (DACommunicator.isRunning()) {
-                       String message = AnalyzerConstants.MSG_STOP
-                                       + CommonConstants.CMD_SPLIT + 0 + CommonConstants.CMD_SPLIT;
-                       Logger.debug("stop send message :" + message);
-
-                       result = handleControlMessage(message);
-                       if (result.equals(HostResult.SUCCESS)) {
-                               Logger.debug("stop message ack :" + result.getMessage());
-                               String[] splitResult = result.getMessage().split(
-                                               CommonConstants.CMD_SPLIT_READ);
-                               if (AnalyzerConstants.MSG_OK.equals(splitResult[0])) {
-                                       return result;
-                               } else {
-                                       result = HostResult.ERR_MSG_STOP_FAIL;
-                                       result.setMessage(new String(splitResult[0]));
-                               }
-                       }
-               } else {
-                       result = HostResult.ERR_MSG_SEND_FAIL;
-               }
-               return result;
-       }
-
-       public HostResult handleControlMessage(String message) {
-               HostResult result = null;
-               String str = null;
-               try {
-                       if (null != controlSock && !controlSock.isClosed()) {
-                               controlWriter.write(message);
-                               controlWriter.flush();
-                       }
-
-                       Logger.debug("wait for ack... [send message : " + message + " ]");
-                       while (DACommunicator.isRunning()) {
-                               char cbuf[] = new char[64];
-                               blocked = true;
-                               int readsize = controlReader.read(cbuf);
-                               blocked = false;
-                               if (readsize > 0) {
-                                       str = String.copyValueOf(cbuf, 0, readsize);
-                                       if (null != str && !str.isEmpty()) {
-                                               result = HostResult.SUCCESS;
-                                               result.setMessage(str);
-                                               break;
-                                       }
-                               }
-                       }
-               } catch (SocketException e) {
-                       result = HostResult.ERR_EXCEPTION_OCCURRED;
-                       result.setMessage(e.getMessage());
-                       e.printStackTrace();
-                       return result;
-               } catch (SocketTimeoutException e) {
-                       result = HostResult.ERR_EXCEPTION_OCCURRED;
-                       result.setMessage(e.getMessage());
-                       e.printStackTrace();
-                       return result;
-               } catch (IOException e) {
-                       result = HostResult.ERR_EXCEPTION_OCCURRED;
-                       result.setMessage(e.getMessage());
-                       e.printStackTrace();
-                       return result;
-               } finally {
-                       blocked = false;
-               }
-               return result;
-       }
-
-       private HostResult connectionProcess() {
-               HostResult result = null;
-               // step 1. check readelf and upload
-               if (CommunicatorUtils.getReadelfSize() < 0) {
-                       Logger.debug("upload readelf");
-                       result = CommunicatorUtils.uploadReadElf();
-                       Logger.debug(result.toString());
-                       if (!result.isSuccess()) {
-                               return result;
-                       }
-               }
-
-               // step 2. run da_manager
-               CommunicatorUtils
-                               .execCommand(AnalyzerShellCommands.DACOMMAND_RUN_MANAGER);
-
-               // step 3. get remote port from /tmp/port.da in device or emul
-               remotePort = CommunicatorUtils.getRemotePort(GlobalInformation
-                               .getCurrentDeviceInfo().getIDevice());
-               if (remotePort < 0) {
-                       return HostResult.ERR_REMOTE_PORT_GET_FAILED;
-               }
-
-               // step 4. port foward
-               result = CommunicatorUtils.foward(CommunicatorUtils.LOCAL_PORT,
-                               remotePort);
-               Logger.debug(result.toString());
-               if (!HostResult.SUCCESS.equals(result)) {
-                       return result;
-               }
-
-               // step 5. set da_communicator is running!
-               DACommunicator.setRunning(true);
-
-               // step 6. create sockets
-
-               result = createControlSocket(CommunicatorUtils.LOCAL_PORT);
-               if (!result.equals(HostResult.SUCCESS)) {
-                       DACommunicator.setRunning(false);
-                       Logger.debug(result.toString());
-                       return result;
-               }
-
-               result = createDataSocket(CommunicatorUtils.LOCAL_PORT);
-               if (!result.equals(HostResult.SUCCESS)) {
-                       DACommunicator.setRunning(false);
-                       Logger.debug(result.toString());
-                       return result;
-               }
-
-               return HostResult.printAndReturn(HostResult.SUCCESS);
-       }
-
-       private HostResult createControlSocket(int port) {
-               HostResult result = HostResult.SUCCESS;
-               try {
-                       controlSock = new Socket(CommonConstants.LOCAL_HOST, port);
-                       if (null == controlSock) {
-                               result = HostResult.ERR_CONTROL_SOCKET_CREATION_FAIL;
-                               Logger.debug(result.toString());
-                               return result;
-                       }
-
-                       controlSock.setSoTimeout(AnalyzerConstants.DATA_SOCKET_TIMEOUT);
-                       controlSock.setReuseAddress(true);
-                       controlSock.setTcpNoDelay(true);
-
-                       controlReader = new BufferedReader(new InputStreamReader(
-                                       controlSock.getInputStream()));
-                       controlWriter = new BufferedWriter(new OutputStreamWriter(
-                                       controlSock.getOutputStream()));
-               } catch (SocketTimeoutException e) {
-                       result = HostResult.ERR_EXCEPTION_OCCURRED;
-                       result.setMessage(e.getMessage());
-                       Logger.debug(result.toString());
-                       e.printStackTrace();
-               } catch (UnknownHostException e) {
-                       result = HostResult.ERR_EXCEPTION_OCCURRED;
-                       result.setMessage(e.getMessage());
-                       e.printStackTrace();
-               } catch (IOException e) {
-                       result = HostResult.ERR_EXCEPTION_OCCURRED;
-                       result.setMessage(e.getMessage());
-                       e.printStackTrace();
-               }
-               return result;
-       }
-
-       private HostResult createDataSocket(int port) {
-               HostResult result = HostResult.SUCCESS;
-               try {
-                       dataSock = new Socket(CommonConstants.LOCAL_HOST, port);
-                       if (null == dataSock) {
-                               result = HostResult.ERR_DATA_SOCKET_CREATION_FAIL;
-                               Logger.debug(result.toString());
-                               return result;
-                       }
-
-                       dataSock.setSoTimeout(AnalyzerConstants.DATA_SOCKET_TIMEOUT);
-                       dataSock.setReuseAddress(true);
-                       dataSock.setTcpNoDelay(true);
-
-                       dataReader = new BufferedReader(new InputStreamReader(
-                                       dataSock.getInputStream()));
-                       dataWriter = new BufferedWriter(new OutputStreamWriter(
-                                       dataSock.getOutputStream()));
-
-                       new Thread(null, new ReceiveCommunicator(),
-                                       AnalyzerConstants.COMMUNICATOR_RECEIVE_THREAD).start();
-                       Logger.debug("Receive Thread start");
-               } catch (SocketTimeoutException e) {
-                       result = HostResult.ERR_EXCEPTION_OCCURRED;
-                       result.setMessage(e.getMessage());
-                       Logger.debug(result.toString());
-                       e.printStackTrace();
-               } catch (UnknownHostException e) {
-                       result = HostResult.ERR_EXCEPTION_OCCURRED;
-                       result.setMessage(e.getMessage());
-                       e.printStackTrace();
-               } catch (IOException e) {
-                       result = HostResult.ERR_EXCEPTION_OCCURRED;
-                       result.setMessage(e.getMessage());
-                       e.printStackTrace();
-               }
-
-               return result;
-       }
-
-       public void closeSocket() {
-               CommonUtil.tryClose(dataReader, dataWriter, dataSock, controlReader,
-                               controlWriter, controlSock);
-       }
-
-       @Override
-       public BufferedReader getDataBufferedReader() {
-               return dataReader;
-       }
-
-       @Override
-       public void clear() {
-               closeSocket();
-               CommunicatorUtils.unfoward(CommunicatorUtils.LOCAL_PORT, remotePort);
-       }
-
-       public Socket getDataSocket() {
-               return dataSock;
-       }
-
-       @Override
-       public void closeSock() {
-               closeSocket();
-               CommunicatorUtils.unfoward(CommunicatorUtils.LOCAL_PORT, remotePort);
-       }
-}
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/communicator/ReceiveCommunicator.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/communicator/ReceiveCommunicator.java
deleted file mode 100644 (file)
index db4f320..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *  Dynamic Analyzer
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: 
- * Jaewon Lim <jaewon81.lim@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.communicator;
-
-import org.tizen.dynamicanalyzer.logparser.MessageProcess;
-
-
-public class ReceiveCommunicator implements Runnable {
-
-       @Override
-       public void run() {
-               MessageProcess.getInstance().startMessageParsing(
-                               DACommunicator.getSockBufferedReader());
-       }
-}
index 9608002..e0ac52c 100644 (file)
@@ -48,6 +48,8 @@ public class SqlConnectionManager {
        private static final int CONNECTION_COUNT_QUERY = 8;
        private static BlockingQueue<Connection> updateConnections = null;
        private static BlockingQueue<Connection> queryConnections = null;
+       private static Object updateConnectionLock = new Object();
+       private static Object queryConnectionLock = new Object();
        private static int realUpdateConnCount = 0;
        private static int realQueryConnCount = 0;
 
@@ -129,14 +131,14 @@ public class SqlConnectionManager {
 
                        // close update connection
                        if (updateConnections != null) {
-                               synchronized (updateConnections) {
-                                       while (updateConnections.size() != realUpdateConnCount) {
-                                               // wait until other execution is finished
-                                               try {
-                                                       updateConnections.wait();
-                                               } catch (InterruptedException e) {
-                                                       e.printStackTrace();
+                               while (updateConnections.size() != realUpdateConnCount) {
+                                       // wait until other execution is finished
+                                       try {
+                                               synchronized (updateConnectionLock) {
+                                                       updateConnectionLock.wait();
                                                }
+                                       } catch (InterruptedException e) {
+                                               e.printStackTrace();
                                        }
                                }
 
@@ -153,14 +155,14 @@ public class SqlConnectionManager {
 
                        // close query connection
                        if (queryConnections != null) {
-                               synchronized (queryConnections) {
-                                       while (queryConnections.size() != realQueryConnCount) {
-                                               // wait until other execution is finished
-                                               try {
-                                                       queryConnections.wait();
-                                               } catch (InterruptedException e) {
-                                                       e.printStackTrace();
+                               while (queryConnections.size() != realQueryConnCount) {
+                                       // wait until other execution is finished
+                                       try {
+                                               synchronized (queryConnectionLock) {
+                                                       queryConnectionLock.wait();
                                                }
+                                       } catch (InterruptedException e) {
+                                               e.printStackTrace();
                                        }
                                }
 
@@ -214,8 +216,8 @@ public class SqlConnectionManager {
                if (conn != null) {
                        try {
                                updateConnections.put(conn);
-                               synchronized (updateConnections) {
-                                       updateConnections.notifyAll();
+                               synchronized (updateConnectionLock) {
+                                       updateConnectionLock.notifyAll();
                                }
                        } catch (InterruptedException e) {
                                e.printStackTrace();
@@ -240,8 +242,8 @@ public class SqlConnectionManager {
                if (conn != null) {
                        try {
                                queryConnections.put(conn);
-                               synchronized (queryConnections) {
-                                       queryConnections.notifyAll();
+                               synchronized (queryConnectionLock) {
+                                       queryConnectionLock.notifyAll();
                                }
                        } catch (InterruptedException e) {
                                e.printStackTrace();
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/logparser/LogParser.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/logparser/LogParser.java
deleted file mode 100644 (file)
index d56d3a8..0000000
+++ /dev/null
@@ -1,748 +0,0 @@
-/*
- *  Dynamic Analyzer
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: 
- * Jaewon Lim <jaewon81.lim@samsung.com>
- * Jooyoul Lee <jy.exe.lee@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.logparser;
-
-import java.util.List;
-
-import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
-import org.tizen.dynamicanalyzer.common.AnalyzerManager;
-import org.tizen.dynamicanalyzer.constant.CommonConstants;
-import org.tizen.dynamicanalyzer.project.FunctionNameManager;
-import org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants;
-import org.tizen.dynamicanalyzer.swap.model.data.LogData;
-import org.tizen.dynamicanalyzer.swap.model.data.LogDataFactory;
-import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
-import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
-import org.tizen.dynamicanalyzer.util.ByteUtil;
-import org.tizen.dynamicanalyzer.util.Logger;
-
-public class LogParser implements Runnable {
-       private static Thread logParser = null;
-       private static boolean dropCallTraceLog = false;
-       private static LogQueue logQueue = null;
-
-       // private static boolean isLogParsingComplete = false;
-
-       public static void clear() {
-               stopLogParser();
-               getLogQueue().clear();
-               // isLogParsingComplete = false;
-       }
-
-       public static LogQueue getLogQueue() {
-               if (null == logQueue) {
-                       logQueue = new LogQueue();
-               }
-               return logQueue;
-       }
-
-       public static void setDropCallTraceLog(boolean drop) {
-               dropCallTraceLog = drop;
-       }
-
-       public static boolean isDropCallTraceLog() {
-               return dropCallTraceLog;
-       }
-
-       public static void startLogParser() {
-               if (null == logParser || !logParser.isAlive()) {
-                       logParser = new Thread(null, new LogParser(),
-                                       AnalyzerConstants.LOG_QUEUE_OBSERVING_THREAD);
-                       logParser.start();
-               }
-       }
-
-       public static void stopLogParser() {
-               if (null != logParser && logParser.isAlive()) {
-                       LogQueue logQueue = getLogQueue();
-                       synchronized (logQueue) {
-                               logQueue.notifyAll();
-                       }
-                       try {
-                               Logger.debug("wait for log parser join");//$NON-NLS-1$
-                               logParser.join(AnalyzerConstants.THREAD_JOIN_WAIT_TIME);
-                       } catch (InterruptedException e) {
-                               e.printStackTrace();
-                       }
-               }
-       }
-
-       /*** log parsing thread ***/
-       @Override
-       public void run() {
-               AnalyzerManager.setLogParsingComplete(false);
-               LogQueue logQueue = getLogQueue();
-               while (!AnalyzerManager.isExit()) {
-                       List<String> logs = logQueue.getFirst();
-                       if (null == logs) {
-                               break;
-                       }
-                       logSlicing(logs);
-               }
-
-               /* log for debug */
-               Logger.debug("log parsing thread end!!"); //$NON-NLS-1$
-               AnalyzerManager.setLogParsingComplete(true);
-
-               if (!AnalyzerManager.isExit()) {
-                       ToolbarArea.getInstance().stopTimer();
-               }
-       }
-
-       private void checkProbeCommon(String[] input, LogData ld) {
-               // ProbeCommonData data = (ProbeCommonData) ld;
-               // int iVal = 0;
-               // long lVal = 0;
-               // String sVal = null;
-               // float fVal = 0;
-               //
-               // iVal = data.getApiId();
-               // iVal = data.getPid();
-               // iVal = data.getTid();
-               // sVal = data.getArgs();
-               // lVal = data.getReturn();
-               // lVal = data.getErrno();
-               // iVal = data.getInternalCall();
-               // lVal = data.getCallerPcAddr();
-               // iVal = data.getReserved1();
-               // iVal = data.getReserved2();
-       }
-
-       private void logSlicing(List<String> logLumb) {
-               // String[] slicedLog2 = null;
-               // Project project = AnalyzerManager.getProject();
-               //
-               // int size = logLumb.size();
-               // LogPackage logPack = new LogPackage();
-               //
-               // for (int i = 0; i < size; i++) {
-               // if (logLumb.get(i).isEmpty()) {
-               // continue;
-               // }
-               // String[] input = logLumb.get(i).split(CommonConstants.NEW_LINE);
-               //
-               // slicedLog2 = input[0].split(AnalyzerConstants.DATA_PARSING_TOKEN);
-               //
-               // BasicDataMessage message = new BasicDataMessage();
-               // message.makeData(slicedLog2);
-               // if (message.getId() == AnalyzerConstants.MSG_DATA_SAMPLE) {
-               // message.setCallstack(input[1]);
-               // }
-               // LogData log = LogDataFactory.createInstance(message);
-               // int id = log.getId();
-               //
-               // // if (log instanceof SystemData) {
-               // // testSystemData(input, log);
-               // // } else if (log instanceof ScreenShotData) {
-               // // testScreenshotData(input, log);
-               // // }
-               //
-               // if (log instanceof ProbeCommonData) {
-               // if (-1 == pid) {
-               // pid = ((ProbeCommonData) log).getPid();
-               // } else {
-               // int p = ((ProbeCommonData) log).getPid();
-               // if (pid != p) {
-               // continue;
-               // }
-               // }
-               // }
-               //
-               // // ADJUST TIME
-               // // long longTime = log.getTime();
-               // // DATime startTime = project.getStartTime();
-               // //
-               // // if (0 == startTime.getSec() && 0 == startTime.getNano()) {
-               // // long sec = longTime / 10000;
-               // // long nano = longTime % 10000;
-               // // nano *= 100000;
-               // // startTime.setSec(sec);
-               // // startTime.setNano(nano);
-               // // project.setStartTime(startTime);
-               // // }
-               // // long lastTime = longTime - startTime;
-               // // lastTime *= 100;
-               // // log.setTime(lastTime);
-               //
-               // int seqNum = log.getSeq();
-               // if (log instanceof UserFunctionData) {
-               // UserFunctionData ufData = (UserFunctionData) log;
-               // String apiName = ufData.getApiName();
-               // if (null == apiName || apiName.isEmpty()
-               //                                              || apiName.equals("_end")) { //$NON-NLS-1$
-               // setFuncName(ufData);
-               // }
-               //
-               // if (LogParser.isDrapCallTraceLog()) {
-               // apiName = ufData.getApiName();
-               // if (!apiName.equals(OSP_MAIN)) {
-               // continue;
-               // }
-               // LogParser.setDropCallTraceLog(false);
-               // }
-               // long binaryStartAddr = ufData.getLowPc();
-               // long binaryEndAddr = ufData.getHighPc();
-               //
-               // if (binaryStartAddr > 0 && binaryEndAddr > 0
-               // && !AnalyzerManager.isBinStartEndSet()) {
-               // AnalyzerManager.setBinaryStartEndAddr(binaryStartAddr,
-               // binaryEndAddr);
-               // }
-               //
-               // if (AnalyzerManager.getCallstackManager().isIrregularUserCall(
-               // ufData)) {
-               // continue;
-               // }
-               // pushLog(log, message, logPack);
-               // /* user callstack create by entry and exit */
-               // AnalyzerManager.getCallstackManager().makeUserCallstack(
-               // ufData,
-               // FunctionUsageProfiler.getInstance()
-               // .getProfileDataMaker());
-               // } else if (log instanceof SystemData) {
-               // if (seqNum == 1) {
-               // UIRecorderPlayThread rp = UIRecorderTool.getInstance()
-               // .getPlayThead();
-               // if (null != rp && rp.isAlive()) {
-               // UIRecorderTool.getInstance().getPlayThead().interrupt();
-               // }
-               // }
-               // pushLog(log, message, logPack);
-               // } else if (log instanceof ProfileData) {
-               // pushLog(log, message, logPack);
-               // } else {
-               // if (log instanceof ScreenShotData) {
-               // String remoteImgPath = ((ScreenShotData) log)
-               // .getImageFilePath();
-               // String rotate = Integer.toString(((ScreenShotData) log)
-               // .getOrientation());
-               // // TODO : fix
-               // processImage(remoteImgPath, rotate);
-               // }
-               // pushLog(log, message, logPack);
-               // AnalyzerManager.getCallstackManager()
-               // .makeCallstackWithoutBacktrace(log);
-               // if (id == AnalyzerConstants.MSG_PROBE_FILE
-               // || id == AnalyzerConstants.MSG_PROBE_MEMORY) {
-               // AnalyzerManager.getLeakDetector().runLeakDectect(log);
-               // }
-               //
-               // AnalyzerManager.getFailedChecker().check(log,
-               // AnalyzerManager.getCallstackManager());
-               // }
-               //
-               // // set last log number
-               // AnalyzerManager.getProject().setLastLogNum(seqNum, id);
-               // }
-               //
-               // updateLog(logPack);
-       }
-
-       // private void processImage(final String from, String rotate) {
-       // final String fileName = getImageName(from);
-       // final String to = AnalyzerManager.getProject().getSavePath()
-       // + File.separator + AnalyzerConstants.IMAGE_FOLDER_NAME
-       // + File.separator + fileName;
-       // final int angle = Integer.parseInt(rotate);
-       // if (angle != 0) {
-       // System.out.println("[ image rotate : " + angle + " ]");
-       // }
-       //
-       // new Thread(null, new Runnable() {
-       // int count = 0;
-       //
-       // @Override
-       // public void run() {
-       // while (true && count < 5) {
-       // SyncResult res = CommunicatorUtils.pull(from, to);
-       // if (null != res && res.isOk()) {
-       // /* image resizing */
-       // String smallImagePath = AnalyzerManager.getProject()
-       // .getSavePath()
-       // + File.separator
-       // + AnalyzerConstants.IMAGE_FOLDER_NAME
-       // + File.separator
-       // + AnalyzerConstants.SMALL_IMAGE_FOLDER_NAME
-       // + File.separator + fileName;
-       // ImageUtil.transform(to, to, DEFAULT_IMG_WIDTH,
-       // DEFAULT_IMG_HEIGHT, angle);
-       // if (angle == 90 || angle == 270) {
-       // ImageUtil.resize(to, smallImagePath,
-       // SMALL_IMG_HEIGHT, SMALL_IMG_WIDTH);
-       // } else {
-       // ImageUtil.resize(to, smallImagePath,
-       // SMALL_IMG_WIDTH, SMALL_IMG_HEIGHT);
-       // }
-       //
-       // break;
-       // } else {
-       //                                              System.out.println("Failed to get '" + from + "' file"); //$NON-NLS-1$ //$NON-NLS-2$
-       // try {
-       // Thread.sleep(1000);
-       // count++;
-       // } catch (InterruptedException e) {
-       // e.printStackTrace();
-       // }
-       // }
-       // }
-       // }
-       // }, AnalyzerConstants.MESSAGE_INTERNAL_IMAGE_THREAD).start();
-       //
-       // }
-
-       private String getImageName(String fullPath) {
-               String name = null;
-               name = fullPath.substring(fullPath.lastIndexOf(CommonConstants.SLASH) + 1);
-               return name;
-       }
-
-       // private void setFuncName(UserFunctionData input) {
-       // boolean isPieBuild = AnalyzerUtil.isPieBuild(input.getPid(),
-       // input.getTime());
-       // String baseAddr = Long.toString(AnalyzerManager.getProject()
-       // .getBaseAddress(input.getPid(), input.getTime()));
-       // // String path = AnalyzerManager.getProject().getBinaryPath();
-       // String path = AnalyzerUtil.getBinarySourcePath(input.getPid(),
-       // input.getTime());
-       // String pcAddr = Long.toString(input.getPcAddr());
-       // String functionName = SymbolManager.addr2func(path, pcAddr, isPieBuild,
-       // baseAddr);
-       // if (null == functionName || functionName.isEmpty()
-       //                              || functionName.equals("_end")) { //$NON-NLS-1$
-       // functionName = InformationViewLabels.CALLSTACK_TABLE_UNKNOWN_FUNCTION;
-       // ApiNameManager.getApiId(functionName);
-       // } else {
-       // String prevFunctionName = functionName;
-       // functionName = SymbolManager
-       // .demanglingFunctionName(prevFunctionName);
-       // ApiNameManager.getApiId(functionName);
-       // }
-       //
-       // input.setApiName(functionName);
-       // }
-
-       // private void pushLog(LogData log, BasicDataMessage msg, LogPackage
-       // logPack) {
-       // if (log instanceof ScreenShotData) {
-       // ImageInfo imgInfo = new ImageInfo();
-       // imgInfo.setSeq(Integer.toString(log.getSeq()));
-       // imgInfo.setTime(Long.toString(log.getTime()));
-       // String[] path = ((ScreenShotData) log).getImageFilePath().split(
-       // CommonConstants.SLASH);
-       // imgInfo.setFileName(new String(path[path.length - 1]));
-       // AnalyzerManager.getImageSet().put(imgInfo.getSeq(), imgInfo);
-       // }
-       //
-       // logPack.setLogs(log.getId(), log);
-       // }
-
-       public static byte[] makeByteArray(int id, String[] input) {
-               // common logs
-               String[] newLog = null;
-               byte[] result = null;
-               byte[] front = null;
-
-               if (id == DataChannelConstants.MSG_DATA_SYSTEM) {
-                       front = makeSystemData(input);
-               } else if (id == DataChannelConstants.MSG_DATA_SAMPLE) {
-                       newLog = new String[2];
-                       // pid
-                       // newLog[0] =
-                       // Integer.toString(AnalyzerManager.getProject().getPID());
-                       newLog[0] = null;
-                       newLog[1] = input[LogCenterConstants.PROFILING_LOG_PCADDR_INDEX];
-
-                       int pid = initIntPayload(newLog[0]);
-                       long pcAddr = initLongPayload(newLog[1]);
-                       int tid = 0;
-                       int cpuNum = 0;
-
-                       front = ByteUtil.getByte(pid, pcAddr, tid, cpuNum);
-               } else {
-                       if (id == DataChannelConstants.MSG_PROBE_SCREENSHOT) {
-                               Logger.debug("debug ");
-                       }
-                       newLog = new String[10];
-                       // api id
-                       newLog[0] = input[LogCenterConstants.APINAME_INDEX];
-                       // pid
-                       newLog[1] = input[LogCenterConstants.PROCESS_ID_INDEX];
-                       // tid
-                       newLog[2] = input[LogCenterConstants.THREAD_ID_INDEX];
-                       // args
-                       newLog[3] = input[LogCenterConstants.INPUTPARM_INDEX];
-                       // return
-                       newLog[4] = input[LogCenterConstants.RETURN_INDEX];
-                       // errno
-                       newLog[5] = input[LogCenterConstants.ERROR_INDEX];
-                       // internal call
-                       newLog[6] = input[LogCenterConstants.INTERNAL_FLAG_INDEX];
-                       // caller pc address
-                       newLog[7] = input[LogCenterConstants.CALLER_PCADDR_INDEX];
-                       // reserved
-                       newLog[8] = CommonConstants.EMPTY;
-                       // reserved
-                       newLog[9] = CommonConstants.EMPTY;
-
-                       if (id == DataChannelConstants.MSG_PROBE_LIFECYCLE) {
-                               Logger.debug("life cycle");
-                       }
-                       int apiId = FunctionNameManager.getFunctionId(newLog[0]);
-                       int pid = initIntPayload(newLog[1]);
-                       int tid = initIntPayload(newLog[2]);
-                       int argsCount = getArgsCount(newLog[3]);
-                       String args = initArgs(newLog[3]);
-                       long ret = initLongPayload(newLog[4]);
-                       long err = initLongPayload(newLog[5]);
-                       int internal = initIntPayload(newLog[6]);
-                       long caller = initLongPayload(newLog[7]);
-                       int reserved1 = initIntPayload(newLog[8]);
-                       int reserved2 = initIntPayload(newLog[9]);
-
-                       front = ByteUtil.getByte(apiId, pid, tid, argsCount, args, ret, err,
-                                       internal, caller, reserved1, reserved2);
-               }
-
-               byte[] rear = null;
-               switch (id) {
-               case DataChannelConstants.MSG_PROBE_MEMORY:
-                       long size = Long.parseLong(input[LogCenterConstants.MEMORY_SIZE_INDEX]);
-                       int apiType = Integer
-                                       .parseInt(input[LogCenterConstants.MEMORY_APITYPE_INDEX]);
-                       long address = AnalyzerUtil
-                                       .addrToLong(input[LogCenterConstants.MEMORY_ADDR_INDEX]);
-                       rear = ByteUtil.getByte(size, apiType, address);
-                       result = ByteUtil.concatByteArray(front, rear);
-                       break;
-               case DataChannelConstants.MSG_PROBE_UICONTROL:
-                       String parentName = input[LogCenterConstants.USER_INTERFACE_CONTROL_LIST_PARENT_NAME_INDEX];
-                       String parentClassName = input[LogCenterConstants.USER_INTERFACE_CONTROL_LIST_PARENT_CLASS_NAME_INDEX];
-                       long parentPointer = AnalyzerUtil
-                                       .addrToLong(input[LogCenterConstants.USER_INTERFACE_CONTROL_LIST_PARENT_POINTER_INDEX]);
-                       String childName = input[LogCenterConstants.USER_INTERFACE_CONTROL_LIST_CHILD_NAME_INDEX];
-                       String childClassName = input[LogCenterConstants.USER_INTERFACE_CONTROL_LIST_CHILD_CLASS_NAME_INDEX];
-                       long childPointer = AnalyzerUtil
-                                       .addrToLong(input[LogCenterConstants.USER_INTERFACE_CONTROL_LIST_CHILD_POINTER_INDEX]);
-                       rear = ByteUtil.getByte(parentName, parentClassName, parentPointer,
-                                       childName, childClassName, childPointer);
-                       result = ByteUtil.concatByteArray(front, rear);
-                       break;
-               case DataChannelConstants.MSG_PROBE_UIEVENT:
-                       int eventType = Integer
-                                       .parseInt(input[LogCenterConstants.UI_EVENT_EVENT_TYPE]);
-                       int detailType = Integer
-                                       .parseInt(input[LogCenterConstants.UI_EVENT_DETAIL_TYPE]);
-                       int x = Integer.parseInt(input[LogCenterConstants.UI_EVENT_X]);
-                       int y = Integer.parseInt(input[LogCenterConstants.UI_EVENT_Y]);
-                       String info1 = input[LogCenterConstants.UI_EVENT_INFO1];
-                       int info2 = initIntPayload(input[LogCenterConstants.UI_EVENT_INFO2]);
-                       rear = ByteUtil.getByte(eventType, detailType, x, y, info1, info2);
-                       result = ByteUtil.concatByteArray(front, rear);
-                       break;
-               case DataChannelConstants.MSG_PROBE_FILE:
-                       long sizeValue = Long
-                                       .parseLong(input[LogCenterConstants.RESOURCE_SIZE_INDEX]);
-                       int fdValue = Integer
-                                       .parseInt(input[LogCenterConstants.RESOURCE_FDVALUE_INDEX]);
-                       int fdType = Integer
-                                       .parseInt(input[LogCenterConstants.RESOURCE_FDTYPE_INDEX]);
-                       int fdApiType = Integer
-                                       .parseInt(input[LogCenterConstants.RESOURCE_FDAPITYPE_INDEX]);
-                       long fileSize = Long
-                                       .parseLong(input[LogCenterConstants.RESOURCE_FILE_SIZE_INDEX]);
-                       String filePath = input[LogCenterConstants.RESOURCE_FILE_PATH_INDEX];
-                       rear = ByteUtil.getByte(sizeValue, fdValue, fdType, fdApiType, fileSize,
-                                       filePath);
-                       result = ByteUtil.concatByteArray(front, rear);
-                       break;
-               case DataChannelConstants.MSG_PROBE_NETWORK:
-                       Logger.debug("case AnalyzerConstants.MSG_PROBE_NETWORK");
-                       break;
-               case DataChannelConstants.MSG_PROBE_GLES20:
-                       apiType = Integer.parseInt(input[LogCenterConstants.GL_API_TYPE_INDEX]);
-                       long elapsedTime = Long
-                                       .parseLong(input[LogCenterConstants.GL_ELAPSED_TIME_INDEX]);
-                       String contextValue = input[LogCenterConstants.GL_CONTEXT_VALUE_INDEX];
-                       rear = ByteUtil.getByte(apiType, elapsedTime, contextValue);
-                       result = ByteUtil.concatByteArray(front, rear);
-                       break;
-               case DataChannelConstants.MSG_PROBE_LIFECYCLE:
-                       result = front;
-                       break;
-               case DataChannelConstants.MSG_PROBE_SCREENSHOT:
-                       String imgFilePath = input[LogCenterConstants.SCREENSHOT_IMAGE_PATH_INDEX];
-                       int orientation = Integer
-                                       .parseInt(input[LogCenterConstants.SCREENSHOT_ROTATE_INDEX]);
-                       rear = ByteUtil.getByte(imgFilePath, orientation);
-                       result = ByteUtil.concatByteArray(front, rear);
-                       break;
-               case DataChannelConstants.MSG_PROBE_SCENE:
-                       String sceneName = input[LogCenterConstants.USER_INTERFACE_SCENE_TRANSFORMS_LIST_SCENE_NAME_INDEX];
-                       String formName = input[LogCenterConstants.USER_INTERFACE_SCENE_TRANSFORMS_LIST_FORM_NAME_INDEX];
-                       long formPointer = Long
-                                       .parseLong(input[LogCenterConstants.USER_INTERFACE_SCENE_TRANSFORMS_LIST_SCENE_NAME_INDEX]);
-                       String panelName = input[LogCenterConstants.USER_INTERFACE_SCENE_TRANSFORMS_LIST_PANEL_NAME_INDEX];
-                       long panelPointer = Long
-                                       .parseLong(input[LogCenterConstants.USER_INTERFACE_SCENE_TRANSFORMS_LIST_PANEL_POINTER_INDEX]);
-                       int transitionTime = Integer
-                                       .parseInt(input[LogCenterConstants.USER_INTERFACE_SCENE_TRANSFORMS_LIST_TRANSITION_INDEX]);
-                       int userTransitionTime = Integer
-                                       .parseInt(input[LogCenterConstants.USER_INTERFACE_SCENE_TRANSFORMS_LIST_USERTIME_INDEX]);
-                       rear = ByteUtil.getByte(sceneName, formName, formPointer, panelName,
-                                       panelPointer, transitionTime, userTransitionTime);
-                       result = ByteUtil.concatByteArray(front, rear);
-                       break;
-               case DataChannelConstants.MSG_DATA_SYSTEM:
-                       result = front;
-                       break;
-               case DataChannelConstants.MSG_DATA_SAMPLE:
-                       result = ByteUtil.concatByteArray(front, rear);
-                       break;
-               case DataChannelConstants.MSG_PROBE_THREAD:
-                       long pThreadId = Long
-                                       .parseLong(input[LogCenterConstants.THREAD_PTHREAD_ID_INDEX]);
-                       long ospThradId = Long
-                                       .parseLong(input[LogCenterConstants.THREAD_TIZENTHREAD_ID_INDEX]);
-                       int threadType = Integer
-                                       .parseInt(input[LogCenterConstants.THREAD_TYPE_INDEX]);
-                       int threadApiType = Integer
-                                       .parseInt(input[LogCenterConstants.THREAD_API_TYPE_INDEX]);
-                       rear = ByteUtil.getByte(pThreadId, ospThradId, threadType, threadApiType);
-                       result = ByteUtil.concatByteArray(front, rear);
-                       break;
-               case DataChannelConstants.MSG_PROBE_CUSTOM:
-                       int handle = Integer.parseInt(input[LogCenterConstants.CUSTOM_CHART_HANDLE]);
-                       int customType = Integer
-                                       .parseInt(input[LogCenterConstants.CUSTOM_CHART_TYPE]);
-                       String customName = input[LogCenterConstants.CUSTOM_CHART_TEXT];
-                       int color = Integer.parseInt(input[LogCenterConstants.CUSTOM_CHART_COLOR]);
-                       double value = Double
-                                       .parseDouble(input[LogCenterConstants.CUSTOM_CHART_VALUE]);
-                       rear = ByteUtil.getByte(handle, customType, customName, color, value);
-                       result = ByteUtil.concatByteArray(front, rear);
-                       break;
-               case DataChannelConstants.MSG_PROBE_SYNC:
-                       long syncVal = Long.parseLong(input[LogCenterConstants.SYNC_VAL_INDEX]);
-                       int syncType = Integer.parseInt(input[LogCenterConstants.SYNC_TYPE_INDEX]);
-                       int syncApiType = Integer
-                                       .parseInt(input[LogCenterConstants.SYNC_API_TYPE_INDEX]);
-                       rear = ByteUtil.getByte(syncVal, syncType, syncApiType);
-                       result = ByteUtil.concatByteArray(front, rear);
-                       break;
-               default:
-                       // USER_FUNCTION
-                       long lowPc = Long
-                                       .parseLong(input[LogCenterConstants.USER_FUNCTION_BINARY_RANGE_START_INDEX]);
-                       long highPc = Long
-                                       .parseLong(input[LogCenterConstants.USER_FUNCTION_BINARY_RANGE_END_INDEX]);
-                       int ufType = Integer
-                                       .parseInt(input[LogCenterConstants.USER_FUNCTION_TYPE_INDEX]);
-                       elapsedTime = Long
-                                       .parseLong(input[LogCenterConstants.USER_FUNCTION_ELAPSED_TIME_INDEX]);
-                       long pcAddr = Long.parseLong(input[LogCenterConstants.PCADDR_INDEX]);
-                       rear = ByteUtil.getByte(lowPc, highPc, ufType, elapsedTime, pcAddr);
-                       result = ByteUtil.concatByteArray(front, rear);
-                       break;
-               }
-
-               return result;
-       }
-
-       private static byte[] makeSystemData(String[] input) {
-               String[] newLog = new String[LogDataFactory
-                               .getLogColumnCountbyId(DataChannelConstants.MSG_DATA_SYSTEM)];
-               // energy
-               newLog[0] = input[LogCenterConstants.DEVICE_ENERGY_INDEX];
-               newLog[1] = input[LogCenterConstants.DEVICE_WIFI_INDEX];
-               newLog[2] = input[LogCenterConstants.DEVICE_BLUETOOTH_INDEX];
-               newLog[3] = input[LogCenterConstants.DEVICE_GPS_INDEX];
-               newLog[4] = input[LogCenterConstants.DEVICE_BRIGHTNESS_INDEX];
-               newLog[5] = input[LogCenterConstants.DEVICE_CAMERA_INDEX];
-               newLog[6] = input[LogCenterConstants.DEVICE_SOUND_INDEX];
-               newLog[7] = input[LogCenterConstants.DEVICE_AUDIO_INDEX];
-               newLog[8] = input[LogCenterConstants.DEVICE_VIBRATION_INDEX];
-               newLog[9] = input[LogCenterConstants.DEVICE_VOLTAGE_INDEX];
-               newLog[10] = input[LogCenterConstants.DEVICE_RSSI_INDEX];
-               newLog[11] = input[LogCenterConstants.DEVICE_VIDEO_INDEX];
-               newLog[12] = input[LogCenterConstants.DEVICE_CALL_INDEX];
-               newLog[13] = input[LogCenterConstants.DEVICE_DNET_INDEX];
-               newLog[14] = input[LogCenterConstants.DEVICE_CPU_FREQUENCY_INDEX];
-               newLog[15] = input[LogCenterConstants.DEVICE_APP_CPU_USAGE_INDEX];
-               newLog[16] = input[LogCenterConstants.DEVICE_SYSTEM_CPU_USAGE_INDEX];
-               newLog[17] = input[LogCenterConstants.DEVICE_VSS_MEMORY_INDEX];
-               newLog[18] = input[LogCenterConstants.DEVICE_RSS_MEMORY_INDEX];
-               newLog[19] = input[LogCenterConstants.DEVICE_SHARED_MEMORY_INDEX];
-               newLog[20] = input[LogCenterConstants.DEVICE_PSS_MEMORY_INDEX];
-               newLog[21] = input[LogCenterConstants.DEVICE_ALLOCATION_SIZE_INDEX];
-               newLog[22] = input[LogCenterConstants.DEVICE_SYSTEM_TOTAL_MEMORY_INDEX];
-               newLog[23] = input[LogCenterConstants.DEVICE_SYSTEM_USED_MEMORY_INDEX];
-               newLog[24] = input[LogCenterConstants.DEVICE_SYSTEM_USED_STORAGE_INDEX];
-               newLog[25] = input[LogCenterConstants.DEVICE_THREAD_COUNT_INDEX];
-               newLog[26] = input[LogCenterConstants.DEVICE_THREAD_LOAD_INDEX];
-               newLog[27] = "1"; // process count
-               newLog[28] = "44,6.66"; // process load
-               // newLog[29] = CommonConstants.ZERO; // disk read size
-               // newLog[30] = CommonConstants.ZERO; // disk write size
-               // newLog[31] = CommonConstants.ZERO; // network send size
-               // newLog[32] = CommonConstants.ZERO; // network receive size
-               newLog[29] = "100"; // disk read size
-               newLog[30] = "200"; // disk write size
-               newLog[31] = "300"; // network send size
-               newLog[32] = "400"; // network receive size
-
-               int energy = initIntPayload(newLog[0]);
-               int wifi = initIntPayload(newLog[1]);
-               int bt = initIntPayload(newLog[2]);
-               int gps = initIntPayload(newLog[3]);
-               int brightness = initIntPayload(newLog[4]);
-               int camera = initIntPayload(newLog[5]);
-               int sound = initIntPayload(newLog[6]);
-               int audio = initIntPayload(newLog[7]);
-               int vibration = initIntPayload(newLog[8]);
-               int voltage = initIntPayload(newLog[9]);
-               int rssi = initIntPayload(newLog[10]);
-               int video = initIntPayload(newLog[11]);
-               int call = initIntPayload(newLog[12]);
-               int dnet = initIntPayload(newLog[13]);
-
-               // ***!!!!
-               String[] fr = newLog[14].split(CommonConstants.COMMA);
-               int coreCount = 0;
-               byte[] temp = new byte[0];
-               for (int i = 0; i < fr.length; i++) {
-                       float f = Float.parseFloat(fr[i]);
-                       temp = ByteUtil.getByte(temp, f);
-                       coreCount = i + 1;
-               }
-               if (coreCount != 0) {
-                       AnalyzerManager.getProject().getDeviceStatusInfo().setCpuCount(coreCount);
-               }
-               byte[] cpuFrequency = new byte[temp.length];
-               System.arraycopy(temp, 0, cpuFrequency, 0, temp.length);
-
-               float appCpuUsage = Float.parseFloat(newLog[15]);
-
-               // cpu load old log : (cpu load, total load)
-               // so drop total load
-               String[] load = newLog[16].split(CommonConstants.COMMA);
-               temp = new byte[0];
-               for (int i = 0; i < load.length - 1; i++) {
-                       float f = Float.parseFloat(load[i]);
-                       temp = ByteUtil.getByte(temp, f);
-               }
-               byte[] cpuLoad = new byte[temp.length];
-               System.arraycopy(temp, 0, cpuLoad, 0, temp.length);
-
-               int virtualMem = initIntPayload(newLog[17]);
-               int resident = initIntPayload(newLog[18]);
-               int shared = initIntPayload(newLog[19]);
-               int pss = initIntPayload(newLog[20]);
-               int totalAlloc = initIntPayload(newLog[21]);
-               long systemTotal = initLongPayload(newLog[22]);
-               long systemUsed = initLongPayload(newLog[23]);
-               int totalUsedDrive = initIntPayload(newLog[24]);
-               int threadCount = initIntPayload(newLog[25]);
-               // TODO
-               // int threadLoad = initIntPayload(newLog[26]);
-               String[] tLoad = newLog[26].split(CommonConstants.COMMA);
-               temp = new byte[0];
-               for (int i = 0; i < tLoad.length; i += 2) {
-                       int tid = Integer.parseInt(tLoad[i]);
-                       float tl = Float.parseFloat(tLoad[i + 1]);
-                       temp = ByteUtil.getByte(temp, tid, tl);
-               }
-               byte[] threadLoad = new byte[temp.length];
-               System.arraycopy(temp, 0, threadLoad, 0, temp.length);
-
-               int processCount = initIntPayload(newLog[27]);
-               String[] pLoad = newLog[28].split(CommonConstants.COMMA);
-               temp = new byte[0];
-               for (int i = 0; i < pLoad.length; i += 2) {
-                       int tid = Integer.parseInt(pLoad[i]);
-                       float tl = Float.parseFloat(pLoad[i + 1]);
-                       temp = ByteUtil.getByte(temp, tid, tl);
-               }
-               byte[] procLoad = new byte[temp.length];
-               System.arraycopy(temp, 0, procLoad, 0, temp.length);
-
-               // int processLoad = initIntPayload(newLog[28]);
-               int diskRead = initIntPayload(newLog[29]);
-               int diskWrite = initIntPayload(newLog[30]);
-               int netSend = initIntPayload(newLog[31]);
-               int netRecv = initIntPayload(newLog[32]);
-
-               byte[] front = ByteUtil.getByte(energy, wifi, bt, gps, brightness, camera, sound,
-                               audio, vibration, voltage, rssi, video, call, dnet, cpuFrequency,
-                               appCpuUsage, cpuLoad, virtualMem, resident, shared, pss, totalAlloc,
-                               systemTotal, systemUsed, totalUsedDrive, threadCount, threadLoad,
-                               processCount, procLoad, diskRead, diskWrite, netSend, netRecv);
-               return front;
-       }
-
-       private static int initIntPayload(String input) {
-               int ret;
-               try {
-                       ret = Integer.parseInt(input);
-               } catch (NumberFormatException e) {
-                       ret = 0;
-               }
-               return ret;
-       }
-
-       private static long initLongPayload(String input) {
-               long ret;
-               try {
-                       ret = Long.parseLong(input);
-               } catch (NumberFormatException e) {
-                       ret = 0;
-               }
-               return ret;
-       }
-
-       private static int getArgsCount(String input) {
-               if (null == input || input.trim().isEmpty()) {
-                       return 0;
-               }
-               String[] args = input.split(CommonConstants.COMMA);
-               return args.length;
-       }
-
-       private static String initArgs(String input) {
-               if (null == input || input.isEmpty()) {
-                       return null;
-               }
-               String[] args = input.split(CommonConstants.COMMA);
-               String output = "";
-               for (String str : args) {
-                       if (null == str) {
-                               continue;
-                       }
-                       output += new String('s' + str.trim() + CommonConstants.EOS);
-               }
-               return output;
-       }
-}
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/logparser/MessageProcess.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/logparser/MessageProcess.java
deleted file mode 100644 (file)
index a38e2cd..0000000
+++ /dev/null
@@ -1,368 +0,0 @@
-/*
- *  Dynamic Analyzer
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: 
- * Jaewon Lim <jaewon81.lim@samsung.com>
- * Jooyoul Lee <jy.exe.lee@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.logparser;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Timer;
-import java.util.TimerTask;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantLock;
-
-import org.eclipse.swt.widgets.Display;
-import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
-import org.tizen.dynamicanalyzer.common.AnalyzerManager;
-import org.tizen.dynamicanalyzer.communicator.DACommunicator;
-import org.tizen.dynamicanalyzer.constant.CommonConstants;
-import org.tizen.dynamicanalyzer.handlers.StopHandler;
-import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
-import org.tizen.dynamicanalyzer.ui.toolbar.StopLogProcessor;
-import org.tizen.dynamicanalyzer.ui.toolbar.StopProcessManager;
-import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
-import org.tizen.dynamicanalyzer.util.Logger;
-import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
-
-public class MessageProcess {
-       final int MSG_ID_INDEX = 0;
-       final int MSG_LENGTH_INDEX = 1;
-       final int MSG_PAYLOAD_INDEX = 2;
-       final int MSG_SPLIT_SIZE = 3;
-
-       /* Message Buffer max length */
-       final int MSG_BUFFER_MAX = 100;
-       final int MSG_BUFFER_TIMER_DELAY = 5;
-       final int MSG_BUFFER_TIMER_PERIOD = 1000; // 1 second
-       final int WAITING_TIME = 10;
-
-       class AddBufferTimerTask extends TimerTask {
-               private int count = 0;
-
-               @Override
-               public void run() {
-                       if (!buffer.isEmpty()) {
-                               addBufferToList();
-                               count = 0;
-                       } else {
-                               count++;
-                               if (count >= WAITING_TIME && DACommunicator.isRunning()) {
-                                       ToolbarArea.getInstance().stopTrace();
-                               }
-                       }
-               }
-       }
-
-       private List<String> buffer = new ArrayList<String>();;
-       private Lock lock = new ReentrantLock();
-       private Timer timer = null;
-
-       private static MessageProcess receivedMessage = new MessageProcess();
-       private int messageCount = 0;
-
-       public static MessageProcess getInstance() {
-               return receivedMessage;
-       }
-
-       public void startTimer() {
-               timer = new Timer();
-               timer.scheduleAtFixedRate(new AddBufferTimerTask(),
-                               MSG_BUFFER_TIMER_DELAY, MSG_BUFFER_TIMER_PERIOD);
-       }
-
-       public void stopTimer() {
-               if (null != timer) {
-                       timer.cancel();
-                       timer = null;
-               }
-       }
-
-       private void addBufferToList() {
-               lock.lock();
-               try {
-                       if (null != buffer && 0 != buffer.size()) {
-                               LogParser.getLogQueue().putLog(buffer);
-                               buffer = new ArrayList<String>();
-                       }
-               } finally {
-                       lock.unlock();
-               }
-       }
-
-       public void processMessage(String message) {
-               // DO NOT DELETE : for debugging
-               // System.out.println("count " + messageCount + ": " + message);
-               try {
-                       String[] messages = message.split(CommonConstants.CMD_SPLIT_READ,
-                                       MSG_SPLIT_SIZE);
-                       int messageIndex = Integer.parseInt(messages[MSG_ID_INDEX]);
-
-                       switch (messageIndex) {
-                       case AnalyzerConstants.MSG_APP_INFO: /* app info : 1 */
-                               if (!AnalyzerManager.isProcessInfoArrived()) {
-                                       processAppInfo(messages[MSG_PAYLOAD_INDEX]);
-                                       AnalyzerManager.setProcessInfoArrived(true);
-                               }
-                               break;
-                       case AnalyzerConstants.MSG_USER_PROFILING_SAMPLE: /* sample : 3 */
-                               if (!AnalyzerManager.hasSampleThread()) {
-                                       AnalyzerManager.setSampleThread(true);
-                               }
-                               break;
-                       case AnalyzerConstants.MSG_DEVICE_LOG: /* device info : 4 */
-                       case AnalyzerConstants.MSG_LOG: /* log : 5 */
-                               // if (AnalyzerConstants.MSG_LOG == messageIndex) {
-                               // System.out
-                               // .println("count " + messageCount + ": " + message);
-                               // }
-                               buffer.add(messages[MSG_PAYLOAD_INDEX]);
-                               messageCount += 1;
-                               break;
-                       case AnalyzerConstants.MSG_TERMINATE: /* terminate : 7 */
-                               processTerminate();
-                               break;
-                       case AnalyzerConstants.MSG_RECORD: /* terminate : 7 */
-                               break;
-                       default:
-                               break;
-                       }
-
-                       if (MSG_BUFFER_MAX < messageCount) {
-                               addBufferToList();
-                               messageCount = 0;
-                       }
-
-               } catch (NumberFormatException e) {
-                       e.printStackTrace();
-               }
-       }
-
-       private void processAppInfo(String message) {
-               // String[] data = message.split(AnalyzerConstants.DATA_PARSING_TOKEN);
-               //
-               // Project project = AnalyzerManager.getProject();
-               // TargetInfo tInfo = project.getTargetInfo();
-               // ProcessInfo pInfo = project.getProcessInfo();
-               //
-               // tInfo.setSystemMemorySize(Integer
-               // .parseInt(data[AnalyzerConstants.APP_INFO_SYSTEM_MEMORY_SIZE]));
-               // tInfo.setStorageSize(Integer
-               // .parseInt(data[AnalyzerConstants.APP_INFO_STORAGE_SIZE]));
-               // tInfo.setBluetoothSupport(Integer
-               // .parseInt(data[AnalyzerConstants.APP_INFO_BLUETOOTH_SUPPORT]));
-               // tInfo.setGpsSupport(Integer
-               // .parseInt(data[AnalyzerConstants.APP_INFO_GPS_SUPPORT]));
-               // tInfo.setWifiSupport(Integer
-               // .parseInt(data[AnalyzerConstants.APP_INFO_WIFI_SUPPORT]));
-               // tInfo.setCameraCount(Integer
-               // .parseInt(data[AnalyzerConstants.APP_INFO_CAMERA_COUNT]));
-               // tInfo.setNetworkType(data[AnalyzerConstants.APP_INFO_NETWORK_TYPE]);
-               // tInfo.setMaxBrightness(Integer
-               // .parseInt(data[AnalyzerConstants.APP_INFO_MAX_BRIGHTNESS]));
-               //
-               // pInfo.setPid(Integer.parseInt(data[AnalyzerConstants.APP_INFO_PID]));
-               // // pInfo.setTime(Integer
-               // // .parseInt(data[AnalyzerConstants.APP_INFO_START_TIME]) * 100);
-               // pInfo.setBinaryType(Integer
-               // .parseInt(data[AnalyzerConstants.APP_INFO_PIE_BUILD]));
-               // pInfo.setLowestAddress(Long
-               // .parseLong(data[AnalyzerConstants.APP_INFO_BASE_ADDRESS]));
-               // pInfo.setAppType(Integer
-               // .parseInt(data[AnalyzerConstants.APP_INFO_APP_TYPE]));
-               // pInfo.setBinaryPath(data[AnalyzerConstants.APP_INFO_BINARY_PATH]);
-               //
-               // if (null == pInfo.getBinaryPath() || pInfo.getBinaryPath().isEmpty())
-               // {
-               // ToolbarArea.getInstance().setSourceViewEnable(false);
-               // ToolbarArea.getInstance().setSourceViewTooltip(
-               // AnalyzerLabels.MESSAGE_PROCESS_PG_WARNING);
-               // } else {
-               // ToolbarArea.getInstance().setSourceViewEnable(true);
-               // ToolbarArea.getInstance().setSourceViewTooltip(
-               // AnalyzerLabels.MESSAGE_PROCESS_VIEW_SOURCE);
-               // }
-               //
-               // // User Call Trace : App is Tizen C++ or Tizen native
-               // if (pInfo.getAppType() == AnalyzerConstants.APP_TYPE_OSP) {
-               // LogParser.setDropCallTraceLog(true);
-               // }
-       }
-
-       // private String getImageName(String fullPath) {
-       // String name = null;
-       // name = fullPath
-       // .substring(fullPath.lastIndexOf(CommonConstants.SLASH) + 1);
-       // return name;
-       // }
-
-       // private void processImage(final String from) {
-       // final String fileName = getImageName(from);
-       // final String to = AnalyzerManager.getProject().getSavePath()
-       // + File.separator + AnalyzerConstants.IMAGE_FOLDER_NAME
-       // + File.separator + fileName;
-       //
-       // new Thread(null, new Runnable() {
-       // @Override
-       // public void run() {
-       // SyncResult res = CommunicatorUtils.pull(from, to);
-       // if (null != res && RESULT_OK == res.getCode()) {
-       // DACommunicator.removeCommand(from);
-       // } else {
-       //                                      System.out.println("Failed to get '" + from + "' file"); //$NON-NLS-1$ //$NON-NLS-2$
-       // }
-       // }
-       // }, AnalyzerConstants.MESSAGE_INTERNAL_IMAGE_THREAD).start();
-       //
-       // }
-
-       private void processTerminate() {
-               if (!AnalyzerManager.isExit()) {
-                       Display.getDefault().syncExec(new Runnable() {
-                               @Override
-                               public void run() {
-                                       StopProcessManager.getInstance().stopProcessStart(
-                                                       AnalyzerLabels.STOP_PROCESS_DLG_SUMMARIZING_DATA); // socket
-                               }
-                       });
-               }
-               DACommunicator.setRunning(false);
-       }
-
-       private String message = null;
-       private String[] messages = null;
-
-       private int sentenceIndex = -1;
-       private String sentence = null;
-
-       public void startMessageParsing(BufferedReader bufferedReader) {
-
-               startTimer();
-
-               try {
-                       while (DACommunicator.isRunning()
-                                       && null != (message = bufferedReader.readLine())) {
-                               if (message.isEmpty()) {
-                                       continue;
-                               }
-
-                               messages = message.split(CommonConstants.CMD_SPLIT_READ, 2);
-
-                               try {
-                                       int index = Integer.parseInt(messages[0]);
-                                       if (AnalyzerConstants.MSG_APP_INFO == index) {
-                                               sentenceIndex = AnalyzerConstants.MSG_APP_INFO;
-                                               sentence = message;
-                                       } else {
-                                               if (AnalyzerConstants.MSG_APP_INFO == sentenceIndex) {
-                                                       processMessage(sentence);
-                                                       sentence = null;
-                                                       sentenceIndex = -1;
-                                               }
-
-                                               // image log parsing
-                                               if (AnalyzerConstants.MSG_DEVICE_LOG == index
-                                                               && sentence != null) {
-                                                       processMessage(sentence);
-                                                       sentence = null;
-                                                       sentenceIndex = -1;
-                                               } else if (AnalyzerConstants.MSG_LOG == index
-                                                               || AnalyzerConstants.MSG_USER_PROFILING_SAMPLE == index) {
-                                                       sentenceIndex = AnalyzerConstants.MSG_LOG;
-                                                       if (null != sentence) {
-                                                               processMessage(sentence);
-                                                       }
-                                                       sentence = message;
-                                               } else {
-                                                       processMessage(message);
-                                               }
-                                       }
-                               } catch (NumberFormatException e) {
-                                       if (message.endsWith(AnalyzerConstants.CALLSTACK_END)) {
-                                               sentence += CommonConstants.NEW_LINE + message;
-                                               processMessage(sentence);
-                                               sentence = null;
-                                               sentenceIndex = -1;
-                                       } else {
-                                               if (null != sentence) {
-                                                       sentence += CommonConstants.NEW_LINE_CHAR + message;
-                                                       if (AnalyzerConstants.MSG_APP_INFO == sentenceIndex) {
-                                                               processMessage(sentence);
-                                                               sentence = null;
-                                                               sentenceIndex = -1;
-                                                       }
-                                               }
-                                       }
-                               }
-                       } // end while()
-                       Logger.debug("Receive thread end!!");
-                       Display.getDefault().asyncExec(new Runnable() {
-                               @Override
-                               public void run() {
-                                       StopProcessManager.getInstance().stopProcessStart(
-                                                       AnalyzerLabels.STOP_PROCESS_DLG_SUMMARIZING_DATA); // socket
-                                       // timeout
-                               }
-                       });
-                       endingSteps();
-               } catch (IOException e) {
-                       Logger.debug("### socket timeout - TODO: show this as a dialog."); //$NON-NLS-1$
-
-                       Display.getDefault().asyncExec(new Runnable() {
-                               @Override
-                               public void run() {
-                                       StopProcessManager
-                                                       .getInstance()
-                                                       .stopProcessStart(
-                                                                       AnalyzerLabels.STOP_PROCESS_DLG_DEVICE_DISCONNECTED); // socket
-                                       // timeout
-                               }
-                       });
-                       endingSteps();
-               }
-       }
-
-       private void endingSteps() {
-               Logger.debug("Ending steps!");
-               message = null;
-               DACommunicator.setRunning(false);
-               // AnalyzerUtil.setRecordState(RecordStateSourceProvider.RECORD_READY);
-               AnalyzerManager.setRunningState(false);
-               Display.getDefault().syncExec(new Runnable() {
-                       @Override
-                       public void run() {
-                               ToolbarArea.getInstance().setToolbarState(
-                                               ToolbarArea.TOOLBAR_STATE_READY);
-                       }
-               });
-               stopTimer();
-               addBufferToList();
-               Logger.debug("stop log process start");//$NON-NLS-1$
-               StopLogProcessor.runStopLogProcessThread();
-               DACommunicator.closeAll();
-               AnalyzerUtil.executeCommand(StopHandler.ID);
-       }
-}
index 07c370d..c616412 100644 (file)
@@ -31,10 +31,8 @@ import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
 
-import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
 import org.tizen.dynamicanalyzer.common.HostResult;
 import org.tizen.dynamicanalyzer.communicator.BaseCommunicator;
-import org.tizen.dynamicanalyzer.communicator.Communicator22;
 import org.tizen.dynamicanalyzer.communicator.CommunicatorUtils;
 import org.tizen.dynamicanalyzer.constant.CommonConstants;
 import org.tizen.dynamicanalyzer.project.DeviceStatusInfo;
@@ -81,11 +79,9 @@ public class DeviceInfo {
 
        public void setTargetVersion(String version) {
                targetVersion = version;
-               if (version.contains(AnalyzerConstants.DA_VERSION_SWAP)) {
-                       communicator = new Communicator30();
-               } else {
-                       communicator = new Communicator22();
-               }
+               // if (version.contains(AnalyzerConstants.DA_VERSION_SWAP)) {
+               communicator = new Communicator30();
+               // }
        }
 
        public String getTargetVersion() {
@@ -117,7 +113,7 @@ public class DeviceInfo {
                this.controlSock = controlSock;
        }
 
-       public boolean equals(DeviceInfo target) {
+       public boolean isSameDevice(DeviceInfo target) {
                if (device.getSerialNumber().equals(target.getIDevice().getSerialNumber())) {
                        return true;
                }
index 0e43446..d690200 100755 (executable)
@@ -556,7 +556,7 @@ public class Project {
                String ret = null;
 
                String content = in.readLine();
-               if (content.equals(PRIMITIVE_SECTION)) {
+               if (content != null && content.equals(PRIMITIVE_SECTION)) {
                        while (null != (content = in.readLine())) {
                                String[] splitData = content.split(CommonConstants.EQUAL);
                                int size = splitData.length;
@@ -599,6 +599,8 @@ public class Project {
                                        setProfilingStartTime(new DATime(val));
                                }
                        }
+               } else {
+                       ret = PRIMITIVE_SECTION;
                }
 
                return ret;
@@ -606,7 +608,7 @@ public class Project {
 
        private void openTargetStatusInfo(BufferedReader in) throws IOException {
                String content = in.readLine();
-               if (content.equals(DEVICE_SECTION)) {
+               if (content != null && content.equals(DEVICE_SECTION)) {
                        if (targetDeviceStatusInfo == null) {
                                targetDeviceStatusInfo = new DeviceStatusInfo(null);
                        }
@@ -616,7 +618,7 @@ public class Project {
 
        private void openApplicationInfo(BufferedReader in) throws IOException {
                String content = in.readLine();
-               if (content.equals(APP_SECTION)) {
+               if (content != null && content.equals(APP_SECTION)) {
                        if (targetApplicationInfo == null) {
                                targetApplicationInfo = new AppInfo();
                        }
index a0331d0..2284655 100755 (executable)
@@ -131,8 +131,12 @@ public class DBTableManager {
 
        public synchronized static DBTableManager getInstance() {
                if (null == instance) {
-                       instance = new DBTableManager();
-                       instance.init();
+                       synchronized (DBTableManager.class) {
+                               if (null == instance) {
+                                       instance = new DBTableManager();
+                                       instance.init();
+                               }
+                       }
                }
                return instance;
        }
index 0f7cd0f..c8aadf5 100755 (executable)
@@ -207,8 +207,7 @@ public class SqlManager {
                        }
                        query.append(type);
                        if (i + 1 == size) {
-                               query.append(CommonConstants.CLOSE_BRACKET).append(
-                                               CommonConstants.SEMICOLON);
+                               query.append(CommonConstants.CLOSE_BRACKET).append(CommonConstants.SEMICOLON);
                        } else {
                                query.append(CommonConstants.COMMA);
                        }
@@ -218,8 +217,7 @@ public class SqlManager {
                return query.toString();
        }
 
-       private void executeCreateIndexTable(Statement stat, String tableName,
-                       String indeColumn) {
+       private void executeCreateIndexTable(Statement stat, String tableName, String indeColumn) {
                String createIndexTable = "create index " + tableName + "_index on "//$NON-NLS-1$//$NON-NLS-2$
                                + tableName + CommonConstants.OPEN_BRACKET + indeColumn
                                + CommonConstants.CLOSE_BRACKET;
@@ -264,8 +262,7 @@ public class SqlManager {
                }
        }
 
-       private boolean executeUpdateCreateTable(Statement stat, String query)
-                       throws SQLException {
+       private boolean executeUpdateCreateTable(Statement stat, String query) throws SQLException {
                if (!AnalyzerManager.isExit()) {
                        if (isQueryPrint) {
                                Logger.debug("query : " + query);
@@ -336,8 +333,8 @@ public class SqlManager {
         *            Condition statements
         * @return List<List<String>> row of columns data
         */
-       public List<LogData> newSelectQuery(String dbFilePath, String[] columnName,
-                       String tableName, String option) {
+       public List<LogData> newSelectQuery(String dbFilePath, String[] columnName, String tableName,
+                       String option) {
                String query = null;
                Statement stat = null;
                ResultSet rs = null;
@@ -397,8 +394,8 @@ public class SqlManager {
                return dbInfo;
        }
 
-       public List<LogData> newSelectQuery2(String dbFilePath, String[] columnName,
-                       String tableName, String preOption, String postOption) {
+       public List<LogData> newSelectQuery2(String dbFilePath, String[] columnName, String tableName,
+                       String preOption, String postOption) {
                String query = null;
                Statement stat = null;
                ResultSet rs = null;
@@ -457,8 +454,8 @@ public class SqlManager {
                return dbInfo;
        }
 
-       public List<List<String>> selectQuery(String dbFilePath, String[] columnName,
-                       String tableName, String option) {
+       public List<List<String>> selectQuery(String dbFilePath, String[] columnName, String tableName,
+                       String option) {
                List<List<String>> dbInfo = null;
                String query = null;
                Statement stat = null;
@@ -517,8 +514,7 @@ public class SqlManager {
                                                } else if (rsMetaData.getColumnTypeName(i).contains("VARCHAR")) {//$NON-NLS-1$
                                                        rowData.add(rs.getString(rsMetaData.getColumnName(i)));
                                                } else {
-                                                       Logger.debug("Error undefine Type : "
-                                                                       + rsMetaData.getColumnTypeName(i));
+                                                       Logger.debug("Error undefine Type : " + rsMetaData.getColumnTypeName(i));
                                                }
 
                                        }
@@ -603,6 +599,11 @@ public class SqlManager {
                        } else {
                                conn = getConnection(dbFilePath);
                        }
+
+                       if (conn == null) {
+                               return null;
+                       }
+
                        if (null == tableName || tableName.length() < 1) {
                                Logger.debug("tableName is null");
                                return null;
@@ -650,8 +651,7 @@ public class SqlManager {
                                                } else if (rsMetaData.getColumnTypeName(i).contains("VARCHAR")) {//$NON-NLS-1$
                                                        rowData.add(rs.getString(rsMetaData.getColumnName(i)));
                                                } else {
-                                                       Logger.error("Error undefine Type : "
-                                                                       + rsMetaData.getColumnTypeName(i));
+                                                       Logger.error("Error undefine Type : " + rsMetaData.getColumnTypeName(i));
                                                }
 
                                        }
@@ -715,7 +715,7 @@ public class SqlManager {
                String queryOption = "where time >=" + time;//$NON-NLS-1$
                List<List<String>> dbInfo = selectQuery(null,
                                new String[] { "min(time)" }, "screenshot", queryOption); //$NON-NLS-1$ //$NON-NLS-2$
-               if (null == dbInfo.get(0).get(0) || dbInfo.isEmpty()) {
+               if (dbInfo == null || dbInfo.isEmpty() || null == dbInfo.get(0).get(0)) {
                        return -1;
                }
                return Long.parseLong(dbInfo.get(0).get(0));
@@ -762,37 +762,31 @@ public class SqlManager {
                                .getLogFormatById(logId)
                                .getDBColumnNames()
                                .toArray(
-                                               new String[LogDataFactory.getLogFormatById(logId)
-                                                               .getDBColumnNames().size()]);
+                                               new String[LogDataFactory.getLogFormatById(logId).getDBColumnNames().size()]);
 
-               List<LogData> dbInfo = newSelectQuery(null, columnNames, tableName,
-                               queryOption.toString()); //$NON-NLS-1$ //$NON-NLS-2$
+               List<LogData> dbInfo = newSelectQuery(null, columnNames, tableName, queryOption.toString()); //$NON-NLS-1$ //$NON-NLS-2$
 
                return dbInfo;
        }
 
-       public List<LogData> selectArea2(int logId, long start, long end, long base,
-                       long count) {
+       public List<LogData> selectArea2(int logId, long start, long end, long base, long count) {
 
                String tableName = LogDataFactory.getLogFormatById(logId).getName();
                StringBuffer preOption = new StringBuffer();
-               preOption
-                               .append(" limit ").append(base).append(CommonConstants.SPACE).append(count); //$NON-NLS-1$
+               preOption.append(" limit ").append(base).append(CommonConstants.SPACE).append(count); //$NON-NLS-1$
 
                StringBuffer postOption = new StringBuffer();
-               postOption.append(" where time >= ").append(start).append(" and time <= ")
-                               .append(end);
+               postOption.append(" where time >= ").append(start).append(" and time <= ").append(end);
                postOption.append(" order by time asc "); //$NON-NLS-1$
 
                String[] columnNames = LogDataFactory
                                .getLogFormatById(logId)
                                .getDBColumnNames()
                                .toArray(
-                                               new String[LogDataFactory.getLogFormatById(logId)
-                                                               .getDBColumnNames().size()]);
+                                               new String[LogDataFactory.getLogFormatById(logId).getDBColumnNames().size()]);
 
-               List<LogData> dbInfo = newSelectQuery2(null, columnNames, tableName,
-                               preOption.toString(), postOption.toString()); //$NON-NLS-1$ //$NON-NLS-2$
+               List<LogData> dbInfo = newSelectQuery2(null, columnNames, tableName, preOption.toString(),
+                               postOption.toString()); //$NON-NLS-1$ //$NON-NLS-2$
 
                return dbInfo;
        }
@@ -814,8 +808,8 @@ public class SqlManager {
        // return dbInfo;
        // }
 
-       public synchronized List<LogData> selectTableData(String tableName,
-                       List<String> tableNames, int from, int to, String option) {
+       public synchronized List<LogData> selectTableData(String tableName, List<String> tableNames,
+                       int from, int to, String option) {
                String[] columnName = new String[tableNames.size()];
                for (int i = 0; i < tableNames.size(); i++) {
                        columnName[i] = tableNames.get(i);
@@ -823,13 +817,12 @@ public class SqlManager {
                String preQueryOption = " limit " + from + " " + to;//$NON-NLS-1$ //$NON-NLS-2$
                String postQueryOption = " where " + option;//$NON-NLS-1$ //$NON-NLS-2$
 
-               List<LogData> dbInfo = newSelectQuery2(null, columnName, tableName,
-                               preQueryOption, postQueryOption);
+               List<LogData> dbInfo = newSelectQuery2(null, columnName, tableName, preQueryOption,
+                               postQueryOption);
                return dbInfo;
        }
 
-       public synchronized long getSelectionTime(String tableName, long startTime,
-                       String option) {
+       public synchronized long getSelectionTime(String tableName, long startTime, String option) {
                String query = null;
                Statement stat = null;
                ResultSet rs = null;
@@ -878,8 +871,8 @@ public class SqlManager {
                return 0;
        }
 
-       public synchronized int getSelectionIndex(String tableName, String columnname,
-                       long startTime, String option) {
+       public synchronized int getSelectionIndex(String tableName, String columnname, long startTime,
+                       String option) {
                String query = null;
                Statement stat = null;
                ResultSet rs = null;
index 85c0b7a..bccef1a 100644 (file)
@@ -157,6 +157,7 @@ public class BasicDataMessage {
                        break;
                case LogCenterConstants.LOG_GLES20:
                        newId = DataChannelConstants.MSG_PROBE_GLES20;
+                       break;
                case LogCenterConstants.LOG_LIFECYCLE:
                        newId = DataChannelConstants.MSG_PROBE_LIFECYCLE;
                        break;
index e793783..4c8e4f5 100755 (executable)
@@ -120,9 +120,9 @@ public class Communicator30 extends BaseCommunicator {
                }
 
                // daemon start
-               Process ps = CommunicatorUtils.execCommand(devInfo.getIDevice(),
+               CommunicatorUtils.execCommand(devInfo.getIDevice(),
                                AnalyzerShellCommands.DACOMMAND_RUN_MANAGER);
-               Logger.debug(ps.toString());
+               Logger.debug("run manager");
 
                // get port
                int remotePort = CommunicatorUtils.getRemotePort(devInfo.getIDevice());
@@ -184,6 +184,11 @@ public class Communicator30 extends BaseCommunicator {
                UserSpaceInst userSpaceInst = getUserSpaceInst();
                Logger.performance("TEST", "Start Trace", "Set application inst");
 
+               if (userSpaceInst == null) {
+                       Logger.error("cannot get user space inst");
+                       return HostResult.ERR_MSG_START_FAIL;
+               }
+
                byte[] replayData;
                // create replay data
                if (ReplayTraceHandler.isReplay) {
@@ -712,8 +717,7 @@ public class Communicator30 extends BaseCommunicator {
        }
 
        public HostResult getTargetInfo(DeviceInfo device) {
-               Logger.debug("Send target info  : "
-                               + ByteUtil.getByte(AnalyzerConstants.MSG_TARGET_INFO, 0));
+               Logger.debug("Send target info...");
                HostResult result = handleControlMessage(device,
                                ByteUtil.getByte(AnalyzerConstants.MSG_TARGET_INFO, 0));
                if (result.isSuccess()) {
@@ -731,8 +735,7 @@ public class Communicator30 extends BaseCommunicator {
 
        @Override
        public HostResult sendKeepAliveMessage(DeviceInfo device) {
-               Logger.debug("Send keep alive message  : "
-                               + ByteUtil.getByte(AnalyzerConstants.MSG_KEEP_ALIVE, 0));
+               Logger.debug("Send keep alive message...");
                HostResult result = handleControlMessage(device,
                                ByteUtil.getByte(AnalyzerConstants.MSG_KEEP_ALIVE, 0));
                if (result.isSuccess()) {
index adf00a8..f8297c2 100755 (executable)
@@ -491,7 +491,16 @@ public class MessageParser {
                                        }
                                });
                        }
-
+                       
+                       if (AnalyzerManager.isProcessInfoArrived()) {
+                               // make log
+                               log = LogDataFactory.createInstance(data);
+                               if (null != log) {
+                                       buffer.add(log);
+                                       messageCount += 1;
+                               }
+                       }
+                       break;
                case DataChannelConstants.MSG_FUNCTION_ENTRY:
                case DataChannelConstants.MSG_FUNCTION_EXIT:
                case DataChannelConstants.MSG_DATA_SAMPLE:
index 96e385a..ba87e96 100755 (executable)
@@ -42,7 +42,6 @@ import org.tizen.dynamicanalyzer.communicator.DACommunicator;
 import org.tizen.dynamicanalyzer.constant.CommonConstants;
 import org.tizen.dynamicanalyzer.model.ImageInfo;
 import org.tizen.dynamicanalyzer.project.FunctionNameManager;
-import org.tizen.dynamicanalyzer.project.ProcessInformation;
 import org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants;
 import org.tizen.dynamicanalyzer.swap.model.data.ContextSwitchData;
 import org.tizen.dynamicanalyzer.swap.model.data.LogData;
@@ -82,9 +81,6 @@ public class SWAPLogParser implements Runnable {
        }
 
        public List<Integer> getFunctionEntryStack(int tid) {
-               if (null == functionEntryStackByTidMap) {
-                       functionEntryStackByTidMap = new HashMap<Integer, List<Integer>>();
-               }
                List<Integer> functionEntryStack = functionEntryStackByTidMap.get(tid);
                if (null == functionEntryStack) {
                        functionEntryStack = new ArrayList<Integer>();
@@ -178,14 +174,14 @@ public class SWAPLogParser implements Runnable {
                                                        Logger.error("function exit log without entry log");
                                                }
                                        }
-                                       
+
                                        // function_exit log doesn't have probe type yet
                                        // if (pData.getProbeType()
                                        // == AnalyzerConstants.FUNCTION_TYPE_APPINST) {
 
-//                                     ProcessInformation process = AnalyzerManager.getProject()
-//                                                     .getProcessInformation(pData.getPid());
-                                       if(pData.getProbeType() != AnalyzerConstants.FUNCTION_TYPE_FILE) {
+                                       // ProcessInformation process = AnalyzerManager.getProject()
+                                       // .getProcessInformation(pData.getPid());
+                                       if (pData.getProbeType() != AnalyzerConstants.FUNCTION_TYPE_FILE) {
                                                int apiId = SymbolManager.getFuncId(pData, pData.getPcAddr(),
                                                                pData.getPid(), pData.getTime());
                                                String apiName = FunctionNameManager.getFunctionName(apiId);
@@ -195,15 +191,15 @@ public class SWAPLogParser implements Runnable {
                                                } else {
                                                        pData.setApiId(apiId);
                                                }
-                                               
-       //                                      if (process.isDropLog()) {
-       //                                              if (apiName.contains("main")) {
-       //                                                      process.setDropLog(false);
-       //                                              } else {
-       //                                                      continue;
-       //                                              }
-       //                                      }
-       
+
+                                               // if (process.isDropLog()) {
+                                               // if (apiName.contains("main")) {
+                                               // process.setDropLog(false);
+                                               // } else {
+                                               // continue;
+                                               // }
+                                               // }
+
                                                pushLog(log, logPack);
                                                AnalyzerManager.getCallstackManager().makeUserCallstack(
                                                                pData,
@@ -212,7 +208,7 @@ public class SWAPLogParser implements Runnable {
                                                // } else { // system call enter/exit : not used yet
                                                // pushLog(log, logPack);
                                                // }
-                                       }else {
+                                       } else {
                                                pushLog(log, logPack);
                                        }
                                } else { // sample log
@@ -234,8 +230,7 @@ public class SWAPLogParser implements Runnable {
                                        String remoteImgPath;
                                        if (DACommunicator.isTargetEmulator()
                                                        && SocketClient.getInstance().isConnected()) {
-                                               GlobalInformation.getCurrentDeviceInfo().emulatorScreenshot
-                                                               .send();
+                                               GlobalInformation.getCurrentDeviceInfo().emulatorScreenshot.send();
                                                remoteImgPath = GlobalInformation.getCurrentDeviceInfo().emulatorScreenshot
                                                                .getFilePath();
                                                bECS = true;
@@ -262,12 +257,12 @@ public class SWAPLogParser implements Runnable {
                                }
                                pushLog(log, logPack);
                                AnalyzerManager.getCallstackManager().makeCallstackWithoutBacktrace(log);
-//                             if (id == DataChannelConstants.MSG_PROBE_FILE
-//                                             || id == DataChannelConstants.MSG_PROBE_MEMORY) {
-//                                     AnalyzerManager.getLeakDetector().runLeakDectect(log);
-//                             }
-//
-//                             AnalyzerManager.getFailedChecker().check(log);
+                               // if (id == DataChannelConstants.MSG_PROBE_FILE
+                               // || id == DataChannelConstants.MSG_PROBE_MEMORY) {
+                               // AnalyzerManager.getLeakDetector().runLeakDectect(log);
+                               // }
+                               //
+                               // AnalyzerManager.getFailedChecker().check(log);
                        }
                }
 
@@ -293,21 +288,15 @@ public class SWAPLogParser implements Runnable {
                                        if (null != res && res.isOk()) {
                                                DACommunicator.removeCommand(from);
                                                /* image resizing */
-                                               String smallImagePath = AnalyzerManager.getProject()
-                                                               .getSavePath()
-                                                               + File.separator
-                                                               + AnalyzerConstants.IMAGE_FOLDER_NAME
-                                                               + File.separator
-                                                               + AnalyzerConstants.SMALL_IMAGE_FOLDER_NAME
+                                               String smallImagePath = AnalyzerManager.getProject().getSavePath()
+                                                               + File.separator + AnalyzerConstants.IMAGE_FOLDER_NAME
+                                                               + File.separator + AnalyzerConstants.SMALL_IMAGE_FOLDER_NAME
                                                                + File.separator + fileName;
-                                               ImageUtil.transform(to, to, DEFAULT_IMG_WIDTH,
-                                                               DEFAULT_IMG_HEIGHT, angle);
+                                               ImageUtil.transform(to, to, DEFAULT_IMG_WIDTH, DEFAULT_IMG_HEIGHT, angle);
                                                if (angle == 90 || angle == 270) {
-                                                       ImageUtil.resize(to, smallImagePath, SMALL_IMG_HEIGHT,
-                                                                       SMALL_IMG_WIDTH);
+                                                       ImageUtil.resize(to, smallImagePath, SMALL_IMG_HEIGHT, SMALL_IMG_WIDTH);
                                                } else {
-                                                       ImageUtil.resize(to, smallImagePath, SMALL_IMG_WIDTH,
-                                                                       SMALL_IMG_HEIGHT);
+                                                       ImageUtil.resize(to, smallImagePath, SMALL_IMG_WIDTH, SMALL_IMG_HEIGHT);
                                                }
 
                                                break;
@@ -342,15 +331,12 @@ public class SWAPLogParser implements Runnable {
                                        File file = new File(path);
                                        if (file.exists()) {
                                                /* image resizing */
-                                               String smallImagePath = AnalyzerManager.getProject()
-                                                               .getSavePath()
-                                                               + File.separator
-                                                               + AnalyzerConstants.IMAGE_FOLDER_NAME
-                                                               + File.separator
-                                                               + AnalyzerConstants.SMALL_IMAGE_FOLDER_NAME
+                                               String smallImagePath = AnalyzerManager.getProject().getSavePath()
+                                                               + File.separator + AnalyzerConstants.IMAGE_FOLDER_NAME
+                                                               + File.separator + AnalyzerConstants.SMALL_IMAGE_FOLDER_NAME
                                                                + File.separator + fileName;
-                                               ImageUtilSWT.transform(path, path, DEFAULT_IMG_WIDTH,
-                                                               DEFAULT_IMG_HEIGHT, angle);
+                                               ImageUtilSWT.transform(path, path, DEFAULT_IMG_WIDTH, DEFAULT_IMG_HEIGHT,
+                                                               angle);
                                                if (angle == 90 || angle == 270) {
                                                        ImageUtilSWT.resize(path, smallImagePath, SMALL_IMG_HEIGHT,
                                                                        SMALL_IMG_WIDTH);
@@ -398,28 +384,10 @@ public class SWAPLogParser implements Runnable {
                                || logData.getId() == DataChannelConstants.MSG_FUNCTION_EXIT) {
                        ProfileData data = (ProfileData) logData;
                        if (data.getProbeType() == AnalyzerConstants.FUNCTION_TYPE_FILE) {
-                               logPack.setLogs(DataChannelConstants.MSG_FUCNTION_ENTRY_EXIT,
-                                               logData);
+                               logPack.setLogs(DataChannelConstants.MSG_FUCNTION_ENTRY_EXIT, logData);
                                return;
                        }
                }
                logPack.setLogs(logData.getId(), logData);
        }
-
-       // private void printContextSwitchData(LogData log) {
-       // ContextSwitchData input = (ContextSwitchData) log;
-       //
-       // System.out.print("seq : " + input.getSeq());
-       // System.out.print("  id : ");
-       // AnalyzerUtil.printHexdecimal(input.getId());
-       // System.out.print(" function name : " + functionName + "[ low :");
-       // AnalyzerUtil.printHexdecimal(Long.parseLong(baseAddr));
-       // System.out.print("   high : ");
-       // AnalyzerUtil.printHexdecimal(Long.parseLong(highAddr));
-       // System.out.print(" pcAddr : ");
-       // AnalyzerUtil.printHexdecimal(Long.parseLong(pcAddr));
-       // System.out.print("  tid " + input.getTid() + " pid " + input.getPid()
-       // + "  time " + input.getTime());
-       // System.out.println(" ]");
-       // }
 }
index 38f8fed..e0aec91 100755 (executable)
@@ -36,11 +36,11 @@ import java.util.List;
 
 public class CommonColumns {
 
-       private static String[] dcn = { "APPID", "PID", "TID", "args", "Return",
-                       "Errno", "InternalCall", "CallerPCAddr", "Reserved1", "Reserved2", "LibName" };
-       private static Integer[] dct = { I, I, I, T, T, L, I, L, I, I , T};
-       private static String[] tcn = { "App ID", "PID", "TID", "Args", "Return",
-                       "Errno", "Internal Call", "Caller PCAddr", "Reserved1", "Reserved2", "LibName" };
+       private static String[] dcn = { "APPID", "PID", "TID", "args", "Return", "Errno",
+                       "InternalCall", "CallerPCAddr", "Reserved1", "Reserved2", "LibName" };
+       private static Integer[] dct = { I, I, I, T, T, L, I, L, I, I, T };
+       private static String[] tcn = { "App ID", "PID", "TID", "Args", "Return", "Errno",
+                       "Internal Call", "Caller PCAddr", "Reserved1", "Reserved2", "LibName" };
        private static Integer[] logTypes = { I, I, I, T, T, L, I, L, I, I, T };
 
        private static List<String> dbColumnNames = null;
@@ -50,9 +50,13 @@ public class CommonColumns {
 
        public static List<String> getDBColumnNames() {
                if (null == dbColumnNames) {
-                       dbColumnNames = new ArrayList<String>();
-                       dbColumnNames.addAll(HeaderColumns.getDBColumnNames());
-                       dbColumnNames.addAll(Arrays.asList(dcn));
+                       synchronized (CommonColumns.class) {
+                               if (null == dbColumnNames) {
+                                       dbColumnNames = new ArrayList<String>();
+                                       dbColumnNames.addAll(HeaderColumns.getDBColumnNames());
+                                       dbColumnNames.addAll(Arrays.asList(dcn));
+                               }
+                       }
                }
                ArrayList<String> ret = new ArrayList<String>();
                ret.addAll(dbColumnNames);
@@ -62,9 +66,13 @@ public class CommonColumns {
 
        public static List<Integer> getDBColumntypes() {
                if (null == dbColumnTypes) {
-                       dbColumnTypes = new ArrayList<Integer>();
-                       dbColumnTypes.addAll(HeaderColumns.getDBColumntypes());
-                       dbColumnTypes.addAll(Arrays.asList(dct));
+                       synchronized (CommonColumns.class) {
+                               if (null == dbColumnTypes) {
+                                       dbColumnTypes = new ArrayList<Integer>();
+                                       dbColumnTypes.addAll(HeaderColumns.getDBColumntypes());
+                                       dbColumnTypes.addAll(Arrays.asList(dct));
+                               }
+                       }
                }
 
                ArrayList<Integer> ret = new ArrayList<Integer>();
@@ -74,9 +82,13 @@ public class CommonColumns {
 
        public static List<String> getTableColumnNames() {
                if (null == tableColumnNames) {
-                       tableColumnNames = new ArrayList<String>();
-                       tableColumnNames.addAll(HeaderColumns.getTableColumnNames());
-                       tableColumnNames.addAll(Arrays.asList(tcn));
+                       synchronized (CommonColumns.class) {
+                               if (null == tableColumnNames) {
+                                       tableColumnNames = new ArrayList<String>();
+                                       tableColumnNames.addAll(HeaderColumns.getTableColumnNames());
+                                       tableColumnNames.addAll(Arrays.asList(tcn));
+                               }
+                       }
                }
                ArrayList<String> ret = new ArrayList<String>();
                ret.addAll(tableColumnNames);
@@ -85,9 +97,13 @@ public class CommonColumns {
 
        public static List<Integer> getLogColumnTypes() {
                if (null == types) {
-                       types = new ArrayList<Integer>();
-                       types.addAll(HeaderColumns.getLogColumnTypes());
-                       types.addAll(Arrays.asList(logTypes));
+                       synchronized (CommonColumns.class) {
+                               if (null == types) {
+                                       types = new ArrayList<Integer>();
+                                       types.addAll(HeaderColumns.getLogColumnTypes());
+                                       types.addAll(Arrays.asList(logTypes));
+                               }
+                       }
                }
 
                ArrayList<Integer> ret = new ArrayList<Integer>();
index c484831..4899688 100755 (executable)
@@ -102,24 +102,27 @@ public class LogFormat {
 
        public static List<LogFormat> getLogFormats() {
                if (null == logFormats) {
-                       logFormats = new ArrayList<LogFormat>();
-
-                       logFormats.add(ContextSwitchLogFormat.getInstance());
-                       logFormats.add(ControlLogFormat.getInstance());
-                       logFormats.add(CustomChartLogFormat.getInstance());
-                       logFormats.add(FileLogFormat.getInstance());
-       //              logFormats.add(NetworkLogFormat.getInstance());
-                       logFormats.add(LifeCycleLogFormat.getInstance());
-                       logFormats.add(MemoryLogFormat.getInstance());
-       //              logFormats.add(ReplayLogFormat.getInstance());
-                       logFormats.add(SceneLogFormat.getInstance());
-                       logFormats.add(ScreenShotLogFormat.getInstance());
-                       logFormats.add(SyncLogFormat.getInstance());
-                       logFormats.add(SystemLogFormat.getInstance());
-                       logFormats.add(ThreadLogFormat.getInstance());
-                       logFormats.add(UIEventLogFormat.getInstance());
-       //              logFormats.add(GLES20LogFormat.getInstance());
-
+                       synchronized (LogFormat.class) {
+                               if (null == logFormats) {
+                                       logFormats = new ArrayList<LogFormat>();
+
+                                       logFormats.add(ContextSwitchLogFormat.getInstance());
+                                       logFormats.add(ControlLogFormat.getInstance());
+                                       logFormats.add(CustomChartLogFormat.getInstance());
+                                       logFormats.add(FileLogFormat.getInstance());
+                       //              logFormats.add(NetworkLogFormat.getInstance());
+                                       logFormats.add(LifeCycleLogFormat.getInstance());
+                                       logFormats.add(MemoryLogFormat.getInstance());
+                       //              logFormats.add(ReplayLogFormat.getInstance());
+                                       logFormats.add(SceneLogFormat.getInstance());
+                                       logFormats.add(ScreenShotLogFormat.getInstance());
+                                       logFormats.add(SyncLogFormat.getInstance());
+                                       logFormats.add(SystemLogFormat.getInstance());
+                                       logFormats.add(ThreadLogFormat.getInstance());
+                                       logFormats.add(UIEventLogFormat.getInstance());
+                       //              logFormats.add(GLES20LogFormat.getInstance());
+                               }
+                       }
                }
                return logFormats;
        }
index a7c37d3..19c0433 100644 (file)
@@ -35,7 +35,6 @@ import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
 import org.tizen.dynamicanalyzer.common.AnalyzerManager;
 import org.tizen.dynamicanalyzer.common.SymbolManager;
 import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
-import org.tizen.dynamicanalyzer.logparser.LogParser;
 import org.tizen.dynamicanalyzer.project.ProcessMemoryMap;
 import org.tizen.dynamicanalyzer.swap.callstack.BaseCallstackManager;
 import org.tizen.dynamicanalyzer.swap.model.data.LogData;
@@ -201,13 +200,6 @@ public class CallStackManager extends BaseCallstackManager {
                        } else {
                                Logger.debug("makeUserCallstack : EXIT self is not the same as top of user callstack");
                        }
-                       if (AnalyzerManager.isOsp()) {
-                               // String apiName = input[LogCenterConstants.APINAME_INDEX];
-                               String apiName = log.getApiName();
-                               if (apiName.equals("OspMain")) { //$NON-NLS-1$
-                                       LogParser.setDropCallTraceLog(true);
-                               }
-                       }
                }
        }
        // TODO: will be removed with other 2.2 only code
@@ -365,13 +357,6 @@ public class CallStackManager extends BaseCallstackManager {
                        } else {
                                Logger.debug("makeUserCallstack : EXIT self is not the same as top of user callstack");
                        }
-                       if (AnalyzerManager.isOsp()) {
-                               // String apiName = input[LogCenterConstants.APINAME_INDEX];
-                               String apiName = log.getApiName();
-                               if (apiName.equals("OspMain")) { //$NON-NLS-1$
-                                       LogParser.setDropCallTraceLog(true);
-                               }
-                       }
                }
        }       
 
index 8741c91..42a225c 100644 (file)
@@ -69,8 +69,7 @@ import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenuItem;
 public class ContextSwitchingChart extends DAChartBoard {
        public static final String KERNEL_CHART_DATA_TYPE = "kernel_data_type";
 
-       private final KernelDataMaker dataMaker = KernelDataManager.getInstance()
-                       .getDataMaker();
+       private final KernelDataMaker dataMaker = KernelDataManager.getInstance().getDataMaker();
 
        private int savedSelectedPid = 0;
 
@@ -78,8 +77,7 @@ public class ContextSwitchingChart extends DAChartBoard {
                super(parent, title);
        }
 
-       public ContextSwitchingChart(Composite parent, String title,
-                       int[] scaleValues) {
+       public ContextSwitchingChart(Composite parent, String title, int[] scaleValues) {
                super(parent, title, scaleValues);
        }
 
@@ -122,8 +120,7 @@ public class ContextSwitchingChart extends DAChartBoard {
 
                                DAChart coreChart = coreItem.getChart();
                                DAChartSeries coreSeries = new DAChartSeries(
-                                               KernelPageLabels.CONTEXT_SWITCH_SERIES_NAME, -1,
-                                               ColorResources.BLUE);
+                                               KernelPageLabels.CONTEXT_SWITCH_SERIES_NAME, -1, ColorResources.BLUE);
                                coreChart.addSeries(coreSeries);
 
                                coreItem.setData(new KernelSelectionData(kdata,
@@ -145,8 +142,7 @@ public class ContextSwitchingChart extends DAChartBoard {
 
                                DAChart functionChart = functionItem.getChart();
                                DAChartSeries functionSeries = new DAChartSeries(
-                                               KernelPageLabels.CONTEXT_SWITCH_SERIES_NAME_CHILD, -1,
-                                               ColorResources.RED);
+                                               KernelPageLabels.CONTEXT_SWITCH_SERIES_NAME_CHILD, -1, ColorResources.RED);
                                functionChart.addSeries(functionSeries);
 
                                functionItem.setData(new KernelSelectionData(kdata,
@@ -171,8 +167,7 @@ public class ContextSwitchingChart extends DAChartBoard {
                        for (int i = 0; i < thread_size; i++) {
                                if (selectedPid != 0) {
                                        DAChartBoardItem item = itemlist.get(i);
-                                       KernelSelectionData seldata = (KernelSelectionData) item
-                                                       .getData();
+                                       KernelSelectionData seldata = (KernelSelectionData) item.getData();
                                        if (seldata.getData().getPid() == selectedPid) {
                                                showItem(i);
                                        } else {
@@ -189,18 +184,14 @@ public class ContextSwitchingChart extends DAChartBoard {
                long starttime = (long) (getVisibleStartTime() * TimelineConstants.MEGA_DOUBLE);
                long endtime = (long) (getVisibleEndTime() * TimelineConstants.MEGA_DOUBLE);
 
-               List<List<Object>> contextData = dataMaker.getContextDataFromDB(
-                               starttime, endtime);
-               List<List<Object>> functionData = dataMaker.getFunctionDataFromDB(
-                               starttime, endtime, -1);
+               List<List<Object>> contextData = dataMaker.getContextDataFromDB(starttime, endtime);
+               List<List<Object>> functionData = dataMaker.getFunctionDataFromDB(starttime, endtime, -1);
                if (contextData != null) {
                        int csize = contextData.size();
                        for (int i = 0; i < csize; i++) {
                                List<Object> idata = contextData.get(i);
-                               int tid = (Integer) idata
-                                               .get(ContextDataDBTable.COLUMN.TID.index);
-                               int cpunum = (Integer) idata
-                                               .get(ContextDataDBTable.COLUMN.CPUNUM.index);
+                               int tid = (Integer) idata.get(ContextDataDBTable.COLUMN.TID.index);
+                               int cpunum = (Integer) idata.get(ContextDataDBTable.COLUMN.CPUNUM.index);
                                double contextStart = (double) ((Long) idata
                                                .get(ContextDataDBTable.COLUMN.STARTTIME.index))
                                                / TimelineConstants.MEGA_DOUBLE;
@@ -214,8 +205,7 @@ public class ContextSwitchingChart extends DAChartBoard {
 
                                coreSeries.addSeriesItem(new ContextSwitchingChartSeriesItem(
                                                KernelPageLabels.CONTEXT_SWITCH_SERIES_ITEM_NAME + " "
-                                                               + Integer.toString(cpunum), contextStart,
-                                               contextEnd));
+                                                               + Integer.toString(cpunum), contextStart, contextEnd));
                                // System.out.println("context(" + tid + ")(" + contextStart +
                                // ","
                                // + contextEnd + ")");
@@ -226,10 +216,8 @@ public class ContextSwitchingChart extends DAChartBoard {
                        int fsize = functionData.size();
                        for (int i = 0; i < fsize; i++) {
                                List<Object> idata = functionData.get(i);
-                               int tid = (Integer) idata
-                                               .get(FunctionDataDBTable.COLUMN.TID.index);
-                               int funcId = (Integer) idata
-                                               .get(FunctionDataDBTable.COLUMN.FUNCID.index);                          
+                               int tid = (Integer) idata.get(FunctionDataDBTable.COLUMN.TID.index);
+                               int funcId = (Integer) idata.get(FunctionDataDBTable.COLUMN.FUNCID.index);
                                String funcname = FunctionNameManager.getFunctionName(funcId);
                                double funcStart = (double) ((Long) idata
                                                .get(FunctionDataDBTable.COLUMN.STARTTIME.index))
@@ -237,40 +225,38 @@ public class ContextSwitchingChart extends DAChartBoard {
                                double funcEnd = (double) ((Long) idata
                                                .get(FunctionDataDBTable.COLUMN.ENDTIME.index))
                                                / TimelineConstants.MEGA_DOUBLE;
-                               int type = (Integer) idata
-                                               .get(FunctionDataDBTable.COLUMN.STARTTYPE.index)
-                                               + (Integer) idata
-                                                               .get(FunctionDataDBTable.COLUMN.ENDTYPE.index);
+                               int type = (Integer) idata.get(FunctionDataDBTable.COLUMN.STARTTYPE.index)
+                                               + (Integer) idata.get(FunctionDataDBTable.COLUMN.ENDTYPE.index);
 
-                               DAChartBoardItem functionItem = findFunctionBoardItem(threads,
-                                               tid);
+                               DAChartBoardItem functionItem = findFunctionBoardItem(threads, tid);
                                assert (functionItem != null);
                                DAChartSeries funcSeries = functionItem.getChart().getSeries(0);
+                               if (funcSeries != null) {
+                                       int style;
+                                       switch (type) {
+                                       case 21:
+                                       case 31:
+                                               style = ContextSwitchingChartSeriesItem.STYLE_OCTAGON_LEFT_ONLY;
+                                               break;
+                                       case 12:
+                                       case 13:
+                                               style = ContextSwitchingChartSeriesItem.STYLE_OCTAGON_RIGHT_ONLY;
+                                               break;
+                                       case 22:
+                                       case 32:
+                                       case 23:
+                                       case 33:
+                                               style = ContextSwitchingChartSeriesItem.STYLE_OCTAGON;
+                                               break;
+                                       case 11:
+                                       default:
+                                               style = ContextSwitchingChartSeriesItem.STYLE_SQUARE;
+                                               break;
+                                       }
 
-                               int style;
-                               switch (type) {
-                               case 21:
-                               case 31:
-                                       style = ContextSwitchingChartSeriesItem.STYLE_OCTAGON_LEFT_ONLY;
-                                       break;
-                               case 12:
-                               case 13:
-                                       style = ContextSwitchingChartSeriesItem.STYLE_OCTAGON_RIGHT_ONLY;
-                                       break;
-                               case 22:
-                               case 32:
-                               case 23:
-                               case 33:
-                                       style = ContextSwitchingChartSeriesItem.STYLE_OCTAGON;
-                                       break;
-                               case 11:
-                               default:
-                                       style = ContextSwitchingChartSeriesItem.STYLE_SQUARE;
-                                       break;
+                                       funcSeries.addSeriesItem(new ContextSwitchingChartSeriesItem(funcname,
+                                                       funcStart, funcEnd, style));
                                }
-
-                               funcSeries.addSeriesItem(new ContextSwitchingChartSeriesItem(
-                                               funcname, funcStart, funcEnd, style));
                        }
                }
 
@@ -280,15 +266,12 @@ public class ContextSwitchingChart extends DAChartBoard {
        }
 
        private String getChartName(KernelDataPerThread data) {
-               String name = KernelPageLabels.CONTEXT_SWITCH_BOARD_NAME_PID + " "
-                               + data.getPid() + "\n"
-                               + KernelPageLabels.CONTEXT_SWITCH_BOARD_NAME_TID + " "
-                               + data.getTid();
+               String name = KernelPageLabels.CONTEXT_SWITCH_BOARD_NAME_PID + " " + data.getPid() + "\n"
+                               + KernelPageLabels.CONTEXT_SWITCH_BOARD_NAME_TID + " " + data.getTid();
                return name;
        }
 
-       private DAChartBoardItem findCoreBoardItem(
-                       List<KernelDataPerThread> threads, int tid) {
+       private DAChartBoardItem findCoreBoardItem(List<KernelDataPerThread> threads, int tid) {
                int size = threads.size();
                for (int i = 0; i < size; i++) {
                        if (threads.get(i).getTid() == tid)
@@ -298,8 +281,7 @@ public class ContextSwitchingChart extends DAChartBoard {
                return null;
        }
 
-       private DAChartBoardItem findFunctionBoardItem(
-                       List<KernelDataPerThread> threads, int tid) {
+       private DAChartBoardItem findFunctionBoardItem(List<KernelDataPerThread> threads, int tid) {
                int size = threads.size();
                for (int i = 0; i < size; i++) {
                        if (threads.get(i).getTid() == tid)
@@ -318,8 +300,7 @@ public class ContextSwitchingChart extends DAChartBoard {
 
                for (int i = 0; i < listsize; i++) {
                        DAChartBoardItem item = itemList.get(i);
-                       KernelDataPerThread gdata = ((KernelSelectionData) item.getData())
-                                       .getData();
+                       KernelDataPerThread gdata = ((KernelSelectionData) item.getData()).getData();
                        sortedmap.put(gdata, i);
                }
 
@@ -332,8 +313,7 @@ public class ContextSwitchingChart extends DAChartBoard {
                reArrangeItem(arranged.toArray(new Integer[listsize]));
        }
 
-       private void initContextSwitchChart(
-                       DAChartBoardHeightChangeableItem chartItem, boolean isParent) {
+       private void initContextSwitchChart(DAChartBoardHeightChangeableItem chartItem, boolean isParent) {
                DAChart chart = chartItem.getChart();
                if (null == chart) {
                        return;
@@ -363,32 +343,24 @@ public class ContextSwitchingChart extends DAChartBoard {
                DAPopupMenu popupMenu = new DAPopupMenu(chart);
                popupMenu.setFont(FontResources.CONTEXT_MENU_ITEM_FONT);
 
-               DAPopupMenuItem startItem = new DAPopupMenuItem(popupMenu,
-                               DAPopupMenuItem.NONE);
+               DAPopupMenuItem startItem = new DAPopupMenuItem(popupMenu, DAPopupMenuItem.NONE);
                startItem.setText(TimelineChartLabels.RANGE_CONTEXT_SET_START);
-               startItem.addListener(new PopupStartMenuItemClickListener(startItem,
-                               this));
+               startItem.addListener(new PopupStartMenuItemClickListener(startItem, this));
 
-               DAPopupMenuItem endItem = new DAPopupMenuItem(popupMenu,
-                               DAPopupMenuItem.NONE);
+               DAPopupMenuItem endItem = new DAPopupMenuItem(popupMenu, DAPopupMenuItem.NONE);
                endItem.setText(TimelineChartLabels.RANGE_CONTEXT_SET_END);
                endItem.addListener(new PopupEndMenuItemClickListener(endItem, this));
 
-               DAPopupMenuItem fromSelectionItem = new DAPopupMenuItem(popupMenu,
-                               DAPopupMenuItem.NONE);
-               fromSelectionItem
-                               .setText(TimelineChartLabels.RANGE_CONTEXT_SET_FROM_SELECTION);
-               fromSelectionItem
-                               .addListener(new PopupFromSelectionMenuItemClickListener(
-                                               fromSelectionItem, this));
+               DAPopupMenuItem fromSelectionItem = new DAPopupMenuItem(popupMenu, DAPopupMenuItem.NONE);
+               fromSelectionItem.setText(TimelineChartLabels.RANGE_CONTEXT_SET_FROM_SELECTION);
+               fromSelectionItem.addListener(new PopupFromSelectionMenuItemClickListener(
+                               fromSelectionItem, this));
 
-               DAPopupMenuItem analysisItem = new DAPopupMenuItem(popupMenu,
-                               DAPopupMenuItem.NONE);
+               DAPopupMenuItem analysisItem = new DAPopupMenuItem(popupMenu, DAPopupMenuItem.NONE);
                analysisItem.setText(TimelineChartLabels.RANGE_CONTEXT_ANALYSIS);
                analysisItem.addListener(new PopupAnalysisMenuItemClickListener());
 
-               DAPopupMenuItem clearItem = new DAPopupMenuItem(popupMenu,
-                               DAPopupMenuItem.NONE);
+               DAPopupMenuItem clearItem = new DAPopupMenuItem(popupMenu, DAPopupMenuItem.NONE);
                clearItem.setText(TimelineChartLabels.RANGE_CONTEXT_CLEAR);
                clearItem.addListener(new PopupClearMenuItemClickListener());
 
@@ -396,8 +368,7 @@ public class ContextSwitchingChart extends DAChartBoard {
                                popupMenu, getTimeline());
                chart.addMouseListener(timelineChartMouseEventListener);
                chart.addMouseMoveListener(timelineChartMouseEventListener);
-               chart.addMouseTrackListener(new TimelineChartMouseTrackAdapter(
-                               getTimeline()));
+               chart.addMouseTrackListener(new TimelineChartMouseTrackAdapter(getTimeline()));
                plot.setMarkers(getMarkers());
        }
 
index 902e763..20bfcfb 100644 (file)
@@ -44,9 +44,8 @@ import org.tizen.dynamicanalyzer.swap.model.data.LogData;
 import org.tizen.dynamicanalyzer.swap.model.data.LogDataTimeComparator;
 
 public class KernelDataManager extends PageDataManager {
-       private static final String PIDTID_QUERY = "select distinct "
-                       + DBConstants.COMMON_COLUMN_PID + ", "
-                       + DBConstants.COMMON_COLUMN_TID + " from %s";
+       private static final String PIDTID_QUERY = "select distinct " + DBConstants.COMMON_COLUMN_PID
+                       + ", " + DBConstants.COMMON_COLUMN_TID + " from %s";
 
        private static final String COUNT_QUERY = "select count(*) from %s where "
                        + DBConstants.COMMON_COLUMN_TID + "=%s";
@@ -87,18 +86,13 @@ public class KernelDataManager extends PageDataManager {
        }
 
        private ArrayList<LogData> getLogsFromLogPackage(LogPackage logPack) {
-               Logs contextEntryLogs = logPack
-                               .getLogs(DataChannelConstants.MSG_CONTEXT_SWITCH_ENTRY);
-               Logs contextExitLogs = logPack
-                               .getLogs(DataChannelConstants.MSG_CONTEXT_SWITCH_EXIT);
-               Logs functionEntryLogs = logPack
-                               .getLogs(DataChannelConstants.MSG_FUNCTION_ENTRY);
-               Logs functionExitLogs = logPack
-                               .getLogs(DataChannelConstants.MSG_FUNCTION_EXIT);
+               Logs contextEntryLogs = logPack.getLogs(DataChannelConstants.MSG_CONTEXT_SWITCH_ENTRY);
+               Logs contextExitLogs = logPack.getLogs(DataChannelConstants.MSG_CONTEXT_SWITCH_EXIT);
+               Logs functionEntryLogs = logPack.getLogs(DataChannelConstants.MSG_FUNCTION_ENTRY);
+               Logs functionExitLogs = logPack.getLogs(DataChannelConstants.MSG_FUNCTION_EXIT);
 
                ArrayList<LogData> kernelLogs = new ArrayList<LogData>();
-               PriorityQueue<LogData> pqueue = new PriorityQueue<LogData>(5,
-                               new LogDataTimeComparator());
+               PriorityQueue<LogData> pqueue = new PriorityQueue<LogData>(5, new LogDataTimeComparator());
 
                List<LogData> contextEntryLogList = null, contextExitLogList = null, functionEntryLogList = null, functionExitLogList = null;
                Iterator<LogData> centryiter = null, cexititer = null, fentryiter = null, fexititer = null;
@@ -172,59 +166,66 @@ public class KernelDataManager extends PageDataManager {
 
                Map<Integer, KernelDataPerThread> threadMap = new HashMap<Integer, KernelDataPerThread>();
 
-               String query = String.format(PIDTID_QUERY,
-                               contextDataTable.getTableName());
-               List<List<Object>> contextPidTid = SqlConnectionManager
-                               .executeQuery(query);
+               String query = String.format(PIDTID_QUERY, contextDataTable.getTableName());
+               List<List<Object>> contextPidTid = SqlConnectionManager.executeQuery(query);
                query = String.format(PIDTID_QUERY, functionDataTable.getTableName());
-               List<List<Object>> functionPidTid = SqlConnectionManager
-                               .executeQuery(query);
-
-               int threadsize = contextPidTid.size();
-               for (int i = 0; i < threadsize; i++) {
-                       List<Object> row = contextPidTid.get(i);
-                       int pid = ((Integer) row.get(0)).intValue();
-                       int tid = ((Integer) row.get(1)).intValue();
-
-                       KernelDataPerThread kdata = new KernelDataPerThread(pid, tid);
-                       threadMap.put(Integer.valueOf(tid), kdata);
-
-                       query = String.format(COUNT_QUERY, contextDataTable.getTableName(),
-                                       Integer.toString(tid));
-                       List<List<Object>> coreCount = SqlConnectionManager
-                                       .executeQuery(query);
-                       Object count = coreCount.get(0).get(0);
-                       if (count instanceof Integer) {
-                               kdata.setCoreFragmentCount(((Integer) count).intValue());
-                       } else if (count instanceof Long) {
-                               kdata.setCoreFragmentCount(((Long) count).intValue());
-                       }
-
-                       query = String.format(COUNT_QUERY,
-                                       functionDataTable.getTableName(), Integer.toString(tid));
-                       List<List<Object>> functionCount = SqlConnectionManager
-                                       .executeQuery(query);
-                       count = functionCount.get(0).get(0);
-                       if (count instanceof Integer) {
-                               kdata.setFunctionFragmentCount(((Integer) count).intValue());
-                       } else if (count instanceof Long) {
-                               kdata.setFunctionFragmentCount(((Long) count).intValue());
+               List<List<Object>> functionPidTid = SqlConnectionManager.executeQuery(query);
+
+               if (contextPidTid != null) {
+                       int threadsize = contextPidTid.size();
+                       for (int i = 0; i < threadsize; i++) {
+                               List<Object> row = contextPidTid.get(i);
+                               int pid = ((Integer) row.get(0)).intValue();
+                               int tid = ((Integer) row.get(1)).intValue();
+
+                               KernelDataPerThread kdata = new KernelDataPerThread(pid, tid);
+                               threadMap.put(Integer.valueOf(tid), kdata);
+
+                               query = String.format(COUNT_QUERY, contextDataTable.getTableName(),
+                                               Integer.toString(tid));
+                               List<List<Object>> coreCount = SqlConnectionManager.executeQuery(query);
+                               Object count;
+                               if (coreCount == null) {
+                                       count = Integer.valueOf(0);
+                               } else {
+                                       count = coreCount.get(0).get(0);
+                               }
+                               if (count instanceof Integer) {
+                                       kdata.setCoreFragmentCount(((Integer) count).intValue());
+                               } else if (count instanceof Long) {
+                                       kdata.setCoreFragmentCount(((Long) count).intValue());
+                               }
+
+                               query = String.format(COUNT_QUERY, functionDataTable.getTableName(),
+                                               Integer.toString(tid));
+                               List<List<Object>> functionCount = SqlConnectionManager.executeQuery(query);
+                               if (functionCount == null) {
+                                       count = Integer.valueOf(0);
+                               } else {
+                                       count = functionCount.get(0).get(0);
+                               }
+                               if (count instanceof Integer) {
+                                       kdata.setFunctionFragmentCount(((Integer) count).intValue());
+                               } else if (count instanceof Long) {
+                                       kdata.setFunctionFragmentCount(((Long) count).intValue());
+                               }
                        }
                }
 
-               threadsize = functionPidTid.size();
-               for (int i = 0; i < threadsize; i++) {
-                       List<Object> row = functionPidTid.get(i);
-                       int tid = ((Integer) row.get(1)).intValue();
+               if (functionPidTid != null) {
+                       int threadsize = functionPidTid.size();
+                       for (int i = 0; i < threadsize; i++) {
+                               List<Object> row = functionPidTid.get(i);
+                               int tid = ((Integer) row.get(1)).intValue();
 
-                       KernelDataPerThread kdata = threadMap.get(Integer.valueOf(tid));
-                       if (kdata != null) {
-                               kdata.createFunctionStack();
+                               KernelDataPerThread kdata = threadMap.get(Integer.valueOf(tid));
+                               if (kdata != null) {
+                                       kdata.createFunctionStack();
+                               }
                        }
                }
 
-               for (Map.Entry<Integer, KernelDataPerThread> entry : threadMap
-                               .entrySet()) {
+               for (Map.Entry<Integer, KernelDataPerThread> entry : threadMap.entrySet()) {
                        KernelDataPerThread kdata = entry.getValue();
                        kdataMaker.addThreadData(kdata);
                }
index 98809a9..f43ba0c 100644 (file)
@@ -65,9 +65,11 @@ public class UpdateViewTimer {
 
        public static void stop() {
                if (null != timer) {
-                       timer.cancel();
-                       timer = null;
-                       Logger.debug("update timer stop"); //$NON-NLS-1$
+                       synchronized (timer) {
+                               timer.cancel();
+                               timer = null;
+                               Logger.debug("update timer stop"); //$NON-NLS-1$
+                       }
                }
        }
 }
\ No newline at end of file
index 71050b5..2dfdb36 100644 (file)
@@ -31,7 +31,6 @@ import org.eclipse.swt.widgets.Display;
 import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
 import org.tizen.dynamicanalyzer.common.AnalyzerManager;
 import org.tizen.dynamicanalyzer.communicator.DACommunicator;
-import org.tizen.dynamicanalyzer.logparser.LogParser;
 import org.tizen.dynamicanalyzer.project.Project;
 import org.tizen.dynamicanalyzer.sql.SqlManager;
 import org.tizen.dynamicanalyzer.swap.logparser.SWAPLogParser;
@@ -87,8 +86,6 @@ public class StopLogProcessor implements Runnable {
 
                if (DACommunicator.isSWAPVersion()) {
                        SWAPLogParser.stopLogParser();
-               } else {
-                       LogParser.stopLogParser();
                }
                percent += 30;
                StopProcessManager.getInstance().setValue(percent);