import java.util.Timer;
import java.util.concurrent.ConcurrentHashMap;
-import org.tizen.dynamicanalyzer.communicator.DACommunicator;
import org.tizen.dynamicanalyzer.constant.CommonConstants;
import org.tizen.dynamicanalyzer.handlers.ClearHandler;
import org.tizen.dynamicanalyzer.handlers.StartHandler;
import org.tizen.dynamicanalyzer.swap.callstack.BaseCallstackManager;
import org.tizen.dynamicanalyzer.swap.callstack.SWAPCallStackManager;
import org.tizen.dynamicanalyzer.swap.model.data.LogDataFactory;
-import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackManager;
import org.tizen.dynamicanalyzer.ui.info.screenshot.ScreenshotTimerTask;
import org.tizen.dynamicanalyzer.ui.opengl.data.type.GLSelectionData;
import org.tizen.dynamicanalyzer.ui.page.BaseView;
private static NewLeakDetector newLeakDetector = new NewLeakDetector();
private static WarningChecker warningChecker = new WarningChecker();
- private static CallStackManager callstackManager = new CallStackManager();
private static SWAPCallStackManager swapCallstackManager = new SWAPCallStackManager(false);
private static Timer screenshotTimer = null;
newLeakDetector.clear();
warningChecker.clear();
- callstackManager.clear();
swapCallstackManager.clear();
isHaveSampleThread = false;
isLogParsingComplete = false;
String pver = curProject.getProtocolVersion();
if (pver.startsWith("3.")) {
return swapCallstackManager;
- } else if (!pver.isEmpty()) {
- return callstackManager;
}
}
- if (DACommunicator.isSWAPVersion()) {
+// if (DACommunicator.isSWAPVersion()) {
return swapCallstackManager;
- } else {
- return callstackManager;
- }
+// }
}
public static void initTraceStart() {
package org.tizen.dynamicanalyzer.logparser;
-import org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants;
-
public class LogCenterConstants {
- /* probe IDs */
- public static final int LOG_MEMORY = 1;
- public static final int LOG_CONTROL = 2;
- public static final int LOG_UI_EVENT = 3;
- // FIXME :
- public static final int LOG_USER_FUNCTION = 44;
- public static final int LOG_RESOURCE = 55;
- public static final int LOG_LIFECYCLE = 6;
- public static final int LOG_SCREENSHOT = 7;
- public static final int LOG_SCENE = 8;
- public static final int LOG_DEVICE = 9;
- public static final int LOG_PROFILING = 11;
- public static final int LOG_THREAD = 12;
- public static final int LOG_CUSTOM_CHART = 13;
- public static final int LOG_SYNC = 14;
- public static final int LOG_NETWORK = 15;
- public static final int LOG_GLES20 = 16;
-
- public static final int TYPE_CALLSTACK = 99;
-
- /* log common index */
- public static final int ID_INDEX = 0;
- public static final int SEQUENCE_NUMBER_INDEX = 1;
- public static final int APINAME_INDEX = 2;
- public static final int TIME_INDEX = 3;
- public static final int PROCESS_ID_INDEX = 4;
- public static final int THREAD_ID_INDEX = 5;
- public static final int INPUTPARM_INDEX = 6;
- public static final int RETURN_INDEX = 7;
- public static final int PCADDR_INDEX = 8;
- public static final int ERROR_INDEX = 9;
- public static final int INTERNAL_FLAG_INDEX = 10;
- public static final int CALLER_PCADDR_INDEX = 11;
-
- /* log memory : 1 */
- public static final int MEMORY_SIZE_INDEX = 12;
- public static final int MEMORY_APITYPE_INDEX = 13;
- public static final int MEMORY_ADDR_INDEX = 14;
- public static final int MEMORY_RESERVED_INDEX = 15;
-
- /* Log UserInterface Control : 2 */
- public static final int USER_INTERFACE_CONTROL_LIST_PARENT_NAME_INDEX = 12;
- public static final int USER_INTERFACE_CONTROL_LIST_PARENT_CLASS_NAME_INDEX = 13;
- public static final int USER_INTERFACE_CONTROL_LIST_PARENT_POINTER_INDEX = 14;
- public static final int USER_INTERFACE_CONTROL_LIST_CHILD_NAME_INDEX = 15;
- public static final int USER_INTERFACE_CONTROL_LIST_CHILD_CLASS_NAME_INDEX = 16;
- public static final int USER_INTERFACE_CONTROL_LIST_CHILD_POINTER_INDEX = 17;
- public static final int USER_INTERFACE_CONTROL_LIST_CONTRIL_TYPE_INDEX = 18;
-
- /* Log UI Event : 3 */
- public static final int UI_EVENT_EVENT_TYPE = 12;
- public static final int UI_EVENT_DETAIL_TYPE = 13;
- public static final int UI_EVENT_X = 14;
- public static final int UI_EVENT_Y = 15;
- public static final int UI_EVENT_INFO1 = 16;
- public static final int UI_EVENT_INFO2 = 17;
-
- /* log user function : 4 */
- public static final int USER_FUNCTION_BINARY_RANGE_START_INDEX = 12;
- public static final int USER_FUNCTION_BINARY_RANGE_END_INDEX = 13;
- public static final int USER_FUNCTION_TYPE_INDEX = 14;
- public static final int USER_FUNCTION_ELAPSED_TIME_INDEX = 15;
-
- public static final int USER_FUNCTION_EVENT_TYPE_ENTER = 0;
- public static final int USER_FUNCTION_EVENT_TYPE_EXIT = 1;
-
+ /* callstack constant */
public static final String USER_FUNCTION_CALLBACK_FUNC_SYMBOL = "(~~ internal library ~~"; //$NON-NLS-1$
public static final String USER_FUNCTION_CALLBACK_FUNC = "~~ internal library ~~"; //$NON-NLS-1$
public static final long USER_FUNCTION_CALLBACK_FUNC_ADDR = 0;
- /* log resource (file) : 5 */
- public static final int RESOURCE_SIZE_INDEX = 12;
- public static final int RESOURCE_FDVALUE_INDEX = 13;
- public static final int RESOURCE_FDTYPE_INDEX = 14;
- public static final int RESOURCE_FDAPITYPE_INDEX = 15;
- public static final int RESOURCE_FILE_SIZE_INDEX = 16;
- public static final int RESOURCE_FILE_PATH_INDEX = 17;
- public static final int RESOURCE_RESERVED_INDEX = 18;
-
+ /* fd type */
public static final int FD_TYPE_FILE = 0;
public static final int FD_TYPE_SOCKET = 1;
public static final int FD_TYPE_THREAD = 2;
- /* Log File */
+ /* file api type */
public static final int FD_API_TYPE_OPEN = 0;
public static final int FD_API_TYPE_CLOSE = 1;
public static final int FD_API_TYPE_READ_START = 2;
public static final int FD_API_TYPE_LOCK_WAIT_START = 16;
public static final int FD_API_TYPE_LOCK_WAIT_END = 17;
- /* Log Network */
+ /* network api type */
public static final int SOCKET_API_FD_OPEN = 0;
public static final int SOCKET_API_FD_CLOSE = 1;
public static final int SOCKET_API_RECV_START = 2;
public static final int HTTP_API_OTHER = 22;
public static final int HTTP_API_CLOSE = 23;
- /* Log Memory */
+ /* memory api type */
public static final int MEMORY_API_ALLOC = 0;
public static final int MEMORY_API_FREE = 1;
public static final int MEMORY_API_MANAGE = 2;
- /* Log snapshot */
- public static final int SCREENSHOT_IMAGE_PATH_INDEX = 12;
- public static final int SCREENSHOT_ROTATE_INDEX = 13;
-
- /* Log UserInterface Scene Transforms : 8 */
- public static final int USER_INTERFACE_SCENE_TRANSFORMS_LIST_SCENE_NAME_INDEX = 12;
- public static final int USER_INTERFACE_SCENE_TRANSFORMS_LIST_FORM_NAME_INDEX = 13;
- public static final int USER_INTERFACE_SCENE_TRANSFORMS_LIST_FORM_POINTER_INDEX = 14;
- public static final int USER_INTERFACE_SCENE_TRANSFORMS_LIST_PANEL_NAME_INDEX = 15;
- public static final int USER_INTERFACE_SCENE_TRANSFORMS_LIST_PANEL_POINTER_INDEX = 16;
- public static final int USER_INTERFACE_SCENE_TRANSFORMS_LIST_TRANSITION_INDEX = 17;
- public static final int USER_INTERFACE_SCENE_TRANSFORMS_LIST_USERTIME_INDEX = 18;
-
- /* log Device : 9 */
- public static final int DEVICE_ENERGY_INDEX = 2;
- public static final int DEVICE_TIME_INDEX = TIME_INDEX;
- public static final int DEVICE_WIFI_INDEX = 4;
- public static final int DEVICE_BLUETOOTH_INDEX = 5;
- public static final int DEVICE_GPS_INDEX = 6;
- public static final int DEVICE_BRIGHTNESS_INDEX = 7;
- public static final int DEVICE_CAMERA_INDEX = 8;
- public static final int DEVICE_SOUND_INDEX = 9;
- public static final int DEVICE_AUDIO_INDEX = 10;
- public static final int DEVICE_VIBRATION_INDEX = 11;
- public static final int DEVICE_VOLTAGE_INDEX = 12;
- public static final int DEVICE_RSSI_INDEX = 13;
- public static final int DEVICE_VIDEO_INDEX = 14;
- public static final int DEVICE_CALL_INDEX = 15;
- public static final int DEVICE_DNET_INDEX = 16;
- public static final int DEVICE_CALL_ALPHA_INDEX = 17;
- public static final int DEVICE_RSSI_ALPHA_INDEX = 18;
- public static final int DEVICE_CPU_FREQUENCY_INDEX = 19;
- public static final int DEVICE_APP_CPU_USAGE_INDEX = 20;
- public static final int DEVICE_SYSTEM_CPU_USAGE_INDEX = 21;
- public static final int DEVICE_VSS_MEMORY_INDEX = 22;
- public static final int DEVICE_RSS_MEMORY_INDEX = 23;
- public static final int DEVICE_SHARED_MEMORY_INDEX = 24;
- public static final int DEVICE_PSS_MEMORY_INDEX = 25;
- public static final int DEVICE_ALLOCATION_SIZE_INDEX = 26;
- public static final int DEVICE_SYSTEM_TOTAL_MEMORY_INDEX = 27;
- public static final int DEVICE_SYSTEM_USED_MEMORY_INDEX = 28;
- public static final int DEVICE_SYSTEM_USED_STORAGE_INDEX = 29;
- public static final int DEVICE_THREAD_COUNT_INDEX = 30;
- public static final int DEVICE_THREAD_LOAD_INDEX = 31;
- public static final int DEVICE_THREAD_RESERVED_INDEX = 32;
-
- /* sample log : 11 */
- public static final int PROFILING_LOG_TIME_INDEX = 2;
- public static final int PROFILING_LOG_PCADDR_INDEX = 3;
- public static final int PROFILING_LOG_CALLSTACK_INDEX = 4;
- public static final int PROFILING_LOG_RESERVED_INDEX = 5;
-
- /* thread log : 12 */
- public static final int THREAD_PTHREAD_ID_INDEX = 12;
- public static final int THREAD_TIZENTHREAD_ID_INDEX = 13;
- public static final int THREAD_TYPE_INDEX = 14;
- public static final int THREAD_API_TYPE_INDEX = 15;
-
+ /* thread type */
public static final int THREAD_TYPE_PTHREAD = 0;
public static final int THREAD_TYPE_TIZEN = 1;
public static final int THREAD_TYPE_MAIN = 2;
+ /* thread api type */
public static final int THREAD_API_TYPE_NEW = 0;
public static final int THREAD_API_TYPE_START = 1;
public static final int THREAD_API_TYPE_STOP = 2;
public static final int THREAD_API_TYPE_INTERNAL_STOP = 7;
public static final int THREAD_API_TYPE_OTHER = 8;
- /* custom log : 13 */
- public static final int CUSTOM_CHART_HANDLE = 12;
- public static final int CUSTOM_CHART_TYPE = 13;
- public static final int CUSTOM_CHART_TEXT = 14;
- public static final int CUSTOM_CHART_COLOR = 15;
- public static final int CUSTOM_CHART_VALUE = 16;
- public static final int CUSTOM_CHART_RESERVED = 17;
-
- /* synchronization log : 14 */
- public static final int SYNC_VAL_INDEX = 12;
- public static final int SYNC_TYPE_INDEX = 13;
- public static final int SYNC_API_TYPE_INDEX = 14;
-
+ /* sync object type */
public static final int SYNC_TYPE_TIZEN_MUTEX = 0;
public static final int SYNC_TYPE_TIZEN_MONITOR = 1;
public static final int SYNC_TYPE_TIZEN_SEMAPHORE = 2;
public static final int SYNC_TYPE_PTHREAD_SPINLOCK = 6;
public static final int SYNC_TYPE_PTHREAD_BARRIER = 7;
+ /* sync api type */
public static final int SYNC_API_TYPE_NEW = 0;
public static final int SYNC_API_TYPE_ACQUIRE_WAIT_START = 1;
public static final int SYNC_API_TYPE_ACQUIRE_WAIT_END = 2;
public static final int SYNC_API_TYPE_NOTIFY = 7;
public static final int SYNC_API_TYPE_NOTIFY_ALL = 8;
public static final int SYNC_API_TYPE_OTHER = 9;
-
- /* network log : 15 */
- public static final int NETWORK_OBJECT_INDEX = 12;
- public static final int NETWORK_FD_INDEX = 13;
- public static final int NETWORK_FDTYPE_INDEX = 14;
- public static final int NETWORK_APITYPE_INDEX = 15;
- public static final int NETWORK_MESSAGE_INDEX = 16;
- public static final int NETWORK_MESSAGE_SIZE_INDEX = 17;
- public static final int NETWORK_DESTINATION_ADDRESS_INDEX = 18;
- public static final int NETWORK_RESERVED_INDEX = 19;
-
- /* gles20 log : 16 */
- public static final int GL_API_TYPE_INDEX = 12;
- public static final int GL_CONTEXT_VALUE_INDEX = 13;
- public static final int GL_ELAPSED_TIME_INDEX = 14;
-
- /* Common Column Size */
- public static final int COMMON_COLUMN_SIZE_RID = 80;
- public static final int COMMON_COLUMN_SIZE_ID = 20;
- public static final int COMMON_COLUMN_SIZE_SEQNUMBER = 0;
- public static final int COMMON_COLUMN_SIZE_APINAME = 100;
- public static final int COMMON_COLUMN_SIZE_TIME = 120;
- public static final int COMMON_COLUMN_SIZE_PID = 80;
- public static final int COMMON_COLUMN_SIZE_TID = 80;
- public static final int COMMON_COLUMN_SIZE_INPUTPARAM = 200;
- public static final int COMMON_COLUMN_SIZE_RETURN = 0;
- public static final int COMMON_COLUMN_SIZE_PCADDR = 0;
- public static final int COMMON_COLUMN_SIZE_ERROR = 0;
-
- public static String getLogCenterNameFromId(int id) {
- if (id == DataChannelConstants.MSG_PROBE_MEMORY) {
- return "memory"; //$NON-NLS-1$
- } else if (id == LOG_USER_FUNCTION) {
- return "user function"; //$NON-NLS-1$
- } else if (id == DataChannelConstants.MSG_PROBE_FILE) {
- return "resource"; //$NON-NLS-1$
- } else if (id == DataChannelConstants.MSG_PROBE_THREAD) {
- return "thread"; //$NON-NLS-1$
- } else if (id == LOG_GLES20) {
- return "graphics"; //$NON-NLS-1$
- } else {
- return "etc..."; //$NON-NLS-1$
- }
- }
}
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.common.Global;
import org.tizen.dynamicanalyzer.constant.CommonConstants;
-import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
import org.tizen.dynamicanalyzer.project.Project;
-import org.tizen.dynamicanalyzer.swap.model.data.LogData;
import org.tizen.dynamicanalyzer.swap.model.data.LogDataFactory;
import org.tizen.dynamicanalyzer.util.CommonUtil;
import org.tizen.dynamicanalyzer.util.Logger;
return true;
}
- /**
- * select query function
- *
- * @param dbFilePath
- * DB File path
- * @param columnName
- * column name list
- * @param tableName
- * table name
- * @param option
- * Condition statements
- * @return List<List<String>> row of columns data
- */
- public List<LogData> newSelectQuery(String dbFilePath, String[] columnName, String tableName,
- String option) {
- String query = null;
- Statement stat = null;
- ResultSet rs = null;
- Connection conn = null;
- List<LogData> dbInfo = new ArrayList<LogData>();
- try {
- if (null == dbFilePath) {
- conn = getConnection();
- } else {
- conn = getConnection(dbFilePath);
- }
- if (null == conn) {
- return null;
- }
- if (null == tableName || tableName.length() < 1) {
- Logger.debug("tableName is null");
- return null;
- }
-
- StringBuilder columns = new StringBuilder();
- if (null == columnName || columnName.length < 1) {
- Logger.debug("tableName is null");
- return null;
- } else {
- for (int i = 0; i < columnName.length; i++) {
- if ((0 < i) && (i < columnName.length)) {
- columns.append(", ");//$NON-NLS-1$
- }
- columns.append(columnName[i]);
- }
- }
- String queryOption = CommonConstants.EMPTY;
- if (null != option) {
- queryOption = option;
- }
- query = String.format("select %s from %s %s;",//$NON-NLS-1$
- columns.toString(), tableName, queryOption);
-
- semaphoreAcquire();
- stat = conn.createStatement();
- if (isQueryPrint) {
- Logger.debug("query : " + query);
- }
- rs = stat.executeQuery(query);
- if (null != rs) {
- while (rs.next()) {
- LogData logData = LogDataFactory.createInstance(rs);
- dbInfo.add(logData);
- }
- }
- } catch (SQLException e) {
- e.printStackTrace();
- } finally {
- semaphoreRelease();
- CommonUtil.tryClose(stat, rs);
- }
- return dbInfo;
- }
-
- public List<LogData> newSelectQuery2(String dbFilePath, String[] columnName, String tableName,
- String preOption, String postOption) {
- String query = null;
- Statement stat = null;
- ResultSet rs = null;
- Connection conn = null;
- List<LogData> dbInfo = new ArrayList<LogData>();
- try {
- if (null == dbFilePath) {
- conn = getConnection();
- } else {
- conn = getConnection(dbFilePath);
- }
- if (null == conn) {
- return null;
- }
- if (null == tableName || tableName.length() < 1) {
- Logger.debug("tableName is null");
- return null;
- }
-
- StringBuilder columns = new StringBuilder();
- if (null == columnName || columnName.length < 1) {
- Logger.debug("tableName is null");
- return null;
- } else {
- for (int i = 0; i < columnName.length; i++) {
- if ((0 < i) && (i < columnName.length)) {
- columns.append(", ");//$NON-NLS-1$
- }
- columns.append(columnName[i]);
- }
- }
- if (null == postOption) {
- postOption = CommonConstants.EMPTY;
- }
- query = String.format("select %s %s from %s %s;",//$NON-NLS-1$
- preOption, columns.toString(), tableName, postOption);
- semaphoreAcquire();
- stat = conn.createStatement();
- if (isQueryPrint) {
- Logger.debug("query : " + query);
- }
- rs = stat.executeQuery(query);
- if (null != rs) {
- while (rs.next()) {
- LogData logData = LogDataFactory.createInstance(rs);
- dbInfo.add(logData);
- }
- }
- } catch (SQLException e) {
- Logger.debug("SQLException - selecte : " + query);
- e.printStackTrace();
- } finally {
- semaphoreRelease();
- CommonUtil.tryClose(stat, rs);
- }
- return dbInfo;
- }
-
public List<List<String>> selectQuery(String dbFilePath, String[] columnName, String tableName,
String option) {
List<List<String>> dbInfo = null;
return dbInfo;
}
- public List<LogData> selectQuery2(String dbFilePath, String tableName, String option) {
- String query = null;
- Statement stat = null;
- ResultSet rs = null;
- Connection conn = null;
- List<LogData> logs = null;
- try {
- if (null == dbFilePath) {
- conn = getConnection();
- } else {
- conn = getConnection(dbFilePath);
- }
- if (null == conn) {
- return null;
- }
- if (null == tableName || tableName.length() < 1) {
- Logger.debug("tableName is null");
- return null;
- }
-
- StringBuilder columns = new StringBuilder();
- columns.append("* ");
- String queryOption = CommonConstants.EMPTY;
- if (null != option) {
- queryOption = option;
- }
- query = String.format("select %s from %s %s;",//$NON-NLS-1$
- columns.toString(), tableName, queryOption);
-
- semaphoreAcquire();
- stat = conn.createStatement();
- if (isQueryPrint) {
- Logger.debug("query : " + query);
- }
- rs = stat.executeQuery(query);
- if (null != rs) {
- logs = new ArrayList<LogData>();
- while (rs.next()) {
- LogData log = LogDataFactory.createInstance(rs);
- logs.add(log);
- }
- }
- } catch (SQLException e) {
- Logger.debug("SQLException - selecte : " + query);
- e.printStackTrace();
- } finally {
- CommonUtil.tryClose(stat, rs);
- semaphoreRelease();
- }
- return logs;
- }
-
public List<List<String>> selectQuery3(String dbFilePath, List<String> columnName,
String tableName, int from, int to, String option) {
List<List<String>> dbInfo = null;
return dbInfo.get(0);
}
- public long executeSelectIndexOperation(long time) {
- String queryOptin = " where time < " + time + " and type = " + LogCenterConstants.USER_FUNCTION_EVENT_TYPE_ENTER; //$NON-NLS-1$ //$NON-NLS-2$
- List<List<String>> dbInfo = selectQuery(null, new String[] { "count(time)" },
- "user_function", queryOptin);
- if (null == dbInfo || null == dbInfo.get(0).get(0)) {
- return 0;
- }
- return Long.parseLong(dbInfo.get(0).get(0));
- }
-
- public int executeSelectCountOperation(long StartTime, long endTime) {
- String countQuery = " where time >" + StartTime + " and time <= " + endTime + " and type = " + LogCenterConstants.USER_FUNCTION_EVENT_TYPE_ENTER; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- List<List<String>> dbInfo = selectQuery(null,
- new String[] { "count(time)" }, "user_function", countQuery); //$NON-NLS-1$ //$NON-NLS-2$
- if (null == dbInfo || null == dbInfo.get(0).get(0)) {
- return 0;
- }
- return Integer.parseInt(dbInfo.get(0).get(0));
- }
-
- public LogData getCpuRates(long startTime, int type) {
- String queryOption = null;
- if (type == 1) {
- queryOption = "where time = (select max(time) from system where time <= " + startTime + ")"; //$NON-NLS-1$
- } else {
- queryOption = "where time = (select min(time) from system)"; //$NON-NLS-1$
- }
- List<LogData> dbInfo = selectQuery2(null, "system", queryOption); //$NON-NLS-1$ //$NON-NLS-2$
- if (null == dbInfo || dbInfo.isEmpty()) {
- return null;
- }
- return dbInfo.get(0);
- }
-
public long getLastScreenshotTime(long time) {
String queryOption = "where time >=" + time;//$NON-NLS-1$
List<List<String>> dbInfo = selectQuery(null,
return Integer.parseInt(dbInfo.get(0).get(0));
}
- // public synchronized List<LogData> selectTableData(int logId, int from,
- // int to, String option) {
- // String tableName = LogDataFactory.getLogFormatById(logId).getName();
- // List<String> tableNames = LogDataFactory.getLogFormatById(logId)
- // .getDBColumnNames();
- // String[] columnName = new String[tableNames.size()];
- // for (int i = 0; i < tableNames.size(); i++) {
- // columnName[i] = tableNames.get(i);
- // }
- // String preQueryOption = " limit " + from + " " + to;//$NON-NLS-1$ //$NON-NLS-2$
- // String postQueryOption = " where " + option;//$NON-NLS-1$ //$NON-NLS-2$
- //
- // List<LogData> dbInfo = newSelectQuery2(null, columnName, tableName,
- // preQueryOption, postQueryOption);
- // return dbInfo;
- // }
-
- public synchronized List<LogData> selectTableData(String tableName, List<String> tableNames,
- int from, int to, String option) {
- String[] columnName = new String[tableNames.size()];
- for (int i = 0; i < tableNames.size(); i++) {
- columnName[i] = tableNames.get(i);
- }
- String preQueryOption = " limit " + from + " " + to;//$NON-NLS-1$ //$NON-NLS-2$
- String postQueryOption = " where " + option;//$NON-NLS-1$ //$NON-NLS-2$
-
- List<LogData> dbInfo = newSelectQuery2(null, columnName, tableName, preQueryOption,
- postQueryOption);
- return dbInfo;
- }
-
public synchronized long getSelectionTime(String tableName, long startTime, String option) {
String query = null;
Statement stat = null;
+++ /dev/null
-/*
- * Dynamic Analyzer
- *
- * Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Jaewon Lim <jaewon81.lim@samsung.com>
- * Jooyoul Lee <jy.exe.lee@samsung.com>
- * Juyoung Kim <j0.kim@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-package org.tizen.dynamicanalyzer.swap.channel.data;
-
-import org.tizen.dynamicanalyzer.common.Global;
-import org.tizen.dynamicanalyzer.constant.CommonConstants;
-import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
-import org.tizen.dynamicanalyzer.swap.model.DATime;
-import org.tizen.dynamicanalyzer.swap.model.data.LogDataFactory;
-import org.tizen.dynamicanalyzer.util.ByteUtil;
-import org.tizen.dynamicanalyzer.util.Logger;
-
-public class BasicDataMessage {
- public static final int INT_SIZE = CommonConstants.INT_SIZE;
- public static final int ID_SIZE = INT_SIZE;
- public static final int SEQ_SIZE = INT_SIZE;
- public static final int TIME_SIZE = CommonConstants.LONG_SIZE;
- public static final int PAYLOAD_LENGTH_SIZE = INT_SIZE;
-
- public static final int HEADER_SIZE = ID_SIZE + SEQ_SIZE + TIME_SIZE
- + PAYLOAD_LENGTH_SIZE;
-
- private boolean PRINT_DATA = false;
-
- protected int id = -1;
- protected int seq = -1;
- protected long time = -1;
- protected int payloadSize = 0;
- protected byte[] payload = null;
- protected boolean complete = false;
- protected String callstackLog = null;
-
- public int getId() {
- return id;
- }
-
- public void setId(int id) {
- this.id = id;
- }
-
- public int getSeq() {
- return seq;
- }
-
- public void setSeq(int seq) {
- this.seq = seq;
- }
-
- public long getTime() {
- return time;
- }
-
- public void setTime(long time) {
- this.time = time;
- }
-
- public byte[] getPayload() {
- return payload;
- }
-
- public void setPayload(byte[] payload) {
- this.payload = payload;
- }
-
- public boolean isComplete() {
- return complete;
- }
-
- public BasicDataMessage getClone() {
- BasicDataMessage clone = new BasicDataMessage();
- clone.id = this.id;
- clone.seq = this.seq;
- clone.time = this.time;
- clone.payload = this.payload;
- return clone;
- }
-
- public void makeData(String[] input) {
- id = Integer.parseInt(input[LogCenterConstants.ID_INDEX]);
- id = mappingId(id);
- seq = Integer.parseInt(input[LogCenterConstants.SEQUENCE_NUMBER_INDEX]);
- time = Long.parseLong(input[LogCenterConstants.TIME_INDEX]);
- int sec = (int) (time / 10000);
- int nano = (int) (time % 10000);
- nano *= 100000;
-
- DATime startTime = Global.getProject().getProfilingStartTime();
- int startSec = startTime.getSec();
- int startNano = startTime.getNano();
-
- if (0 == startSec && 0 == startNano) {
- Logger.debug("if show this log then process info is not comming or late!!");
- startTime.setSec(sec);
- startTime.setNano(nano);
- Global.getProject().setProfilingStartTime(startTime);
- startSec = sec;
- startNano = nano;
- }
-
- sec = sec - startSec;
- nano = nano - startNano;
-
- time = sec / 1000000 + nano / 1000;
-
- int size = LogDataFactory.getLogColumnCountbyId(id);
- String[] newInput = new String[size];
- for (int i = 0; i < size; i++) {
- newInput[i] = CommonConstants.EMPTY;
- }
- System.arraycopy(input, 0, newInput, 0, input.length);
- input = null;
- // payload = AnalyzerUtil.makeByteArray(id, newInput);
- }
-
- // for lower version
- private static int mappingId(int oldId) {
- int newId = -1;
- switch (oldId) {
- case LogCenterConstants.LOG_MEMORY:
- newId = DataChannelConstants.MSG_PROBE_MEMORY;
- break;
- case LogCenterConstants.LOG_CONTROL:
- newId = DataChannelConstants.MSG_PROBE_UICONTROL;
- break;
- case LogCenterConstants.LOG_UI_EVENT:
- newId = DataChannelConstants.MSG_PROBE_UIEVENT;
- break;
- case LogCenterConstants.LOG_RESOURCE:
- newId = DataChannelConstants.MSG_PROBE_FILE;
- break;
- case LogCenterConstants.LOG_NETWORK:
- newId = DataChannelConstants.MSG_PROBE_NETWORK;
- break;
- case LogCenterConstants.LOG_GLES20:
- newId = DataChannelConstants.MSG_PROBE_GLES20;
- break;
- case LogCenterConstants.LOG_LIFECYCLE:
- newId = DataChannelConstants.MSG_PROBE_LIFECYCLE;
- break;
- case LogCenterConstants.LOG_SCREENSHOT:
- newId = DataChannelConstants.MSG_PROBE_SCREENSHOT;
- break;
- case LogCenterConstants.LOG_SCENE:
- newId = DataChannelConstants.MSG_PROBE_SCENE;
- break;
- case LogCenterConstants.LOG_DEVICE:
- newId = DataChannelConstants.MSG_DATA_SYSTEM;
- break;
- case LogCenterConstants.LOG_PROFILING:
- newId = DataChannelConstants.MSG_DATA_SAMPLE;
- break;
- case LogCenterConstants.LOG_THREAD:
- newId = DataChannelConstants.MSG_PROBE_THREAD;
- break;
- case LogCenterConstants.LOG_CUSTOM_CHART:
- newId = DataChannelConstants.MSG_PROBE_CUSTOM;
- break;
- case LogCenterConstants.LOG_SYNC:
- newId = DataChannelConstants.MSG_PROBE_SYNC;
- break;
- default:
- // USER_FUNCTION
- newId = oldId;
- break;
- }
- return newId;
- }
-
- public void setCallstack(String input) {
- callstackLog = input;
- }
-
- public String getCallstack() {
- return callstackLog;
- }
-
- public void printMessage() {
- if (PRINT_DATA) {
- String strId = String.format("%4x", id);
- Logger.debug("Message [id : " + strId + "] [seq :" + seq + "] [ Time : "
- + time + " ms]");
- ByteUtil.printByteArray(payload);
- }
- }
-}
*/
package org.tizen.dynamicanalyzer.swap.model;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-
import org.tizen.dynamicanalyzer.swap.model.data.LogData;
import org.tizen.dynamicanalyzer.util.ByteUtil;
this.eventTime = eventTime;
}
- public void makePreparedStatement(PreparedStatement prep)
- throws SQLException {
-
- super.makePreparedStatement(prep);
- int index = LogData.STATE_COUNT + 1;
-
- prep.setLong(index++, eventTime.getSec());
- prep.setLong(index++, eventTime.getNano());
- prep.setInt(index++, eventId);
- prep.setInt(index++, eventType);
- prep.setInt(index++, eventCode);
- prep.setInt(index++, eventValue);
- }
-
- public void loadData(ResultSet rs) throws SQLException {
- super.loadData(rs);
- int index = LogData.STATE_COUNT + 1;
- setId(rs.getInt(1));
- eventTime.setSec(rs.getInt(index++));
- eventTime.setNano(rs.getInt(index++));
- eventId = rs.getInt(index++);
- eventType = rs.getInt(index++);
- eventCode = rs.getInt(index++);
- eventValue = rs.getInt(index++);
- }
-
public byte[] getByteValues() {
return ByteUtil.getByte(eventTime.getByteValues(), eventId, eventType,
eventCode, eventValue);
import static org.tizen.dynamicanalyzer.constant.CommonConstants.INT_SIZE;
import static org.tizen.dynamicanalyzer.constant.CommonConstants.LONG_SIZE;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-
import org.tizen.dynamicanalyzer.swap.logparser.MessageParser;
import org.tizen.dynamicanalyzer.util.ByteUtil;
this.cpuNum = cpuNum;
}
- @Override
- public void makePreparedStatement(PreparedStatement prep)
- throws SQLException {
- super.makePreparedStatement(prep);
- int index = LogData.STATE_COUNT + 1;
- prep.setLong(index++, pcAddr);
- prep.setInt(index++, pid);
- prep.setInt(index++, tid);
- prep.setInt(index++, cpuNum);
- }
-
- @Override
- public void loadData(ResultSet rs) throws SQLException {
- super.loadData(rs);
- int index = LogData.STATE_COUNT + 1;
- pcAddr = rs.getLong(index++);
- pid = rs.getInt(index++);
- tid = rs.getInt(index++);
- cpuNum = rs.getInt(index++);
- }
-
public int getContextSeqSelf() {
return contextSeqSelf;
}
import static org.tizen.dynamicanalyzer.constant.CommonConstants.LONG_SIZE;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-
import org.tizen.dynamicanalyzer.util.ByteUtil;
public class ControlData extends ProbeCommonData {
public void setChildPointer(long childPointer) {
this.childPointer = childPointer;
}
-
- @Override
- public void makePreparedStatement(PreparedStatement prep)
- throws SQLException {
- super.makePreparedStatement(prep);
- int index = ProbeCommonData.STATE_COUNT + 1;
-
- prep.setString(index++, parentName);
- prep.setString(index++, parentClassName);
- prep.setLong(index++, parentPointer);
- prep.setString(index++, childName);
- prep.setString(index++, childClassName);
- prep.setLong(index++, childPointer);
- }
-
- @Override
- public void loadData(ResultSet rs) throws SQLException {
- super.loadData(rs);
- int index = ProbeCommonData.STATE_COUNT + 1;
- parentName = rs.getString(index++);
- parentClassName = rs.getString(index++);
- parentPointer = rs.getLong(index++);
- childName = rs.getString(index++);
- childClassName = rs.getString(index++);
- childPointer = rs.getLong(index++);
- }
}
import static org.tizen.dynamicanalyzer.constant.CommonConstants.INT_SIZE;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-
import org.tizen.dynamicanalyzer.util.ByteUtil;
public class CustomData extends ProbeCommonData {
public void setValue(double value) {
this.value = value;
}
-
- @Override
- public void makePreparedStatement(PreparedStatement prep)
- throws SQLException {
- super.makePreparedStatement(prep);
- int index = ProbeCommonData.STATE_COUNT + 1;
-
- prep.setInt(index++, handle);
- prep.setInt(index++, type);
- prep.setString(index++, name);
- prep.setInt(index++, color);
- prep.setDouble(index++, value);
- }
-
- @Override
- public void loadData(ResultSet rs) throws SQLException {
- super.loadData(rs);
- int index = ProbeCommonData.STATE_COUNT + 1;
- handle = rs.getInt(index++);
- type = rs.getInt(index++);
- name = rs.getString(index++);
- color = rs.getInt(index++);
- value = rs.getDouble(index++);
- }
}
import static org.tizen.dynamicanalyzer.constant.CommonConstants.INT_SIZE;
import static org.tizen.dynamicanalyzer.constant.CommonConstants.LONG_SIZE;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-
import org.tizen.dynamicanalyzer.util.ByteUtil;
public class FileData extends ProbeCommonData {
Long key = getFdValue();
return key.hashCode();
}
-
- @Override
- public void makePreparedStatement(PreparedStatement prep)
- throws SQLException {
- super.makePreparedStatement(prep);
- int index = ProbeCommonData.STATE_COUNT + 1;
-
- prep.setLong(index++, size);
- prep.setLong(index++, fdValue);
- prep.setInt(index++, fdApiType);
- prep.setLong(index++, fileSize);
- prep.setString(index++, filePath);
- }
-
- @Override
- public void loadData(ResultSet rs) throws SQLException {
- super.loadData(rs);
- int index = ProbeCommonData.STATE_COUNT + 1;
- size = rs.getLong(index++);
- fdValue = rs.getLong(index++);
- fdApiType = rs.getInt(index++);
- fileSize = rs.getLong(index++);
- filePath = rs.getString(index++);
- }
}
package org.tizen.dynamicanalyzer.swap.model.data;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-
import org.tizen.dynamicanalyzer.constant.CommonConstants;
import org.tizen.dynamicanalyzer.util.ByteUtil;
public void setContextValue(String contextValue) {
this.contextValue = contextValue;
}
-
- @Override
- public void makePreparedStatement(PreparedStatement prep)
- throws SQLException {
- super.makePreparedStatement(prep);
- int index = ProbeCommonData.STATE_COUNT + 1;
-
- prep.setInt(index++, apiType);
- prep.setLong(index++, elapsedTime);
- prep.setString(index++, contextValue);
-
- }
-
- @Override
- public void loadData(ResultSet rs) throws SQLException {
- super.loadData(rs);
- int index = ProbeCommonData.STATE_COUNT + 1;
- apiType = rs.getInt(index++);
- elapsedTime = rs.getLong(index++);
- contextValue = rs.getString(index++);
- }
}
import static org.tizen.dynamicanalyzer.constant.CommonConstants.INT_SIZE;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-
import org.tizen.dynamicanalyzer.common.Global;
import org.tizen.dynamicanalyzer.communicator.DACommunicator;
import org.tizen.dynamicanalyzer.swap.model.DATime;
this.time = time;
}
- public void makePreparedStatement(PreparedStatement prep)
- throws SQLException {
- int logNum = LogDataFactory.getLogCountById(id);
- prep.setInt(1, logNum);
- prep.setInt(2, id);
- prep.setInt(3, seq);
- prep.setLong(4, time);
- }
-
- public void loadData(ResultSet rs) throws SQLException {
- id = rs.getInt(2);
- seq = rs.getInt(3);
- time = rs.getLong(4);
- }
-
public abstract int getPid();
public String getLibName() {
import static org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants.MSG_PROBE_UICONTROL;
import static org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants.MSG_PROBE_UIEVENT;
-import java.sql.ResultSet;
-import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
-import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
import org.tizen.dynamicanalyzer.util.ByteUtil;
public class LogDataFactory {
private static List<Integer> logList = new ArrayList<Integer>();
- private static int memoryLogNum = 0;
- private static int controlLogNum = 0;
- private static int uiEventLogNum = 0;
- private static int fileLogNum = 0;
- private static int lifecycleLogNum = 0;
- private static int screenshotLogNum = 0;
- private static int sceneLogNum = 0;
- private static int threadLogNum = 0;
- private static int customLogNum = 0;
- private static int syncLogNum = 0;
- private static int systemLogNum = 0;
- private static int recordLogNum = 0;
- private static int userFunctionLogNum = 0;
- private static int gles20LogNum = 0;
- private static int profilingLogNum = 0;
- private static int contextSwitchLogNum = 0;
-
private LogDataFactory() {
// is static class
}
logList.add(MSG_PROBE_UICONTROL);
logList.add(MSG_PROBE_UIEVENT);
logList.add(MSG_PROBE_FILE);
-// logList.add(MSG_PROBE_NETWORK);
-// logList.add(MSG_PROBE_GLES20);
+ // logList.add(MSG_PROBE_NETWORK);
+ // logList.add(MSG_PROBE_GLES20);
logList.add(MSG_PROBE_LIFECYCLE);
logList.add(MSG_PROBE_SCREENSHOT);
logList.add(MSG_PROBE_SCENE);
logList.add(MSG_PROBE_CUSTOM);
logList.add(MSG_PROBE_SYNC);
logList.add(MSG_DATA_SYSTEM);
-// logList.add(LogCenterConstants.LOG_USER_FUNCTION);
-// logList.add(MSG_DATA_RECORD);
+ // logList.add(LogCenterConstants.LOG_USER_FUNCTION);
+ // logList.add(MSG_DATA_RECORD);
logList.add(MSG_FUNCTION_ENTRY);
logList.add(MSG_FUNCTION_EXIT);
- logList.add(MSG_DATA_SAMPLE);
+ logList.add(MSG_DATA_SAMPLE);
logList.add(MSG_CONTEXT_SWITCH_ENTRY);
logList.add(MSG_CONTEXT_SWITCH_EXIT);
}
// sync
output = new SyncData();
break;
- case LogCenterConstants.LOG_USER_FUNCTION:
- // user function entry/exit
- output = new UserFunctionData();
- break;
case MSG_DATA_SAMPLE:
case MSG_FUNCTION_ENTRY:
case MSG_FUNCTION_EXIT:
}
}
- public static LogData createInstance(ResultSet rs) throws SQLException {
- int id = rs.getInt(2);
- LogData output = null;
- switch (id) {
- case MSG_PROBE_MEMORY:
- // memory
- output = new MemoryData();
- break;
- case MSG_PROBE_UICONTROL:
- // ui control
- output = new ControlData();
- break;
- case MSG_PROBE_UIEVENT:
- output = new UIEventData();
- break;
- case MSG_PROBE_FILE:
- // file
- output = new FileData();
- break;
- case MSG_PROBE_NETWORK:
- // network
- output = new NetworkData();
- break;
- case MSG_PROBE_GLES20:
- // graphics
- output = new GLES20LogData();
- break;
- case MSG_PROBE_LIFECYCLE:
- // life cycle
- output = new LifeCycleLogData();
- break;
- case MSG_PROBE_SCREENSHOT:
- // screenshot
- output = new ScreenShotData();
- break;
- case MSG_PROBE_SCENE:
- // scene
- output = new SceneData();
- break;
- case MSG_PROBE_THREAD:
- // thread
- output = new ThreadData();
- break;
- case MSG_PROBE_CUSTOM:
- // custom
- output = new CustomData();
- break;
- case MSG_PROBE_SYNC:
- // sync
- output = new SyncData();
- break;
- case LogCenterConstants.LOG_USER_FUNCTION:
- // user function entry/exit
- output = new UserFunctionData();
- break;
- case MSG_DATA_SAMPLE:
- case MSG_FUNCTION_ENTRY:
- case MSG_FUNCTION_EXIT:
- // profiling sample log
- output = new ProfileData();
- break;
- case MSG_DATA_SYSTEM:
- // system log
- output = new SystemData();
- break;
- case MSG_CONTEXT_SWITCH_ENTRY:
- case MSG_CONTEXT_SWITCH_EXIT:
- output = new ContextSwitchData();
- break;
- default:
- return null;
- }
- output.loadData(rs);
- return output;
- }
-
public static String getLogFormatName(int id) {
String formatName = null;
switch (id) {
case MSG_PROBE_SYNC:
formatName = "Sync";
break;
- case LogCenterConstants.LOG_USER_FUNCTION:
- // user function entry/exit
- formatName = "UserFunction";
- break;
case MSG_DATA_SAMPLE:
case MSG_FUNCTION_ENTRY:
case MSG_FUNCTION_EXIT:
formatName = "System";
break;
case MSG_DATA_RECORD:
- // format = ReplayLogFormat.getInstance();
+ // format = ReplayLogFormat.getInstance();
break;
default:
break;
return formatName;
}
- public static int getLogColumnCountbyId(int id) {
- int count = 0;
- switch (id) {
- case MSG_PROBE_MEMORY:
- case LogCenterConstants.LOG_MEMORY:
- // memory
- count = 16;
- break;
- case MSG_PROBE_UICONTROL:
- case LogCenterConstants.LOG_CONTROL:
- // ui control
- count = 19;
- break;
- case MSG_PROBE_UIEVENT:
- case LogCenterConstants.LOG_UI_EVENT:
- count = 19;
- break;
- case MSG_PROBE_FILE:
- case MSG_PROBE_NETWORK:
- break;
- case LogCenterConstants.LOG_GLES20:
- count = 16;
- break;
- case LogCenterConstants.LOG_RESOURCE:
- // file
- count = 19;
- break;
- case MSG_PROBE_LIFECYCLE:
- case LogCenterConstants.LOG_LIFECYCLE:
- // life cycle
- count = 12;
- break;
- case MSG_PROBE_SCREENSHOT:
- case LogCenterConstants.LOG_SCREENSHOT:
- // screenshot
- count = 15;
- break;
- case MSG_PROBE_SCENE:
- case LogCenterConstants.LOG_SCENE:
- // scene
- count = 20;
- break;
- case MSG_PROBE_THREAD:
- case LogCenterConstants.LOG_THREAD:
- // thread
- count = 17;
- break;
- case MSG_PROBE_CUSTOM:
- case LogCenterConstants.LOG_CUSTOM_CHART:
- // custom
- count = 18;
- break;
- case MSG_PROBE_SYNC:
- case LogCenterConstants.LOG_SYNC:
- // sync
- count = 16;
- break;
- case LogCenterConstants.LOG_USER_FUNCTION:
- // user fucntion entry/exit
- count = 17;
- break;
- case MSG_DATA_SAMPLE:
- case LogCenterConstants.LOG_PROFILING:
- // profiling sample log
- count = 4;
- break;
- case MSG_DATA_SYSTEM:
- case LogCenterConstants.LOG_DEVICE:
- // system log
- count = 35;
- break;
- default:
-
- }
- return count;
- }
-
- public static int getLogCountById(int id) {
- switch (id) {
- case MSG_PROBE_MEMORY:
- return memoryLogNum++;
-
- case MSG_PROBE_UICONTROL:
- return controlLogNum++;
-
- case MSG_PROBE_UIEVENT:
- return uiEventLogNum++;
-
- case MSG_PROBE_FILE:
- return fileLogNum++;
-
- case MSG_PROBE_LIFECYCLE:
- return lifecycleLogNum++;
-
- case MSG_PROBE_SCREENSHOT:
- return screenshotLogNum++;
-
- case MSG_PROBE_SCENE:
- return sceneLogNum++;
-
- case MSG_PROBE_THREAD:
- return threadLogNum++;
-
- case MSG_PROBE_CUSTOM:
- return customLogNum++;
-
- case MSG_PROBE_SYNC:
- return syncLogNum++;
-
- case LogCenterConstants.LOG_USER_FUNCTION:
- return userFunctionLogNum++;
-
- case MSG_DATA_SYSTEM:
- return systemLogNum++;
-
- case MSG_DATA_RECORD:
- return recordLogNum++;
-
- case MSG_PROBE_GLES20:
- return gles20LogNum++;
-
- case MSG_CONTEXT_SWITCH_ENTRY:
- case MSG_CONTEXT_SWITCH_EXIT:
- return contextSwitchLogNum++;
- case MSG_FUNCTION_ENTRY:
- case MSG_FUNCTION_EXIT:
- case MSG_DATA_SAMPLE:
- return profilingLogNum++;
- default:
- break;
- }
- return 0;
- }
-
public static void clean() {
- memoryLogNum = 0;
- controlLogNum = 0;
- uiEventLogNum = 0;
- fileLogNum = 0;
- lifecycleLogNum = 0;
- screenshotLogNum = 0;
- sceneLogNum = 0;
- threadLogNum = 0;
- customLogNum = 0;
- syncLogNum = 0;
- profilingLogNum = 0;
- systemLogNum = 0;
- recordLogNum = 0;
- userFunctionLogNum = 0;
- gles20LogNum = 0;
- contextSwitchLogNum = 0;
}
}
import static org.tizen.dynamicanalyzer.constant.CommonConstants.INT_SIZE;
import static org.tizen.dynamicanalyzer.constant.CommonConstants.LONG_SIZE;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-
import org.tizen.dynamicanalyzer.util.ByteUtil;
public class MemoryData extends ProbeCommonData {
Long key = getAddress();
return key.hashCode();
}
-
- @Override
- public void makePreparedStatement(PreparedStatement prep)
- throws SQLException {
- super.makePreparedStatement(prep);
- int index = ProbeCommonData.STATE_COUNT + 1;
-
- prep.setLong(index++, size);
- prep.setInt(index++, apiType);
- prep.setLong(index++, address);
- }
-
- @Override
- public void loadData(ResultSet rs) throws SQLException {
- super.loadData(rs);
- int index = ProbeCommonData.STATE_COUNT + 1;
- size = rs.getLong(index++);
- apiType = rs.getInt(index++);
- address = rs.getLong(index++);
- }
}
import static org.tizen.dynamicanalyzer.constant.CommonConstants.INT_SIZE;
import static org.tizen.dynamicanalyzer.constant.CommonConstants.LONG_SIZE;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-
import org.tizen.dynamicanalyzer.constant.CommonConstants;
import org.tizen.dynamicanalyzer.util.ByteUtil;
Long key = getFdValue();
return key.hashCode();
}
-
- @Override
- public void makePreparedStatement(PreparedStatement prep)
- throws SQLException {
- super.makePreparedStatement(prep);
- int index = ProbeCommonData.STATE_COUNT + 1;
-
- prep.setLong(index++, objectAddress);
- prep.setLong(index++, fdValue);
- prep.setInt(index++, fdApiType);
- prep.setInt(index++, destinationIPAddress);
- prep.setInt(index++, destinationPortAddress);
- prep.setInt(index++, messageSize);
- prep.setString(index++, packetMessage);
- }
-
- @Override
- public void loadData(ResultSet rs) throws SQLException {
- super.loadData(rs);
- int index = ProbeCommonData.STATE_COUNT + 1;
- objectAddress = rs.getLong(index++);
- fdValue = rs.getLong(index++);
- fdApiType = rs.getInt(index++);
- destinationIPAddress = rs.getInt(index++);
- destinationPortAddress = rs.getInt(index++);
- messageSize = rs.getInt(index++);
- packetMessage = rs.getString(index++);
- }
}
import static org.tizen.dynamicanalyzer.constant.CommonConstants.INT_SIZE;
import static org.tizen.dynamicanalyzer.constant.CommonConstants.LONG_SIZE;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-
import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.common.Global;
import org.tizen.dynamicanalyzer.project.BinaryInfo;
this.libName = libName;
}
- @Override
- public void makePreparedStatement(PreparedStatement prep) throws SQLException {
- super.makePreparedStatement(prep);
- int index = LogData.STATE_COUNT + 1;
-
- prep.setInt(index++, apiId);
- prep.setInt(index++, pid);
- prep.setInt(index++, tid);
- prep.setString(index++, args);
- prep.setString(index++, ret);
- prep.setLong(index++, errno);
- prep.setInt(index++, internalCall);
- prep.setLong(index++, callerAddress);
- prep.setInt(index++, reserved1);
- prep.setInt(index++, reserved2);
- prep.setString(index++, libName);
- }
-
- @Override
- public void loadData(ResultSet rs) throws SQLException {
- super.loadData(rs);
- int index = LogData.STATE_COUNT + 1;
-
- apiId = rs.getInt(index++);
- pid = rs.getInt(index++);
- tid = rs.getInt(index++);
- args = rs.getString(index++);
- ret = rs.getString(index++);
- errno = rs.getLong(index++);
- internalCall = rs.getInt(index++);
- callerAddress = rs.getLong(index++);
- reserved1 = rs.getInt(index++);
- reserved2 = rs.getInt(index++);
- libName = rs.getString(index++);
- }
-
public boolean isInternal() {
boolean ret = false;
if (AnalyzerConstants.CHECK_INTERNAL) {
import static org.tizen.dynamicanalyzer.constant.CommonConstants.INT_SIZE;
import static org.tizen.dynamicanalyzer.constant.CommonConstants.LONG_SIZE;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-
import org.tizen.dynamicanalyzer.util.ByteUtil;
public class SceneData extends ProbeCommonData {
public void setUserTransitionTime(int userTransitionTime) {
this.userTransitionTime = userTransitionTime;
}
-
- @Override
- public void makePreparedStatement(PreparedStatement prep)
- throws SQLException {
- super.makePreparedStatement(prep);
- int index = ProbeCommonData.STATE_COUNT + 1;
-
- prep.setString(index++, sceneName);
- prep.setString(index++, formName);
- prep.setLong(index++, formPointer);
- prep.setString(index++, panelName);
- prep.setLong(index++, panelPointer);
- prep.setInt(index++, transitionTime);
- prep.setInt(index++, userTransitionTime);
-
- }
-
- @Override
- public void loadData(ResultSet rs) throws SQLException {
- super.loadData(rs);
- int index = ProbeCommonData.STATE_COUNT + 1;
- sceneName = rs.getString(index++);
- formName = rs.getString(index++);
- formPointer = rs.getLong(index++);
- panelName = rs.getString(index++);
- panelPointer = rs.getLong(index++);
- transitionTime = rs.getInt(index++);
- userTransitionTime = rs.getInt(index++);
- }
}
*/
package org.tizen.dynamicanalyzer.swap.model.data;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-
import org.tizen.dynamicanalyzer.util.ByteUtil;
public class ScreenShotData extends ProbeCommonData {
public void setOrientation(int orientation) {
this.orientation = orientation;
}
-
- @Override
- public void makePreparedStatement(PreparedStatement prep)
- throws SQLException {
- super.makePreparedStatement(prep);
- int index = ProbeCommonData.STATE_COUNT + 1;
-
- prep.setString(index++, imageFilePath);
- prep.setInt(index++, orientation);
- }
-
- @Override
- public void loadData(ResultSet rs) throws SQLException {
- super.loadData(rs);
- int index = ProbeCommonData.STATE_COUNT + 1;
- imageFilePath = rs.getString(index++);
- orientation = rs.getInt(index++);
- }
}
import static org.tizen.dynamicanalyzer.constant.CommonConstants.INT_SIZE;
import static org.tizen.dynamicanalyzer.constant.CommonConstants.LONG_SIZE;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-
import org.tizen.dynamicanalyzer.util.ByteUtil;
public class SyncData extends ProbeCommonData {
public void setApiType(int apiType) {
this.apiType = apiType;
}
-
- @Override
- public void makePreparedStatement(PreparedStatement prep)
- throws SQLException {
- super.makePreparedStatement(prep);
- int index = ProbeCommonData.STATE_COUNT + 1;
-
- prep.setLong(index++, syncValue);
- prep.setInt(index++, syncType);
- prep.setInt(index++, apiType);
- }
-
- @Override
- public void loadData(ResultSet rs) throws SQLException {
- super.loadData(rs);
- int index = ProbeCommonData.STATE_COUNT + 1;
- syncValue = rs.getLong(index++);
- syncType = rs.getInt(index++);
- apiType = rs.getInt(index++);
- }
}
import static org.tizen.dynamicanalyzer.constant.CommonConstants.INT_SIZE;
import static org.tizen.dynamicanalyzer.constant.CommonConstants.LONG_SIZE;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-
import org.tizen.dynamicanalyzer.common.Global;
import org.tizen.dynamicanalyzer.constant.CommonConstants;
import org.tizen.dynamicanalyzer.util.ByteUtil;
-import org.tizen.dynamicanalyzer.util.Logger;
import org.tizen.dynamicanalyzer.util.UnsignedInt;
public class SystemData extends LogData {
public void setOtherProcessLoad(String otherProcessLoad) {
this.otherProcessLoad = otherProcessLoad;
}
-
- /*
- * TODO Insert dummy data for compile. this method will be removed.
- */
- @Override
- public void makePreparedStatement(PreparedStatement prep)
- throws SQLException {
- super.makePreparedStatement(prep);
- int index = LogData.STATE_COUNT + 1;
-
- prep.setFloat(index++, 0);
- prep.setString(index++, cpuFrequency);
- prep.setString(index++, cpuLoad);
- prep.setInt(index++, 0);
- prep.setString(index++, "0");
- prep.setInt(index++, 0);
- prep.setString(index++, "0");
- prep.setInt(index++, 0);
- prep.setInt(index++, 0);
- prep.setInt(index++, 0);
- prep.setInt(index++, 0);
- prep.setLong(index++, 0);
- prep.setLong(index++, 0);
- prep.setLong(index++, systemMemoryUsed);
- prep.setInt(index++, 0);
- prep.setInt(index++, 0);
- prep.setInt(index++, 0);
- prep.setInt(index++, 0);
- prep.setInt(index++, 0);
- prep.setInt(index++, 0);
- prep.setInt(index++, 0);
- prep.setInt(index++, wifi);
- prep.setInt(index++, btStatus);
- prep.setInt(index++, gpsStatus);
- prep.setInt(index++, brightness);
- prep.setInt(index++, camera);
- prep.setInt(index++, sound);
- prep.setInt(index++, audio);
- prep.setInt(index++, vibration);
- prep.setInt(index++, voltage);
- prep.setInt(index++, rssi);
- prep.setInt(index++, video);
- prep.setInt(index++, call);
- prep.setInt(index++, dnet);
- prep.setInt(index++, 0);
- prep.setString(index++, deviceEnergyUsage);
- prep.setString(index++, applicationEnergyUsage);
- }
-
- /*
- * TODO this method will be removed.
- */
- @Override
- public void loadData(ResultSet rs) throws SQLException {
- super.loadData(rs);
- int index = LogData.STATE_COUNT + 1;
-
- cpuFrequency = rs.getString(index++);
- cpuLoad = rs.getString(index++);
- systemMemoryUsed = rs.getLong(index++);
- wifi = rs.getInt(index++);
- btStatus = rs.getInt(index++);
- gpsStatus = rs.getInt(index++);
- brightness = rs.getInt(index++);
- camera = rs.getInt(index++);
- sound = rs.getInt(index++);
- audio = rs.getInt(index++);
- vibration = rs.getInt(index++);
- voltage = rs.getInt(index++);
- rssi = rs.getInt(index++);
- video = rs.getInt(index++);
- call = rs.getInt(index++);
- dnet = rs.getInt(index++);
- deviceEnergyUsage = rs.getString(index++);
- applicationEnergyUsage = rs.getString(index++);
- }
-
+
@Override
public int getPid() {
return 0;
import static org.tizen.dynamicanalyzer.constant.CommonConstants.INT_SIZE;
import static org.tizen.dynamicanalyzer.constant.CommonConstants.LONG_SIZE;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-
import org.tizen.dynamicanalyzer.util.ByteUtil;
public class ThreadData extends ProbeCommonData {
public void setClassName(String className) {
this.className = className;
}
-
- @Override
- public void makePreparedStatement(PreparedStatement prep)
- throws SQLException {
- super.makePreparedStatement(prep);
- int index = ProbeCommonData.STATE_COUNT + 1;
-
- prep.setLong(index++, pThreadId);
- prep.setLong(index++, ospThreadId);
- prep.setInt(index++, threadType);
- prep.setInt(index++, apiType);
- }
-
- @Override
- public void loadData(ResultSet rs) throws SQLException {
- super.loadData(rs);
- int index = ProbeCommonData.STATE_COUNT + 1;
- pThreadId = rs.getLong(index++);
- ospThreadId = rs.getLong(index++);
- threadType = rs.getInt(index++);
- apiType = rs.getInt(index++);
- }
}
import static org.tizen.dynamicanalyzer.constant.CommonConstants.INT_SIZE;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-
import org.tizen.dynamicanalyzer.util.ByteUtil;
public class UIEventData extends ProbeCommonData {
public int getLogNum() {
return logNum++;
}
-
- @Override
- public void makePreparedStatement(PreparedStatement prep)
- throws SQLException {
- super.makePreparedStatement(prep);
- int index = ProbeCommonData.STATE_COUNT + 1;
-
- prep.setInt(index++, eventType);
- prep.setInt(index++, detailType);
- prep.setInt(index++, x);
- prep.setInt(index++, y);
- prep.setString(index++, info1);
- prep.setInt(index++, info2);
- }
-
- @Override
- public void loadData(ResultSet rs) throws SQLException {
- super.loadData(rs);
- int index = ProbeCommonData.STATE_COUNT + 1;
-
- eventType = rs.getInt(index++);
- detailType = rs.getInt(index++);
- x = rs.getInt(index++);
- y = rs.getInt(index++);
- info1 = rs.getString(index++);
- info2 = rs.getInt(index++);
- }
}
+++ /dev/null
-/*
- * Dynamic Analyzer
- *
- * Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Jaewon Lim <jaewon81.lim@samsung.com>
- * Jooyoul Lee <jy.exe.lee@samsung.com>
- * Juyoung Kim <j0.kim@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-package org.tizen.dynamicanalyzer.swap.model.data;
-
-import static org.tizen.dynamicanalyzer.constant.CommonConstants.INT_SIZE;
-import static org.tizen.dynamicanalyzer.constant.CommonConstants.LONG_SIZE;
-
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-
-import org.tizen.dynamicanalyzer.util.ByteUtil;
-
-public class UserFunctionData extends ProbeCommonData {
-
- long lowPc = 0;
- long highPc = 0;
- int type = 0;
- long elapsedTime = 0;
- long pcAddr = 0;
-
- public UserFunctionData() {
-
- }
-
- public boolean makeData(byte[] data) {
- super.makeData(data);
- lowPc = ByteUtil.toLong(data, index);
- index += LONG_SIZE;
-
- highPc = ByteUtil.toLong(data, index);
- index += LONG_SIZE;
-
- type = ByteUtil.toInt(data, index);
- index += INT_SIZE;
-
- elapsedTime = ByteUtil.toLong(data, index);
- index += LONG_SIZE;
-
- pcAddr = ByteUtil.toLong(data, index);
-
- return true;
- }
-
- public long getLowPc() {
- return lowPc;
- }
-
- public void setLowPc(long lowPc) {
- this.lowPc = lowPc;
- }
-
- public long getHighPc() {
- return highPc;
- }
-
- public void setHighPc(long highPc) {
- this.highPc = highPc;
- }
-
- public int getType() {
- return type;
- }
-
- public void setType(int type) {
- this.type = type;
- }
-
- public long getElapsedTime() {
- return elapsedTime;
- }
-
- public void setElapsedTime(long elapsedTime) {
- this.elapsedTime = elapsedTime;
- }
-
- public long getPcAddr() {
- return pcAddr;
- }
-
- public void setPcAddr(long pcAddr) {
- this.pcAddr = pcAddr;
- }
-
- @Override
- public void makePreparedStatement(PreparedStatement prep)
- throws SQLException {
- super.makePreparedStatement(prep);
- int index = ProbeCommonData.STATE_COUNT + 1;
-
- prep.setLong(index++, lowPc);
- prep.setLong(index++, highPc);
- prep.setInt(index++, type);
- prep.setLong(index++, elapsedTime);
- prep.setLong(index++, pcAddr);
- }
-
- @Override
- public void loadData(ResultSet rs) throws SQLException {
- super.loadData(rs);
- int index = ProbeCommonData.STATE_COUNT + 1;
- lowPc = rs.getLong(index++);
- highPc = rs.getLong(index++);
- type = rs.getInt(index++);
- elapsedTime = rs.getLong(index++);
- pcAddr = rs.getLong(index++);
- }
-}
+++ /dev/null
-/*
- * Dynamic Analyzer
- *
- * 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>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-package org.tizen.dynamicanalyzer.ui.info.callstack;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
-import org.tizen.dynamicanalyzer.common.AnalyzerManager;
-import org.tizen.dynamicanalyzer.common.Global;
-import org.tizen.dynamicanalyzer.common.SymbolManager;
-import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
-import org.tizen.dynamicanalyzer.project.ProcessMemoryMap;
-import org.tizen.dynamicanalyzer.swap.callstack.BaseCallstackManager;
-import org.tizen.dynamicanalyzer.swap.model.data.LogData;
-import org.tizen.dynamicanalyzer.swap.model.data.ProbeCommonData;
-import org.tizen.dynamicanalyzer.swap.model.data.UserFunctionData;
-import org.tizen.dynamicanalyzer.ui.summary.profiling.ProfileDataMaker;
-import org.tizen.dynamicanalyzer.util.Logger;
-import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
-
-public class CallStackManager extends BaseCallstackManager {
-
- public void makeUserCallstack(LogData input, ProfileDataMaker profiler) {
- UserFunctionData log = (UserFunctionData) input;
- Map<Long, CallStackUnit> addrMap = getCallStackApiAddrByPidMap(log.getPid());
- boolean isPieBuild = AnalyzerUtil.isPieBuild(log.getPid(), log.getTime());
- ProcessMemoryMap pmap = Global.getProject()
- .getProcessInformation(log.getPid()).getProcessMemoryMap(log.getTime());
- if (pmap == null) {
- return;
- }
-
- String binPath = AnalyzerUtil.getProcessLocalBinaryPath(log.getPid(),
- log.getTime());
- if (null == binPath || binPath.isEmpty()) {
- return;
- }
-
- String baseAddr = Long.toString(pmap.getMainbinary().getLowestAddress());
- String strSelfAddr = Long.toString(log.getPcAddr());
- String strCallerAddr = Long.toString(log.getCallerPcAddr());
-
- int seq = log.getSeq();
- int tid = log.getTid();
-
- long selfAddr = log.getPcAddr();
- long callerAddr = log.getCallerPcAddr();
-
- CallStackData callstackData = new CallStackData(seq);
- CallStackUnit selfCallstackUnit = addrMap.get(selfAddr);
-
- if (null == selfCallstackUnit) {
- String strSelfFuncName = SymbolManager.addr2func(binPath, strSelfAddr,
- isPieBuild, baseAddr);
- String strSelfSymbol = getUserFunctionPosition()
- + AnalyzerConstants.CALLSTACK_API_TOKEN_STRING + strSelfFuncName;
- selfCallstackUnit = new CallStackUnit(selfAddr, strSelfSymbol, log);
- addrMap.put(selfAddr, selfCallstackUnit);
- }
-
- // insert call count
- profiler.makeFupDataForCallTrace(selfCallstackUnit, log);
-
- List<CallStackItem> userCallstack = getUserCallstack(tid);
- int size = userCallstack.size();
-
- CallStackUnit callerCallstackUnit = addrMap.get(callerAddr);
- if (null == callerCallstackUnit) {
- String strCallerFuncName = SymbolManager.addr2func(binPath, strCallerAddr,
- isPieBuild, baseAddr);
- String strCallerSymbol = getUserFunctionPosition(log.getPid(), log.getTime())
- + AnalyzerConstants.CALLSTACK_API_TOKEN_STRING + strCallerFuncName;
- callerCallstackUnit = new CallStackUnit(callerAddr, strCallerSymbol, log);
- addrMap.put(callerAddr, callerCallstackUnit);
- }
-
- int eventType = log.getType();
- if (eventType == LogCenterConstants.USER_FUNCTION_EVENT_TYPE_ENTER) {
- if (size == 0) {
- userCallstack.add(new CallStackItem(selfCallstackUnit));
- } else {
- if (!AnalyzerManager.isInBinaryRange(callerAddr)) {
- CallStackUnit callbackApi = new CallStackUnit(
- LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR,
- LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_SYMBOL, log);
- userCallstack.add(new CallStackItem(callbackApi));
- if (addrMap.get(LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR) == null) {
- CallStackUnit defaultCallstackUnit = new CallStackUnit(
- LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR,
- LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_SYMBOL,
- log);
- addrMap.put(LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR,
- defaultCallstackUnit);
- }
- } else if (callerCallstackUnit.getFunctionName().contains(
- AnalyzerConstants.VIRTUAL_THUNK)) {
- CallStackUnit callbackApi = new CallStackUnit(
- LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR,
- LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_SYMBOL, log);
- userCallstack.add(new CallStackItem(callbackApi));
- if (addrMap.get(LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR) == null) {
- CallStackUnit defaultCallstackUnit = new CallStackUnit(
- LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR,
- LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_SYMBOL,
- log);
- addrMap.put(LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR,
- defaultCallstackUnit);
- }
- userCallstack.add(new CallStackItem(callerCallstackUnit));
- } else {
- CallStackUnit callerCsa = addrMap.get(callerAddr);
- if (null == callerCsa) {
- callerCsa = userCallstack.get(size - 1).getCallStackUnit();
- callerCsa.setFunctionStartAddr(callerCsa.getAddr());
- callerCsa.setAddr(callerAddr);
- } else {
- callerCsa.setFunctionStartAddr(userCallstack.get(size - 1)
- .getCallStackUnit().getAddr());
- userCallstack.set(size - 1, new CallStackItem(callerCsa));
- }
- }
- userCallstack.add(new CallStackItem(selfCallstackUnit));
- }
- size = userCallstack.size();
- for (int i = size - 1; i >= 0; i--) {
- callstackData.getAddrs().add(
- userCallstack.get(i).getCallStackUnit().getAddr());
- }
- getCallStackDataBySeqMap().put(seq, callstackData);
- } else if (eventType == LogCenterConstants.USER_FUNCTION_EVENT_TYPE_EXIT) {
- if (size == 0) {
- // this case only range profiling, other time is bug
- return;
- }
- CallStackUnit removeCallStackUnit = userCallstack.get(size - 1)
- .getCallStackUnit();
- if (selfCallstackUnit.getFunctionName().equals(
- removeCallStackUnit.getFunctionName())) {
- userCallstack.remove(size - 1);
- if (size - 2 > 0) {
- if (callerCallstackUnit.getFunctionName().contains(
- AnalyzerConstants.VIRTUAL_THUNK)) {
- if (callerCallstackUnit.getFunctionName().equals(
- userCallstack.get(size - 2).getCallStackUnit()
- .getFunctionName())) {
- userCallstack.remove(size - 2);
- } else {
- Logger.debug("makeUserCallstack : [virtual thunk] EXIT caller is not the same"
- + "as top of user callstack after remove EXIT self");
- }
- }
- }
- size = userCallstack.size();
- if (size - 1 > 0) {
- CallStackUnit checkCallStackUnit = userCallstack.get(size - 1)
- .getCallStackUnit();
- if (checkCallStackUnit.getFunctionName().equals(
- LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC)) {
- userCallstack.remove(size - 1);
- }
- }
- size = userCallstack.size();
- if (size > 0) {
- CallStackUnit prevCallstackUnit = userCallstack.get(size - 1)
- .getCallStackUnit();
- long prevSelfAddr = prevCallstackUnit.getFunctionStartAddr();
- CallStackUnit callerCsa = addrMap.get(prevSelfAddr);
- if (null == callerCsa) {
- prevCallstackUnit.setAddr(prevSelfAddr);
- } else {
- userCallstack.set(size - 1, new CallStackItem(callerCsa));
- }
- }
- } else {
- Logger.debug("makeUserCallstack : EXIT self is not the same as top of user callstack");
- }
- }
- }
- // TODO: will be removed with other 2.2 only code
- public void makeUserCallstackforRange(LogData input, ProfileDataMaker profiler) {
- UserFunctionData log = (UserFunctionData) input;
- Map<Long, CallStackUnit> addrMap = getCallStackApiAddrByPidMap(log.getPid());
- boolean isPieBuild = AnalyzerUtil.isPieBuild(log.getPid(), log.getTime());
- ProcessMemoryMap pmap = Global.getProject()
- .getProcessInformation(log.getPid()).getProcessMemoryMap(log.getTime());
- if (pmap == null) {
- return;
- }
-
- String binPath = AnalyzerUtil.getProcessLocalBinaryPath(log.getPid(),
- log.getTime());
- if (null == binPath || binPath.isEmpty()) {
- return;
- }
-
- String baseAddr = Long.toString(pmap.getMainbinary().getLowestAddress());
- String strSelfAddr = Long.toString(log.getPcAddr());
- String strCallerAddr = Long.toString(log.getCallerPcAddr());
-
- int seq = log.getSeq();
- int tid = log.getTid();
-
- long selfAddr = log.getPcAddr();
- long callerAddr = log.getCallerPcAddr();
-
- CallStackData callstackData = new CallStackData(seq);
- CallStackUnit selfCallstackUnit = addrMap.get(selfAddr);
-
- if (null == selfCallstackUnit) {
- String strSelfFuncName = SymbolManager.addr2func(binPath, strSelfAddr,
- isPieBuild, baseAddr);
- String strSelfSymbol = getUserFunctionPosition()
- + AnalyzerConstants.CALLSTACK_API_TOKEN_STRING + strSelfFuncName;
- selfCallstackUnit = new CallStackUnit(selfAddr, strSelfSymbol, log);
- addrMap.put(selfAddr, selfCallstackUnit);
- }
-
- // insert call count
- profiler.makeFupDataForCallTrace(selfCallstackUnit, log);
-
- List<CallStackItem> userCallstack = getUserCallstack(tid);
- int size = userCallstack.size();
-
- CallStackUnit callerCallstackUnit = addrMap.get(callerAddr);
- if (null == callerCallstackUnit) {
- String strCallerFuncName = SymbolManager.addr2func(binPath, strCallerAddr,
- isPieBuild, baseAddr);
- String strCallerSymbol = getUserFunctionPosition(log.getPid(), log.getTime())
- + AnalyzerConstants.CALLSTACK_API_TOKEN_STRING + strCallerFuncName;
- callerCallstackUnit = new CallStackUnit(callerAddr, strCallerSymbol, log);
- addrMap.put(callerAddr, callerCallstackUnit);
- }
-
- int eventType = log.getType();
- if (eventType == LogCenterConstants.USER_FUNCTION_EVENT_TYPE_ENTER) {
- if (size == 0) {
- userCallstack.add(new CallStackItem(selfCallstackUnit));
- } else {
- if (!AnalyzerManager.isInBinaryRange(callerAddr)) {
- CallStackUnit callbackApi = new CallStackUnit(
- LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR,
- LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_SYMBOL, log);
- userCallstack.add(new CallStackItem(callbackApi));
- if (addrMap.get(LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR) == null) {
- CallStackUnit defaultCallstackUnit = new CallStackUnit(
- LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR,
- LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_SYMBOL,
- log);
- addrMap.put(LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR,
- defaultCallstackUnit);
- }
- } else if (callerCallstackUnit.getFunctionName().contains(
- AnalyzerConstants.VIRTUAL_THUNK)) {
- CallStackUnit callbackApi = new CallStackUnit(
- LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR,
- LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_SYMBOL, log);
- userCallstack.add(new CallStackItem(callbackApi));
- if (addrMap.get(LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR) == null) {
- CallStackUnit defaultCallstackUnit = new CallStackUnit(
- LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR,
- LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_SYMBOL,
- log);
- addrMap.put(LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR,
- defaultCallstackUnit);
- }
- userCallstack.add(new CallStackItem(callerCallstackUnit));
- } else {
- CallStackUnit callerCsa = addrMap.get(callerAddr);
- if (null == callerCsa) {
- callerCsa = userCallstack.get(size - 1).getCallStackUnit();
- callerCsa.setFunctionStartAddr(callerCsa.getAddr());
- callerCsa.setAddr(callerAddr);
- } else {
- callerCsa.setFunctionStartAddr(userCallstack.get(size - 1)
- .getCallStackUnit().getAddr());
- userCallstack.set(size - 1, new CallStackItem(callerCsa));
- }
- }
- userCallstack.add(new CallStackItem(selfCallstackUnit));
- }
- size = userCallstack.size();
- for (int i = size - 1; i >= 0; i--) {
- callstackData.getAddrs().add(
- userCallstack.get(i).getCallStackUnit().getAddr());
- }
- getCallStackDataBySeqMap().put(seq, callstackData);
- } else if (eventType == LogCenterConstants.USER_FUNCTION_EVENT_TYPE_EXIT) {
- if (size == 0) {
- // this case only range profiling, other time is bug
- return;
- }
- CallStackUnit removeCallStackUnit = userCallstack.get(size - 1)
- .getCallStackUnit();
- if (selfCallstackUnit.getFunctionName().equals(
- removeCallStackUnit.getFunctionName())) {
- userCallstack.remove(size - 1);
- if (size - 2 > 0) {
- if (callerCallstackUnit.getFunctionName().contains(
- AnalyzerConstants.VIRTUAL_THUNK)) {
- if (callerCallstackUnit.getFunctionName().equals(
- userCallstack.get(size - 2).getCallStackUnit()
- .getFunctionName())) {
- userCallstack.remove(size - 2);
- } else {
- Logger.debug("makeUserCallstack : [virtual thunk] EXIT caller is not the same"
- + "as top of user callstack after remove EXIT self");
- }
- }
- }
- size = userCallstack.size();
- if (size - 1 > 0) {
- CallStackUnit checkCallStackUnit = userCallstack.get(size - 1)
- .getCallStackUnit();
- if (checkCallStackUnit.getFunctionName().equals(
- LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC)) {
- userCallstack.remove(size - 1);
- }
- }
- size = userCallstack.size();
- if (size > 0) {
- CallStackUnit prevCallstackUnit = userCallstack.get(size - 1)
- .getCallStackUnit();
- long prevSelfAddr = prevCallstackUnit.getFunctionStartAddr();
- CallStackUnit callerCsa = addrMap.get(prevSelfAddr);
- if (null == callerCsa) {
- prevCallstackUnit.setAddr(prevSelfAddr);
- } else {
- userCallstack.set(size - 1, new CallStackItem(callerCsa));
- }
- }
- } else {
- Logger.debug("makeUserCallstack : EXIT self is not the same as top of user callstack");
- }
- }
- }
-
- public void makeCallstackWithoutBacktrace(LogData inputData) {
- Map<Long, CallStackUnit> addrMap = getCallStackApiAddrByPidMap(inputData.getPid());
- boolean isPieBuild = AnalyzerUtil.isPieBuild(inputData.getPid(),
- inputData.getTime());
- ProcessMemoryMap pmap = Global.getProject()
- .getProcessInformation(inputData.getPid())
- .getProcessMemoryMap(inputData.getTime());
- if (pmap == null) {
- return;
- }
-
- String binPath = AnalyzerUtil.getProcessLocalBinaryPath(inputData.getPid(),
- inputData.getTime());
- if (null == binPath || binPath.isEmpty()) {
- return;
- }
-
- String baseAddr = Long.toString(pmap.getMainbinary().getLowestAddress());
-
- ProbeCommonData log = (ProbeCommonData) inputData;
- // String strSeq = input[LogCenterConstants.SEQUENCE_NUMBER_INDEX];
- // String strTid = input[LogCenterConstants.THREAD_ID_INDEX];
- // String strCallerAddr = input[LogCenterConstants.CALLER_PCADDR_INDEX];
-
- // int seq = Integer.parseInt(strSeq);
- // int tid = Integer.parseInt(strTid);
- int seq = log.getSeq();
- int tid = log.getTid();
- // long callerAddr = 0;
- long callerAddr = log.getCallerPcAddr();
- // if (!strCallerAddr.isEmpty()) {
- // callerAddr = Long.parseLong(strCallerAddr);
- // } else {
- // CallStackData callstackData = new CallStackData(seq);
- // getCallStackDataBySeqMap().put(seq, callstackData);
- // return;
- // }
- if (callerAddr < 0) {
- CallStackData callstackData = new CallStackData(seq);
- getCallStackDataBySeqMap().put(seq, callstackData);
- return;
- }
- String strCallerAddr = Long.toString(callerAddr);
-
- List<CallStackItem> probeCallstack = new ArrayList<CallStackItem>(
- getUserCallstack(tid));
- int size = probeCallstack.size();
-
- CallStackData callstackData = new CallStackData(seq);
-
- if ((size == 0) || (!AnalyzerManager.isInBinaryRange(callerAddr))) {
- CallStackUnit callbackApi = new CallStackUnit(
- LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR,
- LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_SYMBOL, log);
- probeCallstack.add(new CallStackItem(callbackApi));
- if (addrMap.get(LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR) == null) {
- CallStackUnit defaultCallstackUnit = new CallStackUnit(
- LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR,
- LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_SYMBOL, log);
- addrMap.put(LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR,
- defaultCallstackUnit);
- }
- } else {
- CallStackUnit callerCallstackUnit = addrMap.get(callerAddr);
- if (null == callerCallstackUnit) {
- String strCallerFuncName = SymbolManager.addr2func(binPath,
- strCallerAddr, isPieBuild, baseAddr);
- String strCallerSymbol = getUserFunctionPosition()
- + AnalyzerConstants.CALLSTACK_API_TOKEN_STRING
- + strCallerFuncName;
- callerCallstackUnit = new CallStackUnit(callerAddr, strCallerSymbol, log);
- addrMap.put(callerAddr, callerCallstackUnit);
- }
-
- CallStackUnit topUserCallstack = probeCallstack.get(size - 1)
- .getCallStackUnit();
- if (callerCallstackUnit.getFunctionName().equals(
- topUserCallstack.getFunctionName())) {
- probeCallstack.set(size - 1, new CallStackItem(callerCallstackUnit));
- } else {
- Logger.debug("probe caller is not the same as top of user callstack"); //$NON-NLS-1$
- }
- }
-
- size = probeCallstack.size();
- for (int i = size - 1; i >= 0; i--) {
- callstackData.getAddrs().add(
- probeCallstack.get(i).getCallStackUnit().getAddr());
- }
- getCallStackDataBySeqMap().put(seq, callstackData);
-
- }
-
- public void clear() {
- callstackApiAddrByPidMap.clear();
- callstackDataBySeqMap.clear();
- userFunctionBin = null;
- userCallstackByTidMap.clear();
- dupUserCallByTidMap.clear();
- seqTimeByTidMap.clear();
- }
-
-}
import org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants;
import org.tizen.dynamicanalyzer.swap.model.data.LogDataFactory;
import org.tizen.dynamicanalyzer.swap.model.data.ProfileData;
-import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackManager;
import org.tizen.dynamicanalyzer.ui.summary.SummaryDataManager;
import org.tizen.dynamicanalyzer.ui.summary.profiling.FunctionSampleDBTable;
import org.tizen.dynamicanalyzer.ui.summary.profiling.ProfileDataMaker;
// private FileDataMaker fileDataMaker = null;
private HashMap<Integer, ProfileDataMaker> profileDataMakerMap = null;
private HashMap<Integer, ProfileDataMaker> swapProfileDataMakerMap = null;
- private BaseCallstackManager callstackManager = null;
private BaseCallstackManager swapCallstackManager = null;
private long markerStartTime = 0;
}
private RangeDataManager() {
- callstackManager = new CallStackManager();
swapCallstackManager = new SWAPCallStackManager(true);
// fileDataMaker = new FileDataMaker(failedChecker, leakDetector,
}
public void clearRange() {
- callstackManager.clear();
swapCallstackManager.clear();
if (profileDataMakerMap != null)
profileDataMakerMap.clear();
public ProfileDataMaker getProfileDataMakerByPid(int pid) {
ProfileDataMaker profileDataMaker = getProfileDataMakerMap().get(pid);
if (null == profileDataMaker) {
- if (DACommunicator.isSWAPVersion()) {
+// if (DACommunicator.isSWAPVersion()) {
profileDataMaker = new ProfileDataMaker(swapCallstackManager);
- } else {
- profileDataMaker = new ProfileDataMaker(callstackManager);
- }
+// }
profileDataMaker.setPid(pid);
getProfileDataMakerMap().put(pid, profileDataMaker);
}
import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.common.path.PathConstants;
import org.tizen.dynamicanalyzer.communicator.DACommunicator;
-import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
import org.tizen.dynamicanalyzer.swap.callstack.BaseCallstackManager;
import org.tizen.dynamicanalyzer.swap.model.data.LogData;
import org.tizen.dynamicanalyzer.swap.model.data.ProfileData;
-import org.tizen.dynamicanalyzer.swap.model.data.UserFunctionData;
import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackData;
import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackItem;
import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackUnit;
}
public void makeFupDataForCallTrace(CallStackUnit inputCallstackApiData,
- UserFunctionData log) {
- long exeTime = 0;
- int type = log.getType();
- int tid = log.getTid();
- List<CallStackItem> userCallstack = callstackManager.getUserCallstack(tid);
- int size = userCallstack.size();
-
- if (type == LogCenterConstants.USER_FUNCTION_EVENT_TYPE_EXIT) {
- if(size == 0 ||
- userCallstack.get(size - 1).getCallStackUnit()
- .getFunctionId() != inputCallstackApiData.getFunctionId()) {
- Logger.debug("exit without entry or EXIT self is not the same as top of user callstack :"
- + inputCallstackApiData.getFunctionName()); //$NON-NLS-1$
- return;
- }
- exeTime += log.getElapsedTime();
- }
-
- ProfilingData parent = getProfilingDataByKey(inputCallstackApiData
- .getPath());
- if (null == parent) {
- parent = makeNewProfilingData(inputCallstackApiData, true);
- checkUserCall(inputCallstackApiData, parent, null, log);
-
- ProfilingData child = makeNewProfilingData(inputCallstackApiData,
- false);
- parent.addChild(child);
- child.addElapsedTime(exeTime);
- child.setParent(parent.getName());
-
- if (type != LogCenterConstants.USER_FUNCTION_EVENT_TYPE_EXIT) {
- child.addCallCount();
- }
- } else { // null != parent
- ProfilingData child = getProfilingDataByKey(inputCallstackApiData
- .getSymbol());
- if (null == child) {
- child = makeNewProfilingData(inputCallstackApiData, false);
- parent.addChild(child);
- child.setParent(parent.getName());
- }
- child.addElapsedTime(exeTime);
- if (type != LogCenterConstants.USER_FUNCTION_EVENT_TYPE_EXIT) {
- child.addCallCount();
- }
-
- // calculate internal time
- CallstackTree current = getCurrentCallstackTree(tid);
- if (type == LogCenterConstants.USER_FUNCTION_EVENT_TYPE_EXIT) {
- if (null == current) {
- // bug
- Logger.debug("exit without entry - range only :" + inputCallstackApiData.getFunctionName()); //$NON-NLS-1$
- } else {
- CallstackTree parentCt = current.getParent();
- if (null != parentCt) {
- parentCt.addChildExeTime(current.getThis()
- .getLastElapsedTime());
- }
- child.addExclusiveElapsedTime(current.getExclusiveExeTime());
- putCurrentCallstackTree(tid, current.getParent());
- }
- } else {
- if (null == current) {
- CallstackTree ct = new CallstackTree(child, null);
- putCurrentCallstackTree(tid, ct);
- } else {
- CallstackTree ct = new CallstackTree(child, current);
- current.addChild(ct);
- putCurrentCallstackTree(tid, ct);
- }
- }
- }
- }
-
- public void makeFupDataForCallTrace(CallStackUnit inputCallstackApiData,
ProfileData log) {
long exeTime = 0;
int type = log.getId();
import org.tizen.dynamicanalyzer.communicator.DACommunicator;
import org.tizen.dynamicanalyzer.constant.CommonConstants;
import org.tizen.dynamicanalyzer.database.DBTable;
-import org.tizen.dynamicanalyzer.nl.ConfigureLabels;
import org.tizen.dynamicanalyzer.nl.TimelineChartLabels;
import org.tizen.dynamicanalyzer.project.BinaryInfo;
import org.tizen.dynamicanalyzer.project.LibraryObject;
import org.tizen.dynamicanalyzer.resources.FontResources;
import org.tizen.dynamicanalyzer.swap.platform.BinarySettingData;
import org.tizen.dynamicanalyzer.swap.platform.BinarySettingManager;
-import org.tizen.dynamicanalyzer.swap.platform.ui.BinarySettingProcessor;
import org.tizen.dynamicanalyzer.swap.platform.ui.BinarySettingProgressManager;
import org.tizen.dynamicanalyzer.swap.platform.ui.InputRow;
import org.tizen.dynamicanalyzer.swap.platform.ui.LoadSettingDialog;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.Map;
import java.util.HashSet;
+import java.util.LinkedHashMap;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
package org.tizen.dynamicanalyzer.ui.userinterface.control;
import org.tizen.dynamicanalyzer.constant.CommonConstants;
-import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
import org.tizen.dynamicanalyzer.swap.model.data.LogData;
public class UIControlListData {
- public static final int KEY_INDEX = LogCenterConstants.SEQUENCE_NUMBER_INDEX;
-
public static final int USER_INTERFACE_CONTROL_LIST_CONTROL = 0;
public static final int USER_INTERFACE_CONTROL_LIST_CLASS_NAME = 1;
public static final int USER_INTERFACE_CONTROL_LIST_INITIALIZER_TIME = 2;
import java.util.ArrayList;
import org.tizen.dynamicanalyzer.constant.CommonConstants;
-import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
import org.tizen.dynamicanalyzer.swap.model.data.LogData;
import org.tizen.dynamicanalyzer.ui.summary.profiling.ProfilingData;
import org.tizen.dynamicanalyzer.utils.Formatter;
public class UIFunctionProfilingData {
- public static final int KEY_INDEX = LogCenterConstants.SEQUENCE_NUMBER_INDEX;
-
public static final int USER_INTERFACE_PROFILING_LIST_API_NAME = 0;
public static final int USER_INTERFACE_PROFILING_LIST_EXCL_CPU_TIME = 1;
public static final int USER_INTERFACE_PROFILING_LIST_INCL_CPU_TIME = 2;
import org.tizen.dynamicanalyzer.common.SymbolManager;
import org.tizen.dynamicanalyzer.constant.CommonConstants;
-import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
import org.tizen.dynamicanalyzer.swap.model.data.LogData;
import org.tizen.dynamicanalyzer.utils.Formatter;
public class UISceneData {
- public static final int KEY_INDEX = LogCenterConstants.SEQUENCE_NUMBER_INDEX;
-
public static final int USER_INTERFACE_SCENE_TRANSFORMS_LISTL_SCENE_NAME = 0;
public static final int USER_INTERFACE_SCENE_TRANSFORMS_LIST_TIME = 1;
public static final int USER_INTERFACE_SCENE_TRANSFORMS_LIST_PID = 2;
+++ /dev/null
-/*
- * Dynamic Analyzer
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Jungwook Ryu <jungwook.ryu@samsung.com>
- * Jooyoul Lee <jy.exe.lee@samsung.com>
- * Juyoung Kim <j0.kim@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-package org.tizen.dynamicanalyzer.ui.widgets.table;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-import org.eclipse.nebula.widgets.grid.Grid;
-import org.eclipse.nebula.widgets.grid.GridItem;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.ScrollBar;
-import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
-import org.tizen.dynamicanalyzer.resources.ColorResources;
-import org.tizen.dynamicanalyzer.resources.FontResources;
-
-public class WindowingTable extends Composite {
-
- protected Grid table = null;
- protected Composite comp = null;
- protected int itemCount = 0;
- protected int type = 0;
- protected List<Integer> columnSize;
- // private TableTooltipListener tableListener;
- protected HashMap<String, String> selection;
- protected List<Integer> selectionIndex;
-
- public void clear() {
- table.removeAll();
- itemCount = 0;
- comp.getVerticalBar().setThumb(0);
- }
-
- public WindowingTable(Composite parent, int style) {
- super(parent, style);
- // this.setBackground(ColorResources.TABLE_BG_COLOR);
- GridLayout layout = new GridLayout();
- layout.horizontalSpacing = 0;
- layout.verticalSpacing = 0;
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- this.setLayout(layout);
- this.setLayoutData(new GridData(GridData.FILL_BOTH));
- // setColumnSize();
- initBaseComposite();
- initTable();
- }
-
- private void initBaseComposite() {
- comp = new Composite(this, SWT.V_SCROLL);
- comp.setBackground(ColorResources.WHITE);
- comp.setLayoutData(new GridData(GridData.FILL_BOTH));
- GridLayout baseLayout = new GridLayout();
- baseLayout.marginWidth = 0;
- baseLayout.marginHeight = 0;
- comp.setLayout(baseLayout);
- comp.setBackground(ColorResources.TABLE_CONTENTS_NORMAL);
-
- final ScrollBar compositScrollBar = comp.getVerticalBar();
- compositScrollBar.setMaximum(100);
- compositScrollBar.setMinimum(0);
- compositScrollBar.setVisible(true);
- }
-
- private void initTable() {
- table = new Grid(comp, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION
- | SWT.H_SCROLL);
- table.setHeaderVisible(true);
- table.setLinesVisible(true);
- table.setLineColor(ColorResources.TABLE_LINE);
- table.setEmptyColumnHeaderRenderer(new DATableEmptyColumnHeaderRenderer());
- table.setEmptyCellRenderer(new DATableEmptyCellRenderer());
- GridData gd = new GridData();
- gd.horizontalAlignment = GridData.FILL;
- gd.verticalAlignment = GridData.FILL;
- gd.grabExcessHorizontalSpace = true;
- gd.grabExcessVerticalSpace = true;
- table.setLayoutData(gd);
- table.setBackground(ColorResources.TABLE_CONTENTS_NORMAL);
- table.setForeground(ColorResources.WHITE);
- table.setFont(FontResources.TABLE_HEADER_FONT);
- table.addSelectionListener(new SelectionListener() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- GridItem[] ti = ((Grid) e.widget).getSelection();
- if (null == ti || ti.length == 0) {
- return;
- }
- int size = ti.length;
- HashMap<String, String> sel = getSelections();
- sel.clear();
- for (int i = 0; i < size; i++) {
- String[] data = (String[]) ti[i].getData();
- String seq = data[LogCenterConstants.SEQUENCE_NUMBER_INDEX + 1];
- if (null != seq && !seq.isEmpty()) {
- sel.put(seq, seq);
- }
- }
-
- // FIXME not used
- // String[] data = (String[]) ti[0].getData();
- //
- // Long selUsec = Long
- // .parseLong(data[LogCenterConstants.TIME_INDEX + 1]);
-
- // Long selMsec = selUsec / TimelineConstants.TIME_US_TO_MS;
- // TimelineComposite timelineComposite = AnalyzerUtil
- // .getTimelineComposite();
- // if (null != timelineComposite) {
- // timelineComposite.setDownTimeSelection(selMsec, false);
- // }
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- });
-
- // Creates table listener.
- // tableListener = new TableTooltipListener(table, false);
- // // Adds table listener.
- // table.addListener(SWT.Dispose, tableListener);
- // table.addListener(SWT.KeyDown, tableListener);
- // table.addListener(SWT.KeyUp, tableListener);
- // table.addListener(SWT.MouseEnter, tableListener);
- // table.addListener(SWT.MouseExit, tableListener);
- // table.addListener(SWT.MouseMove, tableListener);
- // table.addListener(SWT.MouseHover, tableListener);
- // table.addListener(SWT.MouseDoubleClick, tableListener);
-
- table.setItemHeight(getTableItemHeight(table));
- }
-
- // private void setColumnSize(LogCenter logc) {
- // columnSize = new ArrayList<Integer>();
- // if (!logc.isCustomColumn()) {
- // columnSize.add(LogCenterConstants.COMMON_COLUMN_SIZE_RID);
- // columnSize.add(LogCenterConstants.COMMON_COLUMN_SIZE_ID);
- // columnSize.add(LogCenterConstants.COMMON_COLUMN_SIZE_SEQNUMBER);
- // columnSize.add(LogCenterConstants.COMMON_COLUMN_SIZE_APINAME);
- // columnSize.add(LogCenterConstants.COMMON_COLUMN_SIZE_TIME);
- // columnSize.add(LogCenterConstants.COMMON_COLUMN_SIZE_PID);
- // columnSize.add(LogCenterConstants.COMMON_COLUMN_SIZE_TID);
- // columnSize.add(LogCenterConstants.COMMON_COLUMN_SIZE_INPUTPARAM);
- // columnSize.add(LogCenterConstants.COMMON_COLUMN_SIZE_RETURN);
- // columnSize.add(LogCenterConstants.COMMON_COLUMN_SIZE_PCADDR);
- // columnSize.add(LogCenterConstants.COMMON_COLUMN_SIZE_ERROR);
- // } else {
- // columnSize.addAll(logc.getColumnSize());
- // }
- // }
-
- public void setColumnSizes(int id) {
- // LogCenter logc = AnalyzerManager.getLogCenterById(id);
- // if (null != logc) {
- // setColumnSize(logc);
- // List<Integer> cols = logc.getColumnSize();
- // int size = logc.getTotalColumnCount() - columnSize.size();
- // int colsSize = cols.size();
- // for (int i = 0; i < size; i++) {
- // if (i >= colsSize) {
- // columnSize.add(0);
- // } else {
- // columnSize.add(cols.get(i));
- // }
- // }
- // }
- }
-
- // public void setColumns(LogCenter logc) {
- // List<String> columnNames = logc.getTableColumnName();
- // List<Boolean> columnVisibility = logc.getColumnVisibility();
- // List<Integer> order = logc.getColumnOrder();
- // int size = columnNames.size();
- // int sSize = columnSize.size();
- // for (int i = 0; i < size; i++) {
- //
- // GridColumn tableColumn = new GridColumn(table, SWT.NONE);
- // tableColumn.setText(columnNames.get(order.get(i)));
- // tableColumn.setCellRenderer(new DATableCellRenderer());
- // tableColumn.setHeaderRenderer(new DATableHeaderRenderer());
- // if (!columnVisibility.get(order.get(i))) {
- // tableColumn.setWidth(0);
- // } else if (i >= sSize || columnSize.get(order.get(i)) == 0) {
- // tableColumn.pack();
- // } else {
- // tableColumn.setWidth(columnSize.get(order.get(i)));
- // }
- // }
- // }
-
- public void setItemCount(int count) {
- itemCount = count;
- }
-
- public Grid getTable() {
- return table;
- }
-
- public Composite getComposite() {
- return comp;
- }
-
- public HashMap<String, String> getSelections() {
- if (null == selection) {
- selection = new HashMap<String, String>();
- }
- return selection;
- }
-
- public void setType(int t) {
- type = t;
- }
-
- public int getType() {
- return type;
- }
-
- public int getItemCount() {
- if (0 == itemCount) {
- Rectangle rect = table.getClientArea();
- int itemHeight = table.getItemHeight();
- itemCount = (rect.height - table.getHeaderHeight()) / itemHeight
- - 1;
- }
- return itemCount;
- }
-
- public List<Integer> getSelectionIndex() {
- if (null == selectionIndex) {
- selectionIndex = new ArrayList<Integer>();
- }
- return selectionIndex;
- }
-
- public void reDrawLogTable() {
- // LogCenter logc = AnalyzerManager.getLogCenterById(getType());
- //
- // if (null == logc) {
- // return;
- // }
- //
- // List<Integer> order = logc.getColumnOrder();
- //
- // if (0 == table.getColumnCount()) {
- // setColumns(logc);
- // }
- //
- // ScrollBar compositeScrollBar = comp.getVerticalBar();
- // int itemCount = getItemCount();
- // int maxItemCount = logc.getDataSize();
- // if (maxItemCount > itemCount) {
- // table.setItemCount(itemCount);
- // } else {
- // table.setItemCount(maxItemCount);
- // }
- //
- // compositeScrollBar.setMaximum(maxItemCount);
- // compositeScrollBar.setThumb(itemCount);
- // int selection = compositeScrollBar.getSelection();
- // int tableItemIndex = 0;
- // int tableRowSize = table.getItemCount();
- //
- // if (null == Global.getProject()) {
- // return;
- // }
- //
- // List<List<String>> output;
- // output = SqlManager.getInstance().selectRowId(logc, selection,
- // selection + itemCount + 1);
- // if (null != output && !output.isEmpty()) {
- // int size = output.size();
- // getSelectionIndex().clear();
- // for (int i = 0; i < size && tableItemIndex < tableRowSize; i++,
- // tableItemIndex++) {
- // List<String> outputList = output.get(i);
- // int arraySize = outputList.size();
- // /* text */
- // String[] inputText = new String[arraySize];
- // outputList.toArray(inputText);
- //
- // String[] inputData = new String[arraySize];
- // outputList.toArray(inputData);
- //
- // GridItem ti = table.getItem(tableItemIndex);
- // ti.setData(inputData);
- // Formatter.tableItemTimeFormatting(inputText);
- // String reorder[] = new String[inputText.length];
- //
- // for (int index = 0; index < inputText.length; index++) {
- // reorder[index] = inputText[order.get(index)];
- // }
- // int inputSize = reorder.length;
- // for (int ii = 0; ii < inputSize; ii++) {
- // ti.setText(ii, reorder[ii]);
- // }
- // // ti.setText(reorder);
- // String seq = inputData[LogCenterConstants.SEQUENCE_NUMBER_INDEX + 1];
- // if (null != getSelections().get(seq)) {
- // getSelectionIndex().add(tableItemIndex);
- // }
- // }
- // if (selectionIndex.size() != 0) {
- // int[] sels = new int[selectionIndex.size()];
- // for (int i = 0; i < selectionIndex.size(); i++) {
- // sels[i] = selectionIndex.get(i);
- // }
- // table.setSelection(sels);
- // } else {
- // table.deselectAll();
- // }
- // }
- }
-
- private int getTableItemHeight(Grid table) {
- GC gc = new GC(table);
- gc.setFont(table.getFont());
- int height = Math.max(0, gc.getFontMetrics().getHeight());
- gc.dispose();
- gc = null;
- return height;
- }
-
-}
import java.util.List;
import org.tizen.dynamicanalyzer.common.path.PathManager;
-import org.tizen.dynamicanalyzer.nl.ConfigureLabels;
import org.tizen.dynamicanalyzer.ui.toolbar.setting.SettingDataManager;
import org.tizen.dynamicanalyzer.util.CommonUtil;