<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
-#Mon Mar 10 15:44:54 KST 2014
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
-org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.7
+org.eclipse.jdt.core.compiler.source=1.6
\r
/* setting */\r
public static final Image TARGET_MOBILE_2_3 = getPngImage("feature_target_mobile"); //$NON-NLS-1$\r
- public static final Image TARGET_NAME_TV_0_1 = getPngImage("feature_target_tv"); //$NON-NLS-1$\r
+ public static final Image TARGET_NAME_TV_1_0 = getPngImage("feature_target_tv"); //$NON-NLS-1$\r
public static final Image TARGET_WEARABLE_2_3 = getPngImage("feature_target_wearable"); //$NON-NLS-1$\r
\r
public static final Image TEMPLATE_BOTTLENECK_ANALYSIS = getPngImage("feature_template_bottleneck"); //$NON-NLS-1$\r
}
});
}
+
+ public void setEnabled(boolean enabled) {
+ this.text.setEnabled(enabled);
+ }
public void setText(String text) {
this.text.setText(text);
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
-#Tue Mar 11 14:51:59 KST 2014
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
-org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.7
+org.eclipse.jdt.core.compiler.source=1.6
public static final String LOCAL_HOST = "127.0.0.1"; //$NON-NLS-1$
+ public static final int IPv4_OCTET_NUMBER = 4;
+ public static final int MAX_OCTET_NUMBER = 255;
+ public static final int MIN_PORT_NUMBER = 1;
+ public static final int MAX_PORT_NUMBER = 65535;
+
/* extensions */
public static final String EXTENSION_LOG_CENTER = ".logc"; //$NON-NLS-1$
public static final String EXTENSION_LEAK_CHECK = ".leak"; //$NON-NLS-1$
package org.tizen.dynamicanalyzer.util;
+import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
+import java.io.InputStreamReader;
import java.lang.management.ManagementFactory;
import java.lang.management.RuntimeMXBean;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
+import java.util.List;
public class CommonUtil {
private static final String OS = getOS();
private static String pid = null;
- public static int executeCommand(String[] cmds) {
- int retValue = 0;
+ public static boolean executeCommand(String cmd, List<String> stdoutput, List<String> stderror) {
+ boolean bret = false;
Process process = null;
- if (null == cmds || cmds.length == 0) {
- retValue = -1;
- } else {
+ BufferedReader reader = null;
+ BufferedReader error = null;
+
+ if (cmd != null && !cmd.isEmpty()) {
try {
- process = Runtime.getRuntime().exec(cmds);
+ process = Runtime.getRuntime().exec(cmd);
if (process != null) {
process.waitFor();
- retValue = process.exitValue();
+ reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
+ error = new BufferedReader(new InputStreamReader(process.getErrorStream()));
+
+ String line = null;
+ if (stdoutput != null) {
+ while (null != (line = reader.readLine())) {
+ stdoutput.add(line);
+ }
+ }
+
+ if (stderror != null) {
+ while (null != (line = error.readLine())) {
+ stderror.add(line);
+ }
+ }
+
+ bret = true;
}
} catch (IOException e) {
e.printStackTrace();
if (process != null) {
process.destroy();
}
+ tryClose(reader, error);
+ }
+ }
+
+ return bret;
+ }
+
+ public static boolean executeCommand(String[] cmds) {
+ return executeCommand(cmds, null, null);
+ }
+
+ public static boolean executeCommand(String[] cmds, List<String> stdoutput,
+ List<String> stderror) {
+ if (cmds != null && cmds.length != 0) {
+ StringBuffer command = new StringBuffer();
+ for (int i = 0; i < cmds.length; i++) {
+ command.append(cmds[i]);
+ if (i != cmds.length - 1) {
+ command.append(" ");
+ }
}
+
+ return executeCommand(command.toString(), stdoutput, stderror);
}
- return retValue;
+ return false;
}
public static void tryClose(final Object... closeables) {
return pid;
}
+
+ public static String getNormalizedFilename(String original) {
+ // replace prohibited character to underbar
+ String result = original.replace('/', '_');
+ result = result.replace('\\', '_');
+ result = result.replace('?', '_');
+ result = result.replace('*', '_');
+ result = result.replace(':', '_');
+ result = result.replace('|', '_');
+ result = result.replace('\"', '_');
+ result = result.replace('<', '_');
+ result = result.replace('>', '_');
+
+ return result;
+ }
}
private DATimelineMarker endRangeMarker;
public DATimeline(Composite parent, boolean useMarker) {
- super(parent, SWT.NONE);
+ super(parent, SWT.DOUBLE_BUFFERED);
this.addPaintListener(chartPaintListener);
timelineRenderer = new DATimelineTimeRenderer();
if (useMarker) {
public static final String DA_VERSION_SWAP = "3.0";
public static final String DA_VERSION_OLD = "2.2";
+ public static final String DA_VERSION = "DA-2014-10-07";
/* folder names */
public static final String TEMP_FOLDER_RUN_PREFIX = ".RUN"; //$NON-NLS-1$
public final static String COMMON_EXECUTABLE = "_Common executable_";//$NON-NLS-1$
public final static String COMMON_EXECUTABLE_LABEL = "[Common executable]";//$NON-NLS-1$
+ public final static String REMOTE_DEVICE = "[Remote Device]";//$NON-NLS-1$
+
+ public final static int DEFAULT_DEVICE_PORT = 26101;
+
// file constants
public final static int F_SETLKW = 7;
Logger.debug("auto start : " + appid);
DeviceInfo device = DACommunicator.getDeviceByName(deviceName);
Global.setCurrentDeviceInfo(device);
+ DACommunicator.updateAppListFromTarget();
PackageInfo pkgInfo = DACommunicator.getPkgInfoByMainAppID(appid);
if (null == pkgInfo) {
* Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact:
+ * WooJin Jung <woojin2.jung@samsung.com>
* Jooyoul Lee <jy.exe.lee@samsung.com>
* YeongTaik Byeon <yeongtaik.byeon@samsung.com>
* Juyoung Kim <j0.kim@samsung.com>
public static long getReadelfSize() {
long ret = -1;
getUploadDataResult().clear();
- execShellCommand(AnalyzerShellCommands.CMD_UPLOAD_FILE_LIST,
- new MultiLineReceiver() {
- @Override
- public void processNewLines(String[] lines) {
- for (int i = 0; i < lines.length; i++) {
- getUploadDataResult().add(lines[i]);
- }
- }
- });
+ execShellCommand(AnalyzerShellCommands.CMD_UPLOAD_FILE_LIST, new MultiLineReceiver() {
+ @Override
+ public void processNewLines(String[] lines) {
+ for (int i = 0; i < lines.length; i++) {
+ getUploadDataResult().add(lines[i]);
+ }
+ }
+ });
if (getUploadDataResult().isEmpty()) {
return ret;
}
} else {
readelf += CommonConstants.X86_ARCH;
}
- String source = readelf + File.separator
- + AnalyzerConstants.READELF_BIN;
+ String source = readelf + File.separator + AnalyzerConstants.READELF_BIN;
File file = new File(source);
if (file.exists()) {
readelfSize = file.length();
return HostResult.ERR_FILE_IS_NOT_EXISTS;
}
- result = uploadFile(Global.getCurrentDeviceInfo()
- .getIDevice(), source, PathConstants.DA_REMOTE_PATH
- + AnalyzerConstants.READELF_BIN);
+ result = uploadFile(Global.getCurrentDeviceInfo().getIDevice(), source,
+ PathConstants.DA_REMOTE_PATH + AnalyzerConstants.READELF_BIN);
if (!result.isSuccess()) {
return result;
}
}
public static boolean isCurrentDeviceArmArch() {
- execHostCommand(AnalyzerShellCommands.CMD_IS_ARM_ARCH,
- new MultiLineReceiver() {
- @Override
- public void processNewLines(String[] lines) {
- if (lines[0].contains(CommonConstants.ARM_ARCH)) {
- isArch = true;
- } else {
- isArch = false;
- }
- }
- });
+ execHostCommand(AnalyzerShellCommands.CMD_IS_ARM_ARCH, new MultiLineReceiver() {
+ @Override
+ public void processNewLines(String[] lines) {
+ if (lines[0].contains(CommonConstants.ARM_ARCH)) {
+ isArch = true;
+ } else {
+ isArch = false;
+ }
+ }
+ });
return isArch;
}
execShellCommand(command, NullOutputReceiver.getInstance());
}
- public static void execShellCommand(String command,
- IShellOutputReceiver receiver) {
+ public static void execShellCommand(String command, IShellOutputReceiver receiver) {
DeviceInfo currentDevice = Global.getCurrentDeviceInfo();
if (null != currentDevice && isOnline(currentDevice.getIDevice())) {
try {
- currentDevice.getIDevice().executeShellCommand(command,
- receiver);
+ currentDevice.getIDevice().executeShellCommand(command, receiver);
} catch (TimeoutException e) {
e.printStackTrace();
} catch (SdbCommandRejectedException e) {
}
public static void execShellCommand(IDevice device, String command,
- IShellOutputReceiver receiver) throws TimeoutException,
- SdbCommandRejectedException, ShellCommandUnresponsiveException,
- IOException {
+ IShellOutputReceiver receiver) throws TimeoutException, SdbCommandRejectedException,
+ ShellCommandUnresponsiveException, IOException {
if (null != device && isOnline(device)) {
device.executeShellCommand(command, receiver);
}
}
- private static HostResult uploadFile(IDevice device, String source,
- String targetPath) {
+ private static HostResult uploadFile(IDevice device, String source, String targetPath) {
HostResult ret = HostResult.SUCCESS;
SyncResult result = push(device, source, targetPath);
if (null == result || !result.isOk()) {
}
public static SyncResult push(IDevice device, String local, String remote) {
- return push(device, local, remote,
- NullSyncProgressMonitor.getInstance());
+ return push(device, local, remote, NullSyncProgressMonitor.getInstance());
}
- public static SyncResult push(IDevice currentDevice, String local,
- String remote, ISyncProgressMonitor monitor) {
+ public static SyncResult push(IDevice currentDevice, String local, String remote,
+ ISyncProgressMonitor monitor) {
SyncResult result = null;
if (null != currentDevice && isOnline(currentDevice)) {
try {
return pull(remote, local, NullSyncProgressMonitor.getInstance());
}
- public static SyncResult pull(String remote, String local,
- ISyncProgressMonitor monitor) {
+ public static SyncResult pull(String remote, String local, ISyncProgressMonitor monitor) {
SyncResult result = null;
DeviceInfo currentDevice = Global.getCurrentDeviceInfo();
if (null != currentDevice && isOnline(currentDevice.getIDevice())) {
FileOutputStream fileOut = null;
try {
fileOut = new FileOutputStream(local);
- SyncService service = currentDevice.getIDevice()
- .getSyncService();
+ SyncService service = currentDevice.getIDevice().getSyncService();
if (null != service) {
- result = service.doPull(currentDevice.getIDevice()
- .getFileEntry(remote), fileOut, monitor, -1);
+ result = service.doPull(currentDevice.getIDevice().getFileEntry(remote),
+ fileOut, monitor, -1);
}
} catch (TimeoutException e) {
e.printStackTrace();
}
public static SyncResult pull(IDevice device, String local, String remote) {
- return pull(device, local, remote,
- NullSyncProgressMonitor.getInstance());
+ return pull(device, local, remote, NullSyncProgressMonitor.getInstance());
}
public static SyncResult pull(IDevice device, String remote, String local,
fileOut = new FileOutputStream(local);
SyncService service = device.getSyncService();
if (null != service) {
- result = service.doPull(device.getFileEntry(remote),
- fileOut, monitor, -1);
+ result = service.doPull(device.getFileEntry(remote), fileOut, monitor, -1);
}
} catch (TimeoutException e) {
e.printStackTrace();
long start = System.currentTimeMillis();
while ((System.currentTimeMillis() - start) < PORT_WAIT_TIME) {
try {
- execShellCommand(device,
- AnalyzerShellCommands.CMD_CAT_PORT_FILE,
+ execShellCommand(device, AnalyzerShellCommands.CMD_CAT_PORT_FILE,
new MultiLineReceiver() {
@Override
public void processNewLines(String[] lines) {
System.out.print("=");
}
}
-
+
Thread.sleep(50);
} catch (InterruptedException e) {
System.out.print("\n");
break;
}
}
-
+
System.out.print("\n");
- if(remotePort < 0) {
+ if (remotePort < 0) {
Logger.debug("!!port get failed!!");
} else {
Logger.debug("!!port get success!! : " + remotePort);
}
-
+
return remotePort;
}
if (null != currentDevice && isOnline(currentDevice.getIDevice())) {
try {
currentDevice.getIDevice().executeShellCommand(
- AnalyzerShellCommands.CMD_REMOVE
- + CommonConstants.SPACE + path,
+ AnalyzerShellCommands.CMD_REMOVE + CommonConstants.SPACE + path,
NullOutputReceiver.getInstance());
} catch (TimeoutException e) {
e.printStackTrace();
}
}
- public static void execHostCommand(String command,
- IShellOutputReceiver receiver) {
+ public static void execHostCommand(String command, IShellOutputReceiver receiver) {
DeviceInfo currentDevice = Global.getCurrentDeviceInfo();
if (null != currentDevice && isOnline(currentDevice.getIDevice())) {
try {
- currentDevice.getIDevice()
- .executeHostCommand(command, receiver);
+ currentDevice.getIDevice().executeHostCommand(command, receiver);
} catch (IOException e) {
e.printStackTrace();
}
}
}
- public static void execHostCommand(IDevice device, String command,
- IShellOutputReceiver receiver) {
+ public static void execHostCommand(IDevice device, String command, IShellOutputReceiver receiver) {
if (null != device && isOnline(device)) {
try {
device.executeHostCommand(command, receiver);
}
public static List<String> getApiMap(IDevice device) {
- String apiFilePath = PathManager.DA_TEMP_FOLDER_PATH + File.separator
- + device.getSerialNumber() + CommonConstants.UNDERBAR
- + AnalyzerConstants.API_NAME_FILE_NAME;
try {
device.becomeSuperUser(true);
} catch (TimeoutException e) {
e.printStackTrace();
}
- SyncResult res = CommunicatorUtils.pull(device,
- PathConstants.DA_API_MAP_PATH, apiFilePath);
+ String nDeviceName = CommonUtil.getNormalizedFilename(device.getSerialNumber());
+ String apiFilePath = PathManager.DA_TEMP_FOLDER_PATH + File.separator + nDeviceName
+ + CommonConstants.UNDERBAR + AnalyzerConstants.API_NAME_FILE_NAME;
+
+ SyncResult res = CommunicatorUtils.pull(device, PathConstants.DA_API_MAP_PATH, apiFilePath);
if (null != res && res.isOk()) {
Logger.debug("api map copying success!!");//$NON-NLS-1$
} else {
Logger.debug("file open failed...");
return null;
}
-
+
FileInputStream fis = null;
InputStreamReader isr = null;
BufferedReader reader = null;
String input = null;
while (null != (input = reader.readLine())) {
- String[] splitLine = input.trim().split(CommonConstants.SPACE,
- 2);
+ String[] splitLine = input.trim().split(CommonConstants.SPACE, 2);
apiMap.add(new String(splitLine[1]));
}
public static boolean isTargetEmulator() {
DeviceInfo device = Global.getCurrentDeviceInfo();
if (device != null) {
- if (device.getIDevice().getSerialNumber().contains(CommonConstants.EMULATOR)) {
- return true;
- }
+ return device.isEmulator();
}
return false;
}
updateToolbarDevice();
}
}
- if (null != Global.getCurrentDeviceInfo()
- && null != Global.getCurrentApplication()) {
+ if (null != Global.getCurrentDeviceInfo() && null != Global.getCurrentApplication()) {
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
updateToolbarDevice();
}
}
- if (null != Global.getCurrentDeviceInfo()
- && null != Global.getCurrentApplication()) {
+ if (null != Global.getCurrentDeviceInfo() && null != Global.getCurrentApplication()) {
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
import org.tizen.dynamicanalyzer.common.path.PathManager;
import org.tizen.dynamicanalyzer.database.SqlConnectionManager;
import org.tizen.dynamicanalyzer.project.Project;
+import org.tizen.dynamicanalyzer.swap.logparser.DataManagerRegistry;
import org.tizen.dynamicanalyzer.util.Logger;
import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
String targetPath = PathManager.DA_SAVE_PATH + File.separator
+ saveFileName;
+ // save rest data before closing connection to db
+ DataManagerRegistry.saveData();
+
SqlConnectionManager.closeConnection();
File sourceFolder = new File(sourcePath);
* Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact:
+ * WooJin Jung <woojin2.jung@samsung.com>
* Jooyoul Lee <jy.exe.lee@samsung.com>
* Juyoung Kim <j0.kim@samsung.com>
*
import java.util.Iterator;
import java.util.Map;
+import org.tizen.common.core.application.ProfileInfo;
import org.tizen.dynamicanalyzer.common.HostResult;
import org.tizen.dynamicanalyzer.communicator.BaseCommunicator;
import org.tizen.dynamicanalyzer.communicator.CommunicatorUtils;
private DeviceStatusInfo statusInfo = null;
+ private String platformName = null;
+
/*** for version 3.0 */
private int remotePort = -1;
private Socket controlSock = null;
return pkgInfoHash.get(pkgId);
}
+ public String getPlatformName() {
+ if (platformName == null) {
+ platformName = ProfileInfo.getPlatformName(device); // mobile-2.3
+ // device.getPlatformInfo().getProfileName(); // mobile
+
+ if (platformName == null) {
+ platformName = CommonConstants.EMPTY;
+ }
+ }
+
+ return platformName;
+ }
+
public boolean isEmulator() {
if (device != null) {
if (device.getSerialNumber().contains(CommonConstants.EMULATOR)) {
public static String RANGE_PAGE;
public static String SNAPSHOT_ENABLE;
+
+ // string for dialog by toolbar combobox
+ public static String SELECT_PROCESS;
+ public static String REMOTE_DEVICE;
+ public static String IP;
+ public static String PORT;
+ public static String CONNECT;
+ public static String CONNECTING;
// tooltip text
public static String ABOUT;
public static String ABOUT_DIALOG_TITLE;
public static String ABOUT_DIALOG_BUILD_TIME_TAB;
public static String ABOUT_DIALOG_VERSION_TAB;
+ public static String ABOUT_DIALOG_DA_VERSION_TAB;
public static String ABOUT_DIALOG_LICENSE;
public static String CONFIGURATION_DIALOG_AUTO_RANGE;
RANGE_PAGE=Range page
SNAPSHOT_ENABLE=Take snapshot
+#String for dialog by toolbar combobox
+SELECT_PROCESS=Select Process
+REMOTE_DEVICE=Connect Remote Device
+IP=IP address
+PORT=Port number
+CONNECT=Connect
+CONNECTING=Connecting
+
#Setting menu
ABOUT=About Tizen Dynamic Analyzer [F1]
SETTING=Settings [F2]
ABOUT_DIALOG_TITLE=Tizen Dynamic Analyzer
ABOUT_DIALOG_BUILD_TIME_TAB=Build time\t:
-ABOUT_DIALOG_VERSION_TAB=Version\t\t:
+ABOUT_DIALOG_VERSION_TAB=SDK Version\t:
+ABOUT_DIALOG_DA_VERSION_TAB=DA Version\t:
ABOUT_DIALOG_LICENSE=License
CONFIGURATION_DIALOG_AUTO_RANGE=Auto Range View Transmit
public static String FEATURES;
public static String TARGET_NAME_MOBILE_2_3;
- public static String TARGET_NAME_TV_0_1;
+ public static String TARGET_NAME_TV_1_0;
public static String TARGET_WEARABLE_2_3;
public static String TEMPLATE_NAME_BOTTLENECK;
FEATURES=Features
TARGET_NAME_MOBILE_2_3=mobile-2.3
-TARGET_NAME_TV_1_0=tv-0.1
+TARGET_NAME_TV_1_0=tv-1.0
TARGET_WEARABLE_2_3=wearable-2.3
TEMPLATE_NAME_BOTTLENECK=Bottleneck
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact:
+ * WooJin Jung <woojin2.jung@samsung.com>
* YeongTaik Byeon <yeongtaik.byeon@samsung.com>
* Juyoung Kim <j0.kim@samsung.com>
*
/* Thread Details */
public static String THREAD_DETAILS_TID;
- public static String THREAD_DETAILS_TTYPE;
- public static String THREAD_DETAILS_TATTRTYPE;
+ public static String THREAD_DETAILS_TYPE;
+ public static String THREAD_DETAILS_ATTRTYPE;
public static String THREAD_DETAILS_FUNCNAME;
public static String THREAD_DETAILS_CLASSNAME;
public static String THREAD_DETAILS_STARTTIME;
THREAD_API_LIST_VIEW_ERRNO=Error Code
THREAD_DETAILS_TID=Thread ID :
-THREAD_DETAILS_TTYPE=Type :
-THREAD_DETAILS_TATTRTYPE=Attr Type :
+THREAD_DETAILS_TYPE=Type :
+THREAD_DETAILS_ATTRTYPE=Attr Type :
THREAD_DETAILS_FUNCNAME=Thread Function :
THREAD_DETAILS_CLASSNAME=Thread Class :
THREAD_DETAILS_STARTTIME=Start Time :
import java.util.concurrent.atomic.AtomicInteger;
import org.tizen.dynamicanalyzer.communicator.DACommunicator;
-import org.tizen.dynamicanalyzer.database.DBConstants;
import org.tizen.dynamicanalyzer.database.DBTable;
import org.tizen.dynamicanalyzer.database.SqlConnectionManager;
import org.tizen.dynamicanalyzer.project.data.MemoryMapDBTable;
public class ProcessInformation {
private static final String QUERY_DISTINCT_TIME = "select distinct "
+ MemoryMapDBTable.COLUMN.CAPTIME.name + " from %s where "
- + DBConstants.DBCOLUMN_PROCESS_ID + "=%d";
+ + MemoryMapDBTable.COLUMN.PID.name + "=%d";
private final Object processNameRequestLock = new Object();
private boolean dropLog = false;
private NavigableMap<Long, ProcessMemoryMap> processMemSnapshots = new TreeMap<Long, ProcessMemoryMap>();
+ private boolean isMapping = true;
public int getPid() {
return pid;
public void addProcessMemoryMap(ProcessMemoryMap pmap) {
long captime = pmap.getCapturedTime();
- processMemSnapshots.put(Long.valueOf(captime), pmap);
+ synchronized (processMemSnapshots) {
+ processMemSnapshots.put(Long.valueOf(captime), pmap);
+ }
}
public ProcessMemoryMap getLastProcessMemoryMap() {
- return processMemSnapshots.lastEntry().getValue();
+ if (processMemSnapshots.isEmpty()) {
+ return null;
+ } else {
+ return processMemSnapshots.lastEntry().getValue();
+ }
}
public ProcessMemoryMap getProcessMemoryMap(long time) {
}
}
+ public void updateProcessMemoryMap(ProcessMemoryMap pmap, long newtime) {
+ long prevtime = pmap.getCapturedTime();
+ synchronized (processMemSnapshots) {
+ processMemSnapshots.remove(Long.valueOf(prevtime));
+ pmap.setCapturedTime(newtime);
+ processMemSnapshots.put(Long.valueOf(newtime), pmap);
+ }
+ }
+
public void setDropLog(boolean droplog) {
this.dropLog = droplog;
}
return dropLog;
}
+ public void setMappingState(boolean mapping) {
+ isMapping = mapping;
+ }
+
+ public boolean isMapping() {
+ return isMapping;
+ }
+
public void saveMemoryMap(DBTable table) {
for (Map.Entry<Long, ProcessMemoryMap> entry : processMemSnapshots.entrySet()) {
entry.getValue().saveMemoryMap(table);
import java.util.NavigableMap;
import java.util.TreeMap;
-import org.tizen.dynamicanalyzer.database.DBConstants;
import org.tizen.dynamicanalyzer.database.DBTable;
import org.tizen.dynamicanalyzer.project.data.MemoryMapDBTable;
public class ProcessMemoryMap {
- private static final String WHERE_PID_TIME = "where "
- + DBConstants.DBCOLUMN_PROCESS_ID + "=%d and "
- + MemoryMapDBTable.COLUMN.CAPTIME.name + "=%d";
+ private static final String WHERE_PID_TIME = "where " + MemoryMapDBTable.COLUMN.PID.name
+ + "=%d and " + MemoryMapDBTable.COLUMN.CAPTIME.name + "=%d";
private int pid;
public long getCapturedTime() {
return capturedTime;
}
+
+ public void setCapturedTime(long time) {
+ capturedTime = time;
+ }
public void setMainBinary(LibraryObject libobj) {
this.mainBinary = libobj;
return mainBinary;
}
- public void addLibraryMap(LibraryObject libobj) {
+ public boolean addLibraryMap(LibraryObject libobj) {
long lowaddr = libobj.getLowestAddress();
int binid = libobj.getBinaryID();
binaryByAddress.put(Long.valueOf(lowaddr), libobj);
}
synchronized (binaryByBinaryID) {
- binaryByBinaryID.put(Integer.valueOf(binid), libobj);
+ LibraryObject o = binaryByBinaryID.put(Integer.valueOf(binid), libobj);
+ if(o == null)
+ return true;
+ else
+ return false;
}
}
public LibraryObject getLibraryByAddress(long address) {
- Map.Entry<Long, LibraryObject> entry = binaryByAddress.floorEntry(Long
- .valueOf(address));
+ Map.Entry<Long, LibraryObject> entry = binaryByAddress.floorEntry(Long.valueOf(address));
if (entry == null) {
return null;
} else {
}
public boolean removeLibrary(long lowaddr, long highaddr) {
- LibraryObject libobj = binaryByAddress.floorEntry(Long.valueOf(lowaddr))
- .getValue();
+ LibraryObject libobj = binaryByAddress.floorEntry(Long.valueOf(lowaddr)).getValue();
if (libobj != null && highaddr <= libobj.getHighestAddress()) {
synchronized (binaryByAddress) {
binaryByAddress.remove(Long.valueOf(libobj.getLowestAddress()));
private static final String CREATE_TIME = "createTime";
private static final String TOTAL_STOP_TIME = "totalStopTime";
private static final String REPLAY_STOP_TIME = "replayStopTime";
- private static final String PROFILE_STOP_TIME = "profilingStartTime";
+ private static final String PROFILE_START_TIME = "profilingStartTime";
private String version = null;
private String protocolVersion = null;
setAppName(Global.getCurrentApplication().getMainApp().getLabel());
setPackageID(Global.getCurrentApplication().getPackageId());
- DeviceInfo deviceName = Global.getCurrentDeviceInfo();
+ DeviceInfo device = Global.getCurrentDeviceInfo();
+ String deviceSerial = null;
+ if (device != null) {
+ deviceSerial = device.getIDevice().getSerialNumber();
+ }
- if (null != deviceName && null != deviceName.getIDevice().getSerialNumber()
- && !deviceName.getIDevice().getSerialNumber().isEmpty()) {
- setDevice(Global.getCurrentDeviceInfo().getIDevice().getSerialNumber());
+ if (null != deviceSerial && !deviceSerial.isEmpty()) {
+ setDevice(deviceSerial);
} else {
setDevice(CommonConstants.SPACE);
}
writer.write(CommonConstants.NEW_LINE);
writer.write(REPLAY_STOP_TIME + CommonConstants.EQUAL + getReplayStopTime());
writer.write(CommonConstants.NEW_LINE);
- writer.write(PROFILE_STOP_TIME + CommonConstants.EQUAL + getProfilingStartTime());
+ writer.write(PROFILE_START_TIME + CommonConstants.EQUAL + getProfilingStartTime());
writer.write(CommonConstants.NEW_LINE);
writer.write(CommonConstants.NEW_LINE);
setTotalStopTime(Long.parseLong(val));
} else if (infoKey.equals(REPLAY_STOP_TIME)) {
setReplayStopTime(Long.parseLong(val));
- } else if (infoKey.equals(PROFILE_STOP_TIME)) {
+ } else if (infoKey.equals(PROFILE_START_TIME)) {
setProfilingStartTime(new DATime(val));
}
}
import org.tizen.dynamicanalyzer.database.DBTable;
public class BinaryInfoDBTable extends DBTable {
- public static final String TABLENAME = "BinaryInformation";
+ public static final String TABLENAME = "BINARY_INFORMATION";
private static final int MD5SUMSTRLENGTH = 64;
public enum COLUMN {
- BINARYID(0, "BinaryID"),
- BINTYPE(1, "BinaryType"),
- TARGETPATH(2, "TargetPath"),
- LOCALPATH(3, "LocalPath"),
- MD5SUM(4, "md5sum");
+ BINARYID(0, "BINARY_ID"),
+ BINTYPE(1, "BINARY_TYPE"),
+ TARGETPATH(2, "TARGET_PATH"),
+ LOCALPATH(3, "LOCAL_PATH"),
+ MD5SUM(4, "MD5SUM");
public final int index;
public final String name;
import org.tizen.dynamicanalyzer.database.DBTable;
public class FunctionNameDBTable extends DBTable {
- private static final String TABLENAME = "FunctionName";
+ private static final String TABLENAME = "FUNCTION_INFO";
public enum COLUMN {
- FUNCTIONID(0, DBConstants.DBCOLUMN_FUNCTION_ID),
- FUNCTIONNAME(1, DBConstants.DBCOLUMN_FUNCTION_NAME);
+ FUNCTIONID(0, "FUNCTION_ID"),
+ FUNCTIONNAME(1, "FUNCTION_NAME");
public final int index;
public final String name;
import org.tizen.dynamicanalyzer.database.DBTable;
public class MemoryMapDBTable extends DBTable {
- public static final String TABLENAME = "ProcessMemoryMap";
+ public static final String TABLENAME = "PROCESS_MEMORY_MAP";
public enum COLUMN {
- PID(0, DBConstants.DBCOLUMN_PROCESS_ID),
- CAPTIME(1, "CapturedTime"),
- LOWADDR(2, "LowestAddress"),
- HIGHADDR(3, "HighestAddress"),
- BINARYID(4, "BinaryID"),
- MAINTAG(5, "MainTag");
+ PID(0, "PID"),
+ CAPTIME(1, "CAPTURED_TIME"),
+ LOWADDR(2, "LOWEST_ADDRESS"),
+ HIGHADDR(3, "HIGHEST_ADDRESS"),
+ BINARYID(4, "BINARY_ID"),
+ MAINTAG(5, "MAIN_TAG");
public final int index;
public final String name;
import org.tizen.dynamicanalyzer.database.DBTable;
public class ProcessInfoDBTable extends DBTable {
- public static final String TABLENAME = "ProcessInformation";
+ public static final String TABLENAME = "PROCESS_INFORMATION";
public enum COLUMN {
- PID(0, DBConstants.DBCOLUMN_PROCESS_ID),
- PPID(1, "Ppid"),
- STARTTIME(2, DBConstants.DBCOLUMN_START_TIME),
- CALLCOUNT(3, "FunctionCallCount"),
- MAINTAG(4, "MainTag"),
- PROCNAME(5, "ProcessName");
+ PID(0, "PID"),
+ PPID(1, "PPID"),
+ STARTTIME(2, "START_TIME"),
+ CALLCOUNT(3, "FUNCTION_CALL_COUNT"),
+ MAINTAG(4, "MAIN_TAG"),
+ PROCNAME(5, "PROCESS_NAME");
public final int index;
public final String name;
appInst.setFunctionCount(0);
output.getAppInstList().add(appInst);
} else { // normal application or common executable is selected
- for (int k = apps.size() - 1; k >= 0; k--) {
+ for (int k = 0; k < apps.size(); k++) {
AppInfo app = apps.get(k);
// TODO : hardcoding have to remove
if (app.getAppId().contains(AnalyzerConstants.APPCONTROL)) {
continue;
}
- // TODO : make new protocol field or message for launched app
- // and instrucmented app
- if (!app.getAppId().startsWith(app.getPackageId())) {
- continue;
- }
-
BinaryInfo binInfo = Global.getProject().getDeviceStatusInfo()
.getBinaryInfo(app.getExecBinaryPath());
String temppath = binInfo.getTempBinaryPath();
continue;
}
+ List<FunctionInst> functionInstList = getFunctionInstList(app, temppath);
+ if (functionInstList.isEmpty()) {
+ // this means there is no function inst.
+ continue;
+ }
+
ApplicationInst appInst = new ApplicationInst();
- // TODO : add more app type or launch type (core and efl app)
- String appType = app.getInfo(AppInfo.PROPERTY.APPTYPE.index);
- if (appType.contains(AppInfo.APPTYPE_CPP)) {
- appInst.setApplicationType(ApplicationInst.APPTYPE_TIZEN);
- appInst.setApplicationId(app.getAppId());
- } else if (appType.contains(AppInfo.APPTYPE_WEB)) {
- appInst.setApplicationType(ApplicationInst.APPTYPE_WEB);
- appInst.setApplicationId(app.getAppId());
- } else if (appType.contains(AppInfo.APPTYPE_CAPP)) {
- appInst.setApplicationType(ApplicationInst.APPTYPE_TIZEN);
- appInst.setApplicationId(app.getAppId());
+ // TODO : make sure that first app of package is main app
+ if (k == 0) {
+ String appType = app.getInfo(AppInfo.PROPERTY.APPTYPE.index);
+ if (appType.contains(AppInfo.APPTYPE_CPP)) {
+ appInst.setApplicationType(ApplicationInst.APPTYPE_TIZEN);
+ appInst.setApplicationId(app.getAppId());
+ } else if (appType.contains(AppInfo.APPTYPE_WEB)) {
+ appInst.setApplicationType(ApplicationInst.APPTYPE_WEB);
+ appInst.setApplicationId(app.getAppId());
+ } else if (appType.contains(AppInfo.APPTYPE_CAPP)) {
+ appInst.setApplicationType(ApplicationInst.APPTYPE_TIZEN);
+ appInst.setApplicationId(app.getAppId());
+ } else {
+ appInst.setApplicationType(ApplicationInst.APPTYPE_COMMON_EXEC);
+ appInst.setApplicationId(CommonConstants.EMPTY);
+ }
} else {
- appInst.setApplicationType(ApplicationInst.APPTYPE_COMMON_EXEC);
+ appInst.setApplicationType(ApplicationInst.APPTYPE_PROCESS);
appInst.setApplicationId(CommonConstants.EMPTY);
}
appInst.setExecutablePath(app.getExecPath());
Logger.debug("Set execute path : " + app.getExecPath());
- List<FunctionInst> functionInstList = getFunctionInstList(app, temppath);
appInst.getFunctionInstList().addAll(functionInstList);
appInst.setFunctionCount(functionInstList.size());
+
output.getAppInstList().add(appInst);
}
}
pinfo.setDropLog(true);
}
-
+ pinfo.setMappingState(true);
+
ProcessMemoryMap pMap = new ProcessMemoryMap(pinfo.getPid(), subTime.getLongTime());
pinfo.addProcessMemoryMap(pMap);
ProcessInformation pinfo = project.getProcessInformation(pid);
if (null == pinfo) {
// bug!!!
- Logger.debug("bug occurred!!");
+ Logger.error("bug occurred!!");
return;
}
- DATime changeTime = new DATime(sec, nano);
- DATime profileStartTime = project.getProfilingStartTime();
- DATime subTime = changeTime.subtract(profileStartTime);
-
ProcessMemoryMap lastMap = pinfo.getLastProcessMemoryMap();
- ProcessMemoryMap newMap = new ProcessMemoryMap(pinfo.getPid(), subTime.getLongTime());
- pinfo.addProcessMemoryMap(newMap);
- newMap.copy(lastMap);
if (id == DataChannelConstants.MSG_PROCESS_MAP) {
+ // update to last memory map
String libPath = LogDataUtils.getString(index, data);
index += LogDataUtils.getStringLength(index, data);
BinaryInfo bininfo = project.getDeviceStatusInfo().getBinaryInfo(libPath);
LibraryObject libObj = new LibraryObject(bininfo.getID(), lowAddr, highAddr);
- newMap.addLibraryMap(libObj);
+ if(!lastMap.addLibraryMap(libObj)) {
+ Logger.error("exist library");
+ }
+
+ pinfo.setMappingState(true);
} else {
- newMap.removeLibrary(lowAddr, highAddr);
+ DATime changeTime = new DATime(sec, nano);
+ DATime profileStartTime = project.getProfilingStartTime();
+ DATime subTime = changeTime.subtract(profileStartTime);
+
+ if(pinfo.isMapping()) {
+ // make new memory map
+ ProcessMemoryMap newMap = new ProcessMemoryMap(pinfo.getPid(), subTime.getLongTime());
+ pinfo.addProcessMemoryMap(newMap);
+ newMap.copy(lastMap);
+
+ // remove from new map
+ newMap.removeLibrary(lowAddr, highAddr);
+ } else {
+ // update captured time of last memory map
+ pinfo.updateProcessMemoryMap(lastMap, subTime.getLongTime());
+
+ // remove from map
+ lastMap.removeLibrary(lowAddr, highAddr);
+ }
+
+ pinfo.setMappingState(false);
}
}
addBufferToList();
Logger.performance("TEST", "DA end", "Add buffer to list");
- // save rest data before closing connection to db
- DataManagerRegistry.saveData();
-
// stop DB insert thread
DBInsertManager.stopInserters();
} else if (log instanceof ReplayData) {
pushLog(log, logPack);
} else if (log instanceof ContextSwitchData) {
- /** for debug */
- // ContextSwitchData conData = ((ContextSwitchData) log);
- // System.out.println("context switch arrived! "
- // + conData.getContextSeqSelf() + " pid : "
- // + conData.getPid() + " tid : " + conData.getTid()
- // + " cpu : " + conData.getCpuNum());
pushLog(log, logPack);
} else {
if (log instanceof ScreenShotData) {
* Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact:
- * Jaewon Lim <jaewon81.lim@samsung.com>
+ * WooJin Jung <woojin2.jung@samsung.com>
* Jooyoul Lee <jy.exe.lee@samsung.com>
* Juyoung Kim <j0.kim@samsung.com>
*
if(checkConcurrentAccess(filePath)) {
readAccess.setWarning();
if(logData != null) {
- SummaryDataManager.getInstance().getWarningDataMaker().makeData(
+ SummaryDataManager.getInstance().getWarningDataMaker().add(
logData,
FilePageLabels.FILE_CAHRT_PROCESS_ID + pid + ", " +
FilePageLabels.FILE_CAHRT_THREAD_ID + tid,
if(checkConcurrentAccess(filePath)) {
writeAccess.setWarning();
if(logData != null) {
- SummaryDataManager.getInstance().getWarningDataMaker().makeData(
+ SummaryDataManager.getInstance().getWarningDataMaker().add(
logData,
FilePageLabels.FILE_CAHRT_PROCESS_ID + pid + ", " +
FilePageLabels.FILE_CAHRT_THREAD_ID + tid,
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact:
+ * WooJin Jung <woojin2.jung@samsung.com>
* Jooyoul Lee <jy.exe.lee@samsung.com>
* Juyoung Kim <j0.kim@samsung.com>
*
import org.tizen.dynamicanalyzer.database.DBColumn;
import org.tizen.dynamicanalyzer.database.DBConstants;
import org.tizen.dynamicanalyzer.database.DBTable;
+import org.tizen.dynamicanalyzer.util.Logger;
public class ScreenShotDBTable extends DBTable {
private static final String TABLENAME = "TIMELINE_SCREENSHOT";
- private final static int MAX_IMAGEPATH_LEN = 1024;
+ private final static int MAX_IMAGEPATH_LEN = 32;
public static enum COLUMN {
CAPTURE_TIME,
public ScreenShotDBTable() {
addColumn(new DBColumn(CAPTURE_TIME, DBConstants.NOT_NULL, DBConstants.LONG));
- addColumn(new DBColumn(IMAGE_FILE_PATH, DBConstants.NOT_NULL, DBConstants.VARCHAR, MAX_IMAGEPATH_LEN));
+ addColumn(new DBColumn(IMAGE_FILE_PATH, DBConstants.EMPTY, DBConstants.VARCHAR, MAX_IMAGEPATH_LEN));
addColumn(new DBColumn(IMAGE_ORIENTATION, DBConstants.NOT_NULL, DBConstants.INTEGER));
setIndexColumn(COLUMN.CAPTURE_TIME.ordinal());
}
} else {
try {
prep.setLong(1, (Long) (rowData.get(COLUMN.CAPTURE_TIME.ordinal())));
- prep.setString(2, (String) (rowData.get(COLUMN.IMAGE_FILE_PATH.ordinal())));
+ // Check string overflow
+ String image_file = (String) (rowData.get(COLUMN.IMAGE_FILE_PATH.ordinal()));
+ if (image_file != null && image_file.length() > MAX_IMAGEPATH_LEN) {
+ Logger.error("Overflow occurs MAX_IMAGEPATH_LEN in ScreenShotDBTable : " + image_file);
+ image_file = null;
+ }
+ prep.setString(2, image_file);
prep.setInt(3, (Integer) (rowData.get(COLUMN.IMAGE_ORIENTATION.ordinal())));
} catch (SQLException e) {
e.printStackTrace();
import org.tizen.dynamicanalyzer.database.IResultSet;
public class ContextDataDBTable extends DBTable implements IResultSet {
- private static final String TABLENAME = "ContextSwitchData";
+ private static final String TABLENAME = "CONTEXT_SWITCH_DATA";
public enum COLUMN {
SEQ(0, DBConstants.COMMON_COLUMN_SEQ),
PID(1, DBConstants.COMMON_COLUMN_PID),
TID(2, DBConstants.COMMON_COLUMN_TID),
- CPUNUM(3, "CpuNum"),
- STARTTIME(4, "StartTime"),
- STARTADDR(5, "StartPcAddr"),
- ENDTIME(6, "EndTime"),
- ENDADDR(7, "EndPcAddr");
+ CPUNUM(3, "CPU_NUM"),
+ STARTTIME(4, "START_TIME"),
+ STARTADDR(5, "START_PCADDR"),
+ ENDTIME(6, "END_TIME"),
+ ENDADDR(7, "END_PCADDR");
public final int index;
public final String name;
import org.tizen.dynamicanalyzer.database.DBTable;
public class FunctionDataDBTable extends DBTable {
- private static final String TABLENAME = "FunctionCallData";
+ private static final String TABLENAME = "FUNCTION_CALL_DATA";
public enum COLUMN {
SEQ(0, DBConstants.COMMON_COLUMN_SEQ),
PID(1, DBConstants.COMMON_COLUMN_PID),
TID(2, DBConstants.COMMON_COLUMN_TID),
- CPUNUM(3, "CpuNum"),
- STARTTIME(4, "StartTime"),
- STARTTYPE(5, "StartType"),
- STARTADDR(6, "StartPcAddr"),
- ENDTIME(7, "EndTime"),
- ENDTYPE(8, "EndType"),
- ENDADDR(9, "EndPcAddr"),
- FUNCID(10, "FunctionId");
+ CPUNUM(3, "CPU_NUM"),
+ STARTTIME(4, "START_TIME"),
+ STARTTYPE(5, "START_TYPE"),
+ STARTADDR(6, "START_PCADDR"),
+ ENDTIME(7, "END_TIME"),
+ ENDTYPE(8, "END_TYPE"),
+ ENDADDR(9, "END_PCADDR"),
+ FUNCID(10, "FUNCTION_ID");
public final int index;
public final String name;
import java.util.Map;
import java.util.PriorityQueue;
-import org.tizen.dynamicanalyzer.database.DBConstants;
import org.tizen.dynamicanalyzer.database.DBInsertManager;
import org.tizen.dynamicanalyzer.database.DBInserter;
import org.tizen.dynamicanalyzer.database.DBTable;
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_CONTEXT = "select distinct "
+ + ContextDataDBTable.COLUMN.PID.name + ", " + ContextDataDBTable.COLUMN.TID.name
+ + " from %s";
- private static final String COUNT_QUERY = "select count(*) from %s where "
- + DBConstants.COMMON_COLUMN_TID + "=%s";
+ private static final String PIDTID_QUERY_FUNCTION = "select distinct "
+ + FunctionDataDBTable.COLUMN.PID.name + ", " + FunctionDataDBTable.COLUMN.TID.name
+ + " from %s";
+
+ private static final String COUNT_QUERY_CONTEXT = "select count(*) from %s where "
+ + ContextDataDBTable.COLUMN.TID.name + "=%s";
+
+ private static final String COUNT_QUERY_FUNCTION = "select count(*) from %s where "
+ + FunctionDataDBTable.COLUMN.TID.name + "=%s";
private static KernelDataManager instance = null;
private KernelDataMaker kdataMaker = null;
Map<Integer, KernelDataPerThread> threadMap = new HashMap<Integer, KernelDataPerThread>();
- String query = String.format(PIDTID_QUERY, contextDataTable.getTableName());
+ String query = String.format(PIDTID_QUERY_CONTEXT, contextDataTable.getTableName());
List<List<Object>> contextPidTid = SqlConnectionManager.executeQuery(query);
- query = String.format(PIDTID_QUERY, functionDataTable.getTableName());
+ query = String.format(PIDTID_QUERY_FUNCTION, functionDataTable.getTableName());
List<List<Object>> functionPidTid = SqlConnectionManager.executeQuery(query);
if (contextPidTid != null) {
KernelDataPerThread kdata = new KernelDataPerThread(pid, tid);
threadMap.put(Integer.valueOf(tid), kdata);
- query = String.format(COUNT_QUERY, contextDataTable.getTableName(),
+ query = String.format(COUNT_QUERY_CONTEXT, contextDataTable.getTableName(),
Integer.toString(tid));
List<List<Object>> coreCount = SqlConnectionManager.executeQuery(query);
Object count;
kdata.setCoreFragmentCount(((Long) count).intValue());
}
- query = String.format(COUNT_QUERY, functionDataTable.getTableName(),
+ query = String.format(COUNT_QUERY_FUNCTION, functionDataTable.getTableName(),
Integer.toString(tid));
List<List<Object>> functionCount = SqlConnectionManager.executeQuery(query);
if (functionCount == null) {
DAChartSeriesItem seriesItem = null;
double time = getConvertTime(data.getTime());
Color color = ColorResources.NETWORK_API_USED;
- String apiName = Global.getFunctionName(data.getApiNameID());
+ String apiName = Global.getFunctionName(data.getApiId());
if (data.getErrno() != 0) {
color = ColorResources.NETWORK_API_FAILED;
}
}
private String apiEqualsKey(NetworkAPIType contentTemp) {
- return Global.getFunctionName(contentTemp.getApiNameID())
+ return Global.getFunctionName(contentTemp.getApiId())
+ contentTemp.getPid() + contentTemp.getTid();
}
package org.tizen.dynamicanalyzer.ui.network.data;
import java.sql.PreparedStatement;
+import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
public static final int DB_LIB_NAME_INDEX = 14;
private static final String SELECT_API_SERIES_QUERY = "select " //$NON-NLS-1$
- + SEQ + CommonConstants.COMMA
- + DESTINATION_ADDRESS
- + CommonConstants.COMMA + FD_VALUE
- + CommonConstants.COMMA
- + API_TIME + CommonConstants.COMMA
+ + SEQ + CommonConstants.COMMA + DESTINATION_ADDRESS + CommonConstants.COMMA
+ + FD_VALUE
+ + CommonConstants.COMMA + API_TIME + CommonConstants.COMMA
+ API_NAME_ID
- + CommonConstants.COMMA + ERRNO
- + " from " //$NON-NLS-1$
- + TABLENAME + " where %s <= " + API_TIME + " and "
- + API_TIME
- + " <= %s";//$NON-NLS-1$
+ + CommonConstants.COMMA + ERRNO + " from " //$NON-NLS-1$
+ + TABLENAME + " where " + API_TIME + " BETWEEN %s and %s";//$NON-NLS-1$
private static final String SELECT_API_TABLE_CHILD_QUERY = "select " + SEQ//$NON-NLS-1$
- + CommonConstants.COMMA + DESTINATION_ADDRESS
- + CommonConstants.COMMA + FD_VALUE + CommonConstants.COMMA
- + API_TIME + CommonConstants.COMMA + API_NAME_ID
- + CommonConstants.COMMA + ERRNO + CommonConstants.COMMA + PID
- + CommonConstants.COMMA + TID + CommonConstants.COMMA + ARGUMENT
- + CommonConstants.COMMA + RETURN + CommonConstants.COMMA
- + BYTE_SIZE + CommonConstants.COMMA + PAYLOAD
- + CommonConstants.COMMA + API_TYPE + CommonConstants.COMMA
- + CALLER_PC_ADDRESS + CommonConstants.COMMA + LIB_NAME + " from "//$NON-NLS-1$
+ + CommonConstants.COMMA + DESTINATION_ADDRESS + CommonConstants.COMMA + FD_VALUE
+ + CommonConstants.COMMA + API_TIME + CommonConstants.COMMA + API_NAME_ID
+ + CommonConstants.COMMA + ERRNO + CommonConstants.COMMA + PID + CommonConstants.COMMA
+ + TID + CommonConstants.COMMA + ARGUMENT + CommonConstants.COMMA + RETURN
+ + CommonConstants.COMMA + BYTE_SIZE + CommonConstants.COMMA + PAYLOAD
+ + CommonConstants.COMMA + API_TYPE + CommonConstants.COMMA + CALLER_PC_ADDRESS
+ + CommonConstants.COMMA + LIB_NAME + " from "//$NON-NLS-1$
+ TABLENAME + " where " + DESTINATION_ADDRESS + " = '%s' and "//$NON-NLS-1$
+ FD_VALUE + " = '%s'";//$NON-NLS-1$
private static final String SELECT_API_TABLE_PARENT_QUERY = "select " + SEQ//$NON-NLS-1$
- + CommonConstants.COMMA + DESTINATION_ADDRESS
- + CommonConstants.COMMA + FD_VALUE + CommonConstants.COMMA
- + API_TIME + CommonConstants.COMMA + API_NAME_ID
- + CommonConstants.COMMA + ERRNO + CommonConstants.COMMA + PID
- + CommonConstants.COMMA + TID + CommonConstants.COMMA + ARGUMENT
- + CommonConstants.COMMA + RETURN + CommonConstants.COMMA
- + BYTE_SIZE + CommonConstants.COMMA + PAYLOAD
- + CommonConstants.COMMA + API_TYPE + CommonConstants.COMMA
- + CALLER_PC_ADDRESS + CommonConstants.COMMA + LIB_NAME + " from "//$NON-NLS-1$
+ + CommonConstants.COMMA + DESTINATION_ADDRESS + CommonConstants.COMMA + FD_VALUE
+ + CommonConstants.COMMA + API_TIME + CommonConstants.COMMA + API_NAME_ID
+ + CommonConstants.COMMA + ERRNO + CommonConstants.COMMA + PID + CommonConstants.COMMA
+ + TID + CommonConstants.COMMA + ARGUMENT + CommonConstants.COMMA + RETURN
+ + CommonConstants.COMMA + BYTE_SIZE + CommonConstants.COMMA + PAYLOAD
+ + CommonConstants.COMMA + API_TYPE + CommonConstants.COMMA + CALLER_PC_ADDRESS
+ + CommonConstants.COMMA + LIB_NAME + " from "//$NON-NLS-1$
+ TABLENAME + " where " + DESTINATION_ADDRESS + " = '%s'";//$NON-NLS-1$ //$NON-NLS-2$
@Override
}
public NetworkAPIDBManager() {
- addColumn(new DBColumn(SEQ, DBConstants.PRIMARY_KEY,
- DBConstants.LONG));
- addColumn(new DBColumn(DESTINATION_ADDRESS, DBConstants.NOT_NULL,
- DBConstants.BIG_TEXT));
+ addColumn(new DBColumn(SEQ, DBConstants.PRIMARY_KEY, DBConstants.LONG));
+ addColumn(new DBColumn(DESTINATION_ADDRESS, DBConstants.NOT_NULL, DBConstants.BIG_TEXT));
addColumn(new DBColumn(FD_VALUE, DBConstants.NOT_NULL, DBConstants.TEXT));
addColumn(new DBColumn(API_TIME, DBConstants.NOT_NULL, DBConstants.LONG));
- addColumn(new DBColumn(API_NAME_ID, DBConstants.NOT_NULL,
- DBConstants.INTEGER));
+ addColumn(new DBColumn(API_NAME_ID, DBConstants.NOT_NULL, DBConstants.INTEGER));
addColumn(new DBColumn(ERRNO, DBConstants.NOT_NULL, DBConstants.LONG));
addColumn(new DBColumn(PID, DBConstants.NOT_NULL, DBConstants.INTEGER));
addColumn(new DBColumn(TID, DBConstants.NOT_NULL, DBConstants.INTEGER));
- addColumn(new DBColumn(ARGUMENT, DBConstants.NOT_NULL,
- DBConstants.BIG_TEXT));
- addColumn(new DBColumn(RETURN, DBConstants.NOT_NULL,
- DBConstants.BIG_TEXT));
- addColumn(new DBColumn(BYTE_SIZE, DBConstants.NOT_NULL,
- DBConstants.INTEGER));
- addColumn(new DBColumn(PAYLOAD, DBConstants.NOT_NULL,
- DBConstants.BIG_TEXT));
- addColumn(new DBColumn(API_TYPE, DBConstants.NOT_NULL,
- DBConstants.INTEGER));
- addColumn(new DBColumn(CALLER_PC_ADDRESS, DBConstants.NOT_NULL,
- DBConstants.LONG));
- addColumn(new DBColumn(LIB_NAME, DBConstants.NOT_NULL, DBConstants.TEXT));
+ addColumn(new DBColumn(ARGUMENT, DBConstants.NOT_NULL, DBConstants.BIG_TEXT));
+ addColumn(new DBColumn(RETURN, DBConstants.NOT_NULL, DBConstants.BIG_TEXT));
+ addColumn(new DBColumn(BYTE_SIZE, DBConstants.NOT_NULL, DBConstants.INTEGER));
+ addColumn(new DBColumn(PAYLOAD, DBConstants.NOT_NULL, DBConstants.BIG_TEXT));
+ addColumn(new DBColumn(API_TYPE, DBConstants.NOT_NULL, DBConstants.INTEGER));
+ addColumn(new DBColumn(CALLER_PC_ADDRESS, DBConstants.NOT_NULL, DBConstants.LONG));
+ addColumn(new DBColumn(LIB_NAME, DBConstants.NOT_NULL, DBConstants.INTEGER));
}
public void insert(List<List<Object>> insetData) {
insertData(insetData);
}
- public List<NetworkAPIType> selectAPISeries(double visibleStartTime,
- double visibleEndTime) {
- double selectStartTime = visibleStartTime
- * TimelineConstants.MEGA_DOUBLE;
+ public List<NetworkAPIType> selectAPISeries(double visibleStartTime, double visibleEndTime) {
+ double selectStartTime = visibleStartTime * TimelineConstants.MEGA_DOUBLE;
double selectEndTime = visibleEndTime * TimelineConstants.MEGA_DOUBLE;
- String query = String.format(SELECT_API_SERIES_QUERY, selectStartTime,
- selectEndTime);
- List<List<Object>> result = SqlConnectionManager.executeQuery(query);
- if (null == result || result.size() == 0 || result.get(0).size() == 0) {
+ String query = String.format(SELECT_API_SERIES_QUERY, selectStartTime, selectEndTime);
+ ResultSet rs = SqlConnectionManager.executeQueryRS(query);
+ if (rs == null) {
+ SqlConnectionManager.releaseResultSet(rs);
return null;
}
- List<NetworkAPIType> statusSeriesList = new ArrayList<NetworkAPIType>();
- for (List<Object> data : result) {
- statusSeriesList.add(new NetworkAPIType(data));
+ List<NetworkAPIType> returnValue = new ArrayList<NetworkAPIType>();
+ try {
+ while (rs.next()) {
+ NetworkAPIType data = new NetworkAPIType();
+ data.setSeq(rs.getInt(DB_SEQ_INDEX + 1));
+ data.setDestinationAddress(rs.getString(DB_DESTINATION_ADDRESS_INDEX + 1));
+ data.setFdStr(rs.getString(DB_FD_VALUE_INDEX + 1));
+ data.setTime(rs.getLong(DB_API_TIME_INDEX + 1));
+ data.setApiId(rs.getInt(DB_API_NAME_ID_INDEX + 1));
+ data.setErrNo(rs.getLong(DB_ERRNO_INDEX + 1));
+ returnValue.add(data);
+ }
+ SqlConnectionManager.releaseResultSet(rs);
+ } catch (SQLException e) {
+ e.printStackTrace();
}
- return statusSeriesList;
+ return returnValue;
}
- public List<NetworkAPIType> selectAPITable(String address, String fd,
- boolean isParentChart) {
- String query = String.format(SELECT_API_TABLE_CHILD_QUERY,
- address.trim(), fd.trim());
+ public List<NetworkAPIType> selectAPITable(String address, String fd, boolean isParentChart) {
+ String query = String.format(SELECT_API_TABLE_CHILD_QUERY, address.trim(), fd.trim());
if (isParentChart) {
- query = String
- .format(SELECT_API_TABLE_PARENT_QUERY, address.trim());
+ query = String.format(SELECT_API_TABLE_PARENT_QUERY, address.trim());
}
- List<List<Object>> result = SqlConnectionManager.executeQuery(query);
- if (null == result || result.size() == 0 || result.get(0).size() == 0) {
+ ResultSet rs = SqlConnectionManager.executeQueryRS(query);
+ if (rs == null) {
+ SqlConnectionManager.releaseResultSet(rs);
return null;
}
- List<NetworkAPIType> statusSeriesList = new ArrayList<NetworkAPIType>();
- for (List<Object> data : result) {
- statusSeriesList.add(new NetworkAPIType(data));
+ List<NetworkAPIType> returnValue = new ArrayList<NetworkAPIType>();
+ try {
+ while (rs.next()) {
+ NetworkAPIType data = new NetworkAPIType();
+ data.setSeq(rs.getInt(DB_SEQ_INDEX + 1));
+ data.setDestinationAddress(rs.getString(DB_DESTINATION_ADDRESS_INDEX + 1));
+ data.setFdStr(rs.getString(DB_FD_VALUE_INDEX + 1));
+ data.setTime(rs.getLong(DB_API_TIME_INDEX + 1));
+ data.setApiId(rs.getInt(DB_API_NAME_ID_INDEX + 1));
+ data.setErrNo(rs.getLong(DB_ERRNO_INDEX + 1));
+ data.setPid(rs.getInt(DB_PID_INDEX + 1));
+ data.setTid(rs.getInt(DB_TID_INDEX + 1));
+ data.setArgs(rs.getString(DB_ARGUMENT_INDEX + 1));
+ data.setReturn(rs.getString(DB_RETURN_INDEX + 1));
+ data.setPacketMessageSize(rs.getInt(DB_BYTE_SIZE_INDEX + 1));
+ data.setPacketMessage(rs.getString(DB_PAYLOAD_INDEX + 1));
+ data.setFdApiType(rs.getInt(DB_API_TYPE_INDEX + 1));
+ data.setCallerAddress(rs.getLong(DB_CALLER_PC_ADDRESS_INDEX + 1));
+ data.setBinaryId(rs.getInt(DB_LIB_NAME_INDEX + 1));
+ returnValue.add(data);
+ }
+ SqlConnectionManager.releaseResultSet(rs);
+ } catch (SQLException e) {
+ e.printStackTrace();
}
- return statusSeriesList;
+ return returnValue;
}
@Override
isPrepared = false;
} else {
try {
- prep.setInt(DB_SEQ_INDEX + 1,
- (Integer) (rowData.get(DB_SEQ_INDEX)));
+ prep.setInt(DB_SEQ_INDEX + 1, (Integer) (rowData.get(DB_SEQ_INDEX)));
prep.setString(DB_DESTINATION_ADDRESS_INDEX + 1,
(String) (rowData.get(DB_DESTINATION_ADDRESS_INDEX)));
- prep.setString(DB_FD_VALUE_INDEX + 1,
- (String) (rowData.get(DB_FD_VALUE_INDEX)));
- prep.setLong(DB_API_TIME_INDEX + 1,
- (Long) (rowData.get(DB_API_TIME_INDEX)));
- prep.setInt(DB_API_NAME_ID_INDEX + 1,
- (Integer) (rowData.get(DB_API_NAME_ID_INDEX)));
- prep.setLong(DB_ERRNO_INDEX + 1,
- (Long) (rowData.get(DB_ERRNO_INDEX)));
- prep.setInt(DB_PID_INDEX + 1,
- (Integer) (rowData.get(DB_PID_INDEX)));
- prep.setInt(DB_TID_INDEX + 1,
- (Integer) (rowData.get(DB_TID_INDEX)));
- prep.setString(DB_ARGUMENT_INDEX + 1,
- (String) (rowData.get(DB_ARGUMENT_INDEX)));
- prep.setString(DB_RETURN_INDEX + 1,
- (String) (rowData.get(DB_RETURN_INDEX)));
- prep.setInt(DB_BYTE_SIZE_INDEX + 1,
- (Integer) (rowData.get(DB_BYTE_SIZE_INDEX)));
- prep.setString(DB_PAYLOAD_INDEX + 1,
- (String) (rowData.get(DB_PAYLOAD_INDEX)));
- prep.setInt(DB_API_TYPE_INDEX + 1,
- (Integer) (rowData.get(DB_API_TYPE_INDEX)));
+ prep.setString(DB_FD_VALUE_INDEX + 1, (String) (rowData.get(DB_FD_VALUE_INDEX)));
+ prep.setLong(DB_API_TIME_INDEX + 1, (Long) (rowData.get(DB_API_TIME_INDEX)));
+ prep.setInt(DB_API_NAME_ID_INDEX + 1, (Integer) (rowData.get(DB_API_NAME_ID_INDEX)));
+ prep.setLong(DB_ERRNO_INDEX + 1, (Long) (rowData.get(DB_ERRNO_INDEX)));
+ prep.setInt(DB_PID_INDEX + 1, (Integer) (rowData.get(DB_PID_INDEX)));
+ prep.setInt(DB_TID_INDEX + 1, (Integer) (rowData.get(DB_TID_INDEX)));
+ prep.setString(DB_ARGUMENT_INDEX + 1, (String) (rowData.get(DB_ARGUMENT_INDEX)));
+ prep.setString(DB_RETURN_INDEX + 1, (String) (rowData.get(DB_RETURN_INDEX)));
+ prep.setInt(DB_BYTE_SIZE_INDEX + 1, (Integer) (rowData.get(DB_BYTE_SIZE_INDEX)));
+ prep.setString(DB_PAYLOAD_INDEX + 1, (String) (rowData.get(DB_PAYLOAD_INDEX)));
+ prep.setInt(DB_API_TYPE_INDEX + 1, (Integer) (rowData.get(DB_API_TYPE_INDEX)));
prep.setLong(DB_CALLER_PC_ADDRESS_INDEX + 1,
(Long) (rowData.get(DB_CALLER_PC_ADDRESS_INDEX)));
- prep.setString(DB_LIB_NAME_INDEX + 1,
- (String) (rowData.get(DB_LIB_NAME_INDEX)));
+ prep.setInt(DB_LIB_NAME_INDEX + 1, (Integer) (rowData.get(DB_LIB_NAME_INDEX)));
} catch (SQLException e) {
e.printStackTrace();
import org.tizen.dynamicanalyzer.ui.network.data.type.NetworkAPIType;
import org.tizen.dynamicanalyzer.ui.network.data.type.NetworkSeriesType;
import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
-import org.tizen.dynamicanalyzer.util.Logger;
import org.tizen.dynamicanalyzer.util.WorkbenchUtil;
import org.tizen.dynamicanalyzer.widgets.da.base.DADialog;
/*** make network data thread ***/
@Override
protected void makeData(LogPackage pack) {
- try {
+// try {
Logs logs = pack.getLogs(DataChannelConstants.MSG_PROBE_NETWORK);
if (null != logs && logs.getRawLogs().size() != 0) {
List<LogData> inputs = logs.getLogs();
networkDataMaker.makeData(inputs);
}
- } catch (Exception e) {
- Logger.error("exception network updateView");
- }
+// } catch (Exception e) {
+// Logger.error("exception network updateView");
+// }
}
}
package org.tizen.dynamicanalyzer.ui.network.data;
import java.sql.PreparedStatement;
+import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
public final static int DB_API_ID_INDEX = 6;
public final static int DB_PID_INDEX = 7;
- private static final String SELECT_QUERY = "select " + RID
- + CommonConstants.COMMA + DESTINATION_ADDRESS
- + CommonConstants.COMMA + FD_VALUE + CommonConstants.COMMA
- + START_TIME + CommonConstants.COMMA + END_TIME
- + CommonConstants.COMMA + STATUS_TYPE + CommonConstants.COMMA
- + API_ID + CommonConstants.COMMA + PID + " from " + TABLENAME; //$NON-NLS-1$
-
- private static final String SELECT_PID_QUERY = "select " + RID
- + CommonConstants.COMMA + DESTINATION_ADDRESS
- + CommonConstants.COMMA + FD_VALUE + CommonConstants.COMMA
- + START_TIME + CommonConstants.COMMA + END_TIME
- + CommonConstants.COMMA + STATUS_TYPE + CommonConstants.COMMA
- + API_ID + CommonConstants.COMMA + PID
+ private static final String SELECT_QUERY = "select " + RID + CommonConstants.COMMA
+ + DESTINATION_ADDRESS + CommonConstants.COMMA + FD_VALUE + CommonConstants.COMMA
+ + START_TIME + CommonConstants.COMMA + END_TIME + CommonConstants.COMMA + STATUS_TYPE
+ + CommonConstants.COMMA + API_ID + CommonConstants.COMMA + PID + " from " + TABLENAME; //$NON-NLS-1$
+
+ private static final String SELECT_PID_QUERY = "select " + RID + CommonConstants.COMMA
+ + DESTINATION_ADDRESS + CommonConstants.COMMA + FD_VALUE + CommonConstants.COMMA
+ + START_TIME + CommonConstants.COMMA + END_TIME + CommonConstants.COMMA + STATUS_TYPE
+ + CommonConstants.COMMA + API_ID + CommonConstants.COMMA + PID
+ " from " + TABLENAME + " where pid = '%s'"; //$NON-NLS-1$
private static int rid = 0;
}
public NetworkSeriesDBManager() {
- addColumn(new DBColumn(RID, DBConstants.PRIMARY_KEY,
- DBConstants.INTEGER));
- addColumn(new DBColumn(DESTINATION_ADDRESS, DBConstants.NOT_NULL,
- DBConstants.TEXT));
+ addColumn(new DBColumn(RID, DBConstants.PRIMARY_KEY, DBConstants.INTEGER));
+ addColumn(new DBColumn(DESTINATION_ADDRESS, DBConstants.NOT_NULL, DBConstants.TEXT));
addColumn(new DBColumn(FD_VALUE, DBConstants.NOT_NULL, DBConstants.TEXT));
- addColumn(new DBColumn(START_TIME, DBConstants.NOT_NULL,
- DBConstants.LONG));
+ addColumn(new DBColumn(START_TIME, DBConstants.NOT_NULL, DBConstants.LONG));
addColumn(new DBColumn(END_TIME, DBConstants.NOT_NULL, DBConstants.LONG));
- addColumn(new DBColumn(STATUS_TYPE, DBConstants.NOT_NULL,
- DBConstants.INTEGER));
- addColumn(new DBColumn(API_ID, DBConstants.NOT_NULL,
- DBConstants.INTEGER));
+ addColumn(new DBColumn(STATUS_TYPE, DBConstants.NOT_NULL, DBConstants.INTEGER));
+ addColumn(new DBColumn(API_ID, DBConstants.NOT_NULL, DBConstants.INTEGER));
addColumn(new DBColumn(PID, DBConstants.NOT_NULL, DBConstants.INTEGER));
rid = 0;
}
insertData(insertDataList);
}
- public List<NetworkSeriesType> select(double visibleStartTime,
- double visibleEndTime) {
+ public List<NetworkSeriesType> select(double visibleStartTime, double visibleEndTime) {
String selectQuery = SELECT_QUERY;
int selectedPid = ToolbarArea.getInstance().getSelectedPid();
if (selectedPid != 0) {
selectQuery = String.format(SELECT_PID_QUERY, selectedPid);
}
- double selectStartTime = visibleStartTime
- * TimelineConstants.MEGA_DOUBLE;
+ double selectStartTime = visibleStartTime * TimelineConstants.MEGA_DOUBLE;
double selectEndTime = visibleEndTime * TimelineConstants.MEGA_DOUBLE;
- String query = String.format(selectQuery, selectStartTime,
- selectEndTime);
- List<List<Object>> result = SqlConnectionManager.executeQuery(query);
- if (null == result || result.size() == 0 || result.get(0).size() == 0) {
+ String query = String.format(selectQuery, selectStartTime, selectEndTime);
+ ResultSet rs = SqlConnectionManager.executeQueryRS(query);
+ if (rs == null) {
+ SqlConnectionManager.releaseResultSet(rs);
return null;
}
+
List<NetworkSeriesType> statusSeriesList = new ArrayList<NetworkSeriesType>();
- for (List<Object> data : result) {
- statusSeriesList.add(new NetworkSeriesType(data));
+ try {
+ while (rs.next()) {
+ NetworkSeriesType data = new NetworkSeriesType();
+ data.setRid(rs.getInt(DB_RID_INDEX + 1));
+ data.setDestinationAddress(rs.getString(DB_DESTINATION_ADDRESSINDEX + 1));
+ data.setFdValue(rs.getString(DB_FD_VALUE_INDEX + 1));
+ data.setStartTime(rs.getLong(DB_START_TIME_INDEX + 1));
+ data.setEndTime(rs.getLong(DB_END_TIME_INDEX + 1));
+ data.setAPIType(rs.getInt(DB_STATUS_TYPE_INDEX + 1));
+ data.setApiID(rs.getInt(DB_API_ID_INDEX + 1));
+ data.setpId(rs.getInt(DB_PID_INDEX + 1));
+ statusSeriesList.add(data);
+ }
+ SqlConnectionManager.releaseResultSet(rs);
+ } catch (SQLException e) {
+ e.printStackTrace();
}
return statusSeriesList;
+
}
@Override
isPrepared = false;
} else {
try {
- prep.setInt(DB_RID_INDEX + 1,
- (Integer) (rowData.get(DB_RID_INDEX)));
+ prep.setInt(DB_RID_INDEX + 1, (Integer) (rowData.get(DB_RID_INDEX)));
prep.setString(DB_DESTINATION_ADDRESSINDEX + 1,
(String) (rowData.get(DB_DESTINATION_ADDRESSINDEX)));
- prep.setString(DB_FD_VALUE_INDEX + 1,
- (String) (rowData.get(DB_FD_VALUE_INDEX)));
- prep.setLong(DB_START_TIME_INDEX + 1,
- (Long) (rowData.get(DB_START_TIME_INDEX)));
- prep.setLong(DB_END_TIME_INDEX + 1,
- (Long) (rowData.get(DB_END_TIME_INDEX)));
- prep.setInt(DB_STATUS_TYPE_INDEX + 1,
- (Integer) (rowData.get(DB_STATUS_TYPE_INDEX)));
- prep.setInt(DB_API_ID_INDEX + 1,
- (Integer) (rowData.get(DB_API_ID_INDEX)));
- prep.setInt(DB_PID_INDEX + 1,
- (Integer) (rowData.get(DB_PID_INDEX)));
+ prep.setString(DB_FD_VALUE_INDEX + 1, (String) (rowData.get(DB_FD_VALUE_INDEX)));
+ prep.setLong(DB_START_TIME_INDEX + 1, (Long) (rowData.get(DB_START_TIME_INDEX)));
+ prep.setLong(DB_END_TIME_INDEX + 1, (Long) (rowData.get(DB_END_TIME_INDEX)));
+ prep.setInt(DB_STATUS_TYPE_INDEX + 1, (Integer) (rowData.get(DB_STATUS_TYPE_INDEX)));
+ prep.setInt(DB_API_ID_INDEX + 1, (Integer) (rowData.get(DB_API_ID_INDEX)));
+ prep.setInt(DB_PID_INDEX + 1, (Integer) (rowData.get(DB_PID_INDEX)));
} catch (SQLException e) {
e.printStackTrace();
import java.util.ArrayList;
import java.util.List;
+import org.tizen.dynamicanalyzer.common.Global;
import org.tizen.dynamicanalyzer.constant.CommonConstants;
+import org.tizen.dynamicanalyzer.project.BinaryInfo;
import org.tizen.dynamicanalyzer.swap.model.data.NetworkData;
-import org.tizen.dynamicanalyzer.ui.network.data.NetworkAPIDBManager;
public class NetworkAPIType extends NetworkData {
- private final static int apiSeriesColumnSize = 6;
- private long seq = -1;
- private long time = -1;
private String destinationAddress = CommonConstants.EMPTY;
private String fdStr = CommonConstants.EMPTY;
+ private int binaryId = 0;
- public NetworkAPIType(long sequenceNumber, String destinationAddress,
- String fdValue, long apiTime, int apiNameID, long errno, int pID,
- int tID, String arg, String returnValue, int byteSize,
- String payLoad, int apiType, long callerAddress, String libName) {
+ public NetworkAPIType() {
+
+ }
+
+ public NetworkAPIType(long sequenceNumber, String destinationAddress, String fdValue,
+ long apiTime, int apiNameID, long errno, int pID, int tID, String arg,
+ String returnValue, int byteSize, String payLoad, int apiType, long callerAddress,
+ String libName) {
setSeq(sequenceNumber);
setDestinationAddress(destinationAddress);
setFdStr(fdValue);
setTime(apiTime);
- setApiNameID(apiNameID);
- setErrno(errno);
+ setApiId(apiNameID);
+ setErrNo(errno);
setPid(pID);
setTid(tID);
setArgs(arg);
setPacketMessage(payLoad);
setFdApiType(apiType);
setCallerAddress(callerAddress);
- setLibName(libName);
-
- }
-
- public NetworkAPIType(List<Object> data) {
- setSeq((Integer) data.get(NetworkAPIDBManager.DB_SEQ_INDEX));
- setDestinationAddress((String) data
- .get(NetworkAPIDBManager.DB_DESTINATION_ADDRESS_INDEX));
- setFdStr((String) data.get(NetworkAPIDBManager.DB_FD_VALUE_INDEX));
- setTime((Long) data.get(NetworkAPIDBManager.DB_API_TIME_INDEX));
- setApiNameID((Integer) data
- .get(NetworkAPIDBManager.DB_API_NAME_ID_INDEX));
- setErrno((Long) data.get(NetworkAPIDBManager.DB_ERRNO_INDEX));
- if (data.size() <= apiSeriesColumnSize) {
- return;
- }
- setPid((Integer) data.get(NetworkAPIDBManager.DB_PID_INDEX));
- setTid((Integer) data.get(NetworkAPIDBManager.DB_PID_INDEX));
- setArgs((String) data.get(NetworkAPIDBManager.DB_ARGUMENT_INDEX));
- setReturn((String) data.get(NetworkAPIDBManager.DB_RETURN_INDEX));
- setPacketMessageSize((Integer) data
- .get(NetworkAPIDBManager.DB_BYTE_SIZE_INDEX));
- setPacketMessage((String) data
- .get(NetworkAPIDBManager.DB_PAYLOAD_INDEX));
- setFdApiType((Integer) data.get(NetworkAPIDBManager.DB_API_TYPE_INDEX));
- setCallerAddress((Long) data
- .get(NetworkAPIDBManager.DB_CALLER_PC_ADDRESS_INDEX));
- setLibName((String) data.get(NetworkAPIDBManager.DB_LIB_NAME_INDEX));
- }
-
- public long getSeq() {
- return seq;
- }
-
- public void setSeq(long sequenceNumber) {
- this.seq = sequenceNumber;
+ setBinaryID(libName);
}
public String getDestinationAddress() {
this.fdStr = fdValue;
}
- public long getTime() {
- return time;
- }
-
- public void setTime(long apiTime) {
- this.time = apiTime;
- }
-
- public int getApiNameID() {
- return apiId;
- }
-
- public void setApiNameID(int apiNameID) {
- this.apiId = apiNameID;
- }
-
- public long getErrno() {
- return errno;
- }
-
- public void setErrno(long errno) {
- this.errno = errno;
- }
-
- public int getPid() {
- return pid;
- }
-
- public void setPid(int pID) {
- this.pid = pID;
- }
-
- public int getTid() {
- return tid;
- }
-
- public void setTid(int tID) {
- this.tid = tID;
- }
-
- public String getArgs() {
- return args.trim();
- }
-
- public void setArgs(String argument) {
- this.args = argument;
- }
-
- public String getReturn() {
- return ret.trim();
- }
-
- public void setReturn(String returnValue) {
- this.ret = returnValue;
- }
-
- public int getPacketMessageSize() {
- return messageSize;
- }
-
public void setPacketMessageSize(int byteSize) {
this.messageSize = byteSize;
}
- public String getPacketMessage() {
- return packetMessage;
- }
-
public void setPacketMessage(String payload) {
this.packetMessage = payload;
}
- public int getFdApiType() {
- return fdApiType;
- }
-
public void setFdApiType(int apiType) {
this.fdApiType = apiType;
}
- public long getCallerPcAddr() {
- return callerAddress;
- }
-
- public void setCallerAddress(long callerAddress) {
- this.callerAddress = callerAddress;
+ public int getBinaryId() {
+ return binaryId;
}
- public String getLibName() {
- return libName;
+ public void setBinaryId(int binaryId) {
+ this.binaryId = binaryId;
+ BinaryInfo binInfo = Global.getProject().getDeviceStatusInfo().getBinaryInfo(getBinaryId());
+ libName = binInfo.getTargetBinaryPath();
}
- public void setLibName(String libName) {
- this.libName = libName;
+ public void setBinaryID(String binaryPath) {
+ BinaryInfo binInfo = Global.getProject().getDeviceStatusInfo().getBinaryInfo(binaryPath);
+ this.binaryId = binInfo.getID();
+ libName = binInfo.getTargetBinaryPath();
}
public List<Object> getDBInsertData() {
data.add(getDestinationAddress());
data.add(getFdStr());
data.add(getTime());
- data.add(getApiNameID());
+ data.add(getApiId());
data.add(getErrno());
data.add(getPid());
data.add(getTid());
data.add(getPacketMessage());
data.add(getFdApiType());
data.add(getCallerPcAddr());
- data.add(getLibName());
+ data.add(getBinaryId());
return data;
}
private int apiID = -1;
private int pId = -1;
- public NetworkSeriesType(String destinationAddress, String fdValue,
- long startTime, long endTime, int statusType, int apiId, int pId) {
+ public NetworkSeriesType() {
+
+ }
+
+ public NetworkSeriesType(String destinationAddress, String fdValue, long startTime,
+ long endTime, int statusType, int apiId, int pId) {
setRid(0);
setDestinationAddress(destinationAddress);
setFdValue(fdValue);
public NetworkSeriesType(List<Object> data) {
setRid((Integer) data.get(NetworkSeriesDBManager.DB_RID_INDEX));
- setDestinationAddress((String) data
- .get(NetworkSeriesDBManager.DB_DESTINATION_ADDRESSINDEX));
+ setDestinationAddress((String) data.get(NetworkSeriesDBManager.DB_DESTINATION_ADDRESSINDEX));
setFdValue((String) data.get(NetworkSeriesDBManager.DB_FD_VALUE_INDEX));
- setStartTime((Long) data
- .get(NetworkSeriesDBManager.DB_START_TIME_INDEX));
+ setStartTime((Long) data.get(NetworkSeriesDBManager.DB_START_TIME_INDEX));
setEndTime((Long) data.get(NetworkSeriesDBManager.DB_END_TIME_INDEX));
- setAPIType((Integer) data
- .get(NetworkSeriesDBManager.DB_STATUS_TYPE_INDEX));
+ setAPIType((Integer) data.get(NetworkSeriesDBManager.DB_STATUS_TYPE_INDEX));
setApiID((Integer) data.get(NetworkSeriesDBManager.DB_API_ID_INDEX));
setpId((Integer) data.get(NetworkSeriesDBManager.DB_API_ID_INDEX));
}
}
private void updateTableInfo(GLSelectionData data) {
- List<List<Object>> apiList = GLDataManager.getInstance().getCurrentAPITableData();
- if (null == apiList || apiList.size() == 0 || apiList.get(0).size() == 0) {
+ List<GLAPIData> apiList = GLDataManager.getInstance().getCurrentAPITableData();
+ if (null == apiList || apiList.size() == 0) {
return;
}
GLCurrentFrameDataManger glFrameData = new GLCurrentFrameDataManger();
- for (List<Object> listItem : apiList) {
- glFrameData.addAPIData(new GLAPIData(listItem));
+ for (GLAPIData listItem : apiList) {
+ glFrameData.addAPIData(listItem);
}
StringBuffer strDetailView = new StringBuffer();
import org.tizen.dynamicanalyzer.resources.ImageResources;
import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
import org.tizen.dynamicanalyzer.ui.opengl.data.GLDataManager;
-import org.tizen.dynamicanalyzer.ui.opengl.data.DB.GLFrameRateDBTableManager;
+import org.tizen.dynamicanalyzer.ui.opengl.data.DB.GLChartDBType;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot.AutoRangeType;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeries;
public void updateView(double startIndex, double endIndex) {
frameRateSeries.getSeriesItemList().clear();
- List<List<Object>> chartDataList = GLDataManager.getInstance().getFrameRateDBTableManager()
- .selectFrameRate(startIndex, endIndex);
- if (null == chartDataList || chartDataList.size() == 0 || chartDataList.get(0).size() == 0) {
+ List<GLChartDBType> chartDataList = GLDataManager.getInstance()
+ .getFrameRateDBTableManager().selectFrameRate(startIndex, endIndex);
+ if (null == chartDataList) {
return;
- }
- checkStartFrameRateTime(startIndex, chartDataList);
-
- for (int i = 0; i < chartDataList.size(); i++) {
- List<Object> chartData = chartDataList.get(i);
- addData((Integer) chartData.get(GLFrameRateDBTableManager.TABLE_CHART_TIME_INDEX),
- (Integer) chartData.get(GLFrameRateDBTableManager.TABLE_FRAME_INDEX_INDEX),
- (Integer) chartData.get(GLFrameRateDBTableManager.TABLE_FRAME_COUNT_INDEX),
- (Boolean) chartData.get(GLFrameRateDBTableManager.TABLE_ERROR_INFO_INDEX));
+ } else {
+ checkStartFrameRateTime(startIndex, chartDataList);
+ for (int i = 0; i < chartDataList.size(); i++) {
+ GLChartDBType chartData = chartDataList.get(i);
+ addData(chartData.getChartTime(), chartData.getFrameIndex(),
+ chartData.getFrameCount(), chartData.isErrno());
+ }
}
}
- private void checkStartFrameRateTime(double startIndex, List<List<Object>> chartDataList) {
- if (startIndex != 0) {
+ private void checkStartFrameRateTime(double startIndex, List<GLChartDBType> chartDataList) {
+ if (startIndex != 0 || chartDataList.size() == 0) {
return;
}
- int frameRateStartTime = (Integer) chartDataList.get(0).get(
- GLFrameRateDBTableManager.TABLE_CHART_TIME_INDEX);
+ int frameRateStartTime = chartDataList.get(0).getChartTime();
if (GLDataManager.getInstance().getStartFrameRateTime() < frameRateStartTime) {
GLDataManager.getInstance().setStartFrameRateTime(frameRateStartTime);
}
import org.tizen.dynamicanalyzer.resources.ImageResources;
import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
import org.tizen.dynamicanalyzer.ui.opengl.data.GLDataManager;
-import org.tizen.dynamicanalyzer.ui.opengl.data.DB.GLFrameTimeDBTableManager;
+import org.tizen.dynamicanalyzer.ui.opengl.data.DB.GLChartDBType;
import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot.AutoRangeType;
private GLFrameTimeChart() {
chartName = GLPageLabels.GL_CHART_TITLE_FRAME_TIME;
chartIcon = ImageResources.CHART_FRAME_TIME;
- frameTimeSeries = new DAChartSeries(chartName,
- DAChartSeries.SERIES_STYLE_BAR,
+ frameTimeSeries = new DAChartSeries(chartName, DAChartSeries.SERIES_STYLE_BAR,
ColorResources.SERIES_COLOR_CPU_APP);
}
@Override
- public DAChartBoardItem createBoardItem(DAChartBoard chartBoard,
- boolean enablePopupMenu) {
- DAChartBoardItem item = super.createBoardItem(chartBoard,
- enablePopupMenu);
+ public DAChartBoardItem createBoardItem(DAChartBoard chartBoard, boolean enablePopupMenu) {
+ DAChartBoardItem item = super.createBoardItem(chartBoard, enablePopupMenu);
chart.addSeries(frameTimeSeries);
chart.getPlot().setSeriesHeightRange(true);
public void updateView(double startIndex, double endIndex) {
frameTimeSeries.getSeriesItemList().clear();
- List<List<Object>> chartDataList = GLDataManager.getInstance()
- .getFrameTimeDBTableManager()
- .selectFrameTime(startIndex, endIndex);
+ List<GLChartDBType> chartDataList = GLDataManager.getInstance()
+ .getFrameTimeDBTableManager().selectFrameTime(startIndex, endIndex);
if (null == chartDataList) {
return;
} else {
for (int i = 0; i < chartDataList.size(); i++) {
- List<Object> chartData = chartDataList.get(i);
- addData((Integer) chartData
- .get(GLFrameTimeDBTableManager.TABLE_CHART_TIME_INDEX),
- (Integer) chartData
- .get(GLFrameTimeDBTableManager.TABLE_VALUE_INDEX),
- (Boolean) chartData
- .get(GLFrameTimeDBTableManager.TABLE_ERROR_INFO_INDEX));
+ GLChartDBType chartData = chartDataList.get(i);
+ addData(chartData.getChartTime(), chartData.getFrameMakingTime(),
+ chartData.isErrno());
}
}
}
package org.tizen.dynamicanalyzer.ui.opengl.data.DB;
import java.sql.PreparedStatement;
+import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
private static final String LIB_NAME = DBConstants.COMMON_COLUMN_CALLER_LIB_NAME;
public final static int TABLE_SEQ_INDEX = 0;
- public final static int TABLE_FRAME_INDEX_INDEX = 1;
- public final static int TABLE_CONTEXT_ID_INDEX = 2;
+ public final static int TABLE_CONTEXT_ID_INDEX = 1;
+ public final static int TABLE_FRAME_INDEX_INDEX = 2;
public final static int TABLE_TIME_INDEX = 3;
public final static int TABLE_API_ID_INDEX = 4;
public final static int TABLE_ARGUMENT_INDEX = 5;
public final static int TABLE_LIB_NAME_INDEX = 12;
private static final String SELECT_API_TABLE_QUERY_FROM_FRAME_RATE_CHART = "select "//$NON-NLS-1$
- + SEQ + CommonConstants.COMMA + FRAME_INDEX + CommonConstants.COMMA
- + CONTEXT_ID
+ + SEQ + CommonConstants.COMMA + CONTEXT_ID + CommonConstants.COMMA
+ + FRAME_INDEX
+ CommonConstants.COMMA + TIME + CommonConstants.COMMA + API_ID
+ CommonConstants.COMMA
+ ARGUMENT + CommonConstants.COMMA + RET + CommonConstants.COMMA
+ TID + CommonConstants.COMMA + CALLER_PC_ADDRESS + CommonConstants.COMMA
+ LIB_NAME
+ " from "//$NON-NLS-1$
- + TABLENAME + " where '%s' <= "//$NON-NLS-1$
- + FRAME_INDEX + " and " + FRAME_INDEX + " <= '%s'";//$NON-NLS-1$
+ + TABLENAME + " where " + FRAME_INDEX + " between '%s' and '%s'";//$NON-NLS-1$
@Override
public String getTableName() {
addColumn(new DBColumn(PID, DBConstants.NOT_NULL, DBConstants.INTEGER));
addColumn(new DBColumn(TID, DBConstants.NOT_NULL, DBConstants.INTEGER));
addColumn(new DBColumn(CALLER_PC_ADDRESS, DBConstants.NOT_NULL, DBConstants.LONG));
- addColumn(new DBColumn(LIB_NAME, DBConstants.NOT_NULL, DBConstants.TEXT_LIB_NAME));
+ addColumn(new DBColumn(LIB_NAME, DBConstants.NOT_NULL, DBConstants.INTEGER));
setIndexColumn(TABLE_FRAME_INDEX_INDEX);
}
insertData(insertDataList);
}
- public List<List<Object>> selectOpenGLAPIData(int frameStartIndex, int frameEndIndex) {
+ public List<GLAPIData> selectOpenGLAPIData(int frameStartIndex, int frameEndIndex) {
String query = String.format(SELECT_API_TABLE_QUERY_FROM_FRAME_RATE_CHART, frameStartIndex,
frameEndIndex);
- List<List<Object>> result = SqlConnectionManager.executeQuery(query);
- if (null == result || result.size() == 0 || result.get(0).size() == 0) {
+ ResultSet rs = SqlConnectionManager.executeQueryRS(query);
+ if (rs == null) {
+ SqlConnectionManager.releaseResultSet(rs);
return null;
}
- return result;
+ List<GLAPIData> returnValue = new ArrayList<GLAPIData>();
+ try {
+ while (rs.next()) {
+ GLAPIData data = new GLAPIData();
+ data.setSeq(rs.getInt(TABLE_SEQ_INDEX + 1));
+ data.setContextID(rs.getLong(TABLE_CONTEXT_ID_INDEX + 1));
+ data.setFrameIndex(rs.getInt(TABLE_FRAME_INDEX_INDEX + 1));
+ data.setTime(rs.getLong(TABLE_TIME_INDEX + 1));
+ data.setApiId(rs.getInt(TABLE_API_ID_INDEX + 1));
+ data.setArgs(rs.getString(TABLE_ARGUMENT_INDEX + 1));
+ data.setReturn(rs.getString(TABLE_RET_INDEX + 1));
+ data.setElapsedTime(rs.getLong(TABLE_ELAPSED_TIMEQ_INDEX + 1));
+ data.setErrNo(rs.getLong(TABLE_ERROR_INDEX + 1));
+ data.setPid(rs.getInt(TABLE_PID_INDEX + 1));
+ data.setTid(rs.getInt(TABLE_TID_INDEX + 1));
+ data.setCallerAddress(rs.getLong(TABLE_CALLER_PC_ADDRESS_INDEX + 1));
+ data.setBinaryId(rs.getInt(TABLE_LIB_NAME_INDEX + 1));
+ returnValue.add(data);
+ }
+ SqlConnectionManager.releaseResultSet(rs);
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ return returnValue;
}
@Override
} else {
try {
prep.setInt(TABLE_SEQ_INDEX + 1, (Integer) (rowData.get(TABLE_SEQ_INDEX)));
- prep.setLong(TABLE_FRAME_INDEX_INDEX + 1,
- (Long) (rowData.get(TABLE_FRAME_INDEX_INDEX)));
- prep.setInt(TABLE_CONTEXT_ID_INDEX + 1,
- (Integer) (rowData.get(TABLE_CONTEXT_ID_INDEX)));
+ prep.setLong(TABLE_CONTEXT_ID_INDEX + 1,
+ (Long) (rowData.get(TABLE_CONTEXT_ID_INDEX)));
+ prep.setInt(TABLE_FRAME_INDEX_INDEX + 1,
+ (Integer) (rowData.get(TABLE_FRAME_INDEX_INDEX)));
prep.setLong(TABLE_TIME_INDEX + 1, (Long) (rowData.get(TABLE_TIME_INDEX)));
prep.setInt(TABLE_API_ID_INDEX + 1, (Integer) (rowData.get(TABLE_API_ID_INDEX)));
prep.setString(TABLE_ARGUMENT_INDEX + 1,
prep.setInt(TABLE_TID_INDEX + 1, (Integer) (rowData.get(TABLE_TID_INDEX)));
prep.setLong(TABLE_CALLER_PC_ADDRESS_INDEX + 1,
(Long) (rowData.get(TABLE_CALLER_PC_ADDRESS_INDEX)));
- prep.setString(TABLE_LIB_NAME_INDEX + 1,
- (String) (rowData.get(TABLE_LIB_NAME_INDEX)));
+ prep.setInt(TABLE_LIB_NAME_INDEX + 1, (Integer) (rowData.get(TABLE_LIB_NAME_INDEX)));
} catch (SQLException e) {
e.printStackTrace();
--- /dev/null
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Hyunjong Park <phjwithyou.park@samsung.com>
+ * Sanghyun Lee <sanghyunnim.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.ui.opengl.data.DB;
+
+public class GLChartDBType {
+ private int chartTime = 0;
+ private int frameIndex = 0;
+ private int frameCount = 0;
+ private int frameRateTime = 0;
+ private int frameMakingTime = 0;
+ private boolean errno = false;
+ private int PID = 0;
+
+ public int getChartTime() {
+ return chartTime;
+ }
+
+ public void setChartTime(int chartTime) {
+ this.chartTime = chartTime;
+ }
+
+ public boolean isErrno() {
+ return errno;
+ }
+
+ public void setErrno(boolean errno) {
+ this.errno = errno;
+ }
+
+ public int getFrameMakingTime() {
+ return frameMakingTime;
+ }
+
+ public void setFrameMakingTime(int frameMakingTime) {
+ this.frameMakingTime = frameMakingTime;
+ }
+
+ public int getFrameRateTime() {
+ return frameRateTime;
+ }
+
+ public void setFrameRateTime(int frameRateTime) {
+ this.frameRateTime = frameRateTime;
+ }
+
+ public int getPID() {
+ return PID;
+ }
+
+ public void setPID(int pID) {
+ PID = pID;
+ }
+
+ public int getFrameIndex() {
+ return frameIndex;
+ }
+
+ public void setFrameIndex(int frameIndex) {
+ this.frameIndex = frameIndex;
+ }
+
+ public int getFrameCount() {
+ return frameCount;
+ }
+
+ public void setFrameCount(int frameCount) {
+ this.frameCount = frameCount;
+ }
+
+}
package org.tizen.dynamicanalyzer.ui.opengl.data.DB;
import java.sql.PreparedStatement;
+import java.sql.ResultSet;
import java.sql.SQLException;
+import java.util.ArrayList;
import java.util.List;
import org.tizen.dynamicanalyzer.constant.CommonConstants;
public final static int TABLE_PID_INDEX = 4;
private static final String SELECT_FRAME_RATE_TABLE_QUERY = "select "//$NON-NLS-1$
- + CHART_TIME + CommonConstants.COMMA
- + FRAME_COUNT
- + CommonConstants.COMMA + FRAME_INDEX
+ + CHART_TIME + CommonConstants.COMMA + FRAME_COUNT
+ CommonConstants.COMMA
- + ERROR_INFO + CommonConstants.COMMA + PID + " from "//$NON-NLS-1$
- + TABLENAME + " where '%s' <= " + CHART_TIME + " and " + CHART_TIME//$NON-NLS-1$ //$NON-NLS-2$
- + " <= '%s'";//$NON-NLS-1$
+ + FRAME_INDEX + CommonConstants.COMMA + ERROR_INFO + CommonConstants.COMMA
+ + PID
+ + " from "//$NON-NLS-1$
+ + TABLENAME + " WHERE " + CHART_TIME + " BETWEEN '%s' and '%s'";//$NON-NLS-1$
private static final String SELECT_PID_FRAME_RATE_TABLE_QUERY = "select "//$NON-NLS-1$
- + CHART_TIME + CommonConstants.COMMA
- + FRAME_COUNT
- + CommonConstants.COMMA + FRAME_INDEX
+ + CHART_TIME + CommonConstants.COMMA + FRAME_COUNT
+ CommonConstants.COMMA
- + ERROR_INFO + CommonConstants.COMMA + PID + " from "//$NON-NLS-1$
- + TABLENAME + " where '%s' <= " + CHART_TIME + " and " + CHART_TIME//$NON-NLS-1$ //$NON-NLS-2$
- + " <= '%s' and " + PID + " = '%s'";//$NON-NLS-1$
+ + FRAME_INDEX + CommonConstants.COMMA + ERROR_INFO + CommonConstants.COMMA
+ + PID
+ + " from "//$NON-NLS-1$
+ + TABLENAME + " where +" + CHART_TIME + " BETWEEN ' %s'and '%s' and " + PID + " = '%s'";//$NON-NLS-1$
@Override
public String getTableName() {
}
public GLFrameRateDBTableManager() {
- addColumn(new DBColumn(CHART_TIME, DBConstants.NOT_NULL,
- DBConstants.INTEGER));
- addColumn(new DBColumn(FRAME_COUNT, DBConstants.NOT_NULL,
- DBConstants.INTEGER));
- addColumn(new DBColumn(FRAME_INDEX, DBConstants.NOT_NULL,
- DBConstants.INTEGER));
- addColumn(new DBColumn(ERROR_INFO, DBConstants.NOT_NULL,
- DBConstants.BOOLEAN));
+ addColumn(new DBColumn(CHART_TIME, DBConstants.PRIMARY_KEY, DBConstants.INTEGER));
+ addColumn(new DBColumn(FRAME_COUNT, DBConstants.NOT_NULL, DBConstants.INTEGER));
+ addColumn(new DBColumn(FRAME_INDEX, DBConstants.NOT_NULL, DBConstants.INTEGER));
+ addColumn(new DBColumn(ERROR_INFO, DBConstants.NOT_NULL, DBConstants.BOOLEAN));
addColumn(new DBColumn(PID, DBConstants.NOT_NULL, DBConstants.INTEGER));
setIndexColumn(TABLE_CHART_TIME_INDEX);
}
}
public GLFrameRateInfo selectFrameCountInfo(int startIndex, int endIndex) {
- String query = String.format(SELECT_FRAME_RATE_TABLE_QUERY, startIndex,
- endIndex);
+ String query = String.format(SELECT_FRAME_RATE_TABLE_QUERY, startIndex, endIndex);
List<List<Object>> result = SqlConnectionManager.executeQuery(query);
if (null == result || result.size() == 0 || result.get(0).size() == 0) {
return null;
for (int i = 0; i < result.size(); i++) {
if (i == 0) {
- startFrameIndex = (Integer) (result.get(i)
- .get(TABLE_FRAME_INDEX_INDEX));
+ startFrameIndex = (Integer) (result.get(i).get(TABLE_FRAME_INDEX_INDEX));
}
if (i == result.size() - 1) {
endFrameIndex = startFrameIndex
return returnData;
}
- public List<List<Object>> selectFrameRate(double startIndex, double endIndex) {
- String query = String.format(SELECT_FRAME_RATE_TABLE_QUERY, startIndex,
- endIndex);
+ public List<GLChartDBType> selectFrameRate(double startIndex, double endIndex) {
+ String query = String.format(SELECT_FRAME_RATE_TABLE_QUERY, startIndex, endIndex);
if (ToolbarArea.getInstance().getSelectedPid() != 0) {
- query = String.format(SELECT_PID_FRAME_RATE_TABLE_QUERY,
- startIndex, endIndex, ToolbarArea.getInstance()
- .getSelectedPid());
+ query = String.format(SELECT_PID_FRAME_RATE_TABLE_QUERY, startIndex, endIndex,
+ ToolbarArea.getInstance().getSelectedPid());
}
- return SqlConnectionManager.executeQuery(query);
+ ResultSet rs = SqlConnectionManager.executeQueryRS(query);
+ if (rs == null) {
+ SqlConnectionManager.releaseResultSet(rs);
+ return null;
+ }
+
+ List<GLChartDBType> returnValue = new ArrayList<GLChartDBType>();
+ try {
+ while (rs.next()) {
+ GLChartDBType chartData = new GLChartDBType();
+ chartData.setChartTime(rs.getInt(TABLE_CHART_TIME_INDEX + 1));
+ chartData.setFrameCount(rs.getInt(TABLE_FRAME_COUNT_INDEX + 1));
+ chartData.setFrameIndex(rs.getInt(TABLE_FRAME_INDEX_INDEX + 1));
+ chartData.setErrno(rs.getBoolean(TABLE_ERROR_INFO_INDEX + 1));
+ returnValue.add(chartData);
+ }
+ SqlConnectionManager.releaseResultSet(rs);
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ return returnValue;
}
@Override
(Integer) (rowData.get(TABLE_FRAME_INDEX_INDEX)));
prep.setBoolean(TABLE_ERROR_INFO_INDEX + 1,
(Boolean) (rowData.get(TABLE_ERROR_INFO_INDEX)));
- prep.setInt(TABLE_PID_INDEX + 1,
- (Integer) (rowData.get(TABLE_PID_INDEX)));
+ prep.setInt(TABLE_PID_INDEX + 1, (Integer) (rowData.get(TABLE_PID_INDEX)));
} catch (SQLException e) {
e.printStackTrace();
isPrepared = false;
package org.tizen.dynamicanalyzer.ui.opengl.data.DB;
import java.sql.PreparedStatement;
+import java.sql.ResultSet;
import java.sql.SQLException;
+import java.util.ArrayList;
import java.util.List;
import org.tizen.dynamicanalyzer.constant.CommonConstants;
public static final String CHART_TIME = "CHART_TIME";//$NON-NLS-1$
public static final String FRAME_RATE = "FRAME_RATE_TIME";//$NON-NLS-1$
- public static final String VALUE = "VALUE";//$NON-NLS-1$
+ public static final String FRAME_MAKING_TIME = "FRAME_MAKING_TIME";//$NON-NLS-1$
public static final String ERROR_INFO = "ERROR_INFO";//$NON-NLS-1$
- public static final String START_SEQ = "START_SEQ";//$NON-NLS-1$
- public static final String END_SEQ = "END_SEQ";//$NON-NLS-1$
public static final String PID = DBConstants.COMMON_COLUMN_PID;
public final static int TABLE_CHART_TIME_INDEX = 0;
public final static int TABLE_FRAME_RATE_INDEX = 1;
- public final static int TABLE_VALUE_INDEX = 2;
+ public final static int TABLE_FRAME_MAKING_TIME_INDEX = 2;
public final static int TABLE_ERROR_INFO_INDEX = 3;
- public final static int TABLE_START_SEQ_INDEX = 4;
- public final static int TABLE_END_SEQ_INDEX = 5;
- public final static int TABLE_PID_INDEX = 6;
+ public final static int TABLE_PID_INDEX = 4;
- private static final String SELECT_TOTAL_FRAME_TIME_TABLE_QUERY = "select "//$NON-NLS-1$
- + CHART_TIME + CommonConstants.COMMA
- + FRAME_RATE
- + CommonConstants.COMMA + VALUE
- + CommonConstants.COMMA
- + ERROR_INFO + CommonConstants.COMMA
- + START_SEQ
- + CommonConstants.COMMA + END_SEQ + " from "//$NON-NLS-1$
+ private static final String SELECT_COUNT_FRAME_TIME_TABLE_QUERY = "select count(*) from "
+ TABLENAME;
private static final String SELECT_FRAME_TIME_TABLE_QUERY = "select "//$NON-NLS-1$
- + CHART_TIME + CommonConstants.COMMA
- + FRAME_RATE
- + CommonConstants.COMMA + VALUE
+ + CHART_TIME + CommonConstants.COMMA + FRAME_RATE
+ CommonConstants.COMMA
- + ERROR_INFO + CommonConstants.COMMA
- + START_SEQ
- + CommonConstants.COMMA + END_SEQ + " from "//$NON-NLS-1$
- + TABLENAME + " where '%s' <= " + CHART_TIME + " and "//$NON-NLS-1$//$NON-NLS-2$
- + CHART_TIME + " <= '%s'";//$NON-NLS-1$
+ + FRAME_MAKING_TIME + CommonConstants.COMMA + ERROR_INFO + " from "//$NON-NLS-1$
+ + TABLENAME + " where " + CHART_TIME + " between '%s' and '%s'";//$NON-NLS-1$
private static final String SELECT_PID_FRAME_TIME_TABLE_QUERY = "select "//$NON-NLS-1$
- + CHART_TIME + CommonConstants.COMMA
- + FRAME_RATE
- + CommonConstants.COMMA + VALUE
+ + CHART_TIME + CommonConstants.COMMA + FRAME_RATE
+ CommonConstants.COMMA
- + ERROR_INFO + CommonConstants.COMMA
- + START_SEQ
- + CommonConstants.COMMA + END_SEQ + " from "//$NON-NLS-1$
- + TABLENAME + " where '%s' <= " + CHART_TIME + " and "//$NON-NLS-1$//$NON-NLS-2$
- + CHART_TIME + " <= '%s' and " + PID + " = '%s'";//$NON-NLS-1$
+ + FRAME_MAKING_TIME + CommonConstants.COMMA + ERROR_INFO + " from "//$NON-NLS-1$
+ + TABLENAME + " where " + CHART_TIME + " between '%s' and '%s' and " + PID + " = '%s'";//$NON-NLS-1$
@Override
public String getTableName() {
}
public GLFrameTimeDBTableManager() {
- addColumn(new DBColumn(CHART_TIME, DBConstants.PRIMARY_KEY,
- DBConstants.INTEGER));
- addColumn(new DBColumn(FRAME_RATE, DBConstants.NOT_NULL,
- DBConstants.INTEGER));
- addColumn(new DBColumn(VALUE, DBConstants.NOT_NULL, DBConstants.INTEGER));
- addColumn(new DBColumn(ERROR_INFO, DBConstants.NOT_NULL,
- DBConstants.BOOLEAN));
- addColumn(new DBColumn(START_SEQ, DBConstants.NOT_NULL,
- DBConstants.INTEGER));
- addColumn(new DBColumn(END_SEQ, DBConstants.NOT_NULL,
- DBConstants.INTEGER));
+ addColumn(new DBColumn(CHART_TIME, DBConstants.NOT_NULL, DBConstants.INTEGER));
+ addColumn(new DBColumn(FRAME_RATE, DBConstants.NOT_NULL, DBConstants.INTEGER));
+ addColumn(new DBColumn(FRAME_MAKING_TIME, DBConstants.NOT_NULL, DBConstants.INTEGER));
+ addColumn(new DBColumn(ERROR_INFO, DBConstants.NOT_NULL, DBConstants.BOOLEAN));
addColumn(new DBColumn(PID, DBConstants.NOT_NULL, DBConstants.INTEGER));
setIndexColumn(TABLE_CHART_TIME_INDEX);
}
public int getFrameSize() {
- List<List<Object>> result = SqlConnectionManager
- .executeQuery(SELECT_TOTAL_FRAME_TIME_TABLE_QUERY);
- if (null == result || result.size() == 0 || result.get(0).size() == 0) {
- return 0;
- } else {
- return result.size();
+ int returnValue = 0;
+ ResultSet rs = SqlConnectionManager.executeQueryRS(SELECT_COUNT_FRAME_TIME_TABLE_QUERY);
+ if (rs == null) {
+ SqlConnectionManager.releaseResultSet(rs);
+ return returnValue;
+ }
+ try {
+ while (rs.next()) {
+ returnValue = rs.getInt(1);
+ }
+ SqlConnectionManager.releaseResultSet(rs);
+ } catch (SQLException e) {
+ e.printStackTrace();
}
+ return returnValue;
}
- public List<List<Object>> selectFrameTime(double startIndex, double endIndex) {
- String query = String.format(SELECT_FRAME_TIME_TABLE_QUERY, startIndex,
- endIndex);
+ public List<GLChartDBType> selectFrameTime(double startIndex, double endIndex) {
+ String query = String.format(SELECT_FRAME_TIME_TABLE_QUERY, startIndex, endIndex);
if (ToolbarArea.getInstance().getSelectedPid() != 0) {
- query = String.format(SELECT_PID_FRAME_TIME_TABLE_QUERY,
- startIndex, endIndex, ToolbarArea.getInstance()
- .getSelectedPid());
+ query = String.format(SELECT_PID_FRAME_TIME_TABLE_QUERY, startIndex, endIndex,
+ ToolbarArea.getInstance().getSelectedPid());
+ }
+ ResultSet rs = SqlConnectionManager.executeQueryRS(query);
+ if (rs == null) {
+ SqlConnectionManager.releaseResultSet(rs);
+ return null;
}
- return SqlConnectionManager.executeQuery(query);
+ List<GLChartDBType> returnValue = new ArrayList<GLChartDBType>();
+ try {
+ while (rs.next()) {
+ GLChartDBType chartData = new GLChartDBType();
+ chartData.setChartTime(rs.getInt(TABLE_CHART_TIME_INDEX + 1));
+ chartData.setFrameMakingTime(rs.getInt(TABLE_FRAME_MAKING_TIME_INDEX + 1));
+ chartData.setErrno(rs.getBoolean(TABLE_ERROR_INFO_INDEX + 1));
+ returnValue.add(chartData);
+ }
+ SqlConnectionManager.releaseResultSet(rs);
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ return returnValue;
}
@Override
(Integer) (rowData.get(TABLE_CHART_TIME_INDEX)));
prep.setInt(TABLE_FRAME_RATE_INDEX + 1,
(Integer) (rowData.get(TABLE_FRAME_RATE_INDEX)));
- prep.setInt(TABLE_VALUE_INDEX + 1,
- (Integer) (rowData.get(TABLE_VALUE_INDEX)));
+ prep.setInt(TABLE_FRAME_MAKING_TIME_INDEX + 1,
+ (Integer) (rowData.get(TABLE_FRAME_MAKING_TIME_INDEX)));
prep.setBoolean(TABLE_ERROR_INFO_INDEX + 1,
(Boolean) (rowData.get(TABLE_ERROR_INFO_INDEX)));
- prep.setInt(TABLE_START_SEQ_INDEX + 1,
- (Integer) (rowData.get(TABLE_START_SEQ_INDEX)));
- prep.setInt(TABLE_END_SEQ_INDEX + 1,
- (Integer) (rowData.get(TABLE_END_SEQ_INDEX)));
- prep.setInt(TABLE_PID_INDEX + 1,
- (Integer) (rowData.get(TABLE_PID_INDEX)));
+ prep.setInt(TABLE_PID_INDEX + 1, (Integer) (rowData.get(TABLE_PID_INDEX)));
} catch (SQLException e) {
e.printStackTrace();
package org.tizen.dynamicanalyzer.ui.opengl.data.DB;
import java.sql.PreparedStatement;
+import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
}
public List<GLRedundantDataType> select() {
- List<List<Object>> result = SqlConnectionManager.executeQuery(SELECT_QUERY);
- if (null == result || result.size() == 0 || result.get(0).size() == 0) {
+ ResultSet rs = SqlConnectionManager.executeQueryRS(SELECT_QUERY);
+ if (rs == null) {
+ SqlConnectionManager.releaseResultSet(rs);
return null;
}
List<GLRedundantDataType> textureList = new ArrayList<GLRedundantDataType>();
- for (int i = 0; i < result.size(); i++) {
- int callCount = (Integer) result.get(i).get(TABLE_CALL_COUNT_INDEX);
- long elapsedTime = (Long) result.get(i).get(TABLE_ELAPSED_TIME_INDEX);
- int apiID = (Integer) result.get(i).get(TABLE_API_ID_INDEX);
- String parameter = (String) result.get(i).get(TABLE_ARGUMENT_INDEX);
- GLRedundantDataType data = new GLRedundantDataType(apiID, parameter, callCount,
- elapsedTime);
- data.setCallCount(callCount);
- textureList.add(data);
+ try {
+ while (rs.next()) {
+ GLRedundantDataType data = new GLRedundantDataType();
+ data.setCallCount(rs.getInt(TABLE_CALL_COUNT_INDEX + 1));
+ data.setElapsedTime(rs.getLong(TABLE_ELAPSED_TIME_INDEX + 1));
+ data.setApiID(rs.getInt(TABLE_API_ID_INDEX + 1));
+ data.setArgs(rs.getString(TABLE_ARGUMENT_INDEX + 1));
+ textureList.add(data);
+ }
+ SqlConnectionManager.releaseResultSet(rs);
+ } catch (SQLException e) {
+ e.printStackTrace();
}
return textureList;
}
package org.tizen.dynamicanalyzer.ui.opengl.data.DB;
import java.sql.PreparedStatement;
+import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
-import org.tizen.dynamicanalyzer.constant.CommonConstants;
import org.tizen.dynamicanalyzer.database.DBColumn;
import org.tizen.dynamicanalyzer.database.DBConstants;
import org.tizen.dynamicanalyzer.database.DBTable;
private static final String TABLENAME = "GL_HISTORY";//$NON-NLS-1$
public static final String CONTEXT_ID = "CONTEXT_ID";//$NON-NLS-1$
- public static final String CONTEXT_DB_INDEX = "CONTEXT_DB_INDEX";//$NON-NLS-1$
- public static final String CHANGE_SEQ = "CHANGE_SEQ";//$NON-NLS-1$
+ public static final String CONTEXT_DB_INDEX = "RENDER_STATE_ID";//$NON-NLS-1$
+ public static final String CHANGE_SEQ = "CHANGE_SEQUENCE_NUMBER";//$NON-NLS-1$
public static final String FRAME_RATE_INDEX = "FRAME_RATE_INDEX";//$NON-NLS-1$
public static final String FRAME_TIME_INDEX = "FRAME_TIME_INDEX";//$NON-NLS-1$
public final static int TABLE_FRAME_RATE_INDEX_INDEX = 3;
public final static int TABLE_FRAME_TIME_INDEX_INDEX = 4;
- private static final String SELECT_LAST_CHANGED_SEQ_QUERY = "select "
- + CONTEXT_ID + CommonConstants.COMMA + CONTEXT_DB_INDEX
- + CommonConstants.COMMA + CHANGE_SEQ + CommonConstants.COMMA
- + FRAME_RATE_INDEX + CommonConstants.COMMA + FRAME_TIME_INDEX
- + " from " + TABLENAME + " where " + CONTEXT_ID + " = '%s' and "//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
- + CONTEXT_DB_INDEX + " = '%s' and " + CHANGE_SEQ//$NON-NLS-1$
- + " < '%s' order by " + CHANGE_SEQ + " desc";//$NON-NLS-1$//$NON-NLS-2$
-
- private static final String SELECT_NEXT_CHANGED_SEQ_QUERY = "select "//$NON-NLS-1$
- + CONTEXT_ID + CommonConstants.COMMA
- + CONTEXT_DB_INDEX
- + CommonConstants.COMMA + CHANGE_SEQ
- + CommonConstants.COMMA
- + FRAME_RATE_INDEX + CommonConstants.COMMA
- + FRAME_TIME_INDEX
- + " from " + TABLENAME + " where " + CONTEXT_ID + " = '%s' and "//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
- + CONTEXT_DB_INDEX + " = '%s' and " + CHANGE_SEQ//$NON-NLS-1$
- + " > '%s' order by " + CHANGE_SEQ + " desc";//$NON-NLS-1$//$NON-NLS-2$
+ private static final String SELECT_LAST_CHANGED_SEQ_QUERY = "select CONTEXT_ID,RENDER_STATE_ID,CHANGE_SEQUENCE_NUMBER,FRAME_RATE_INDEX,FRAME_TIME_INDEX "
+ + "from GL_HISTORY "
+ + "where CONTEXT_ID = '%s'and RENDER_STATE_ID = '%s'and "
+ + "CHANGE_SEQUENCE_NUMBER = (select MAX(CHANGE_SEQUENCE_NUMBER) "
+ + "from GL_HISTORY "
+ + "where CONTEXT_ID = '%s' and RENDER_STATE_ID = '%s' and CHANGE_SEQUENCE_NUMBER < '%s')";
+
+ private static final String SELECT_NEXT_CHANGED_SEQ_QUERY = "select CONTEXT_ID,RENDER_STATE_ID,CHANGE_SEQUENCE_NUMBER,FRAME_RATE_INDEX,FRAME_TIME_INDEX "
+ + "from GL_HISTORY "
+ + "where CONTEXT_ID = '%s'and RENDER_STATE_ID = '%s'and "
+ + "CHANGE_SEQUENCE_NUMBER = (select MIN(CHANGE_SEQUENCE_NUMBER) "
+ + "from GL_HISTORY "
+ + "where CONTEXT_ID = '%s' and RENDER_STATE_ID = '%s' and CHANGE_SEQUENCE_NUMBER > '%s')";
@Override
public String getTableName() {
}
public GLStateHistoryDBTableManager() {
- addColumn(new DBColumn(CONTEXT_ID, DBConstants.NOT_NULL,
- DBConstants.LONG));
- addColumn(new DBColumn(CONTEXT_DB_INDEX, DBConstants.NOT_NULL,
- DBConstants.INTEGER));
- addColumn(new DBColumn(CHANGE_SEQ, DBConstants.NOT_NULL,
- DBConstants.LONG));
- addColumn(new DBColumn(FRAME_RATE_INDEX, DBConstants.NOT_NULL,
- DBConstants.INTEGER));
- addColumn(new DBColumn(FRAME_TIME_INDEX, DBConstants.NOT_NULL,
- DBConstants.INTEGER));
+ addColumn(new DBColumn(CONTEXT_ID, DBConstants.NOT_NULL, DBConstants.LONG));
+ addColumn(new DBColumn(CONTEXT_DB_INDEX, DBConstants.NOT_NULL, DBConstants.INTEGER));
+ addColumn(new DBColumn(CHANGE_SEQ, DBConstants.NOT_NULL, DBConstants.LONG));
+ addColumn(new DBColumn(FRAME_RATE_INDEX, DBConstants.NOT_NULL, DBConstants.INTEGER));
+ addColumn(new DBColumn(FRAME_TIME_INDEX, DBConstants.NOT_NULL, DBConstants.INTEGER));
setIndexColumn(TABLE_CHANGE_SEQ_INDEX);
}
- public void insertData(long contextId, int stateIndex, long seq,
- int frameRateIndex, int frameTimeIndex) {
+ public void insertData(long contextId, int stateIndex, long seq, int frameRateIndex,
+ int frameTimeIndex) {
List<List<Object>> insertList = new ArrayList<List<Object>>();
List<Object> objectList = new ArrayList<Object>();
objectList.add(contextId);
insertData(insertList);
}
- public List<Object> selectLastChangedSeq(long contextId, int stateIndex,
- long seq) {
- String query = String.format(SELECT_LAST_CHANGED_SEQ_QUERY, contextId,
- stateIndex, seq);
- List<List<Object>> result = SqlConnectionManager.executeQuery(query);
- if (null == result || result.size() == 0 || result.get(0).size() == 0) {
+ public List<Object> selectLastChangedSeq(long contextId, int stateIndex, long seq) {
+ String query = String.format(SELECT_LAST_CHANGED_SEQ_QUERY, contextId, stateIndex,
+ contextId, stateIndex, seq);
+ ResultSet rs = SqlConnectionManager.executeQueryRS(query);
+ if (rs == null) {
+ SqlConnectionManager.releaseResultSet(rs);
return null;
}
- return result.get(0);
+ return getDBData(rs);
+ }
+
+ private List<Object> getDBData(ResultSet rs) {
+ List<Object> returnValue = new ArrayList<Object>();
+ try {
+ while (rs.next()) {
+ returnValue.add(rs.getLong(TABLE_CONTEXT_ID_INDEX + 1));
+ returnValue.add(rs.getInt(TABLE_CONTEXT_DB_INDEX_INDEX + 1));
+ returnValue.add(rs.getLong(TABLE_CHANGE_SEQ_INDEX + 1));
+ returnValue.add(rs.getInt(TABLE_FRAME_RATE_INDEX_INDEX + 1));
+ returnValue.add(rs.getInt(TABLE_FRAME_TIME_INDEX_INDEX + 1));
+ }
+ SqlConnectionManager.releaseResultSet(rs);
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ return returnValue;
}
- public List<Object> selectNextChangedSeq(long contextId, int stateIndex,
- long seq) {
- String query = String.format(SELECT_NEXT_CHANGED_SEQ_QUERY, contextId,
- stateIndex, seq);
- List<List<Object>> result = SqlConnectionManager.executeQuery(query);
- if (null == result || result.size() == 0 || result.get(0).size() == 0) {
+ public List<Object> selectNextChangedSeq(long contextId, int stateIndex, long seq) {
+ String query = String.format(SELECT_NEXT_CHANGED_SEQ_QUERY, contextId, stateIndex,
+ contextId, stateIndex, seq);
+ ResultSet rs = SqlConnectionManager.executeQueryRS(query);
+ if (rs == null) {
+ SqlConnectionManager.releaseResultSet(rs);
return null;
}
- return result.get(0);
+ return getDBData(rs);
}
@Override
package org.tizen.dynamicanalyzer.ui.opengl.data.DB;
import java.sql.PreparedStatement;
+import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
if (null == result || result.size() == 0 || result.get(0).size() == 0) {
return;
}
- for (int i = 0; i < result.size(); i++) {
- if ((Integer) result.get(i).get(TABLE_TYPE_INDEX) == TYPE_PROGRAM) {
- initProgramData(i, result);
- } else {
- initSraderData(i, result);
+ ResultSet rs = SqlConnectionManager.executeQueryRS(SELECT_QUERY);
+ if (rs == null) {
+ SqlConnectionManager.releaseResultSet(rs);
+ return;
+ }
+ try {
+ while (rs.next()) {
+ if (rs.getInt(TABLE_TYPE_INDEX + 1) == TYPE_PROGRAM) {
+ initProgramData(rs);
+ } else {
+ initSraderData(rs);
+ }
}
+ SqlConnectionManager.releaseResultSet(rs);
+ } catch (SQLException e) {
+ e.printStackTrace();
}
}
- private void initProgramData(int index, List<List<Object>> result) {
- GLStateProgramType programType = new GLStateProgramType((Integer) result.get(index).get(
- TABLE_ID_INDEX));
- programType.setDeleteStatus((Integer) result.get(index).get(TABLE_DELETE_STATUS_INDEX));
- programType.setLinkStatus((Integer) result.get(index).get(TABLE_LINK_STATUS_INDEX));
- programType.setFragmentShaderId((Integer) result.get(index).get(TABLE_FRAGMENT_ID_INDEX));
- programType.setVertexShaderId((Integer) result.get(index).get(TABLE_VERTEX_ID_INDEX));
- programType.setContextId((Long) result.get(index).get(TABLE_CONTEXT_NAME_INDEX));
- GLDataManager.getInstance().getStateDataManager().getProgramMakeObject()
- .addProgramList(programType);
+ private void initProgramData(ResultSet rs) {
+ GLStateProgramType programType;
+ try {
+ programType = new GLStateProgramType(rs.getInt(TABLE_ID_INDEX + 1));
+ programType.setDeleteStatus(rs.getInt(TABLE_DELETE_STATUS_INDEX + 1));
+ programType.setLinkStatus(rs.getInt(TABLE_LINK_STATUS_INDEX + 1));
+ programType.setFragmentShaderId(rs.getInt(TABLE_FRAGMENT_ID_INDEX + 1));
+ programType.setVertexShaderId(rs.getInt(TABLE_VERTEX_ID_INDEX + 1));
+ programType.setContextId(rs.getLong(TABLE_CONTEXT_NAME_INDEX + 1));
+ GLDataManager.getInstance().getStateDataManager().getProgramMakeObject()
+ .addProgramList(programType);
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
}
- private void initSraderData(int index, List<List<Object>> result) {
- GLStateShaderType shaderType = new GLStateShaderType((Long) result.get(index).get(
- TABLE_CONTEXT_NAME_INDEX), (Integer) result.get(index).get(TABLE_ID_INDEX));
- shaderType.setShaderSrc((String) result.get(index).get(TABLE_SHADER_SRC_INDEX));
- shaderType.setDeleteStatus((Integer) result.get(index).get(TABLE_DELETE_STATUS_INDEX));
- shaderType.setCompileStatus((Integer) result.get(index).get(TABLE_LINK_STATUS_INDEX));
- GLDataManager.getInstance().getStateDataManager().getProgramMakeObject()
- .addShaderList(shaderType);
+ private void initSraderData(ResultSet rs) {
+ GLStateShaderType shaderType;
+ try {
+ shaderType = new GLStateShaderType(rs.getLong(TABLE_CONTEXT_NAME_INDEX + 1),
+ rs.getInt(TABLE_ID_INDEX + 1));
+ shaderType.setShaderSrc(rs.getString(TABLE_SHADER_SRC_INDEX + 1));
+ shaderType.setDeleteStatus(rs.getInt(TABLE_DELETE_STATUS_INDEX + 1));
+ shaderType.setCompileStatus(rs.getInt(TABLE_COMPILE_STATUS_INDEX + 1));
+ GLDataManager.getInstance().getStateDataManager().getProgramMakeObject()
+ .addShaderList(shaderType);
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
}
public void insertProgramData() {
List<List<Object>> returnObjectList = new ArrayList<List<Object>>();
List<GLStateShaderType> shaderList = GLDataManager.getInstance().getStateDataManager()
.getProgramMakeObject().getShaderList();
- if(null == shaderList){
+ if (null == shaderList) {
return returnObjectList;
}
for (int i = 0; i < shaderList.size(); i++) {
package org.tizen.dynamicanalyzer.ui.opengl.data.DB;
import java.sql.PreparedStatement;
+import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
}
public List<GLSharingContextType> selectSharingData() {
- List<List<Object>> result = SqlConnectionManager.executeQuery(SELECT_QUERY);
- if (null == result || result.size() == 0 || result.get(0).size() == 0) {
+ ResultSet rs = SqlConnectionManager.executeQueryRS(SELECT_QUERY);
+ if (rs == null) {
+ SqlConnectionManager.releaseResultSet(rs);
return null;
}
-
List<GLSharingContextType> sharingInfoList = new ArrayList<GLSharingContextType>();
- for (int i = 0; i < result.size(); i++) {
- sharingInfoList.add(new GLSharingContextType((Long) result.get(i).get(
- TABLE_CONTEXT_ID_INDEX), (Long) result.get(i).get(
- TABLE_SHARING_CONTEXT_ID_INDEX)));
+ try {
+ while (rs.next()) {
+ sharingInfoList.add(new GLSharingContextType(
+ rs.getLong(TABLE_CONTEXT_ID_INDEX + 1), rs
+ .getLong(TABLE_SHARING_CONTEXT_ID_INDEX + 1)));
+ }
+ SqlConnectionManager.releaseResultSet(rs);
+ } catch (SQLException e) {
+ e.printStackTrace();
}
-
return sharingInfoList;
}
package org.tizen.dynamicanalyzer.ui.opengl.data.DB;
import java.sql.PreparedStatement;
+import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
public void initTextureDataAtOpen() {
List<GLStateTextureType> selectedList = select();
- if(null == selectedList){
+ if (null == selectedList) {
return;
}
for (GLStateTextureType type : selectedList) {
}
public List<GLStateTextureType> select() {
- List<List<Object>> result = SqlConnectionManager.executeQuery(SELECT_QUERY);
- if (null == result || result.size() == 0 || result.get(0).size() == 0) {
+ ResultSet rs = SqlConnectionManager.executeQueryRS(SELECT_QUERY);
+ if (rs == null) {
+ SqlConnectionManager.releaseResultSet(rs);
return null;
}
-
List<GLStateTextureType> textureList = new ArrayList<GLStateTextureType>();
- for (int i = 0; i < result.size(); i++) {
- long contextID = (Long) result.get(i).get(TABLE_CONTEXT_ID_INDEX);
- int seq = (Integer) result.get(i).get(TABLE_CHANGE_SEQ_INDEX);
- int unitType = (Integer) result.get(i).get(TABLE_TEXTURE_UNIT_TYPE_INDEX);
- int textureId = (Integer) result.get(i).get(TABLE_TEXTURE_OBJ_ID_INDEX);
- int magFilter = (Integer) result.get(i).get(TABLE_TEXTURE_OBJ_MAG_FUNC_INDEX);
- int minFilter = (Integer) result.get(i).get(TABLE_TEXTURE_OBJ_MIN_FUNC_INDEX);
- int wrapS = (Integer) result.get(i).get(TABLE_TEXTURE_OBJ_WRAP_S_INDEX);
- int wrapT = (Integer) result.get(i).get(TABLE_TEXTURE_OBJ_WRAP_T_INDEX);
-
- GLStateTextureType textureType = new GLStateTextureType(textureId, contextID, seq);
- textureType.setMagFilter(magFilter);
- textureType.setMinFilter(minFilter);
- textureType.setWrapS(wrapS);
- textureType.setWrapT(wrapT);
- textureType.setType(unitType);
- textureList.add(textureType);
+ try {
+ while (rs.next()) {
+ long contextID = rs.getLong(TABLE_CONTEXT_ID_INDEX + 1);
+ int seq = rs.getInt(TABLE_CHANGE_SEQ_INDEX + 1);
+ int unitType = rs.getInt(TABLE_TEXTURE_UNIT_TYPE_INDEX + 1);
+ int textureId = rs.getInt(TABLE_TEXTURE_OBJ_ID_INDEX + 1);
+ int magFilter = rs.getInt(TABLE_TEXTURE_OBJ_MAG_FUNC_INDEX + 1);
+ int minFilter = rs.getInt(TABLE_TEXTURE_OBJ_MIN_FUNC_INDEX + 1);
+ int wrapS = rs.getInt(TABLE_TEXTURE_OBJ_WRAP_S_INDEX + 1);
+ int wrapT = rs.getInt(TABLE_TEXTURE_OBJ_WRAP_T_INDEX + 1);
+
+ GLStateTextureType textureType = new GLStateTextureType(textureId, contextID, seq);
+ textureType.setMagFilter(magFilter);
+ textureType.setMinFilter(minFilter);
+ textureType.setWrapS(wrapS);
+ textureType.setWrapT(wrapT);
+ textureType.setType(unitType);
+ textureList.add(textureType);
+ }
+ SqlConnectionManager.releaseResultSet(rs);
+ } catch (SQLException e) {
+ e.printStackTrace();
}
return textureList;
}
private boolean isSelectFrameRateChart = true;
private long apiTimeOfPreFrameIndex = 0;
private String selectedAPIAtTable = CommonConstants.EMPTY;
- private List<List<Object>> currentAPITableData = null;
+ private List<GLAPIData> currentAPITableData = null;
private int chartSelectedStartIndexForAPITable = -1;
private int chartSelectedEndIndexForAPITable = -1;
frameRateDataList = new ArrayList<GLFrameRateInfo>();
sharingContextList = new ArrayList<GLSharingContextType>();
statisticsDataManger = new GLStatisticsDataManager();
- currentAPITableData = new ArrayList<List<Object>>();
+ currentAPITableData = new ArrayList<GLAPIData>();
startFrameRateTime = 1;
selectedContextID = -1;
currentFrameIndex = 1;
@Override
protected void onThreadStop() {
-
+
}
@Override
for (LogData data : glesLogs.getRawLogs()) {
GLES20LogData logData = (GLES20LogData) data;
if (checkFailedAPI(logData)) {
- SummaryDataManager.getInstance().getFailedApiDataMaker()
- .makeData(logData);
+ SummaryDataManager.getInstance().getFailedApiDataMaker().makeData(logData);
}
}
}
int currentFrameIndexOfState = currentFrameIndex;
for (LogData data : glesLogs.getRawLogs()) {
GLES20LogData logData = (GLES20LogData) data;
- stateDataManager.extractGLAPIParameter(logData,
- currentFrameIndexOfState);
+ stateDataManager.extractGLAPIParameter(logData, currentFrameIndexOfState);
if (GLUtil.isLastAPIOfFrame(logData.getApiName())) {
currentFrameIndexOfState++;
}
List<GLAPIData> insetAPIDataList = new ArrayList<GLAPIData>();
for (LogData data : glesLogs.getRawLogs()) {
GLES20LogData logData = (GLES20LogData) data;
- insetAPIDataList
- .add(new GLAPIData(logData, currentFrameIndexOfAPI));
+ insetAPIDataList.add(new GLAPIData(logData, currentFrameIndexOfAPI));
if (GLUtil.isLastAPIOfFrame(logData.getApiName())) {
currentFrameIndexOfAPI++;
}
GLCurrentFrameDataManger currentFrameData = new GLCurrentFrameDataManger();
for (LogData data : glesLogs.getRawLogs()) {
GLES20LogData logData = (GLES20LogData) data;
- currentFrameData.addAPIData(new GLAPIData(logData,
- currentFrameIndexOfFrameTime));
+ currentFrameData.addAPIData(new GLAPIData(logData, currentFrameIndexOfFrameTime));
if (GLUtil.isLastAPIOfFrame(logData.getApiName())) {
- makeFrameTimeData(insetFrameTimeChartDataList,
- currentFrameData, currentFrameIndexOfFrameTime,
- apiTimeOfPreFrameIndex, logData.getTime());
+ makeFrameTimeData(insetFrameTimeChartDataList, currentFrameData,
+ currentFrameIndexOfFrameTime, apiTimeOfPreFrameIndex, logData.getTime());
currentFrameIndexOfFrameTime++;
apiTimeOfPreFrameIndex = logData.getTime();
}
hasFailedAPIofCurrentFrame = true;
}
if (GLUtil.isLastAPIOfFrame(logData.getApiName())) {
- makeFrameRateChartDataList(logData,
- currentFrameIndexOfFrameRate,
+ makeFrameRateChartDataList(logData, currentFrameIndexOfFrameRate,
hasFailedAPIofCurrentFrame);
hasFailedAPIofCurrentFrame = false;
currentFrameIndexOfFrameRate++;
}
}
- private void makeFrameTimeData(
- List<List<Object>> insetFrameTimeChartDataList,
- GLCurrentFrameDataManger glCurrentFrameData,
- int currentFrameIndexOfFrameTime, long apiTimeOfPreFrameIndex,
- long apiTime) {
- long frameValue = (apiTime - apiTimeOfPreFrameIndex)
- / TimelineConstants.KILO_LONG;
+ private void makeFrameTimeData(List<List<Object>> insetFrameTimeChartDataList,
+ GLCurrentFrameDataManger glCurrentFrameData, int currentFrameIndexOfFrameTime,
+ long apiTimeOfPreFrameIndex, long apiTime) {
+ long frameValue = (apiTime - apiTimeOfPreFrameIndex) / TimelineConstants.KILO_LONG;
List<Object> framTimeChartData = new ArrayList<Object>();
framTimeChartData.add(currentFrameIndexOfFrameTime);
- framTimeChartData.add(GLUtil.getTimeLineTime(glCurrentFrameData
- .getFirstLogData()));
+ framTimeChartData.add(GLUtil.getTimeLineTime(glCurrentFrameData.getFirstLogData()));
framTimeChartData.add((int) frameValue);
framTimeChartData.add(glCurrentFrameData.hasError());
- framTimeChartData.add(glCurrentFrameData.getStartSeq());
- framTimeChartData.add(glCurrentFrameData.getEndSeq());
framTimeChartData.add(glCurrentFrameData.getPid());
glCurrentFrameData.initFrameIndex();
insetFrameTimeChartDataList.add(framTimeChartData);
}
public void updateSharingContextList() {
- this.sharingContextList = GLDataManager.getInstance()
- .getStateSharingDBTableManage().selectSharingData();
+ this.sharingContextList = GLDataManager.getInstance().getStateSharingDBTableManage()
+ .selectSharingData();
}
public boolean isSharingData(long itemContextId) {
}
for (int i = 0; i < sharingContextList.size(); i++) {
long contextId = sharingContextList.get(i).getContextId();
- long sharingContextId = sharingContextList.get(i)
- .getSharingContextId();
- if (contextId == selectedContextID
- && sharingContextId == itemContextId) {
+ long sharingContextId = sharingContextList.get(i).getSharingContextId();
+ if (contextId == selectedContextID && sharingContextId == itemContextId) {
return true;
}
}
this.selectedContextID = selectedContextID;
}
- public List<List<Object>> getCurrentAPITableData(int frameStartIndex,
- int frameEndIndex) {
- if (currentAPITableData != null
- && chartSelectedStartIndexForAPITable == frameStartIndex
+ public List<GLAPIData> getCurrentAPITableData(int frameStartIndex, int frameEndIndex) {
+ if (currentAPITableData != null && chartSelectedStartIndexForAPITable == frameStartIndex
&& chartSelectedEndIndexForAPITable == frameEndIndex) {
return currentAPITableData;
}
chartSelectedStartIndexForAPITable = frameStartIndex;
chartSelectedEndIndexForAPITable = frameEndIndex;
- currentAPITableData = getAPIDataMagerInstance().selectOpenGLAPIData(
- frameStartIndex, frameEndIndex);
+ currentAPITableData = getAPIDataMagerInstance().selectOpenGLAPIData(frameStartIndex,
+ frameEndIndex);
return currentAPITableData;
}
- public List<List<Object>> getCurrentAPITableData() {
+ public List<GLAPIData> getCurrentAPITableData() {
return currentAPITableData;
}
import org.tizen.dynamicanalyzer.util.Logger;
public class GLStatisticsDataManager {
- private static final String SPLIT = CommonConstants.SPACE + CommonConstants.CMD_SPLIT
- + CommonConstants.SPACE;
+ private static final String SPLIT = CommonConstants.SPACE
+ + CommonConstants.CMD_SPLIT + CommonConstants.SPACE;
private static final String STATE_CHANGE = "State Change";//$NON-NLS-1$
private static final String MATRIX = "Matrix";//$NON-NLS-1$
private static final String TEXTURE = "Texture";//$NON-NLS-1$
if (null == savedHash) {
redundantHsahMap.put(
hashKey,
- new GLRedundantDataType(logData.getApiId(), logData.getArgs(), 1, logData
- .getElapsedTime()));
+ new GLRedundantDataType(logData.getApiId(), logData
+ .getArgs(), 1, logData.getElapsedTime()));
} else {
savedHash.addCallCount();
savedHash.addElapsedTime(logData.getElapsedTime());
}
public void selectRedundantData() {
- List<GLRedundantDataType> redundantList = GLDataManager.getInstance().getRedundantDBTable()
- .select();
+ List<GLRedundantDataType> redundantList = GLDataManager.getInstance()
+ .getRedundantDBTable().select();
if (null == redundantList) {
return;
}
for (GLRedundantDataType data : redundantList) {
- String hashKey = Global.getFunctionName(data.getApiID()) + data.getArgs();
+ String hashKey = Global.getFunctionName(data.getApiID())
+ + data.getArgs();
GLRedundantDataType savedHash = redundantHsahMap.get(hashKey);
if (null == savedHash) {
redundantHsahMap.put(
hashKey,
- new GLRedundantDataType(data.getApiID(), data.getArgs(), data
- .getCallCount(), data.getElapsedTime()));
+ new GLRedundantDataType(data.getApiID(),
+ data.getArgs(), data.getCallCount(), data
+ .getElapsedTime()));
} else {
- savedHash.setCallCount(savedHash.getCallCount() + data.getCallCount());
+ savedHash.setCallCount(savedHash.getCallCount()
+ + data.getCallCount());
}
totalAPICount += data.getCallCount();
}
public List<GLRedundantDataType> getRedundantTableData() {
List<GLRedundantDataType> returnList = new ArrayList<GLRedundantDataType>();
- for (Map.Entry<String, GLRedundantDataType> entry : redundantHsahMap.entrySet()) {
+ for (Map.Entry<String, GLRedundantDataType> entry : redundantHsahMap
+ .entrySet()) {
returnList.add(entry.getValue());
}
return returnList;
public List<GLStatisticsDataType> getStatisticsTableData() {
List<GLStatisticsDataType> returnList = new ArrayList<GLStatisticsDataType>();
LinkedHashMap<String, GLStatisticsDataType> statisticsHashMap = getStatisticDataFromRedundantHashMap();
- for (Map.Entry<String, GLStatisticsDataType> entry : statisticsHashMap.entrySet()) {
+ for (Map.Entry<String, GLStatisticsDataType> entry : statisticsHashMap
+ .entrySet()) {
returnList.add(entry.getValue());
}
return returnList;
private LinkedHashMap<String, GLStatisticsDataType> getStatisticDataFromRedundantHashMap() {
LinkedHashMap<String, GLStatisticsDataType> returnStatisticsHsahMap = new LinkedHashMap<String, GLStatisticsDataType>();
- for (Map.Entry<String, GLRedundantDataType> entry : redundantHsahMap.entrySet()) {
+ for (Map.Entry<String, GLRedundantDataType> entry : redundantHsahMap
+ .entrySet()) {
GLRedundantDataType redundantDataType = entry.getValue();
String hashKey = redundantDataType.getAPIName();
- GLStatisticsDataType savedHash = returnStatisticsHsahMap.get(hashKey);
+ GLStatisticsDataType savedHash = returnStatisticsHsahMap
+ .get(hashKey);
if (null == savedHash) {
- returnStatisticsHsahMap.put(
- hashKey,
- new GLStatisticsDataType(redundantDataType.getApiID(), redundantDataType
- .getArgs(), getRate(redundantDataType.getCallCount()),
- redundantDataType.getCallCount(), redundantDataType
- .getElapsedTime(), getAPIType(redundantDataType
- .getAPIName())));
+ returnStatisticsHsahMap.put(hashKey,
+ new GLStatisticsDataType(redundantDataType.getApiID(),
+ redundantDataType.getArgs(),
+ getRate(redundantDataType.getCallCount()),
+ redundantDataType.getCallCount(),
+ redundantDataType.getElapsedTime(),
+ getAPIType(redundantDataType.getAPIName())));
} else {
savedHash.addCallCount(redundantDataType.getCallCount());
savedHash.setRate(getRate(savedHash.getCallCount()));
if (apiName.contains(TEXTURE) || apiName.contains("Tex")) {//$NON-NLS-1$
returnBuffer.append(TEXTURE).append(SPLIT);
}
- if (apiName.contains(BUFFER) || apiName.contains(CLEAR) ) {
+ if (apiName.contains(BUFFER) || apiName.contains(CLEAR)) {
returnBuffer.append(BUFFER).append(SPLIT);
}
if (apiName.contains(GET) || apiName.contains("glHint")) {//$NON-NLS-1$
if (apiName.contains(IS)) {
returnBuffer.append(IS).append(SPLIT);
}
- if (apiName.contains(DRAW) || apiName.contains("glFinish") || apiName.contains("glFlush")) {//$NON-NLS-1$//$NON-NLS-2$
+ if (apiName.contains(DRAW)
+ || apiName.contains("glFinish") || apiName.contains("glFlush")) {//$NON-NLS-1$//$NON-NLS-2$
returnBuffer.append(DRAW).append(SPLIT);
}
if (apiName.contains(DELETE)) {
|| apiName.contains("glScissor") || apiName.contains("glViewport")) {//$NON-NLS-1$//$NON-NLS-2$
returnBuffer.append(STATE_CHANGE).append(SPLIT);
}
- if (apiName.contains(EVAS_GL)) {
+ if (apiName.contains(EVAS_GL)
+ || apiName.contains("elm_glview_gl_api_get")) {//$NON-NLS-1$
returnBuffer.append(EVAS_GL);
}
if (returnBuffer.length() == 0) {
Logger.error("Not Define API Type of Statistics : " + apiName);
return CommonConstants.EMPTY;
}
- if (returnBuffer.lastIndexOf(SPLIT) == returnBuffer.length() - SPLIT.length()) {
- returnBuffer.delete(returnBuffer.length() - SPLIT.length(), returnBuffer.length());
+ if (returnBuffer.lastIndexOf(SPLIT) == returnBuffer.length()
+ - SPLIT.length()) {
+ returnBuffer.delete(returnBuffer.length() - SPLIT.length(),
+ returnBuffer.length());
}
return returnBuffer.toString();
}
import java.util.ArrayList;
import java.util.List;
+import org.tizen.dynamicanalyzer.common.Global;
+import org.tizen.dynamicanalyzer.project.BinaryInfo;
import org.tizen.dynamicanalyzer.swap.model.data.GLES20LogData;
-import org.tizen.dynamicanalyzer.ui.opengl.data.DB.GLAPIDBTableManager;
public class GLAPIData extends GLES20LogData {
private int frameIndex = 0;
+ private int binaryId = 0;
+
+ public GLAPIData() {
- public GLAPIData(List<Object> data) {
- setSeq((Integer) data.get(GLAPIDBTableManager.TABLE_SEQ_INDEX));
- setFrameIndex((Integer) data.get(GLAPIDBTableManager.TABLE_FRAME_INDEX_INDEX));
- setContextID((Long) data.get(GLAPIDBTableManager.TABLE_CONTEXT_ID_INDEX));
- setTime((Long) data.get(GLAPIDBTableManager.TABLE_TIME_INDEX));
- setApiId((Integer) data.get(GLAPIDBTableManager.TABLE_API_ID_INDEX));
- setArgs((String) data.get(GLAPIDBTableManager.TABLE_ARGUMENT_INDEX));
- setReturn((String) data.get(GLAPIDBTableManager.TABLE_RET_INDEX));
- setElapsedTime((Long) data.get(GLAPIDBTableManager.TABLE_ELAPSED_TIMEQ_INDEX));
- setErrNo((Long) data.get(GLAPIDBTableManager.TABLE_ERROR_INDEX));
- setPid((Integer) data.get(GLAPIDBTableManager.TABLE_PID_INDEX));
- setTid((Integer) data.get(GLAPIDBTableManager.TABLE_TID_INDEX));
- setCallerAddress((Long) data.get(GLAPIDBTableManager.TABLE_CALLER_PC_ADDRESS_INDEX));
- setLibName((String) data.get(GLAPIDBTableManager.TABLE_LIB_NAME_INDEX));
}
public GLAPIData(GLES20LogData logData, int currentFrameIndex) {
setPid(logData.getPid());
setTid(logData.getTid());
setCallerAddress(logData.getCallerPcAddr());
- setLibName(logData.getLibName());
+ setBinaryID(logData.getLibName());
+ }
+
+ public String getLibName() {
+ BinaryInfo binInfo = Global.getProject().getDeviceStatusInfo().getBinaryInfo(getBinaryId());
+ libName = binInfo.getTargetBinaryPath();
+ return libName;
}
public void setContextID(long id) {
data.add(getPid());
data.add(getTid());
data.add(getCallerPcAddr());
- data.add(getLibName());
+ data.add(getBinaryId());
return data;
}
+ public int getBinaryId() {
+ return binaryId;
+ }
+
+ public void setBinaryId(int binaryId) {
+ this.binaryId = binaryId;
+ }
+
+ public void setBinaryID(String binaryPath) {
+ BinaryInfo binInfo = Global.getProject().getDeviceStatusInfo().getBinaryInfo(binaryPath);
+ this.binaryId = binInfo.getID();
+ }
+
}
private int callCount = -1;
private long elapsedTime = 0;
+ public GLRedundantDataType() {
+
+ }
+
public GLRedundantDataType(int apiID, String args, int callCount, long elapsedTime) {
this.apiID = apiID;
this.args = args;
if (items == null || items.length == 0) {
return;
}
- DATableDataFormat dataFormat = (DATableDataFormat) items[0]
- .getData();
+ DATableDataFormat dataFormat = (DATableDataFormat) items[0].getData();
if (dataFormat.getLogData() instanceof GLAPIData == false) {
return;
}
long time = glAPIType.getTime();
int frameIndex = glAPIType.getFrameIndex();
long contextId = glAPIType.getContextID();
- GLDataManager.getInstance().setSelectedAPIAtTable(
- glAPIType.getApiName());
- GLSelectionData selData = new GLSelectionData(
- GLPage.apiListViewID, time, time, items, table,
- frameIndex, contextId);
+ GLDataManager.getInstance().setSelectedAPIAtTable(glAPIType.getApiName());
+ GLSelectionData selData = new GLSelectionData(GLPage.apiListViewID, time, time,
+ items, table, frameIndex, contextId);
AnalyzerManager.getCurrentPage().updateView(selData);
AnalyzerManager.updateView(GLPage.apiListViewID, selData);
}
protected List<TableInput> makeTableInput() {
List<TableInput> input = new ArrayList<TableInput>();
- List<List<Object>> apiList = GLDataManager.getInstance()
- .getCurrentAPITableData(startFrameIndex, endFrameIndex);
+ List<GLAPIData> apiList = GLDataManager.getInstance().getCurrentAPITableData(
+ startFrameIndex, endFrameIndex);
if (null == apiList) {
return null;
}
int size = apiList.size();
for (int i = 0; i < size; i++) {
- GLAPIData glApiType = new GLAPIData(apiList.get(i));
+ GLAPIData glApiType = apiList.get(i);
String seq = Long.toString(glApiType.getSeq());
List<String> text = new ArrayList<String>();
text.add(seq);
text.add(Integer.toString(glApiType.getFrameIndex()));
text.add(String.valueOf(Formatter.toTimeFormat(glApiType.getTime())));
text.add(glApiType.getApiName());
- text.add(GLConstantDefine.convertEnumValue(glApiType.getArgs(),
- CommonConstants.COMMA, null));
+ text.add(GLConstantDefine.convertEnumValue(glApiType.getArgs(), CommonConstants.COMMA,
+ null));
text.add(glApiType.getReturn());
text.add(String.valueOf(glApiType.getElapsedTime()));
text.add(GLES20ErrorDefine.getError(glApiType.getErrno()));
text.add(String.valueOf(glApiType.getPid()));
text.add(String.valueOf(glApiType.getTid()));
- DATableDataFormat tableData = new DATableDataFormat(
- Long.parseLong(seq));
+ DATableDataFormat tableData = new DATableDataFormat(Long.parseLong(seq));
List<Object> compareData = new ArrayList<Object>();
for (int j = 0; j < text.size(); j++) {
compareData.add(text.get(j));
tableInput.setText(text);
tableInput.setData(glApiType);
tableInput.setData(tableData);
- if (!GLES20ErrorDefine.getError(glApiType.getErrno()).contains(
- "SUCCESS")) {//$NON-NLS-1$
+ if (!GLES20ErrorDefine.getError(glApiType.getErrno()).contains("SUCCESS")) {//$NON-NLS-1$
tableInput.setFailed(true);
}
- if (GLDataManager.getInstance().getSelectedAPIAtTable()
- .equals(glApiType.getApiName())) {
+ if (GLDataManager.getInstance().getSelectedAPIAtTable().equals(glApiType.getApiName())) {
tableInput.setSecondSelection(true);
}
input.add(tableInput);
int frameIndex = glAPIType.getFrameIndex();
long contextId = glAPIType.getContextID();
- GLSelectionData selData = new GLSelectionData(GLPage.apiListViewID,
- time, time, items, table, frameIndex, contextId);
+ GLSelectionData selData = new GLSelectionData(GLPage.apiListViewID, time, time, items,
+ table, frameIndex, contextId);
AnalyzerManager.getCurrentPage().updateView(selData);
}
}
- public void updateTableFromContext(int startFrameIndex, int endFrameIndex,
- String seq) {
+ public void updateTableFromContext(int startFrameIndex, int endFrameIndex, String seq) {
if (startFrameIndex >= 0) {
this.startFrameIndex = startFrameIndex;
}
for (int ii = 0; ii < nSize; ii++) {
if (table.getItem(ii).getText(0).equals(seq)) {
table.setSelection(ii);
- table.getVerticalBar().setSelection(
- getScrollSelectionIndex(table, ii));
+ table.getVerticalBar().setSelection(getScrollSelectionIndex(table, ii));
updateTable();
}
}
int frameIndex = glAPIType.getFrameIndex();
long contextId = glAPIType.getContextID();
- GLSelectionData selData = new GLSelectionData(GLPage.apiListViewID,
- time, time, items, table, frameIndex, contextId);
+ GLSelectionData selData = new GLSelectionData(GLPage.apiListViewID, time, time, items,
+ table, frameIndex, contextId);
AnalyzerManager.getCurrentPage().updateView(selData);
}
DBInsertManager.makeInserter(freeDataTable));
failedApiDataMaker = new FailedApiDataMaker(
DBInsertManager.makeInserter(failedApiDataTable));
- warningDataMaker = new WarningDataMaker(DBInsertManager.makeInserter(warningDataDBTable));
+ warningDataMaker = new WarningDataMaker(warningDataDBTable);
}
public LeakDataMaker getLeakDataMaker() {
@Override
public void saveData(Map<String, String> dataMap) {
leakDataMaker.makeData();
+ warningDataMaker.insertDBWhenSave();
}
@Override
CurrentLeakData newLeakData = new CurrentLeakData(seqNum, allocValue, pid);
leakDetector.addCurrentLeakData(newLeakData);
}
+
+ warningDataMaker.selectDBWhenOpen();
}
}
// Feature On : false, Feature Off : true
private boolean isDropLog(LogData logData) {
TargetData target = SettingDataManager.getInstance().getConnectedTarget();
- int id = logData.getId();
- switch (id) {
+ ProbeCommonData pData = (ProbeCommonData) logData;
+ if (!pData.isInternal()) return false;
+ switch (pData.getId()) {
case DataChannelConstants.MSG_PROBE_FILE:
if (target.isSelectedFeature(ConfigureLabels.INCLUDE_INSIDE_CALL_FILE)) {
return false;
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact:
+ * WooJin Jung <woojin2.jung@samsung.com>
* Jooyoul Lee <jy.exe.lee@samsung.com>
* Juyoung Kim <j0.kim@samsung.com>
*
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact:
+ * WooJin Jung <woojin2.jung@samsung.com>
* Jooyoul Lee <jy.exe.lee@samsung.com>
* Juyoung Kim <j0.kim@samsung.com>
*
public static final String SEQUENCE_NUMBER = DBConstants.DBCOLUMN_SEQUENCE_NUMBER;
public static final String MESSAGE_ID = "MESSAGE_ID";
public static final String PROCESS_ID = DBConstants.DBCOLUMN_PROCESS_ID;
+ public static final String THREAD_ID = DBConstants.DBCOLUMN_THREAD_ID;
public static final String START_TIME = DBConstants.DBCOLUMN_START_TIME;
+ public static final String END_TIME = DBConstants.DBCOLUMN_END_TIME;
public static final String WARNING_CASE = "WARNING_CASE";
public static final String WARNING_KEY = "WARNING_KEY";
public static final String CALLER_PC_ADDRESS = DBConstants.DBCOLUMN_CALLER_PC_ADDRESS;
public final static int COLUMN_INDEX_SEQUENCE_NUMBER = 1;
public final static int COLUMN_INDEX_MESSAGE_ID = 2;
public final static int COLUMN_INDEX_PROCESS_ID = 3;
- public final static int COLUMN_INDEX_START_TIME = 4;
- public final static int COLUMN_INDEX_WARNING_CASE = 5;
- public final static int COLUMN_INDEX_WARNING_KEY = 6;
- public final static int COLUMN_INDEX_CALLER_PC_ADDRESS = 7;
- public final static int COLUMN_INDEX_CALLER_LIBRARY_NAME = 8;
+ public final static int COLUMN_INDEX_THREAD_ID = 4;
+ public final static int COLUMN_INDEX_START_TIME = 5;
+ public final static int COLUMN_INDEX_END_TIME = 6;
+ public final static int COLUMN_INDEX_WARNING_CASE = 7;
+ public final static int COLUMN_INDEX_WARNING_KEY = 8;
+ public final static int COLUMN_INDEX_CALLER_PC_ADDRESS = 9;
+ public final static int COLUMN_INDEX_CALLER_LIBRARY_NAME = 10;
@Override
public String getTableName() {
addColumn(new DBColumn(SEQUENCE_NUMBER, DBConstants.NOT_NULL, DBConstants.DBTYPE_INT8));
addColumn(new DBColumn(MESSAGE_ID, DBConstants.NOT_NULL, DBConstants.DBTYPE_INT4));
addColumn(new DBColumn(PROCESS_ID, DBConstants.NOT_NULL, DBConstants.DBTYPE_INT4));
+ addColumn(new DBColumn(THREAD_ID, DBConstants.NOT_NULL, DBConstants.DBTYPE_INT4));
addColumn(new DBColumn(START_TIME, DBConstants.NOT_NULL, DBConstants.DBTYPE_LONG));
+ addColumn(new DBColumn(END_TIME, DBConstants.NOT_NULL, DBConstants.DBTYPE_LONG));
addColumn(new DBColumn(WARNING_CASE, DBConstants.NOT_NULL, DBConstants.DBTYPE_INT4));
addColumn(new DBColumn(WARNING_KEY, DBConstants.NOT_NULL, DBConstants.DBTYPE_VARCHAR,
DALimit.FILEPATH_LENGTH));
isPrepared = false;
} else {
try {
- prep.setInt(1, (Integer) (rowData.get(0)));
- prep.setLong(2, (Long) (rowData.get(1)));
- prep.setInt(3, (Integer) (rowData.get(2)));
- prep.setInt(4, (Integer) (rowData.get(3)));
- prep.setLong(5, (Long) (rowData.get(4)));
- prep.setInt(6, (Integer) (rowData.get(5)));
- prep.setString(7, (String) (rowData.get(6)));
- prep.setLong(8, (Long) (rowData.get(7)));
- prep.setString(9, (String) (rowData.get(8)));
+ prep.setInt(COLUMN_INDEX_RID+1, (Integer) (rowData.get(COLUMN_INDEX_RID)));
+ prep.setLong(COLUMN_INDEX_SEQUENCE_NUMBER+1, (Long) (rowData.get(COLUMN_INDEX_SEQUENCE_NUMBER)));
+ prep.setInt(COLUMN_INDEX_MESSAGE_ID+1, (Integer) (rowData.get(COLUMN_INDEX_MESSAGE_ID)));
+ prep.setInt(COLUMN_INDEX_PROCESS_ID+1, (Integer) (rowData.get(COLUMN_INDEX_PROCESS_ID)));
+ prep.setInt(COLUMN_INDEX_THREAD_ID+1, (Integer) (rowData.get(COLUMN_INDEX_THREAD_ID)));
+ prep.setLong(COLUMN_INDEX_START_TIME+1, (Long) (rowData.get(COLUMN_INDEX_START_TIME)));
+ prep.setLong(COLUMN_INDEX_END_TIME+1, (Long) (rowData.get(COLUMN_INDEX_END_TIME)));
+ prep.setInt(COLUMN_INDEX_WARNING_CASE+1, (Integer) (rowData.get(COLUMN_INDEX_WARNING_CASE)));
+ prep.setString(COLUMN_INDEX_WARNING_KEY+1, (String) (rowData.get(COLUMN_INDEX_WARNING_KEY)));
+ prep.setLong(COLUMN_INDEX_CALLER_PC_ADDRESS+1, (Long) (rowData.get(COLUMN_INDEX_CALLER_PC_ADDRESS)));
+ prep.setString(COLUMN_INDEX_CALLER_LIBRARY_NAME+1, (String) (rowData.get(COLUMN_INDEX_CALLER_LIBRARY_NAME)));
} catch (SQLException e) {
e.printStackTrace();
isPrepared = false;
import java.util.ArrayList;
import java.util.List;
-import org.tizen.dynamicanalyzer.database.DBInserter;
+import org.tizen.dynamicanalyzer.constant.CommonConstants;
import org.tizen.dynamicanalyzer.database.DBTable;
import org.tizen.dynamicanalyzer.database.IResultSet;
import org.tizen.dynamicanalyzer.swap.model.data.LogData;
private ArrayList<List<Object>> warningDataList;
- private DBInserter warningDBInserter = null;
+ private WarningDataDBTable warningDBTable = null;
- public WarningDataMaker(DBInserter inserter) {
+ public WarningDataMaker(WarningDataDBTable inserter) {
warningDataList = new ArrayList<List<Object>>();
- warningDBInserter = inserter;
+ warningDBTable = inserter;
+ }
+
+ public void insertDBWhenSave(){
+ if (warningDataList.size() > 0) {
+ @SuppressWarnings("unchecked")
+ List<List<Object>> wList = (List<List<Object>>) warningDataList.clone();
+ warningDataList.clear();
+ warningDBTable.insertData(wList);
+ }
+ }
+
+ public void selectDBWhenOpen(){
+ warningDataList.clear();
+ warningDataList = (ArrayList<List<Object>>) getWarningDataFromDB();
+ }
+
+ public ArrayList<List<Object>> getWarningDataList(){
+ return warningDataList;
+ }
+
+ public boolean removeData(LogData input,String key, int type) {
+ int size = warningDataList.size();
+ for (int i = 0; i < size; i++) {
+ String fileKey = (String)warningDataList.get(i).get(WarningDataDBTable.COLUMN_INDEX_WARNING_KEY);
+ int warningType = (Integer)warningDataList.get(i).get(WarningDataDBTable.COLUMN_INDEX_WARNING_CASE);
+ if (key.equals(fileKey) && warningType == type) {
+ ProbeCommonData pData = (ProbeCommonData) input;
+ warningDataList.get(i).set(WarningDataDBTable.COLUMN_INDEX_END_TIME, Long.valueOf(pData.getTime()));
+ return true;
+ }
+ }
+ return false;
}
public void makeData(List<LogData> inputs, String key, int warningCase) {
dbWarningData.add(Long.valueOf(pData.getSeq()));
dbWarningData.add(Integer.valueOf(pData.getId()));
dbWarningData.add(Integer.valueOf(pData.getPid()));
+ dbWarningData.add(Integer.valueOf(pData.getTid()));
dbWarningData.add(Long.valueOf(pData.getTime()));
+ dbWarningData.add(Long.valueOf(-1));
dbWarningData.add(Integer.valueOf(warningCase));
dbWarningData.add(String.valueOf(key));
dbWarningData.add(Long.valueOf(pData.getCallerPcAddr()));
}
}
- if (warningDataList.size() > 0) {
- @SuppressWarnings("unchecked")
- List<List<Object>> wList = (List<List<Object>>) warningDataList.clone();
- warningDataList.clear();
-
- warningDBInserter.pushData(wList);
- }
}
- public void makeData(LogData input, String key, int warningCase) {
+ public void add(LogData input, String key, int warningCase) {
ProbeCommonData pData = (ProbeCommonData) input;
if (!sameWarningDataChecker(key, warningCase)) {
dbWarningData.add(Long.valueOf(pData.getSeq()));
dbWarningData.add(Integer.valueOf(pData.getId()));
dbWarningData.add(Integer.valueOf(pData.getPid()));
+ dbWarningData.add(Integer.valueOf(pData.getTid()));
dbWarningData.add(Long.valueOf(pData.getTime()));
+ dbWarningData.add(Long.valueOf(-1));
dbWarningData.add(Integer.valueOf(warningCase));
dbWarningData.add(String.valueOf(key));
dbWarningData.add(Long.valueOf(pData.getCallerPcAddr()));
warningDataList.add(dbWarningData);
- @SuppressWarnings("unchecked")
- List<List<Object>> wList = (List<List<Object>>) warningDataList.clone();
- warningDataList.clear();
-
- warningDBInserter.pushData(wList);
}
}
columns.add(WarningDataDBTable.SEQUENCE_NUMBER);
columns.add(WarningDataDBTable.MESSAGE_ID);
columns.add(WarningDataDBTable.PROCESS_ID);
+ columns.add(WarningDataDBTable.THREAD_ID);
columns.add(WarningDataDBTable.START_TIME);
+ columns.add(WarningDataDBTable.END_TIME);
columns.add(WarningDataDBTable.WARNING_CASE);
columns.add(WarningDataDBTable.WARNING_KEY);
columns.add(WarningDataDBTable.CALLER_PC_ADDRESS);
public List<Object> extractDataFromResultSet(ResultSet rs) {
List<Object> row = new ArrayList<Object>();
try {
- row.add(Integer.valueOf(rs.getInt(1)));
- row.add(Long.valueOf(rs.getLong(2)));
- row.add(Integer.valueOf(rs.getInt(3)));
- row.add(Integer.valueOf(rs.getInt(4)));
- row.add(Long.valueOf(rs.getLong(5)));
- row.add(Integer.valueOf(rs.getInt(6)));
- row.add(rs.getString(7));
- row.add(Long.valueOf(rs.getLong(8)));
- row.add(rs.getString(9));
+ row.add(Integer.valueOf(rs.getInt(WarningDataDBTable.COLUMN_INDEX_RID+1)));
+ row.add(Long.valueOf(rs.getLong(WarningDataDBTable.COLUMN_INDEX_SEQUENCE_NUMBER+1)));
+ row.add(Integer.valueOf(rs.getInt(WarningDataDBTable.COLUMN_INDEX_MESSAGE_ID+1)));
+ row.add(Integer.valueOf(rs.getInt(WarningDataDBTable.COLUMN_INDEX_PROCESS_ID+1)));
+ row.add(Integer.valueOf(rs.getInt(WarningDataDBTable.COLUMN_INDEX_THREAD_ID+1)));
+ row.add(Long.valueOf(rs.getLong(WarningDataDBTable.COLUMN_INDEX_START_TIME+1)));
+ row.add(Long.valueOf(rs.getLong(WarningDataDBTable.COLUMN_INDEX_END_TIME+1)));
+ row.add(Integer.valueOf(rs.getInt(WarningDataDBTable.COLUMN_INDEX_WARNING_CASE+1)));
+ row.add(rs.getString(WarningDataDBTable.COLUMN_INDEX_WARNING_KEY+1));
+ row.add(Long.valueOf(rs.getLong(WarningDataDBTable.COLUMN_INDEX_CALLER_PC_ADDRESS+1)));
+ row.add(rs.getString(WarningDataDBTable.COLUMN_INDEX_CALLER_LIBRARY_NAME+1));
} catch (SQLException e) {
e.printStackTrace();
return null;
}
public String getFullWarningMessageByLogSeq(long seq) {
- String where = String.format(query_withSeq, WarningDataDBTable.SEQUENCE_NUMBER, seq);
- List<String> columns = new ArrayList<String>();
- columns.add(WarningDataDBTable.WARNING_KEY);
- columns.add(WarningDataDBTable.WARNING_CASE);
-
- DBTable table = SummaryDataManager.getInstance().getWarningDataDBTable();
- List<List<Object>> result = table.selectData(columns, where, new IResultSet() {
- @Override
- public List<Object> extractDataFromResultSet(ResultSet rs) {
- List<Object> row = new ArrayList<Object>();
- try {
- row.add(rs.getString(1));
- row.add(Integer.valueOf(rs.getInt(2)));
- } catch (SQLException e) {
- e.printStackTrace();
- return null;
- }
-
- return row;
+ int size = warningDataList.size();
+ for (int i = 0; i < size; i++) {
+ long sequence = (Long)warningDataList.get(i).get(WarningDataDBTable.COLUMN_INDEX_SEQUENCE_NUMBER);
+ if (sequence == seq) {
+ String findKey = (String)warningDataList.get(i).get(WarningDataDBTable.COLUMN_INDEX_WARNING_KEY);
+ int warningType = (Integer)warningDataList.get(i).get(WarningDataDBTable.COLUMN_INDEX_WARNING_CASE);
+ return WarningCase.getFullWarningMessage(findKey, warningType);
}
- });
-
- String message = null;
- if (result != null) {
- List<Object> data = result.get(0);
- String key = (String)data.get(0);
- int warningCase = (Integer)data.get(1);
- message = WarningCase.getFullWarningMessage(key, warningCase);
}
-
- return message;
+ return CommonConstants.EMPTY;
}
public List<List<Object>> getWarningDataFromDBForRange(Long startTime, Long endTime) {
columns.add(WarningDataDBTable.SEQUENCE_NUMBER);
columns.add(WarningDataDBTable.MESSAGE_ID);
columns.add(WarningDataDBTable.PROCESS_ID);
+ columns.add(WarningDataDBTable.THREAD_ID);
columns.add(WarningDataDBTable.START_TIME);
+ columns.add(WarningDataDBTable.END_TIME);
columns.add(WarningDataDBTable.WARNING_CASE);
columns.add(WarningDataDBTable.WARNING_KEY);
columns.add(WarningDataDBTable.CALLER_PC_ADDRESS);
public List<Object> extractDataFromResultSet(ResultSet rs) {
List<Object> row = new ArrayList<Object>();
try {
- row.add(Integer.valueOf(rs.getInt(1)));
- row.add(Long.valueOf(rs.getLong(2)));
- row.add(Integer.valueOf(rs.getInt(3)));
- row.add(Integer.valueOf(rs.getInt(4)));
- row.add(Long.valueOf(rs.getLong(5)));
- row.add(Integer.valueOf(rs.getInt(6)));
- row.add(rs.getString(7));
- row.add(Long.valueOf(rs.getLong(8)));
- row.add(rs.getString(9));
+ row.add(Integer.valueOf(rs.getInt(WarningDataDBTable.COLUMN_INDEX_RID+1)));
+ row.add(Long.valueOf(rs.getLong(WarningDataDBTable.COLUMN_INDEX_SEQUENCE_NUMBER+1)));
+ row.add(Integer.valueOf(rs.getInt(WarningDataDBTable.COLUMN_INDEX_MESSAGE_ID+1)));
+ row.add(Integer.valueOf(rs.getInt(WarningDataDBTable.COLUMN_INDEX_PROCESS_ID+1)));
+ row.add(Integer.valueOf(rs.getInt(WarningDataDBTable.COLUMN_INDEX_THREAD_ID+1)));
+ row.add(Long.valueOf(rs.getLong(WarningDataDBTable.COLUMN_INDEX_START_TIME+1)));
+ row.add(Long.valueOf(rs.getLong(WarningDataDBTable.COLUMN_INDEX_END_TIME+1)));
+ row.add(Integer.valueOf(rs.getInt(WarningDataDBTable.COLUMN_INDEX_WARNING_CASE+1)));
+ row.add(rs.getString(WarningDataDBTable.COLUMN_INDEX_WARNING_KEY+1));
+ row.add(Long.valueOf(rs.getLong(WarningDataDBTable.COLUMN_INDEX_CALLER_PC_ADDRESS+1)));
+ row.add(rs.getString(WarningDataDBTable.COLUMN_INDEX_CALLER_LIBRARY_NAME+1));
} catch (SQLException e) {
e.printStackTrace();
return null;
import org.tizen.dynamicanalyzer.ui.range.RangePage;
import org.tizen.dynamicanalyzer.ui.summary.SummaryDataManager;
import org.tizen.dynamicanalyzer.ui.summary.SummaryPage;
+import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
import org.tizen.dynamicanalyzer.ui.widgets.table.DATableComposite;
import org.tizen.dynamicanalyzer.ui.widgets.table.DATableDataFormat;
protected List<TableInput> makeTableInput() {
List<List<Object>> warningData = null;
- if (isRange) {
- Long markerStartTime = Long.valueOf(RangeDataManager.getInstance().getMarkerStartTime());
- Long markerEndTime = Long.valueOf(RangeDataManager.getInstance().getMarkerEndTime());
- warningData = warningDataMaker.getWarningDataFromDBForRange(markerStartTime, markerEndTime);
- } else {
- warningData = warningDataMaker.getWarningDataFromDB();
- }
+ warningData = warningDataMaker.getWarningDataList();
if (warningData == null) return null;
List<TableInput> input = new ArrayList<TableInput>();
for (int i = 0; i < size; i++) {
List<Object> idata = warningData.get(i);
+ if(!isVaildData(idata)){
+ continue;
+ }
+
// create text
List<String> text = new ArrayList<String>();
List<String> data = new ArrayList<String>();
probeData.setSeq(seq);
probeData.setId(msgID);
probeData.setPid(pid);
+ probeData.setTid((Integer)idata.get(WarningDataDBTable.COLUMN_INDEX_THREAD_ID));
probeData.setTime((Long)idata.get(WarningDataDBTable.COLUMN_INDEX_START_TIME));
probeData.setReserved1(warningCase); // warningCase
probeData.setCallerAddress((Long)idata.get(WarningDataDBTable.COLUMN_INDEX_CALLER_PC_ADDRESS));
}
return input;
}
+
+ private boolean isVaildData(List<Object> idata){
+ Long markerStartTime = null;
+ Long markerEndTime = null;
+ if (isRange) {
+ markerStartTime = Long.valueOf(RangeDataManager.getInstance().getMarkerStartTime());
+ markerEndTime = Long.valueOf(RangeDataManager.getInstance().getMarkerEndTime());
+ }else{
+ markerStartTime = (long) 0;
+ markerEndTime = ToolbarArea.getInstance().getTime();
+ }
+
+ Long startTime = (Long)idata.get(WarningDataDBTable.COLUMN_INDEX_START_TIME);
+ Long endTime = (Long)idata.get(WarningDataDBTable.COLUMN_INDEX_END_TIME);
+
+ if(startTime < markerStartTime || markerEndTime < startTime ){
+ return false;
+ }
+ if(endTime != -1 && markerStartTime <= endTime && endTime <= markerEndTime ){
+ return false;
+ }
+ return true;
+ }
}
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact:
+ * WooJin Jung <woojin2.jung@samsung.com>
* yeongtaik byeon <yeongtaik.byeon@samsung.com>
* Juyoung Kim <j0.kim@samsung.com>
*
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact:
+ * WooJin Jung <woojin2.jung@samsung.com>
* yeongtaik byeon <yeongtaik.byeon@samsung.com>
* Jooyoul Lee <jy.exe.lee@samsung.com>
* Juyoung Kim <j0.kim@samsung.com>
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact:
+ * WooJin Jung <woojin2.jung@samsung.com>
* yeongtaik byeon <yeongtaik.byeon@samsung.com>
* Juyoung Kim <j0.kim@samsung.com>
*
import org.tizen.dynamicanalyzer.nl.ThreadPageLabels;
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.resources.FontResources;
-import org.tizen.dynamicanalyzer.swap.model.data.ThreadData;
+import org.tizen.dynamicanalyzer.swap.model.data.ProbeCommonData;
import org.tizen.dynamicanalyzer.ui.common.SetRangeMarkerMouseMoveListener;
import org.tizen.dynamicanalyzer.ui.common.UICommonConstants;
import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
+import org.tizen.dynamicanalyzer.ui.thread.thread.ThreadPageThreadData;
import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
import org.tizen.dynamicanalyzer.ui.timeline.logparser.LifecycleLogParser;
import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
ColorResources.FRAME_RATE_COMBO_HOVER_END,
ColorResources.FRAME_RATE_COMBO_DISABLE_START,
ColorResources.FRAME_RATE_COMBO_DISABLE_END);
- threadCombo.setOutlineColors(ColorResources.FRAME_RATE_COMBO_OUTLINE_NORMAL,
+ threadCombo.setOutlineColors(
+ ColorResources.FRAME_RATE_COMBO_OUTLINE_NORMAL,
ColorResources.FRAME_RATE_COMBO_OUTLINE_PUSH,
ColorResources.FRAME_RATE_COMBO_OUTLINE_HOVER,
ColorResources.FRAME_RATE_COMBO_OUTLINE_DISABLE);
threadCombo.setFontColors(ColorResources.ADD_CHART_FONT_COLOR,
ColorResources.ADD_CHART_FONT_COLOR,
ColorResources.ADD_CHART_FONT_COLOR,
- ColorResources.ADD_CHART_FONT_COLOR);
+ ColorResources.ADD_CHART_FONT_COLOR);
threadCombo.setItemFont(FontResources.FRAME_RATE_DROPDOWN);
threadCombo.setItemFontColor(ColorResources.ADD_CHART_FONT_COLOR);
threadCombo.setButtonRenderer(new DACustomButtonRenderer());
ColorResources.FRAME_RATE_COMBO_HOVER_END,
ColorResources.FRAME_RATE_COMBO_DISABLE_START,
ColorResources.FRAME_RATE_COMBO_DISABLE_END);
- syncCombo.setOutlineColors(ColorResources.FRAME_RATE_COMBO_OUTLINE_NORMAL,
+ syncCombo.setOutlineColors(
+ ColorResources.FRAME_RATE_COMBO_OUTLINE_NORMAL,
ColorResources.FRAME_RATE_COMBO_OUTLINE_PUSH,
ColorResources.FRAME_RATE_COMBO_OUTLINE_HOVER,
ColorResources.FRAME_RATE_COMBO_OUTLINE_DISABLE);
syncCombo.setFontColors(ColorResources.ADD_CHART_FONT_COLOR,
ColorResources.ADD_CHART_FONT_COLOR,
ColorResources.ADD_CHART_FONT_COLOR,
- ColorResources.ADD_CHART_FONT_COLOR);
+ ColorResources.ADD_CHART_FONT_COLOR);
syncCombo.setItemFont(FontResources.FRAME_RATE_DROPDOWN);
syncCombo.setItemFontColor(ColorResources.ADD_CHART_FONT_COLOR);
syncCombo.setButtonRenderer(new DACustomButtonRenderer());
if (stackLayout.topControl.equals(syncChart)) {
changeComboSyncToThread();
}
-
- String selectTid = Long.toString(((ThreadData) odata).getPThreadId());
- threadChart.selectItem(manager.getItemIndexByTid(selectTid));
+ String selectTid = Integer.toString(((ProbeCommonData) odata).getTid());
+ threadChart.selectItem(getChartIndexOfSelected(selectTid));
} else {
long start = selData.getStartTime();
long end = selData.getEndTime();
}
}
+ private int getChartIndexOfSelected(String tID) {
+ int itemSize = threadChart.getItemList().getItemSize();
+ if (0 == itemSize) {
+ return 0;
+ }
+ for (int i = 0; i < itemSize; i++) {
+ DAChartBoardItem item = threadChart.getItemList().get(i);
+ ThreadPageThreadData pageData = (ThreadPageThreadData) item
+ .getData();
+ if (pageData.getTid().equals(tID)) {
+ return i;
+ }
+ }
+ return 0;
+ }
+
@Override
public void clear() {
threadChart.clear();
rangeMarker.setAlpha((int) (255 * 0.25));
board.addIntervalMarker(rangeMarker);
}
-
+
public void setRangeMarker(double starttime, double endtime) {
DAChartBoard currentChart = (DAChartBoard) stackLayout.topControl;
currentChart.setTimelineMarkerStartTime(starttime);
currentChart.setTimelineMarkerEndTime(endtime);
((DAChartPlotIntervalMarker) currentChart.getMarkers().get(
- UICommonConstants.RANGE_MARKER_INDEX)).setInterval(
- starttime, endtime);
+ UICommonConstants.RANGE_MARKER_INDEX)).setInterval(starttime,
+ endtime);
}
}
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact:
+ * WooJin Jung <woojin2.jung@samsung.com>
* yeongtaik byeon <yeongtaik.byeon@samsung.com>
* Jooyoul Lee <jy.exe.lee@samsung.com>
* Juyoung Kim <j0.kim@samsung.com>
import java.util.List;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.PaintEvent;
-import org.eclipse.swt.events.PaintListener;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Text;
import org.tizen.dynamicanalyzer.common.DASelectionData;
import org.tizen.dynamicanalyzer.constant.CommonConstants;
import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
import org.tizen.dynamicanalyzer.widgets.da.view.DAViewData;
public class ThreadDetailInfoView extends DAViewComposite {
+ private Composite contents = null;
+ private Text detailText = null;
+
+ private final static String leftFormAttachment = CommonConstants.SPACE
+ + CommonConstants.SPACE;
+ private final static String heightFormAttachment = CommonConstants.NEW_LINE
+ + CommonConstants.NEW_LINE;
+
public static final int LEFT_MARGIN = 10;
public static final int HEIGHT_MARGIN = 20;
- private Canvas canvas = null;
private String tid = AnalyzerLabels.EMPTY_STRING;
private String type = AnalyzerLabels.EMPTY_STRING;
private String funcName = AnalyzerLabels.EMPTY_STRING;
- private String className = AnalyzerLabels.EMPTY_STRING;
+ private String className = AnalyzerLabels.EMPTY_STRING;
private String startTime = AnalyzerLabels.EMPTY_STRING;
private String endTime = AnalyzerLabels.EMPTY_STRING;
private String attrType = AnalyzerLabels.EMPTY_STRING;
private ThreadPageData item = null;
- private boolean select = false;
private void init() {
tid = AnalyzerLabels.EMPTY_STRING;
startTime = AnalyzerLabels.EMPTY_STRING;
endTime = AnalyzerLabels.EMPTY_STRING;
attrType = AnalyzerLabels.EMPTY_STRING;
- select = false;
+ detailText.setText(CommonConstants.EMPTY);
}
public ThreadDetailInfoView(Composite parent, int style) {
setTitle(ThreadPageLabels.THREAD_DETAILS_TITLE);
- Composite contents = getContentArea();
- contents.setBackground(ColorResources.VIEW_BG_COLOR);
- contents.setLayout(new FillLayout());
- canvas = new Canvas(contents, SWT.TRANSPARENT);
- canvas.addPaintListener(new PaintListener() {
-
- @Override
- public void paintControl(PaintEvent e) {
- Rectangle rect = canvas.getBounds();
- e.gc.setBackground(ColorResources.VIEW_BG_COLOR);
- e.gc.fillRectangle(rect.x, rect.y, rect.width, rect.height);
- e.gc.setForeground(ColorResources.TABLE_CONTENTS_FONT_COLOR);
- e.gc.setFont(FontResources.DETAIL_INFO_FONT);
-
- if (false == select) {
- return;
- }
-
- int y = HEIGHT_MARGIN;
- Point p = e.gc.textExtent(type, SWT.DRAW_MNEMONIC);
- e.gc.drawText(ThreadPageLabels.THREAD_DETAILS_TTYPE + type,
- LEFT_MARGIN, y);
- y += (p.y + HEIGHT_MARGIN);
+ Composite detailCom = getContentArea();
+ detailCom.setBackground(ColorResources.VIEW_BG_COLOR);
+ detailCom.setLayout(new FormLayout());
+ FormData labelData = new FormData();
+ labelData.top = new FormAttachment(0, 0);
+ labelData.left = new FormAttachment(0, 0);
+ labelData.right = new FormAttachment(100, 0);
+ labelData.bottom = new FormAttachment(100, 0);
+ detailCom.setLayoutData(labelData);
- if (null != tid && !(tid.equals(CommonConstants.EMPTY))) {
- e.gc.drawText(ThreadPageLabels.THREAD_DETAILS_TID + tid,
- LEFT_MARGIN, y);
- p = e.gc.textExtent(tid, SWT.DRAW_MNEMONIC);
- y += (p.y + HEIGHT_MARGIN);
- }
- // tizen thread : show thread class name
- // other thread (e.g. pthread) : show thread function name
- if (type.equals(ThreadPageLabels.THREAD_ITEM_TYPE_TIZEN)) {
- if (null != className && !(className.equals(CommonConstants.EMPTY))) {
- e.gc.drawText(ThreadPageLabels.THREAD_DETAILS_CLASSNAME + className,
- LEFT_MARGIN, y);
- p = e.gc.textExtent(tid, SWT.DRAW_MNEMONIC);
- y += (p.y + HEIGHT_MARGIN);
- }
- } else {
- if (null != funcName && !(funcName.equals(CommonConstants.EMPTY))) {
- e.gc.drawText(ThreadPageLabels.THREAD_DETAILS_FUNCNAME + funcName,
- LEFT_MARGIN, y);
- p = e.gc.textExtent(tid, SWT.DRAW_MNEMONIC);
- y += (p.y + HEIGHT_MARGIN);
- }
- }
+ contents = detailCom;
+ contents.setBackground(ColorResources.VIEW_BG_COLOR);
+ contents.setLayout(new FormLayout());
- if (null != startTime
- && !(startTime.equals(CommonConstants.EMPTY))) {
- e.gc.drawText(ThreadPageLabels.THREAD_DETAILS_STARTTIME
- + startTime, LEFT_MARGIN, y);
- p = e.gc.textExtent(startTime, SWT.DRAW_MNEMONIC);
- y += (p.y + HEIGHT_MARGIN);
- }
+ detailText = new Text(contents, SWT.BORDER | SWT.V_SCROLL
+ | SWT.H_SCROLL);
+ detailText.setBackground(ColorResources.VIEW_BG_COLOR);
+ detailText.setForeground(ColorResources.TABLE_CONTENTS_FONT_COLOR);
+ detailText.setFont(FontResources.DETAIL_INFO_FONT);
- if (null != endTime && !(endTime.equals(CommonConstants.EMPTY))) {
- e.gc.drawText(ThreadPageLabels.THREAD_DETAILS_ENDTIME
- + endTime, LEFT_MARGIN, y);
- p = e.gc.textExtent(ThreadPageLabels.THREAD_DETAILS_ENDTIME
- + endTime, SWT.DRAW_MNEMONIC);
- y += (p.y + HEIGHT_MARGIN);
- }
+ FormData buttonData = new FormData();
+ buttonData.top = new FormAttachment(contents, 0);
+ buttonData.left = new FormAttachment(0, 0);
+ buttonData.right = new FormAttachment(100, 0);
+ buttonData.bottom = new FormAttachment(100, 0);
+ detailText.setLayoutData(buttonData);
+ detailText.getVerticalBar().setVisible(true);
+ detailText.getHorizontalBar().setVisible(true);
- if (null != attrType
- && !(attrType.equals(CommonConstants.EMPTY))) {
- e.gc.drawText(ThreadPageLabels.THREAD_DETAILS_TATTRTYPE
- + attrType, LEFT_MARGIN, y);
- }
- }
- });
}
private void updateDetails() {
attrType = str;
}
}
- select = true;
- canvas.redraw();
+
+ StringBuffer strDetailView = new StringBuffer(heightFormAttachment);
+ addDetailInfo(strDetailView, ThreadPageLabels.THREAD_DETAILS_TYPE
+ + type);
+ if (null != tid && !(tid.equals(CommonConstants.EMPTY))) {
+ addDetailInfo(strDetailView, ThreadPageLabels.THREAD_DETAILS_TID
+ + tid);
+ }
+ if (type.equals(ThreadPageLabels.THREAD_ITEM_TYPE_TIZEN)) {
+ if (null != className && !(className.equals(CommonConstants.EMPTY))) {
+ addDetailInfo(strDetailView,
+ ThreadPageLabels.THREAD_DETAILS_CLASSNAME + className);
+ }
+ } else {
+ if (null != funcName && !(funcName.equals(CommonConstants.EMPTY))) {
+ addDetailInfo(strDetailView,
+ ThreadPageLabels.THREAD_DETAILS_FUNCNAME + funcName);
+ }
+ }
+
+ if (null != startTime && !(startTime.equals(CommonConstants.EMPTY))) {
+ addDetailInfo(strDetailView,
+ ThreadPageLabels.THREAD_DETAILS_STARTTIME + startTime);
+ }
+
+ if (null != endTime && !(endTime.equals(CommonConstants.EMPTY))) {
+ addDetailInfo(strDetailView,
+ ThreadPageLabels.THREAD_DETAILS_ENDTIME + endTime);
+ }
+
+ if (null != attrType && !(attrType.equals(CommonConstants.EMPTY))) {
+ addDetailInfo(strDetailView,
+ ThreadPageLabels.THREAD_DETAILS_ATTRTYPE + attrType);
+ }
+ detailText.setText(strDetailView.toString());
+ detailText.redraw();
+ }
+
+ private void addDetailInfo(StringBuffer strDetailView, String info) {
+ strDetailView.append(leftFormAttachment + info + heightFormAttachment);
}
private boolean isChange() {
if (!type.equals(((ThreadPageThreadData) item).getTypeString())) {
return true;
}
- if (!funcName.equals(((ThreadPageThreadData) item).getThreadFuncName())) {
+ if (!funcName.equals(((ThreadPageThreadData) item)
+ .getThreadFuncName())) {
return true;
}
- if (!className.equals(((ThreadPageThreadData) item).getThreadClassName())) {
+ if (!className.equals(((ThreadPageThreadData) item)
+ .getThreadClassName())) {
return true;
}
- if (!startTime.equals(((ThreadPageThreadData) item).getStartTimeString())) {
+ if (!startTime.equals(((ThreadPageThreadData) item)
+ .getStartTimeString())) {
return true;
}
- if (!endTime.equals(((ThreadPageThreadData) item).getEndTimeString())) {
+ if (!endTime.equals(((ThreadPageThreadData) item)
+ .getEndTimeString())) {
return true;
}
if (!attrType.equals(item.getAttrType())) {
item = (ThreadPageData) data.getData();
} else {
item = null;
- select = false;
}
updateDetails();
@Override
public Control getControl() {
- return canvas;
+ return contents;
}
@Override
public void clear() {
init();
- canvas.redraw();
+ detailText.redraw();
}
}
\ No newline at end of file
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact:
+ * WooJin Jung <woojin2.jung@samsung.com>
* yeongtaik byeon <yeongtaik.byeon@samsung.com>
* Jooyoul Lee <jy.exe.lee@samsung.com>
* Juyoung Kim <j0.kim@samsung.com>
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact:
+ * WooJin Jung <woojin2.jung@samsung.com>
* yeongtaik byeon <yeongtaik.byeon@samsung.com>
* Juyoung Kim <j0.kim@samsung.com>
*
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact:
+ * WooJin Jung <woojin2.jung@samsung.com>
* yeongtaik byeon <yeongtaik.byeon@samsung.com>
* Juyoung Kim <j0.kim@samsung.com>
*
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact:
+ * WooJin Jung <woojin2.jung@samsung.com>
* yeongtaik byeon <yeongtaik.byeon@samsung.com>
* Juyoung Kim <j0.kim@samsung.com>
*
import org.tizen.dynamicanalyzer.ui.thread.data.SyncEventInserter;
import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
import org.tizen.dynamicanalyzer.util.Logger;
+import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
import org.tizen.dynamicanalyzer.widgets.chart.DAChart;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot.AutoRangeType;
if (null == parent) {
item = new DAChartBoardItem(board, sync.getTypeString()
+ ThreadPageLabels.THREAD_CHART_NAME_PREFIX
- + ThreadPageLabels.THREAD_CHART_NAME_OBJ + sync.getKey()
+ + ThreadPageLabels.THREAD_CHART_NAME_OBJ + AnalyzerUtil.toHexdecimal(sync.getKey())
+ ThreadPageLabels.THREAD_CHART_NAME_POSTFIX);
item.useExpand(true);
chart = item.getChart();
private DAChartSeries loadSeries;
private DAChartSeries eventSeries;
private DAChartSeries apiSeries;
-
+
public static final byte TYPE_MAIN = 0;
public static final byte TYPE_PTHREAD = 1;
public static final byte TYPE_TIZEN = 2;
-
+
private static int internalSeq = 0;
private int threadDataID = -1;
- public ThreadPageThreadData(int type, String pid, String tid, String attrType,
- int funcID) {
+ public ThreadPageThreadData(int type, String pid, String tid,
+ String attrType, int funcID) {
super(type, String.valueOf(tid), pid, tid, attrType);
this.threadFuncID = funcID;
threadDataID = internalSeq++;
}
-
+
// using open trace
- public ThreadPageThreadData(int id, int pid, int tid, int threadType, String attrType,
- long startTime, long endTime, int functionID, String className) {
- super(threadType, String.valueOf(tid), String.valueOf(pid), String.valueOf(tid), attrType);
+ public ThreadPageThreadData(int id, int pid, int tid, int threadType,
+ String attrType, long startTime, long endTime, int functionID,
+ String className) {
+ super(threadType, String.valueOf(tid), String.valueOf(pid), String
+ .valueOf(tid), attrType);
this.threadDataID = id;
this.threadFuncID = functionID;
this.StartTime = startTime;
public void addDataEvent(ThreadPageThreadDataEvent dataEvent) {
contentsQueue.add(dataEvent);
}
-
+
public int getThreadFuncID() {
return threadFuncID;
}
-
+
public String getThreadFuncName() {
if (threadFuncID == -1) {
return CommonConstants.EMPTY;
return Global.getFunctionName(threadFuncID);
}
}
-
+
public String getThreadClassName() {
return threadClassName;
}
-
+
public void setThreadClassName(String className) {
threadClassName = className;
}
setStartTime(threadEvent.getTime());
} else if (eventApiType == LogCenterConstants.THREAD_API_TYPE_WAIT_END) {
if (threadEvent.isJoinAPI()) {
- seriesItem = new DAChartSeriesItem(threadEvent.getDoubleTime(),
+ seriesItem = new DAChartSeriesItem(
+ threadEvent.getDoubleTime(),
DAChartSeriesItem.SERIES_ARROW_LEFT,
ThreadPageLabels.THREAD_CHART_ITEM_JOINED);
seriesItem.setBarWidth(Double.parseDouble(threadEvent
.getCallerTid()));
} else {
- seriesItem = new DAChartSeriesItem(threadEvent.getDoubleTime(),
+ seriesItem = new DAChartSeriesItem(
+ threadEvent.getDoubleTime(),
DAChartSeriesItem.SERIES_ARROW_NONE,
threadEvent.getTooltipContent());
}
} else if (eventApiType == LogCenterConstants.THREAD_API_TYPE_INTERNAL_STOP) {
if (null != threadEvent.getCallerTid()) {
- seriesItem = new DAChartSeriesItem(threadEvent.getDoubleTime(),
- DAChartSeriesItem.SERIES_ARROW_RIGHT,
+ seriesItem = new DAChartSeriesItem(
+ threadEvent.getDoubleTime(),
+ DAChartSeriesItem.SERIES_ARROW_LEFT,
threadEvent.getTooltipContent());
seriesItem.setBarWidth(Double.parseDouble(threadEvent
.getCallerTid()));
} else {
- seriesItem = new DAChartSeriesItem(threadEvent.getDoubleTime(),
+ seriesItem = new DAChartSeriesItem(
+ threadEvent.getDoubleTime(),
DAChartSeriesItem.SERIES_ARROW_NONE,
threadEvent.getTooltipContent());
}
setEndTime(threadEvent.getTime());
// save ThreadData when endtime is set
if (AnalyzerManager.isRunning()) {
- ThreadChartManager.getInstance().saveThreadPageThreadData(this);
+ ThreadChartManager.getInstance().saveThreadPageThreadData(
+ this);
}
} else {
seriesItem = new DAChartSeriesItem(threadEvent.getDoubleTime(),
return CommonConstants.EMPTY;
}
}
-
+
public long getStartTime() {
return StartTime;
}
public void setStartTime(long startTime) {
StartTime = startTime;
}
-
+
public String getStartTimeString() { // to show in details view
if (StartTime == -1) {
return null;
} else {
- double startTime = Formatter.longTimeToDoubleTime(StartTime);
+ double startTime = Formatter.longTimeToDoubleTime(StartTime);
return String.valueOf(startTime);
}
}
public void setEndTime(long endTime) {
EndTime = endTime;
}
-
+
public String getEndTimeString() { // to show in details view
if (EndTime == -1) {
return null;
} else {
- double endTime = Formatter.longTimeToDoubleTime(EndTime);
+ double endTime = Formatter.longTimeToDoubleTime(EndTime);
return String.valueOf(endTime);
}
}
-
+
public int getThreadDataID() {
return threadDataID;
}
-
+
public static void clear() {
internalSeq = 0;
- }
+ }
}
\ No newline at end of file
*/
package org.tizen.dynamicanalyzer.ui.thread.thread;
+import java.util.ArrayList;
+import java.util.Arrays;
+
+import org.tizen.dynamicanalyzer.nl.ThreadPageLabels;
import org.tizen.dynamicanalyzer.swap.model.data.LogData;
import org.tizen.dynamicanalyzer.ui.thread.ThreadPageDataEvent;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeriesItem;
private String callID = null;
private String callerTid = null;
private int threadDataID = -1;
- private boolean isJoinAPI = false;
+
+ ArrayList<String> joinAPIs = new ArrayList<String>(Arrays.asList(
+ ThreadPageLabels.THREAD_API_PTHREAD_JOIN,
+ ThreadPageLabels.THREAD_API_TIZEN_JOIN));
public ThreadPageThreadDataEvent(int eventType, int threadType,
- int apiType, long time, String tid, String tooltip,
- long errorNum, LogData contents) {
+ int apiType, long time, String tid, String tooltip, long errorNum,
+ LogData contents) {
super(time, tid, apiType, tooltip, errorNum, contents);
setEventType(eventType);
setThreadType(threadType);
public void setCallerTid(String callerTid) {
this.callerTid = callerTid;
}
-
+
public int getThreadDataID() {
return threadDataID;
}
-
+
public void setThreadDataID(int id) {
this.threadDataID = id;
}
-
+
public boolean isJoinAPI() {
- return isJoinAPI;
- }
-
- public void setJoinAPI(boolean isJoinAPI) {
- this.isJoinAPI = isJoinAPI;
+ int index = joinAPIs.indexOf(getTooltipContent());
+ if (index < 0) {
+ return false;
+ } else {
+ return true;
+ }
}
-
+
}
\ No newline at end of file
package org.tizen.dynamicanalyzer.ui.thread.thread;
import java.util.ArrayList;
+import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
-import java.util.Comparator;
-import org.tizen.dynamicanalyzer.common.AnalyzerManager;
+import org.tizen.dynamicanalyzer.common.Global;
import org.tizen.dynamicanalyzer.common.SymbolManager;
import org.tizen.dynamicanalyzer.constant.CommonConstants;
import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
import org.tizen.dynamicanalyzer.nl.ThreadPageLabels;
import org.tizen.dynamicanalyzer.nl.TimelineChartLabels;
-import org.tizen.dynamicanalyzer.common.Global;
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.resources.FontResources;
import org.tizen.dynamicanalyzer.resources.ImageResources;
import org.tizen.dynamicanalyzer.ui.thread.sync.ThreadPageSyncDataManager;
import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
import org.tizen.dynamicanalyzer.util.Logger;
+import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
import org.tizen.dynamicanalyzer.widgets.chart.DAChart;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot.AutoRangeType;
public static final int PTHREAD_CREATE_JOINABLE = 0;
public static final int PTHREAD_CREATE_DETACHED = 1;
-
+
public ThreadPageThreadDataManager(DAChartBoard board) {
this.setBoard(board);
}
DAChartBoardItem item = new DAChartBoardItem(parent, sync.getTypeString()
+ ThreadPageLabels.THREAD_CHART_NAME_PREFIX
- + ThreadPageLabels.THREAD_CHART_NAME_OBJ + sync.getKey()
+ + ThreadPageLabels.THREAD_CHART_NAME_OBJ + AnalyzerUtil.toHexdecimal(sync.getKey())
+ ThreadPageLabels.THREAD_CHART_NAME_POSTFIX);
item.useExpand(true);
if (input.getApiName().equals(
ThreadPageLabels.THREAD_API_PTHREAD_JOIN)) {
// join, delete warning
- AnalyzerManager.getWarningChecker().removeData(
+ SummaryDataManager.getInstance().getWarningDataMaker().removeData(
+ event.getContents(),
ThreadPageLabels.THREAD_CHART_NAME_TID
- + findCallerTid(Long.toString(input
- .getOspThreadId())),
- WarningCase.JOINABLE_LEAK.getType());
+ + findCallerTid(pthreadId),
+ WarningCase.JOINABLE_LEAK.getType());
+// AnalyzerManager.getWarningChecker().removeData(
+// ThreadPageLabels.THREAD_CHART_NAME_TID
+// + (Long.toString(input
+// .getOspThreadId())),
+// WarningCase.JOINABLE_LEAK.getType());
}
break;
case LogCenterConstants.THREAD_API_TYPE_INTERNAL_STOP:
event.setCallID(pthreadId);
pushEvent(event);
pushCallEvent(event);
+
if (true == isJoinableThread(tid)) {
// warningData
// WarningData wData = new WarningData(
// WarningCase.JOINABLE_LEAK.getType(), input,
// ThreadPageLabels.THREAD_CHART_NAME_TID + tid);
// AnalyzerManager.getWarningChecker().getWarningData().add(wData);
- SummaryDataManager.getInstance().getWarningDataMaker().makeData(
+ SummaryDataManager.getInstance().getWarningDataMaker().add(
input, ThreadPageLabels.THREAD_CHART_NAME_TID + tid,
WarningCase.JOINABLE_LEAK.getType());
- }
+ }
+ //FIXME add code for remove waning case
break;
case LogCenterConstants.THREAD_API_TYPE_INTERNAL_START:
Integer threadAttrTypeInt = threadAttrMap.get(pthreadId);
tid, apiName, errorNum, input);
pushEvent(event);
// join, delete warning
- AnalyzerManager.getWarningChecker().removeData(
- ThreadPageLabels.THREAD_CHART_NAME_TID
- + findCallerTid(Long.toString(input
- .getOspThreadId())),
+// AnalyzerManager.getWarningChecker().removeData(
+// ThreadPageLabels.THREAD_CHART_NAME_TID
+// + findCallerTid(Long.toString(input
+// .getOspThreadId())),
+// WarningCase.JOINABLE_LEAK.getType());
+ SummaryDataManager.getInstance().getWarningDataMaker().removeData(
+ event.getContents(), ThreadPageLabels.THREAD_CHART_NAME_TID + findCallerTid(callID),
WarningCase.JOINABLE_LEAK.getType());
} // FIXME : do not shows sleep's wait end
// event.getContents(),
// ThreadPageLabels.THREAD_CHART_NAME_TID + tid);
// AnalyzerManager.getWarningChecker().getWarningData().add(wData);
- SummaryDataManager.getInstance().getWarningDataMaker().makeData(
+ SummaryDataManager.getInstance().getWarningDataMaker().add(
event.getContents(), ThreadPageLabels.THREAD_CHART_NAME_TID + tid,
WarningCase.JOINABLE_LEAK.getType());
}
}
return false;
} else if (LogCenterConstants.THREAD_API_TYPE_WAIT_END == apiType) {
- if (!tData.getApiName().equals(
- ThreadPageLabels.THREAD_API_TIZEN_JOIN)) {
+ if (!event.isJoinAPI()) {
return true;
}
callEvent.setCallerTid(event.getTid());
} else {
// join, delete warning
- AnalyzerManager.getWarningChecker().removeData(
- ThreadPageLabels.THREAD_CHART_NAME_TID
- + callEvent.getTid(),
+ SummaryDataManager.getInstance().getWarningDataMaker().removeData(
+ event.getContents(), ThreadPageLabels.THREAD_CHART_NAME_TID + callEvent.getTid(),
WarningCase.JOINABLE_LEAK.getType());
+// AnalyzerManager.getWarningChecker().removeData(
+// ThreadPageLabels.THREAD_CHART_NAME_TID
+// + callEvent.getTid(),
+// WarningCase.JOINABLE_LEAK.getType());
callEvent.getChartItem().setY(
DAChartSeriesItem.SERIES_ARROW_RIGHT);
callEvent.getChartItem().setBarWidth(
hasUpdate = false;
ThreadPageThreadData.clear(); // reset internal seq number
}
-}
\ No newline at end of file
+}
MEMORY_PSS,
THREAD_COUNT,
HEAP_ALLOCATION_TOTAL_BYTE,
- HEAP_ALLOCATION_NAME,
+ HEAP_ALLOCATION_BINARY_ID,
HEAP_ALLOCATION_BYTE,
THREAD_ID,
THREAD_LOAD
public static final String MEMORY_PSS = "MEMORY_PSS";
public static final String THREAD_COUNT = "THREAD_COUNT";
public static final String HEAP_ALLOCATION_TOTAL_BYTE = "HEAP_ALLOCATION_TOTAL_BYTE";
- public static final String HEAP_ALLOCATION_NAME = "HEAP_ALLOCATION_NAME";
+ public static final String HEAP_ALLOCATION_BINARY_ID = "HEAP_ALLOCATION_BINARY_ID";
public static final String HEAP_ALLOCATION_BYTE = "HEAP_ALLOCATION_BYTE";
public static final String THREAD_ID = "THREAD_ID";
public static final String THREAD_LOAD = "THREAD_LOAD";
- public static final int HEAP_ALLOCATION_NAME_LEN = 256;
@Override
public String getTableName() {
addColumn(new DBColumn(MEMORY_PSS, DBConstants.EMPTY, DBConstants.LONG));
addColumn(new DBColumn(THREAD_COUNT, DBConstants.EMPTY, DBConstants.INTEGER));
addColumn(new DBColumn(HEAP_ALLOCATION_TOTAL_BYTE, DBConstants.EMPTY, DBConstants.LONG));
- addColumn(new DBColumn(HEAP_ALLOCATION_NAME, DBConstants.EMPTY, DBConstants.VARCHAR_ARRAY,
- HEAP_ALLOCATION_NAME_LEN));
+ addColumn(new DBColumn(HEAP_ALLOCATION_BINARY_ID, DBConstants.EMPTY, DBConstants.INTEGER_ARRAY));
addColumn(new DBColumn(HEAP_ALLOCATION_BYTE, DBConstants.EMPTY, DBConstants.BIGINT_ARRAY));
addColumn(new DBColumn(THREAD_ID, DBConstants.EMPTY, DBConstants.INTEGER_ARRAY));
addColumn(new DBColumn(THREAD_LOAD, DBConstants.EMPTY, DBConstants.FLOAT_ARRAY));
prep.setLong(++index, (Long) (rowData.get(COLUMN.MEMORY_SHARED.ordinal())));
prep.setLong(++index, (Long) (rowData.get(COLUMN.MEMORY_PSS.ordinal())));
prep.setInt(++index, (Integer) (rowData.get(COLUMN.THREAD_COUNT.ordinal())));
- prep.setLong(++index,
- (Long) (rowData.get(COLUMN.HEAP_ALLOCATION_TOTAL_BYTE.ordinal())));
- setArrayToPreparedStatement(COLUMN.HEAP_ALLOCATION_NAME.ordinal(),
- DBConstants.VARCHAR, prep, rowData);
+ prep.setLong(++index, (Long) (rowData.get(COLUMN.HEAP_ALLOCATION_TOTAL_BYTE.ordinal())));
+ setArrayToPreparedStatement(COLUMN.HEAP_ALLOCATION_BINARY_ID.ordinal(),
+ DBConstants.INTEGER, prep, rowData);
setArrayToPreparedStatement(COLUMN.HEAP_ALLOCATION_BYTE.ordinal(),
DBConstants.LONG, prep, rowData);
setArrayToPreparedStatement(COLUMN.THREAD_ID.ordinal(), DBConstants.INTEGER, prep,
row.add(Long.valueOf(rs.getLong(7)));
row.add(Integer.valueOf(rs.getInt(8)));
row.add(Long.valueOf(rs.getLong(9)));
- row.add(getArrayFromResultSet(rs, 10, String.valueOf(0)));
+ row.add(getArrayFromResultSet(rs, 10, Integer.valueOf(0)));
row.add(getArrayFromResultSet(rs, 11, Long.valueOf(0)));
row.add(getArrayFromResultSet(rs, 12, Integer.valueOf(0)));
row.add(getArrayFromResultSet(rs, 13, Float.valueOf(0)));
import org.tizen.dynamicanalyzer.database.DBColumn;
import org.tizen.dynamicanalyzer.database.DBConstants;
import org.tizen.dynamicanalyzer.database.DBTable;
+import org.tizen.dynamicanalyzer.util.Logger;
public class UIEventDBTable extends DBTable {
private static final String TABLENAME = "TIMELINE_UIEVENT";
- private final static int MAX_INFO_LEN = 256;
+ private final static int MAX_INFO_LEN = 64;
public static enum COLUMN {
EVENT_TIME,
prep.setInt(3, (Integer) (rowData.get(COLUMN.DETAIL_TYPE.ordinal())));
prep.setInt(4, (Integer) (rowData.get(COLUMN.POINT_X.ordinal())));
prep.setInt(5, (Integer) (rowData.get(COLUMN.POINT_Y.ordinal())));
- prep.setString(6, (String) (rowData.get(COLUMN.INFO_STRING.ordinal())));
+ // Check string overflow
+ String info = (String) (rowData.get(COLUMN.INFO_STRING.ordinal()));
+ if (info != null && info.length() > MAX_INFO_LEN) {
+ Logger.error("Overflow occurs INFO_STRING in UIEventDBTable : " + info);
+ info = info.substring(0, MAX_INFO_LEN);
+ }
+ prep.setString(6, info);
prep.setInt(7, (Integer) (rowData.get(COLUMN.INFO_INTEGER.ordinal())));
} catch (SQLException e) {
e.printStackTrace();
public class HeapChart extends TimelineChart {
private static HeapChart instance = null;
- private List<String> librarySequenceList = new ArrayList<String>();
- // Map<PID, Map<binaryPath, DAChartSeries>>
- private Map<Integer, Map<String, DAChartSeries>> seriesPerProcessMap = new HashMap<Integer, Map<String, DAChartSeries>>();
+ private List<Integer> librarySequenceList = new ArrayList<Integer>();
+ // Map<PID, Map<binaryID, DAChartSeries>>
+ private Map<Integer, Map<Integer, DAChartSeries>> seriesPerProcessMap =
+ new HashMap<Integer, Map<Integer, DAChartSeries>>();
private DAChartBoardItem parentBoardItem;
private List<DAChartBoardItem> childBoardItemList = new ArrayList<DAChartBoardItem>();
+ private static final int totalAllocSeriesID = -100;
+ private static final int appAllocSeriesID = -10;
+
public static HeapChart getInstance() {
if (instance == null) {
instance = new HeapChart();
return instance;
}
- private Map<String, DAChartSeries> createChartSeries(int pid) {
- Map<String, DAChartSeries> chartSeriesMap = new HashMap<String, DAChartSeries>();
+ private Map<Integer, DAChartSeries> createChartSeries(int pid) {
+ Map<Integer, DAChartSeries> chartSeriesMap = new HashMap<Integer, DAChartSeries>();
/*
* Add total allocation
*/
DAChartSeries totalAllocationSeries = new DAChartSeries(
TimelineChartLabels.HEAP_CHART_SERIES_NAME_TOTAL_ALLOCATION,
DAChartSeries.SERIES_STYLE_AREA, ColorResources.SERIES_COLOR_HEAP_SYSTEM);
- chartSeriesMap.put(TimelineChartLabels.HEAP_CHART_SERIES_NAME_TOTAL_ALLOCATION,
- totalAllocationSeries);
+ chartSeriesMap.put(totalAllocSeriesID, totalAllocationSeries);
/*
* Add additional library allocation
*/
if (null != libObj) {
DAChartSeries libraryAllocSeries = new DAChartSeries(libraryPath,
DAChartSeries.SERIES_STYLE_AREA);
- chartSeriesMap.put(libraryPath, libraryAllocSeries);
+ chartSeriesMap.put(libObj.getBinaryID(), libraryAllocSeries);
}
}
}
DAChartSeries targetAllocationSeries = new DAChartSeries(
TimelineChartLabels.HEAP_CHART_SERIES_NAME_APP_ALLOCATION,
DAChartSeries.SERIES_STYLE_AREA, ColorResources.SERIES_COLOR_HEAP_USER);
- chartSeriesMap.put(TimelineChartLabels.HEAP_CHART_SERIES_NAME_APP_ALLOCATION,
- targetAllocationSeries);
+ chartSeriesMap.put(appAllocSeriesID, targetAllocationSeries);
return chartSeriesMap;
}
/*
* Clear series items
*/
- Iterator<Map<String, DAChartSeries>> iterPerPID = seriesPerProcessMap.values().iterator();
+ Iterator<Map<Integer, DAChartSeries>> iterPerPID = seriesPerProcessMap.values().iterator();
while (iterPerPID.hasNext()) {
Iterator<DAChartSeries> iterSeries = iterPerPID.next().values().iterator();
while (iterSeries.hasNext()) {
* First process, use parentBoardItem.
*/
if (seriesPerProcessMap.isEmpty()) {
- Map<String, DAChartSeries> seriesMap = createChartSeries(pid);
+ Map<Integer, DAChartSeries> seriesMap = createChartSeries(pid);
seriesPerProcessMap.put(pid, seriesMap);
setChartSeries(chart, seriesMap);
final String processName = AnalyzerUtil.getProcessName(pid.intValue());
* If new Process created, Create ChartBoardItem, Chart, Series.
*/
else if (seriesPerProcessMap.get(pid) == null) {
- final Map<String, DAChartSeries> seriesMap = createChartSeries(pid);
+ final Map<Integer, DAChartSeries> seriesMap = createChartSeries(pid);
seriesPerProcessMap.put(pid, seriesMap);
Display.getDefault().syncExec(new Runnable() {
@Override
});
}
- Map<String, DAChartSeries> seriesMap = seriesPerProcessMap.get(pid);
+ Map<Integer, DAChartSeries> seriesMap = seriesPerProcessMap.get(pid);
for (int i = 0; i < data.size(); i++) {
List<Object> row = data.get(i);
double time = (Long) row.get(TargetProcessDBTable.COLUMN.SAMPLING_TIME.ordinal())
.get(TargetProcessDBTable.COLUMN.HEAP_ALLOCATION_TOTAL_BYTE.ordinal());
@SuppressWarnings("unchecked")
- List<Object> binaryPathList = (List<Object>) row
- .get(TargetProcessDBTable.COLUMN.HEAP_ALLOCATION_NAME.ordinal());
+ List<Object> binaryIDList = (List<Object>) row
+ .get(TargetProcessDBTable.COLUMN.HEAP_ALLOCATION_BINARY_ID.ordinal());
@SuppressWarnings("unchecked")
List<Object> binaryAllocList = (List<Object>) row
.get(TargetProcessDBTable.COLUMN.HEAP_ALLOCATION_BYTE.ordinal());
- DAChartSeries totalAllocSeries = seriesMap
- .get(TimelineChartLabels.HEAP_CHART_SERIES_NAME_TOTAL_ALLOCATION);
+ DAChartSeries totalAllocSeries = seriesMap.get(totalAllocSeriesID);
totalAllocSeries.addSeriesItem(new DAChartSeriesItem(time, totalAlloc, Formatter
.toByteFormat(totalAlloc)));
long targetAlloc = (Long) binaryAllocList.get(0); // target
// located
// at first
// index.
- DAChartSeries appAllocSeries = seriesMap
- .get(TimelineChartLabels.HEAP_CHART_SERIES_NAME_APP_ALLOCATION);
+ DAChartSeries appAllocSeries = seriesMap.get(appAllocSeriesID);
appAllocSeries.addSeriesItem(new DAChartSeriesItem(time, targetAlloc, Formatter
.toByteFormat(targetAlloc)));
*/
long beforeLibraryAlloc = 0; // need to accumulate
for (int ii = 0; ii < librarySequenceList.size(); ii++) {
- String libraryPath = librarySequenceList.get(ii);
- DAChartSeries allocSeries = seriesMap.get(libraryPath);
+ Integer libraryID = librarySequenceList.get(ii);
+ DAChartSeries allocSeries = seriesMap.get(libraryID);
if (allocSeries == null) { // this process don't use this binary
continue;
}
- int index = binaryPathList.indexOf(libraryPath);
+ int index = binaryIDList.indexOf(libraryID);
long libraryAlloc = 0;
if (index > 0) {
libraryAlloc = (Long) binaryAllocList.get(index);
}
}
- private void setChartSeries(DAChart chart, Map<String, DAChartSeries> seriesMap) {
- chart.addSeries(seriesMap.get(TimelineChartLabels.HEAP_CHART_SERIES_NAME_TOTAL_ALLOCATION));
- Iterator<String> iterSeries = seriesMap.keySet().iterator();
+ private void setChartSeries(DAChart chart, Map<Integer, DAChartSeries> seriesMap) {
+ chart.addSeries(seriesMap.get(totalAllocSeriesID));
+ Iterator<Integer> iterSeries = seriesMap.keySet().iterator();
while (iterSeries.hasNext()) {
- String libraryPath = iterSeries.next();
- if (libraryPath.equals(TimelineChartLabels.HEAP_CHART_SERIES_NAME_TOTAL_ALLOCATION)
- || libraryPath
- .equals(TimelineChartLabels.HEAP_CHART_SERIES_NAME_APP_ALLOCATION)) {
+ Integer binaryID = iterSeries.next();
+ if (binaryID < 0) {
continue;
}
- chart.addSeries(seriesMap.get(libraryPath));
- if (librarySequenceList.indexOf(libraryPath) < 0) {
- librarySequenceList.add(libraryPath);
+ chart.addSeries(seriesMap.get(binaryID));
+ if (librarySequenceList.indexOf(binaryID) < 0) {
+ librarySequenceList.add(binaryID);
}
}
- chart.addSeries(seriesMap.get(TimelineChartLabels.HEAP_CHART_SERIES_NAME_APP_ALLOCATION));
+ chart.addSeries(seriesMap.get(appAllocSeriesID));
}
@Override
import org.tizen.dynamicanalyzer.swap.model.data.UIEventData;
import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseEventListener;
import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseTrackAdapter;
-import org.tizen.dynamicanalyzer.ui.info.screenshot.ScreenShotDBTable;
import org.tizen.dynamicanalyzer.ui.info.screenshot.ScreenshotDataManager;
import org.tizen.dynamicanalyzer.ui.timeline.CustomDataDBTable;
import org.tizen.dynamicanalyzer.ui.timeline.SystemDataDBTable;
private static final int MEM_API_TYPE_ALLOC = 0;
private static final int MEM_API_TYPE_FREE = 1;
private static final int MEM_USER = 2;
+ private static final int appAllocSeriesID = -10;
// Map<PID, target Allocation Byte>
private Map<Integer, Long> allocByteMap = new HashMap<Integer, Long>();
- // Map<PID, Map<binaryPath, Allocation Byte>>
- private Map<Integer, Map<String, Long>> libraryAllocByteMap = new HashMap<Integer, Map<String, Long>>();
+ // Map<PID, Map<binaryID, Allocation Byte>>
+ private Map<Integer, Map<Integer, Long>> libraryAllocByteMap = new HashMap<Integer, Map<Integer, Long>>();
// Map<Address, Allocation Byte>
private HashMap<Long, Long> allocationSeriesDataSetMap = new HashMap<Long, Long>();
if (allocByteMap.get(logData.getPid()) == null) {
allocByteMap.put(Integer.valueOf(logData.getPid()), new Long(0));
libraryAllocByteMap.put(Integer.valueOf(logData.getPid()),
- new HashMap<String, Long>());
+ new HashMap<Integer, Long>());
}
int memApiType = logData.getMemoryApiType();
/*
* Check library allocation
*/
- String binaryPath = null;
+ BinaryInfo binaryInfo = null;
Project project = Global.getProject();
ProcessMemoryMap pmap = project.getProcessInformation(logData.getPid())
.getProcessMemoryMap(logData.getTime());
if (pmap != null) {
LibraryObject lib = pmap.getLibraryByAddress(logData.getCallerPcAddr());
if (lib != null && lib != pmap.getMainbinary()) {
- BinaryInfo binfo = project.getDeviceStatusInfo().getBinaryInfo(
+ binaryInfo = project.getDeviceStatusInfo().getBinaryInfo(
lib.getBinaryID());
- binaryPath = binfo.getTargetBinaryPath();
}
}
if (errorNo == 0 && MEM_USER == internalFlag) {
if (MEM_API_TYPE_ALLOC == memApiType || MEM_API_TYPE_FREE == memApiType) {
- addNewSeriesUserAllocData(memApiType, logData, binaryPath);
+ addNewSeriesUserAllocData(memApiType, logData, binaryInfo);
}
}
}
/*
* Set inform for Heap allocation
*/
- List<Object> binaryPathList = new ArrayList<Object>();
+ List<Object> binaryIDList = new ArrayList<Object>();
List<Object> allocByteList = new ArrayList<Object>();
- binaryPathList
- .add(TimelineChartLabels.HEAP_CHART_SERIES_NAME_APP_ALLOCATION);
+ binaryIDList.add(appAllocSeriesID);
if (allocByteMap.get(process.getPid()) == null) {
allocByteList.add(new Long(0));
} else {
allocByteList.add(allocByteMap.get(process.getPid()));
}
- Map<String, Long> libraryList = libraryAllocByteMap.get(process.getPid());
+ Map<Integer, Long> libraryList = libraryAllocByteMap.get(process.getPid());
if (libraryList == null) {
- libraryList = new HashMap<String, Long>();
+ libraryList = new HashMap<Integer, Long>();
}
- Iterator<String> iter = libraryList.keySet().iterator();
+ Iterator<Integer> iter = libraryList.keySet().iterator();
while (iter.hasNext()) {
- String binaryPath = iter.next();
- binaryPathList.add(binaryPath);
- allocByteList.add(libraryList.get(binaryPath));
+ Integer binaryID = iter.next();
+ binaryIDList.add(binaryID);
+ allocByteList.add(libraryList.get(binaryID));
}
- dbTargetProcessData.add(binaryPathList);
+ dbTargetProcessData.add(binaryIDList);
dbTargetProcessData.add(allocByteList);
/*
}
}
- private void addNewSeriesUserAllocData(int fdApiType, MemoryData log, String libraryPath) {
+ private void addNewSeriesUserAllocData(int fdApiType, MemoryData log, BinaryInfo libraryInfo) {
long size = 0;
Long allocByte = allocByteMap.get(log.getPid());
if (MEM_API_TYPE_ALLOC == fdApiType) {
try {
size = log.getSize();
- if (libraryPath == null) {
+ if (libraryInfo == null) {
allocByteMap.put(log.getPid(), allocByte + size);
} else {
- Long libraryAllocByte = libraryAllocByteMap.get(log.getPid()).get(libraryPath);
+ Long libraryAllocByte = libraryAllocByteMap.get(log.getPid()).get(libraryInfo.getID());
if (libraryAllocByte == null) {
libraryAllocByte = new Long(0);
}
- libraryAllocByteMap.get(log.getPid()).put(libraryPath, libraryAllocByte + size);
+ libraryAllocByteMap.get(log.getPid()).put(libraryInfo.getID(), libraryAllocByte + size);
}
allocationSeriesDataSetMap.put(address, size);
} catch (NumberFormatException ne) {
}
size = allocationSeriesDataSetMap.get(address);
- if (libraryPath == null) {
+ if (libraryInfo == null) {
allocByteMap.put(log.getPid(), allocByte - size);
} else {
- Long libraryAllocByte = libraryAllocByteMap.get(log.getPid()).get(libraryPath);
- libraryAllocByteMap.get(log.getPid()).put(libraryPath, libraryAllocByte - size);
+ Long libraryAllocByte = libraryAllocByteMap.get(log.getPid()).get(libraryInfo.getID());
+ libraryAllocByteMap.get(log.getPid()).put(libraryInfo.getID(), libraryAllocByte - size);
}
}
}
public void mouseUp(MouseEvent event) {
Table table = chartTableViewer.getTable();
int selectItemIndex = table.getSelectionIndex();
+ /*
+ * It's possible because Empty column is shown in table especially Windows OS.
+ */
+ if (selectItemIndex < 0) {
+ return;
+ }
TableItem[] chartTableItems = chartTableViewer.getTable().getItems();
TableItemData itemData = (TableItemData)chartTableItems[selectItemIndex].getData();
itemData.isEnabled = !itemData.isEnabled; // toggle
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.tizen.dynamicanalyzer.appearance.DesignConstants;
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.common.path.PathManager;
import org.tizen.dynamicanalyzer.constant.CommonConstants;
import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
private static String ideBuildVersionInfo = CommonConstants.EMPTY;
private static String daBuildVersionInfo = CommonConstants.EMPTY;
private static String daBuildTimeInfo = CommonConstants.EMPTY;
+
+ private static String daVersionInfo = AnalyzerConstants.DA_VERSION;
private final Image iconImage = ImageResources.ABOUT_TIZEN_SDK;
final static String daAboutFilePath = PathManager.getWorkbenchPluginPath() + File.separator
+ "about.mappings";
+ final static String sdkVersionFilePath = PathManager.TIZEN_SDK_INSTALL_PATH + File.separator
+ + "sdk.version";
+
public AboutDialog(Shell parent) {
super(parent);
}
version.setForeground(ColorResources.DEFAULT_FONT_COLOR);
version.setFont(FontResources.ABOUT_TEXT);
+ Label daVersion = new Label(base, SWT.TRANSPARENT);
+ daVersion.setText(AnalyzerLabels.ABOUT_DIALOG_DA_VERSION_TAB + daVersionInfo);
+ daVersion.setBackground(ColorResources.DIALOG_BG_UPPER);
+ daVersion.setAlignment(SWT.LEFT);
+ daVersion.setForeground(ColorResources.DEFAULT_FONT_COLOR);
+ daVersion.setFont(FontResources.ABOUT_TEXT);
+
Label buildTime = new Label(base, SWT.TRANSPARENT);
// String buildTimeString = getBuildTime();// FIXME
buildTime.setText(AnalyzerLabels.ABOUT_DIALOG_BUILD_TIME_TAB + daBuildTimeInfo);
buildTime.setAlignment(SWT.LEFT);
buildTime.setForeground(ColorResources.DEFAULT_FONT_COLOR);
buildTime.setFont(FontResources.ABOUT_TEXT);
-
+
FormData labelData = new FormData();
labelData.left = new FormAttachment(0, 0);
labelData.top = new FormAttachment(0, 0);
labelData.right = new FormAttachment(100, 0);
labelData.top = new FormAttachment(0, textPos += 17);
labelData.height = 17;
+ daVersion.setLayoutData(labelData);
+
+ labelData = new FormData();
+ labelData.left = new FormAttachment(0, 155);
+ labelData.right = new FormAttachment(100, 0);
+ labelData.top = new FormAttachment(0, textPos += 17);
+ labelData.height = 17;
buildTime.setLayoutData(labelData);
Composite buttonComp = new Composite(shell, SWT.NONE);
if (ideBuildVersionInfo.equals(CommonConstants.EMPTY)
|| daBuildTimeInfo.equals(CommonConstants.EMPTY)) {
updateDABuildInfo();
- ideBuildVersionInfo = getIDEVersion();// FIXME remove the IDE dependency.
+ ideBuildVersionInfo = getSdkVersion();
if (null != daBuildVersionInfo && daBuildVersionInfo.contains("RC")) {//$NON-NLS-1$
return;
}
return splitData[1];
}
+ private static String getSdkVersion() {
+ File file = new File(sdkVersionFilePath);
+ if (!file.exists()) {
+ Logger.error(
+ "about dlg, not exists file : " + sdkVersionFilePath);
+ return CommonConstants.EMPTY;
+ }
+ BufferedReader in = null;
+ String content;
+ try {
+ in = new BufferedReader(new FileReader(file));
+ while (null != (content = in.readLine())) {
+ String[] splitData = content.split("TIZEN_SDK_VERSION="); //$NON-NLS-1$
+ int size = splitData.length;
+ if (2 == size) {
+ return splitData[1];
+ }
+ }
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ } finally {
+ CommonUtil.tryClose(in);
+ }
+ return CommonConstants.EMPTY;
+ }
+
private static String getIDEVersion() {
File ideAboutFile = new File(PathManager.getIDEAboutFilePath());
if (!ideAboutFile.exists()) {
import org.eclipse.swt.widgets.Shell;
import org.tizen.dynamicanalyzer.appearance.DesignConstants;
import org.tizen.dynamicanalyzer.common.Global;
+import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
import org.tizen.dynamicanalyzer.nl.WidgetLabels;
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
shell.setLayout(new FormLayout());
shell.setSize(446, 600);
shell.setBackground(ColorResources.DIALOG_BG_UPPER);
- shell.setText("Select process");
+ shell.setText(AnalyzerLabels.SELECT_PROCESS);
explorer = new ProcessExplorer(shell);
FormData data = new FormData();
--- /dev/null
+package org.tizen.dynamicanalyzer.ui.toolbar;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.tizen.dynamicanalyzer.appearance.DesignConstants;
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
+import org.tizen.dynamicanalyzer.constant.CommonConstants;
+import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
+import org.tizen.dynamicanalyzer.nl.WidgetLabels;
+import org.tizen.dynamicanalyzer.resources.ColorResources;
+import org.tizen.dynamicanalyzer.widgets.animation.DAAnimationIcon;
+import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
+import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonClickEventListener;
+import org.tizen.dynamicanalyzer.widgets.da.base.DAButton;
+import org.tizen.dynamicanalyzer.widgets.da.base.DAMessageBox;
+import org.tizen.dynamicanalyzer.widgets.da.base.DAText;
+import org.tizen.dynamicanalyzer.widgets.helper.ImageResources;
+
+public class RemoteDeviceDialog extends DAMessageBox {
+ private static final long THREAD_JOIN_WAITTIME = 1000;
+
+ private RemoteDeviceDialog self = null;
+
+ private DAText ipTextbox = null;
+ private DAText portTextbox = null;
+
+ private List<Image> progressImage = new ArrayList<Image>();
+ private DAAnimationIcon progressIcon = null;
+ private Label progressLabel = null;
+
+ private DACustomButton connectButton = null;
+ private DACustomButton cancelButton = null;
+
+ private String address = null;
+ private Thread managerThread = null;
+
+ public RemoteDeviceDialog(Shell parentShell) {
+ super(parentShell);
+
+ self = this;
+
+ shell.setLayout(new FormLayout());
+ shell.setSize(400, 192);
+ shell.setBackground(ColorResources.DIALOG_BG_UPPER);
+ shell.setText(AnalyzerLabels.REMOTE_DEVICE);
+
+ // IP label and textbox
+ Label ipText = new Label(shell, SWT.TRANSPARENT);
+ FormData data = new FormData();
+ data.top = new FormAttachment(0, 12);
+ data.left = new FormAttachment(0, 15);
+ data.height = 20;
+ data.width = 100;
+ ipText.setLayoutData(data);
+ ipText.setBackground(ColorResources.DIALOG_BG_UPPER);
+ ipText.setAlignment(SWT.LEFT);
+ ipText.setForeground(ColorResources.BLACK);
+ ipText.setText(AnalyzerLabels.IP);
+
+ ipTextbox = new DAText(shell, SWT.SINGLE);
+ data = new FormData();
+ data.top = new FormAttachment(0, 12);
+ data.left = new FormAttachment(ipText, 12);
+ data.height = 20;
+ data.width = 250;
+ ipTextbox.setLayoutData(data);
+ ipTextbox.setBackground(ColorResources.VIEW_BG_COLOR);
+ ipTextbox.getControl().addKeyListener(ipTextboxListener);
+
+ // Port label and textbox
+ Label portText = new Label(shell, SWT.TRANSPARENT);
+ data = new FormData();
+ data.top = new FormAttachment(ipText, 12);
+ data.left = new FormAttachment(0, 15);
+ data.height = 20;
+ data.width = 100;
+ portText.setLayoutData(data);
+ portText.setBackground(ColorResources.DIALOG_BG_UPPER);
+ portText.setAlignment(SWT.LEFT);
+ portText.setForeground(ColorResources.BLACK);
+ portText.setText(AnalyzerLabels.PORT);
+
+ portTextbox = new DAText(shell, SWT.SINGLE);
+ data = new FormData();
+ data.top = new FormAttachment(ipText, 12);
+ data.left = new FormAttachment(portText, 12);
+ data.height = 20;
+ data.width = 250;
+ portTextbox.setLayoutData(data);
+ portTextbox.setBackground(ColorResources.VIEW_BG_COLOR);
+ portTextbox.getControl().addKeyListener(portTextboxListener);
+
+ // progress Icon and text
+ progressImage.add(ImageResources.STOP_PROGRESS_LOADING_01);
+ progressImage.add(ImageResources.STOP_PROGRESS_LOADING_02);
+ progressImage.add(ImageResources.STOP_PROGRESS_LOADING_03);
+ progressImage.add(ImageResources.STOP_PROGRESS_LOADING_04);
+ progressImage.add(ImageResources.STOP_PROGRESS_LOADING_05);
+ progressImage.add(ImageResources.STOP_PROGRESS_LOADING_06);
+ progressImage.add(ImageResources.STOP_PROGRESS_LOADING_07);
+ progressImage.add(ImageResources.STOP_PROGRESS_LOADING_08);
+
+ progressIcon = new DAAnimationIcon(shell, SWT.NONE, progressImage);
+ data = new FormData();
+ data.top = new FormAttachment(portText, 16);
+ data.left = new FormAttachment(30, 10);
+ data.height = 24;
+ data.width = 24;
+ progressIcon.setLayoutData(data);
+ progressIcon.setVisible(false);
+
+ progressLabel = new Label(shell, SWT.TRANSPARENT);
+ data = new FormData();
+ data.top = new FormAttachment(portText, 20);
+ data.left = new FormAttachment(progressIcon, 12);
+ data.height = 20;
+ data.width = 150;
+ progressLabel.setLayoutData(data);
+ progressLabel.setBackground(ColorResources.DIALOG_BG_UPPER);
+ progressLabel.setAlignment(SWT.LEFT);
+ progressLabel.setForeground(ColorResources.BLACK);
+ progressLabel.setText(AnalyzerLabels.CONNECTING);
+ progressLabel.setVisible(false);
+
+ // connect and cancel button
+ Composite buttonComp = new Composite(shell, SWT.NONE);
+ buttonComp.setLayout(new FormLayout());
+ buttonComp.setBackground(ColorResources.DIALOG_BG_LOWER);
+
+ buttonComp.addPaintListener(new PaintListener() {
+
+ @Override
+ public void paintControl(PaintEvent e) {
+ Composite comp = (Composite) e.widget;
+ Rectangle rect = comp.getClientArea();
+ e.gc.setForeground(ColorResources.DIALOG_SUNKEN_1);
+ e.gc.drawLine(rect.x, rect.y, rect.x + rect.width, rect.y);
+ e.gc.setForeground(ColorResources.DIALOG_SUNKEN_2);
+ e.gc.drawLine(rect.x, rect.y + 1, rect.x + rect.width, rect.y + 1);
+ }
+ });
+
+ FormData compData = new FormData();
+ compData.top = new FormAttachment(100, -50);
+ compData.left = new FormAttachment(0, 0);
+ compData.right = new FormAttachment(100, 0);
+ compData.bottom = new FormAttachment(100, 0);
+ buttonComp.setLayoutData(compData);
+
+ connectButton = new DAButton(buttonComp, SWT.NONE);
+ data = new FormData();
+ data.top = new FormAttachment(0, 11);
+ data.left = new FormAttachment(50, -DesignConstants.DA_BUTTON_WIDTH - 4);
+ data.height = DesignConstants.DA_BUTTON_HEIGHT;
+ data.width = DesignConstants.DA_BUTTON_WIDTH;
+ connectButton.setLayoutData(data);
+ connectButton.setText(AnalyzerLabels.CONNECT);
+ connectButton.addClickListener(connectButtonListener);
+ connectButton.setButtonEnabled(false);
+
+ cancelButton = new DAButton(buttonComp, SWT.NONE);
+ data = new FormData();
+ data.top = new FormAttachment(0, 11);
+ data.left = new FormAttachment(50, 4);
+ data.height = DesignConstants.DA_BUTTON_HEIGHT;
+ data.width = DesignConstants.DA_BUTTON_WIDTH;
+ cancelButton.setLayoutData(data);
+ cancelButton.setText(WidgetLabels.CANCEL);
+ cancelButton.addClickListener(cancelButtonListener);
+ }
+
+ private DACustomButtonClickEventListener connectButtonListener = new DACustomButtonClickEventListener() {
+
+ @Override
+ public void handleClickEvent(DACustomButton button) {
+ String ip = ipTextbox.getText();
+ String port = portTextbox.getText();
+
+ if (ip.isEmpty()) {
+ return;
+ }
+
+ if (port.isEmpty()) {
+ port = String.valueOf(AnalyzerConstants.DEFAULT_DEVICE_PORT);
+ }
+
+ address = ip + ":" + port;
+
+ // show progress and try to connect
+ connectButton.setButtonEnabled(false);
+ ipTextbox.setEnabled(false);
+ portTextbox.setEnabled(false);
+
+ progressIcon.setVisible(true);
+ progressLabel.setVisible(true);
+ progressIcon.start();
+
+ // start RemoteDeviceManager
+ Thread managerThread = new Thread(new RemoteDeviceManager(self));
+ managerThread.start();
+ }
+ };
+
+ private DACustomButtonClickEventListener cancelButtonListener = new DACustomButtonClickEventListener() {
+
+ @Override
+ public void handleClickEvent(DACustomButton button) {
+ address = null;
+
+ if (managerThread != null && managerThread.isAlive()) {
+ managerThread.interrupt();
+ try {
+ managerThread.join(THREAD_JOIN_WAITTIME);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ managerThread = null;
+
+ setConnectionResult(false);
+ } else {
+ shell.close();
+ }
+ }
+ };
+
+ private KeyListener ipTextboxListener = new KeyListener() {
+
+ @Override
+ public void keyReleased(KeyEvent e) {
+ if (!checkValidIP(ipTextbox.getText())) {
+ connectButton.setButtonEnabled(false);
+ } else {
+ connectButton.setButtonEnabled(true);
+ }
+ }
+
+ @Override
+ public void keyPressed(KeyEvent e) {
+
+ }
+ };
+
+ private KeyListener portTextboxListener = new KeyListener() {
+
+ @Override
+ public void keyReleased(KeyEvent e) {
+ if (!checkValidPort(portTextbox.getText())) {
+ connectButton.setButtonEnabled(false);
+ } else {
+ connectButton.setButtonEnabled(true);
+ }
+ }
+
+ @Override
+ public void keyPressed(KeyEvent e) {
+
+ }
+ };
+
+ private boolean checkValidIP(String ipaddr) {
+ String[] splitstr = ipaddr.split("\\.");
+ if (splitstr == null || splitstr.length != CommonConstants.IPv4_OCTET_NUMBER) {
+ return false;
+ }
+
+ for (int i = 0; i < CommonConstants.IPv4_OCTET_NUMBER; i++) {
+ int classnum = Integer.parseInt(splitstr[i]);
+ if (classnum < 0 || classnum > CommonConstants.MAX_OCTET_NUMBER) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ private boolean checkValidPort(String port) {
+ if (port.isEmpty()) {
+ return true;
+ }
+
+ int portnum = Integer.parseInt(port);
+
+ if (portnum < CommonConstants.MIN_PORT_NUMBER || portnum > CommonConstants.MAX_PORT_NUMBER) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+
+ public String getAddress() {
+ return address;
+ }
+
+ public void setConnectionResult(boolean bresult) {
+ if (bresult) {
+ // if succeeded to connect remote device
+ result = AnalyzerConstants.SUCCESS;
+ shell.close();
+ } else {
+ // if failed to connect remote device
+ address = null;
+
+ progressIcon.setVisible(false);
+ progressLabel.setVisible(false);
+
+ connectButton.setButtonEnabled(true);
+ ipTextbox.setEnabled(true);
+ portTextbox.setEnabled(true);
+ }
+ }
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.ui.toolbar;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.swt.widgets.Display;
+import org.tizen.dynamicanalyzer.common.path.PathManager;
+import org.tizen.dynamicanalyzer.util.CommonUtil;
+
+public class RemoteDeviceManager implements Runnable {
+ private static final String CMD_SDB_CONNECT = PathManager.SDB_PATH + " connect ";
+ private static final String CMD_SDB_DEVICE = PathManager.SDB_PATH + " devices";
+ private static final String CONNECTED_STR1 = "connected";
+ private static final String CONNECTED_STR2 = "already";
+
+ private static final long SLEEPTIME = 300;
+ private static final long MAX_WAITTIME = 5000;
+
+ private RemoteDeviceDialog parentDialog = null;
+
+ public RemoteDeviceManager(RemoteDeviceDialog dialog) {
+ parentDialog = dialog;
+ }
+
+ @Override
+ public void run() {
+ boolean bret = false;
+
+ // execute sdb connect command
+ String address = parentDialog.getAddress();
+ if (address != null) {
+ String cmd = CMD_SDB_CONNECT + address;
+
+ List<String> outputlines = new ArrayList<String>();
+ if (CommonUtil.executeCommand(cmd, outputlines, null) && !outputlines.isEmpty()) {
+ for (String line : outputlines) {
+ if (line.startsWith(CONNECTED_STR1) || line.contains(CONNECTED_STR2)) {
+ bret = true;
+ break;
+ }
+ }
+ }
+
+ // wait for device is online
+ if (bret) {
+ bret = false;
+ cmd = CMD_SDB_DEVICE;
+ long starttime = System.currentTimeMillis();
+ do {
+ outputlines.clear();
+ if (CommonUtil.executeCommand(cmd, outputlines, null) && !outputlines.isEmpty()) {
+ for (String line : outputlines) {
+ if (line.startsWith(address)) {
+ if (line.contains("device")) {
+ bret = true;
+ break;
+ }
+ }
+ }
+ }
+
+ try {
+ Thread.sleep(SLEEPTIME);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ break;
+ }
+ } while (System.currentTimeMillis() < starttime + MAX_WAITTIME);
+ }
+ }
+
+ final boolean fret = bret;
+ // set result to dialog
+ Display.getDefault().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ parentDialog.setConnectionResult(fret);
+ }
+ });
+ }
+}
DeviceInfo oldDevInfo = Global.getCurrentDeviceInfo();
if (oldDevInfo != null)
oldDeviceName = oldDevInfo.getIDevice().getSerialNumber();
- String serial = combo.getText();
+ final String serial = combo.getText();
- if (serial != null && !serial.equals(oldDeviceName)) {
- Global.setCurrentDeviceInfo(DACommunicator.setSelectedDeviceBySerial(serial));
- if (null != serial && !serial.isEmpty()) {
+ if (serial == null || serial.isEmpty()) {
+ Global.setCurrentDeviceInfo(null);
+ } else {
+ if (serial.equals(AnalyzerConstants.REMOTE_DEVICE)) {
+ final String oldDevName = oldDeviceName;
+
+ Display.getDefault().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ String newDevice = null;
+ Shell shell = WorkbenchUtil.getWorkbenchWindow().getShell();
+ RemoteDeviceDialog pdialog = new RemoteDeviceDialog(shell);
+ pdialog.open();
+ String address = pdialog.getAddress();
+ if (address != null && !address.isEmpty()) {
+ newDevice = address;
+ } else {
+ newDevice = null;
+ }
+
+ if (newDevice == null) {
+ if (oldDevName == null)
+ deviceCombo.setText(CommonConstants.EMPTY);
+ else
+ deviceCombo.setText(oldDevName);
+ } else {
+ deviceCombo.setText(newDevice);
+ }
+
+ if (newDevice != null && !newDevice.isEmpty()) {
+ DACommunicator.setSelectedDeviceBySerial(serial);
+ initAppCombo();
+ setRepalyButtonEnable(true);
+ }
+ }
+ });
+
+ } else if (!serial.equals(oldDeviceName)) {
+ DACommunicator.setSelectedDeviceBySerial(serial);
initAppCombo();
+ setRepalyButtonEnable(true);
}
- setRepalyButtonEnable(true);
}
}
});
setToolbarStartStopState(true);
- if (null == DACommunicator.getDevices() || DACommunicator.getDevices().isEmpty()) {
- deviceCombo.setEnabled(false);
- }
+ // commented because REMOVE_DEVICE is added
+ // if (null == DACommunicator.getDevices() || DACommunicator.getDevices().isEmpty()) {
+ // deviceCombo.setEnabled(false);
+ // }
if (!deviceCombo.isEnabled() || null == Global.getCurrentDeviceInfo()) {
appCombo.setEnabled(false);
setToolbarStartStopState(true);
- if (null == DACommunicator.getDevices() || DACommunicator.getDevices().isEmpty()) {
- deviceCombo.setEnabled(false);
- }
+ // commented because REMOVE_DEVICE is added
+ // if (null == DACommunicator.getDevices() || DACommunicator.getDevices().isEmpty())
+ // {
+ // deviceCombo.setEnabled(false);
+ // }
if (!deviceCombo.isEnabled() || null == Global.getCurrentDeviceInfo()) {
appCombo.setEnabled(false);
appCombo.setEnabled(true);
appCombo.initCombo();
- addToAppComboFromTarget();
+ boolean existDevice = addToAppComboFromTarget();
- List<String> pkgs = appCombo.getItems();
- if (pkgs != null && pkgs.size() > 0) {
+ if (existDevice) {
+ List<String> pkgs = appCombo.getItems();
PackageInfo pkgInfo = null;
String packageID = Global.getCurrentDeviceInfo().getSelectedPackageID();
deviceCombo.initCombo();
if (null == items || items.isEmpty()) {
deviceCombo.add(CommonConstants.EMPTY);
+ deviceCombo.add(AnalyzerConstants.REMOTE_DEVICE);
deviceCombo.select(0);
appCombo.initCombo();
appCombo.setEnabled(false);
selIndex = i;
}
}
+ deviceCombo.add(AnalyzerConstants.REMOTE_DEVICE);
deviceCombo.select(selIndex);
Global.setCurrentDeviceInfo(DACommunicator.getDeviceByName(items.get(selIndex)));
}
}
- private void addToAppComboFromTarget() {
+ // return false if target is not connected
+ private boolean addToAppComboFromTarget() {
Map<String, PackageInfo> pkgInfos = DACommunicator.updateAppListFromTarget();
+ if (pkgInfos == null) {
+ addToAppCombo(null);
+ return false;
+ }
List<PackageInfo> pkgList = new ArrayList<PackageInfo>();
- if (pkgInfos != null) {
- // TODO : reconstruct real app list for app combo
- // relation between package and app?
- for (Map.Entry<String, PackageInfo> entry : pkgInfos.entrySet()) {
- PackageInfo pkg = entry.getValue();
- AppInfo mainapp = pkg.getMainApp();
- if (!mainapp.getAppId().contains(AnalyzerConstants.APPCONTROL)) {
- String label = mainapp.getLabel();
- if (label.isEmpty()) {
- label = mainapp.getExecFileName();
- mainapp.setInfo(AppInfo.PROPERTY.LABEL.index, label);
- }
- pkgList.add(pkg);
+
+ // TODO : reconstruct real app list for app combo
+ // relation between package and app?
+ for (Map.Entry<String, PackageInfo> entry : pkgInfos.entrySet()) {
+ PackageInfo pkg = entry.getValue();
+ AppInfo mainapp = pkg.getMainApp();
+ if (!mainapp.getAppId().contains(AnalyzerConstants.APPCONTROL)) {
+ String label = mainapp.getLabel();
+ if (label.isEmpty()) {
+ label = mainapp.getExecFileName();
+ mainapp.setInfo(AppInfo.PROPERTY.LABEL.index, label);
}
+ pkgList.add(pkg);
}
}
});
addToAppCombo(pkgList);
+
+ return true;
}
public void setAppComboText(final String text) {
for (int i = 0; i < size; i++) {
deviceCombo.add(devices.get(i).getIDevice().getSerialNumber());
}
+ deviceCombo.add(AnalyzerConstants.REMOTE_DEVICE);
+
int index = deviceCombo.getItems().indexOf(selectedDevice);
if (index >= 0) {
deviceCombo.setText(selectedDevice);
import java.util.Map;
import java.util.Set;
-import org.tizen.common.core.application.ProfileInfo;
import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.common.Global;
import org.tizen.dynamicanalyzer.common.path.PathManager;
import org.tizen.dynamicanalyzer.nl.ConfigureLabels;
import org.tizen.dynamicanalyzer.util.CommonUtil;
import org.tizen.dynamicanalyzer.util.Logger;
-import org.tizen.sdblib.IDevice;
public class SettingDataManager {
DeviceInfo currentDevice = Global.getCurrentDeviceInfo();
if (currentDevice != null) {
- IDevice device = currentDevice.getIDevice();
- String profileName = ProfileInfo.getPlatformName(device); // mobile-2.3
- // device.getPlatformInfo().getProfileName(); // mobile
+ String profileName = currentDevice.getPlatformName();
- if (isTarget(profileName)) {
- return map.get(profileName);
+ if (profileName != null && !(profileName.isEmpty())) {
+ if (isTarget(profileName)) {
+ return map.get(profileName);
+ }
}
}
private void initDataList() {
targetHashMap = new HashMap<String, Image>();
targetHashMap.put(ConfigureLabels.TARGET_NAME_MOBILE_2_3, ImageResources.TARGET_MOBILE_2_3);
- targetHashMap.put(ConfigureLabels.TARGET_NAME_TV_0_1, ImageResources.TARGET_NAME_TV_0_1);
+ targetHashMap.put(ConfigureLabels.TARGET_NAME_TV_1_0, ImageResources.TARGET_NAME_TV_1_0);
targetHashMap.put(ConfigureLabels.TARGET_WEARABLE_2_3, ImageResources.TARGET_WEARABLE_2_3);
package org.tizen.dynamicanalyzer.utils;
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
String[] command = new String[] { toolPath, RpmUtil.getDebugInfoOption(), "-d",
targetpath, rpmpath };
- BufferedReader reader = null;
- BufferedReader error = null;
-
- try {
- Runtime rt = Runtime.getRuntime();
- Process process = rt.exec(command);
- process.waitFor();
- reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
-
- String line = null;
- int lineCount = 0;
- while (null != (line = reader.readLine())) {
- lineCount++;
- if (lineCount == 1) {
- Logger.debug("CHANGE DIR : " + line);
- } else {
- Logger.debug("EXTRACE RPM : " + line);
+ List<String> outputlines = new ArrayList<String>();
+ List<String> errorlines = new ArrayList<String>();
+ if (CommonUtil.executeCommand(command, outputlines, errorlines)) {
+ int linecount = outputlines.size();
+ if (linecount < 2) {
+ Logger.debug("debug info file extract failed...");
+ if (errorlines.size() != 0) {
+ Logger.debug(errorlines.get(0));
}
- }
-
- if (lineCount < 2) {
- error = new BufferedReader(new InputStreamReader(process.getErrorStream()));
- String errorStr = error.readLine();
- Logger.debug("debug info file extract failed... : " + errorStr);
} else {
bret = true;
}
- } catch (IOException e) {
- e.printStackTrace();
- } catch (InterruptedException e) {
- e.printStackTrace();
- } finally {
- CommonUtil.tryClose(reader, error);
}
}
if (null != rpmpath) {
String toolPath = PathManager.getDebugInfoScript();
String[] command = new String[] { toolPath, RpmUtil.getDebugInfoOption(), "-l", rpmpath };
- BufferedReader reader = null;
- try {
- Runtime rt = Runtime.getRuntime();
- Process process = rt.exec(command);
- process.waitFor();
- reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
+ List<String> outputlines = new ArrayList<String>();
+
+ if (CommonUtil.executeCommand(command, outputlines, null)) {
ret = new ArrayList<String>();
- String line = null;
- while (null != (line = reader.readLine())) {
+ for (String line : outputlines) {
if (line.startsWith("./")) {
line = line.substring(1);
ret.add(line);
}
}
- } catch (IOException e) {
- e.printStackTrace();
- } catch (InterruptedException e) {
- e.printStackTrace();
- } finally {
- CommonUtil.tryClose(reader);
}
}