--- /dev/null
+package org.tizen.dynamicanalyzer.ui.timeline;
+
+import java.util.List;
+
+import org.tizen.dynamicanalyzer.common.AnalyzerManager;
+import org.tizen.dynamicanalyzer.swap.logparser.ReadBlockingQueue;
+import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineChartManager;
+
+public class SystemDataDBInserter implements Runnable {
+ private static ReadBlockingQueue<List<List<Object>>> systemDataQueue = new ReadBlockingQueue<List<List<Object>>>();
+
+ private static volatile Thread inserterThread = null;
+
+ public static void startThread() {
+ if (inserterThread == null || !inserterThread.isAlive()) {
+ synchronized (SystemDataDBInserter.class) {
+ if (inserterThread == null || !inserterThread.isAlive()) {
+ inserterThread = new Thread(null,
+ new SystemDataDBInserter());
+ inserterThread.start();
+ }
+ }
+ }
+ }
+
+ public static void stopThread() {
+ if (inserterThread != null && inserterThread.isAlive()) {
+ try {
+ sendNotify();
+ inserterThread.join(AnalyzerManager.THREAD_JOIN_WAIT_TIME);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public static void pushContextData(List<List<Object>> data) {
+ systemDataQueue.offer(data);
+ }
+
+ public static void clear() {
+ stopThread();
+ }
+
+ @Override
+ public void run() {
+ while (!AnalyzerManager.isExit()) {
+ List<List<Object>> contextData = systemDataQueue.poll();
+
+ if (contextData != null && contextData.size() != 0) {
+ for (int i = 0; i < contextData.size(); i++) {
+ List<Object> row = contextData.get(i);
+// System.err.print("Count : " + row.size() + ", ");
+ }
+// System.err.println("\n----------------------------");
+ TimelineChartManager.getInstance().getSystemDataTable()
+ .insertData(contextData);
+ }
+ }
+ }
+
+ public static void sendNotify() {
+ synchronized (systemDataQueue) {
+ systemDataQueue.notifyAll();
+ }
+ }
+
+}
--- /dev/null
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Jungwook Ryu <jungwook.ryu@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.dynamicanalyzer.ui.timeline;
+
+import org.tizen.dynamicanalyzer.database.DBColumn;
+import org.tizen.dynamicanalyzer.database.DBConstants;
+import org.tizen.dynamicanalyzer.database.DBTable;
+
+public class SystemDataDBTable extends DBTable {
+ private static final String TABLENAME = "TIMELINE_SYSTEM_DATA";
+
+ public static enum COLUMN {
+ TIME,
+ CPU_LOAD_APP,
+ PROCESS_COUNT,
+ HEAP_ALLOCATION_TOTAL,
+ HEAP_ALLOCATION_APP,
+ MEMORY_VIRTUAL,
+ MEMORY_RESIDENT,
+ MEMORY_SHARED,
+ MEMORY_PSS,
+ MEMORY_TOTAL_SYSTEM,
+ MEMORY_USAGE_SYSTEM,
+ NETWORK_SIZE_SEND,
+ NETWORK_SIZE_RECEIVE,
+ DEVICE_STATUS_WIFI,
+ DEVICE_STATUS_BLUETOOTH,
+ DEVICE_STATUS_GPS,
+ DEVICE_STATUS_BRIGHTNESS,
+ DEVICE_STATUS_DNET,
+ DEVICE_STATUS_CAMERA,
+ DEVICE_STATUS_SOUND,
+ DEVICE_STATUS_AUDIO,
+ DEVICE_STATUS_VIBRATION,
+ DEVICE_STATUS_VOLTAGE,
+ DEVICE_STATUS_RSSI,
+ DEVICE_STATUS_VIDEO,
+ DEVICE_STATUS_CALL,
+ DISK_TOTAL_USAGE,
+ DISK_IO_READ_SIZE,
+ DISK_IO_READ_SECTOR,
+ DISK_IO_WRITE_SIZE,
+ DISK_IO_WRITE_SECTOR,
+ ENERGY_USAGE,
+ FD_COUNT,
+ FD_ACTIVITY
+ }
+
+ public static final String TIME = "TIME";
+ public static final String CPU_LOAD_APP = "CPU_LOAD_APP";
+ public static final String PROCESS_COUNT = "PROCESS_COUNT";
+ public static final String HEAP_ALLOCATION_TOTAL = "HEAP_ALLOCATION_TOTAL";
+ public static final String HEAP_ALLOCATION_APP = "HEAP_ALLOCATION_APP";
+ public static final String MEMORY_VIRTUAL = "MEMORY_VIRTUAL";
+ public static final String MEMORY_RESIDENT = "MEMORY_RESIDENT";
+ public static final String MEMORY_SHARED = "MEMORY_SHARED";
+ public static final String MEMORY_PSS = "MEMORY_PSS";
+ public static final String MEMORY_TOTAL_SYSTEM = "MEMORY_TOTAL_SYSTEM";
+ public static final String MEMORY_USAGE_SYSTEM = "MEMORY_USAGE_SYSTEM";
+ public static final String NETWORK_SIZE_SEND = "NETWORK_SIZE_SEND";
+ public static final String NETWORK_SIZE_RECEIVE = "NETWORK_SIZE_RECEIVE";
+ public static final String DEVICE_STATUS_WIFI = "DEVICE_STATUS_WIFI";
+ public static final String DEVICE_STATUS_BLUETOOTH = "DEVICE_STATUS_BLUETOOTH";
+ public static final String DEVICE_STATUS_GPS = "DEVICE_STATUS_GPS";
+ public static final String DEVICE_STATUS_BRIGHTNESS = "DEVICE_STATUS_BRIGHTNESS";
+ public static final String DEVICE_STATUS_DNET = "DEVICE_STATUS_DNET";
+ public static final String DEVICE_STATUS_CAMERA = "DEVICE_STATUS_CAMERA";
+ public static final String DEVICE_STATUS_SOUND = "DEVICE_STATUS_SOUND";
+ public static final String DEVICE_STATUS_AUDIO = "DEVICE_STATUS_AUDIO";
+ public static final String DEVICE_STATUS_VIBRATION = "DEVICE_STATUS_VIBRATION";
+ public static final String DEVICE_STATUS_VOLTAGE = "DEVICE_STATUS_VOLTAGE";
+ public static final String DEVICE_STATUS_RSSI = "DEVICE_STATUS_RSSI";
+ public static final String DEVICE_STATUS_VIDEO = "DEVICE_STATUS_VIDEO";
+ public static final String DEVICE_STATUS_CALL = "DEVICE_STATUS_CALL";
+ public static final String DISK_TOTAL_USAGE = "DISK_TOTAL_USAGE";
+ public static final String DISK_IO_READ_SIZE = "DISK_IO_READ_SIZE";
+ public static final String DISK_IO_READ_SECTOR = "DISK_IO_READ_SECTOR";
+ public static final String DISK_IO_WRITE_SIZE = "DISK_IO_WRITE_SIZE";
+ public static final String DISK_IO_WRITE_SECTOR = "DISK_IO_WRITE_SECTOR";
+ public static final String ENERGY_USAGE = "ENERGY_USAGE";
+ public static final String FD_COUNT = "FD_COUNT";
+ public static final String FD_ACTIVITY = "FD_ACTIVITY";
+
+ @Override
+ public String getTableName() {
+ return TABLENAME;
+ }
+
+ public SystemDataDBTable() {
+ addColumn(new DBColumn(TIME, DBConstants.NOT_NULL, DBConstants.LONG));
+ addColumn(new DBColumn(CPU_LOAD_APP, DBConstants.NOT_NULL, DBConstants.INTEGER)); // TODO integer -> float
+ addColumn(new DBColumn(PROCESS_COUNT, DBConstants.NOT_NULL, DBConstants.INTEGER));
+ addColumn(new DBColumn(HEAP_ALLOCATION_TOTAL, DBConstants.NOT_NULL, DBConstants.LONG));
+ addColumn(new DBColumn(HEAP_ALLOCATION_APP, DBConstants.NOT_NULL, DBConstants.LONG));
+ addColumn(new DBColumn(MEMORY_VIRTUAL, DBConstants.NOT_NULL, DBConstants.INTEGER));
+ addColumn(new DBColumn(MEMORY_RESIDENT, DBConstants.NOT_NULL, DBConstants.INTEGER));
+ addColumn(new DBColumn(MEMORY_SHARED, DBConstants.NOT_NULL, DBConstants.INTEGER));
+ addColumn(new DBColumn(MEMORY_PSS, DBConstants.NOT_NULL, DBConstants.INTEGER));
+ addColumn(new DBColumn(MEMORY_TOTAL_SYSTEM, DBConstants.NOT_NULL, DBConstants.LONG)); //10
+ addColumn(new DBColumn(MEMORY_USAGE_SYSTEM, DBConstants.NOT_NULL, DBConstants.LONG));
+ addColumn(new DBColumn(NETWORK_SIZE_SEND, DBConstants.NOT_NULL, DBConstants.INTEGER));
+ addColumn(new DBColumn(NETWORK_SIZE_RECEIVE, DBConstants.NOT_NULL, DBConstants.INTEGER));
+ addColumn(new DBColumn(DEVICE_STATUS_WIFI, DBConstants.NOT_NULL, DBConstants.INTEGER));
+ addColumn(new DBColumn(DEVICE_STATUS_BLUETOOTH, DBConstants.NOT_NULL, DBConstants.INTEGER));
+ addColumn(new DBColumn(DEVICE_STATUS_GPS, DBConstants.NOT_NULL, DBConstants.INTEGER));
+ addColumn(new DBColumn(DEVICE_STATUS_BRIGHTNESS, DBConstants.NOT_NULL, DBConstants.INTEGER));
+ addColumn(new DBColumn(DEVICE_STATUS_DNET, DBConstants.NOT_NULL, DBConstants.INTEGER));
+ addColumn(new DBColumn(DEVICE_STATUS_CAMERA, DBConstants.NOT_NULL, DBConstants.INTEGER));
+ addColumn(new DBColumn(DEVICE_STATUS_SOUND, DBConstants.NOT_NULL, DBConstants.INTEGER)); //20
+ addColumn(new DBColumn(DEVICE_STATUS_AUDIO, DBConstants.NOT_NULL, DBConstants.INTEGER));
+ addColumn(new DBColumn(DEVICE_STATUS_VIBRATION, DBConstants.NOT_NULL, DBConstants.INTEGER));
+ addColumn(new DBColumn(DEVICE_STATUS_VOLTAGE, DBConstants.NOT_NULL, DBConstants.INTEGER));
+ addColumn(new DBColumn(DEVICE_STATUS_RSSI, DBConstants.NOT_NULL, DBConstants.INTEGER));
+ addColumn(new DBColumn(DEVICE_STATUS_VIDEO, DBConstants.NOT_NULL, DBConstants.INTEGER));
+ addColumn(new DBColumn(DEVICE_STATUS_CALL, DBConstants.NOT_NULL, DBConstants.INTEGER));
+ addColumn(new DBColumn(DISK_TOTAL_USAGE, DBConstants.NOT_NULL, DBConstants.INTEGER));
+ addColumn(new DBColumn(DISK_IO_READ_SIZE, DBConstants.NOT_NULL, DBConstants.INTEGER));
+ addColumn(new DBColumn(DISK_IO_READ_SECTOR, DBConstants.NOT_NULL, DBConstants.INTEGER));
+ addColumn(new DBColumn(DISK_IO_WRITE_SIZE, DBConstants.NOT_NULL, DBConstants.INTEGER)); //30
+ addColumn(new DBColumn(DISK_IO_WRITE_SECTOR, DBConstants.NOT_NULL, DBConstants.INTEGER));
+ addColumn(new DBColumn(ENERGY_USAGE, DBConstants.NOT_NULL, DBConstants.INTEGER));
+// addColumn(new DBColumn(FD_COUNT, DBConstants.NOT_NULL, DBConstants.INTEGER));
+// addColumn(new DBColumn(FD_ACTIVITY, DBConstants.NOT_NULL, DBConstants.INTEGER));
+ }
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.ui.timeline;
+
+import org.tizen.dynamicanalyzer.database.DBColumn;
+import org.tizen.dynamicanalyzer.database.DBConstants;
+import org.tizen.dynamicanalyzer.database.DBTable;
+
+public class UIEventDBTable extends DBTable {
+ private static final String TABLENAME = "TIMELINE_UIEVENT";
+
+ public static enum COLUMN {
+ TIME,
+ EVENT_TYPE,
+ DETAIL_TYPE,
+ POINT_X,
+ POINT_Y,
+ INFO_STRING,
+ INFO_INTEGER
+ }
+
+ public static final String TIME = "TIME";
+ public static final String EVENT_TYPE = "EVENT_TYPE";
+ public static final String DETAIL_TYPE = "DETAIL_TYPE";
+ public static final String POINT_X = "POINT_X";
+ public static final String POINT_Y = "POINT_Y";
+ public static final String INFO_STRING = "INFO_STRING";
+ public static final String INFO_INTEGER = "INFO_INTEGER";
+
+ @Override
+ public String getTableName() {
+ return TABLENAME;
+ }
+
+ public UIEventDBTable() {
+ addColumn(new DBColumn(TIME, DBConstants.NOT_NULL, DBConstants.LONG));
+ addColumn(new DBColumn(EVENT_TYPE, DBConstants.NOT_NULL, DBConstants.INTEGER));
+ addColumn(new DBColumn(DETAIL_TYPE, DBConstants.NOT_NULL, DBConstants.INTEGER));
+ addColumn(new DBColumn(POINT_X, DBConstants.NOT_NULL, DBConstants.INTEGER));
+ addColumn(new DBColumn(POINT_Y, DBConstants.NOT_NULL, DBConstants.INTEGER));
+ addColumn(new DBColumn(INFO_STRING, DBConstants.NOT_NULL, DBConstants.TEXT));
+ addColumn(new DBColumn(INFO_INTEGER, DBConstants.NOT_NULL, DBConstants.INTEGER));
+ }
+}