1. Process Size, Heap, Memory chart is chagned to support multi process.
2. DiskIO Chart shows 2 more info (Disk read sector, write sector).
3. FileChart is removed.
3. Timeline Chart's series color is changed.
4. MSG_SYSTEM parsing logic is changed because of changing MSG_SYSTEM.
Change-Id: Ie62d3baf2f135244801f70bfcbfcca782bb55421
Signed-off-by: jungwook.ryu <jungwook.ryu@samsung.com>
public static Color SERIES_COLOR_CPUCORE_CORE2 = getColor("seriesColorCPUCoreCore2"); //$NON-NLS-1$\r
public static Color SERIES_COLOR_CPUCORE_CORE3 = getColor("seriesColorCPUCoreCore3"); //$NON-NLS-1$\r
\r
- public static Color SERIES_COLOR_CPU_FREQ = getColor("seriesColorCPUFreq"); //$NON-NLS-1$\r
-\r
public static Color SERIES_COLOR_HEAP_SYSTEM = getColor("seriesColorHeapSystem"); //$NON-NLS-1$\r
public static Color SERIES_COLOR_HEAP_USER = getColor("seriesColorHeapApp"); //$NON-NLS-1$\r
\r
public static Color SERIES_COLOR_MEMORY_SYS_USED = getColor("seriesColorMemorySysUsed"); //$NON-NLS-1$\r
public static Color SERIES_COLOR_MEMORY_APP_USED = getColor("seriesColorMemoryAppUsed"); //$NON-NLS-1$\r
\r
- public static Color SERIES_COLOR_FILE_READ = getColor("seriesColorFileRead"); //$NON-NLS-1$\r
- public static Color SERIES_COLOR_FILE_WRITE = getColor("seriesColorFileWrite"); //$NON-NLS-1$\r
- public static Color SERIES_COLOR_FILE_FD = getColor("seriesColorFileFD"); //$NON-NLS-1$\r
-\r
+ public static Color SERIES_COLOR_NETWORK_IO_SEND = getColor("seriesColorNetworkIOSend"); //$NON-NLS-1$\r
+ public static Color SERIES_COLOR_NETWORK_IO_RECEIVE = getColor("seriesColorNetworkIOReceive"); //$NON-NLS-1$\r
+ \r
+ public static Color SERIES_COLOR_DISK_IO_READ_BYTE = getColor("seriesColorDiskIOReadByte"); //$NON-NLS-1$\r
+ public static Color SERIES_COLOR_DISK_IO_WRITE_BYTE = getColor("seriesColorDiskIOWriteByte"); //$NON-NLS-1$\r
+ public static Color SERIES_COLOR_DISK_IO_READ_SECTOR = getColor("seriesColorDiskIOReadSector"); //$NON-NLS-1$\r
+ public static Color SERIES_COLOR_DISK_IO_READ_WRITE_SECTOR = getColor("seriesColorDiskIOWriteSector"); //$NON-NLS-1$\r
+ \r
+ public static Color SERIES_COLOR_DEVICE_WIFI = getColor("seriesColorDeviceWifi"); //$NON-NLS-1$\r
+ public static Color SERIES_COLOR_DEVICE_BLUETOOTH = getColor("seriesColorDeviceBluetooth"); //$NON-NLS-1$\r
+ public static Color SERIES_COLOR_DEVICE_GPS = getColor("seriesColorDeviceGPS"); //$NON-NLS-1$\r
+ public static Color SERIES_COLOR_DEVICE_DNET = getColor("seriesColorDeviceDNet"); //$NON-NLS-1$\r
+ public static Color SERIES_COLOR_DEVICE_CAMERA = getColor("seriesColorDeviceCamera"); //$NON-NLS-1$\r
+ \r
public static Color SERIES_COLOR_UI_EVENT_KEY = getColor("seriesColorUIEventKey");//$NON-NLS-1$\r
public static Color SERIES_COLOR_UI_EVENT_TOUCH = getColor("seriesColorUIEventTouch");//$NON-NLS-1$\r
public static Color SERIES_COLOR_UI_EVENT_GESTURE = getColor("seriesColorUIEventGesture");//$NON-NLS-1$\r
setColor("add_chart_disable_color_end", new RGB(225, 225, 225)); //$NON-NLS-1$
/** Timeline chart **/
- setColor("seriesColorCPUSystem", new RGB(111, 151, 39)); //$NON-NLS-1$
- setColor("seriesColorCPUApp", new RGB(72, 185, 221)); //$NON-NLS-1$
+ setColor("seriesColorCPUSystem", new RGB(131, 207, 232)); //$NON-NLS-1$
+ setColor("seriesColorCPUApp", new RGB(125, 161, 60)); //$NON-NLS-1$
- setColor("seriesColorCPUCoreCore0", new RGB(17, 105, 192)); //$NON-NLS-1$
- setColor("seriesColorCPUCoreCore1", new RGB(111, 151, 39)); //$NON-NLS-1$
- setColor("seriesColorCPUCoreCore2", new RGB(187, 60, 159)); //$NON-NLS-1$
- setColor("seriesColorCPUCoreCore3", new RGB(51, 160, 137)); //$NON-NLS-1$
+ setColor("seriesColorCPUCoreCore0", new RGB(40, 160, 198)); //$NON-NLS-1$
+ setColor("seriesColorCPUCoreCore1", new RGB(125, 161, 60)); //$NON-NLS-1$
+ setColor("seriesColorCPUCoreCore2", new RGB(194, 79, 167)); //$NON-NLS-1$
+ setColor("seriesColorCPUCoreCore3", new RGB(71, 169, 149)); //$NON-NLS-1$
- setColor("seriesColorCPUFreq", new RGB(197, 124, 15)); //$NON-NLS-1$
+ setColor("seriesColorHeapSystem", new RGB(131, 207, 232)); //$NON-NLS-1$
+ setColor("seriesColorHeapApp", new RGB(88, 99, 212)); //$NON-NLS-1$
- setColor("seriesColorHeapSystem", new RGB(72, 185, 221)); //$NON-NLS-1$
- setColor("seriesColorHeapApp", new RGB(70, 82, 207)); //$NON-NLS-1$
+ setColor("seriesColorProcessVSS", new RGB(131, 207, 232)); //$NON-NLS-1$
+ setColor("seriesColorProcessRSS", new RGB(164, 43, 191)); //$NON-NLS-1$
+ setColor("seriesColorProcessPSS", new RGB(206, 177, 77)); //$NON-NLS-1$
- setColor("seriesColorProcessVSS", new RGB(72, 185, 221)); //$NON-NLS-1$
- setColor("seriesColorProcessRSS", new RGB(111, 151, 39)); //$NON-NLS-1$
- setColor("seriesColorProcessPSS", new RGB(201, 168, 58)); //$NON-NLS-1$
+ setColor("seriesColorMemorySysMax", new RGB(90, 200, 177)); //$NON-NLS-1$
+ setColor("seriesColorMemorySysUsed", new RGB(88, 99, 212)); //$NON-NLS-1$
+ setColor("seriesColorMemoryAppUsed", new RGB(229, 123, 206)); //$NON-NLS-1$
- setColor("seriesColorMemorySysMax", new RGB(72, 185, 221)); //$NON-NLS-1$
- setColor("seriesColorMemorySysUsed", new RGB(155, 20, 184)); //$NON-NLS-1$
- setColor("seriesColorMemoryAppUsed", new RGB(111, 151, 39)); //$NON-NLS-1$
-
- setColor("seriesColorFileRead", new RGB(226, 109, 201)); //$NON-NLS-1$
- setColor("seriesColorFileWrite", new RGB(72, 185, 221)); //$NON-NLS-1$
- setColor("seriesColorFileFD", new RGB(111, 151, 39)); //$NON-NLS-1$
+ setColor("seriesColorNetworkIOSend", new RGB(194, 79, 167)); //$NON-NLS-1$
+ setColor("seriesColorNetworkIOReceive", new RGB(88, 99, 212)); //$NON-NLS-1$
+ setColor("seriesColorDiskIOReadByte", new RGB(164, 43, 191)); //$NON-NLS-1$
+ setColor("seriesColorDiskIOWriteByte", new RGB(194, 79, 167)); //$NON-NLS-1$
+ setColor("seriesColorDiskIOReadSector", new RGB(131, 207, 232)); //$NON-NLS-1$
+ setColor("seriesColorDiskIOWriteSector", new RGB(229, 123, 206)); //$NON-NLS-1$
+
+ setColor("seriesColorDeviceWifi", new RGB(164, 43, 191)); //$NON-NLS-1$
+ setColor("seriesColorDeviceBluetooth", new RGB(88, 99, 212)); //$NON-NLS-1$
+ setColor("seriesColorDeviceGPS", new RGB(203, 136, 39)); //$NON-NLS-1$
+ setColor("seriesColorDeviceDNet", new RGB(161, 137, 60)); //$NON-NLS-1$
+ setColor("seriesColorDeviceCamera", new RGB(229, 123, 206)); //$NON-NLS-1$
+
setColor("seriesColorUIEventKey", new RGB(122, 132, 238)); //$NON-NLS-1$
setColor("seriesColorUIEventTouch", new RGB(129, 172, 50)); //$NON-NLS-1$
setColor("seriesColorUIEventGesture", new RGB(236, 107, 47)); //$NON-NLS-1$
setColor("seriesColorUIEventOrientation", new RGB(177, 202, 229)); //$NON-NLS-1$
- setColor("seriesColorUIEventFramework", new RGB(212, 150, 57)); //$NON-NLS-1$
+ setColor("seriesColorUIEventFramework", new RGB(216, 160, 76)); //$NON-NLS-1$
setColor("selectionRange", new RGB(23, 98, 132)); //$NON-NLS-1$
setColor("selectionLine", new RGB(23, 98, 132)); //$NON-NLS-1$
.getSelectedImageIndex();
for (int i = index; i < seriesItemSize; i++) {
DAChartSeriesItem seriesItem = seriesItems.get(i);
- double currentX = seriesItem.getX();
- int pixcelStartX = plot.getXPixcelFromX(currentX, r);
- Image image = seriesItem.getImage();
- int yPosition = (int) seriesItem.getY();
- if (r.height != DAChartBoard.DEFAULT_ITEM_HEIGHT - 1) {
- image = new Image(Display.getDefault(), image.getImageData()
- .scaledTo(image.getBounds().width / 2,
- image.getBounds().height / 2));
- yPosition = SCREENSHOT_Y_POSITION_MINI;
- }
+ if (seriesItem != null) {
+ double currentX = seriesItem.getX();
+ int pixcelStartX = plot.getXPixcelFromX(currentX, r);
+ Image image = seriesItem.getImage();
+ int yPosition = (int) seriesItem.getY();
+ if (r.height != DAChartBoard.DEFAULT_ITEM_HEIGHT - 1) {
+ image = new Image(Display.getDefault(), image.getImageData()
+ .scaledTo(image.getBounds().width / 2,
+ image.getBounds().height / 2));
+ yPosition = SCREENSHOT_Y_POSITION_MINI;
+ }
- if (i != highlightedImageIndex && i != selectedImageIndex) {
- gc.drawImage(image, pixcelStartX, yPosition);
- gc.setLineWidth(SCREENSHOT_BORDER_LINE_WIDTH);
- gc.setForeground(ColorResources.SCREENSHOT_CHART_BORDER_LINE);
- gc.drawRectangle(pixcelStartX, yPosition,
- image.getBounds().width, image.getBounds().height);
- }
+ if (i != highlightedImageIndex && i != selectedImageIndex) {
+ gc.drawImage(image, pixcelStartX, yPosition);
+ gc.setLineWidth(SCREENSHOT_BORDER_LINE_WIDTH);
+ gc.setForeground(ColorResources.SCREENSHOT_CHART_BORDER_LINE);
+ gc.drawRectangle(pixcelStartX, yPosition,
+ image.getBounds().width, image.getBounds().height);
+ }
- if (currentX > plot.getVisibleEndX()) {
- break;
+ if (currentX > plot.getVisibleEndX()) {
+ break;
+ }
}
}
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact:
+ * Jungwook Ryu <jungwook.ryu@samsung.com>
* yeongtaik byeon <yeongtaik.byeon@samsung.com>
* Juyoung Kim <j0.kim@samsung.com>
*
itemCell.setLayoutData(data);
this.layout();
}
-
+
public DAChartBoardItem(DAChartBoard parent, String itemName) {
super(parent.getItemList(), SWT.NONE);
parentBoard = parent;
parentItem.registerItem(this);
}
+ public DAChartBoardItem(DAChartBoardItem parent, String itemName, Image icon,
+ int chartStyle) {
+ super(parent.getChildItemList(), SWT.NONE);
+ parentItem = parent;
+ depth = parent.getDepth() + 1;
+ initWidget(itemName, icon, chartStyle);
+ parentItem.registerItem(this);
+ }
+
double getBoardItemHeightRatio() {
double itemHeightRatio;
if (depth == 0) {
callNotifyResizeChild();
}
- void unFoldChild() {
+ public void unFoldChild() {
childFolded = false;
FormData childListData = (FormData) childItemList.getLayoutData();
childListData.height = childItemList.getListHeight();
childItemList.setLayoutData(childListData);
-
+
+ itemCell.setFoldButtonTrue();
callNotifyResizeChild();
}
private String itemName;
private Image itemIcon;
private Image foldBackBuffer;
-
+ private PaintListener nameCellPaintListener;
+
//FIXME for debugging
public String getItemName() {
return itemName;
}
nameCellCurrentBGImage = nameCellNormalBGImage;
redrawFoldBackground();
- nameCell.addPaintListener(new PaintListener() {
+
+ nameCellPaintListener = (new PaintListener() {
@Override
public void paintControl(PaintEvent e) {
Rectangle rect = ((Canvas) (e.widget)).getClientArea();
-
if (nameCellCurrentBGImage != null) {
Rectangle imageRect = nameCellCurrentBGImage.getBounds();
e.gc.drawImage(nameCellCurrentBGImage, imageRect.x,
imageRect.y, imageRect.width, imageRect.height,
rect.x, rect.y, rect.width, rect.height);
}
-
e.gc.setForeground(ColorResources.BLACK);
e.gc.setFont(parent.getNameFont());
drawNameIcon(e.gc, rect);
}
});
+ nameCell.addPaintListener(nameCellPaintListener);
nameCell.addMouseListener(new MouseListener() {
@Override
chartCell.setLayoutData(data);
}
- void setFoldButtonTrue() {
+ public void setFoldButtonTrue() {
if (null == childFoldButton) {
return;
}
chartCell.contentsClear();
}
}
+
+ /*
+ * TODO need to source arrangement. remove redundancy and hard coding for margin.
+ */
+ public void setAdditionalInfo(final String additionalInfo) {
+ nameCell.removePaintListener(nameCellPaintListener);
+ nameCell.addPaintListener(new PaintListener() {
+ @Override
+ public void paintControl(PaintEvent e) {
+ Rectangle nameCellRect = ((Canvas) (e.widget)).getClientArea();
+
+ if (nameCellCurrentBGImage != null) {
+ Rectangle imageRect = nameCellCurrentBGImage.getBounds();
+ e.gc.drawImage(nameCellCurrentBGImage, imageRect.x,
+ imageRect.y, imageRect.width, imageRect.height,
+ nameCellRect.x, nameCellRect.y, nameCellRect.width, nameCellRect.height);
+ }
+
+ e.gc.setForeground(ColorResources.BLACK);
+ e.gc.setFont(parentItem.getNameFont());
+
+ if (itemName == null) {
+ return;
+ }
+
+ Point allNamep = e.gc.textExtent(itemName, SWT.DRAW_DELIMITER);
+ Rectangle iconRect;
+
+ int startY = nameCellRect.height / 2 - allNamep.y / 2;
+
+ // drawIcon
+ if (itemIcon != null) {
+ iconRect = itemIcon.getBounds();
+ int NameIconHeight = allNamep.y + iconRect.height + DEFAULT_NAME_ICON_MARGIN;
+ if (NameIconHeight < nameCellRect.height) {
+ startY = nameCellRect.height / 2 - NameIconHeight / 2;
+ e.gc.drawImage(itemIcon, iconRect.x, iconRect.y, iconRect.width, iconRect.height,
+ nameCellRect.width / 3, startY,
+ iconRect.width / 2, iconRect.height / 2);
+ startY += iconRect.height / 2;
+ }
+ }
+
+ // drawName
+ String[] temp = itemName.split("\n");
+ int lineLength = temp.length;
+ Point[] p = new Point[lineLength];
+ int middleX = nameCellRect.width / 2;
+
+ for (int i = 0; i < lineLength; i++) {
+ p[i] = e.gc.textExtent(temp[i]);
+ e.gc.drawText(temp[i], middleX - p[i].x / 2, startY, true);
+ startY += p[i].y + 1;
+ }
+
+ startY += 2;
+
+ // draw additional Info
+ temp = additionalInfo.split("\n");
+ lineLength = temp.length;
+ p = new Point[lineLength];
+ middleX = nameCellRect.width / 2;
+
+ for (int i = 0; i < lineLength; i++) {
+ p[i] = e.gc.textExtent(temp[i]);
+ e.gc.drawText(temp[i], middleX - p[i].x / 2, startY, true);
+ startY += p[i].y;
+ }
+ }
+ });
+
+ nameCell.redraw();
+ }
}
public static final long FEATURE_FUNCTION_PROFILING = (RESERVED_1 << 2)|FEATURE_FUNCTION_SAMPLING;
public static final long FEATURE_ALLOCATION = FEATURE_ON << 3;//0x0008;
+ public static final long SYSTEM_CPU = 0x10;
+ public static final long SYSTEM_MEMORY = 0x10 << 1;
+ public static final long SYSTEM_PROCESS_LOAD = 0x100 ;
+ public static final long SYSTEM_PROCESSES = 0x10 << 2 | SYSTEM_PROCESS_LOAD;
+ public static final long SYSTEM_THREAD_LOAD = 0x10 << 3; //0x10 << 3;
-
+// public static final long SYSTEM_FD = 0x100 << 1;
+// public static final long SYSTEM_DISK = 0x100 << 2;
+// public static final long SYSTEM_NETWORK = 0x100 << 3;
+// public static final long SYSTEM_DEVICE = 0x1000;
+// public static final long SYSTEM_ENERGY = 0x1000 << 1;
+ public static final long SYSTEM_DISK = 0x100 << 1;
+ public static final long SYSTEM_NETWORK = 0x100 << 2;
+ public static final long SYSTEM_DEVICE = 0x100 << 3;
+ public static final long SYSTEM_ENERGY = 0x1000;
public static final long FEATURE_FILE_API = 0x0010; // 4
- public static final long FEATURE_THREAD_API = 0x0020; // 5
+ public static final long FEATURE_THREAD_API = 0x0020; // 5
public static final long FEATURE_OSP_UI_API = 0x0040; //6
public static final long FEATURE_SCREENSHOT = 0x0080; //7
public static final long FEATURE_USER_EVENT = 0x0100; //8
public static final long FEATURE_NETWORK_API = 0x20000; //17
public static final long FEATURE_OPENGL_API = 0x40000; //18
- public static final long SYSTEM_CPU = 0x100000; //20
- public static final long SYSTEM_PROCESSES = 0x200000; //21
- public static final long SYSTEM_MEMORY = 0x400000; //22
- public static final long SYSTEM_DISK = 0x800000; //23
- public static final long SYSTEM_NETWORK = 0x1000000; //24
- public static final long SYSTEM_DEVICE = 0x2000000; //25
- public static final long SYSTEM_RESERVED = 0x8000000; //27
-
- public static final long SYSTEM_ENERGY = 0x4000000; //26
-
public static final long MEMORY_API_PROBING_NO_FILTER = 0x10000000; //28
public static final long FILE_API_PROBING_NO_FILTER = 0x20000000; //29
public static final long THREAD_API_PROBING_NO_FILTER = 0x40000000; //30
// public static final long OPENGL_API_PROBING_NO_FILTER = FEATURE_ON << 33;// prefeaturen
public static final long NETWORK_API_PROBING_NO_FILTER = FEATURE_ON; // prefeature
public static final long OPENGL_API_PROBING_NO_FILTER = FEATURE_ON <<1;// prefeaturen
+
public static final long SCREENSHOT_PERIODIC = 10;//must modification
public static final long SCREENSHOT_PERIODIC_AUTO = 1;//must modification
public static String FEATURE_SYSTEM_NETWORK; // 3.0 only
public static String FEATURE_SYSTEM_DEVICE; // 3.0 only
public static String FEATURE_SYSTEM_ENERGY; // 3.0 only
+ public static String FEATURE_SYSTEM_THREAD; // 3.0 only
public static String DETAIL_FUNCTIONPROFILING;
public static String DETAIL_ALLOCATION;
FEATURE_SYSTEM_NETWORK=System network
FEATURE_SYSTEM_DEVICE=System device
FEATURE_SYSTEM_ENERGY=System energy
+FEATURE_SYSTEM_THREAD=System Thread
DETAIL_FUNCTIONPROFILING=Shows the function profile.
CPU_FREQUENCY_CHART_FREQUENCY=CPU frequency
CPU_FREQUENCY_CHART_TITLE=CPU frequency
-FILE_CHART_SERIES_NAME_FD_COUNT=File count
+FILE_CHART_SERIES_NAME_FD_COUNT=FD Count
FILE_CHART_SERIES_NAME_READ=Read size
FILE_CHART_SERIES_NAME_WRITE=Write size
FILE_CHART_TITLE=File
UI_EVENT_CHART_TITLE=UI event
DISK_IO_CHART_TITLE=Disk IO
-DISK_IO_CHART_SERIES_READ=Read
-DISK_IO_CHART_SERIES_WRITE=Write
-DISK_IO_CHART_SERIES_READ_SECTOR=Sector read
-DISK_IO_CHART_SERIES_WRITE_SECTOR=Sector write
+DISK_IO_CHART_SERIES_READ=Read Byte
+DISK_IO_CHART_SERIES_WRITE=Write Byte
+DISK_IO_CHART_SERIES_READ_SECTOR=Sector read count
+DISK_IO_CHART_SERIES_WRITE_SECTOR=Sector write count
NETWORK_IO_CHART_TITLE=Network IO
NETWORK_IO_CHART_SERIES_SEND=Send
public void setFeatures(long low, long high) {
lowFeatures = low;
highFeatures = high;
+ System.out.println("lowFeatures : "+lowFeatures+" highFeatures : "+highFeatures);
}
@Override
--- /dev/null
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2013 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.swap.model.data;
+
+public class ProcessProfileData {
+ private int pid;
+ private float processLoad;
+ private long virtualMemory;
+ private long residentMemory;
+ private long sharedMemory;
+ private long pssMemory;
+ private long totalAllocSize;
+ private int threadCount;
+ private String threadLoad;
+
+ public int getPid() {
+ return pid;
+ }
+
+ public void setPid(int pid) {
+ this.pid = pid;
+ }
+
+ public float getProcessLoad() {
+ return processLoad;
+ }
+
+ public void setProcessLoad(float processLoad) {
+ this.processLoad = processLoad;
+ }
+
+ public long getVirtualMemory() {
+ return virtualMemory;
+ }
+
+ public void setVirtualMemory(long virtualMemory) {
+ this.virtualMemory = virtualMemory;
+ }
+
+ public long getResidentMemory() {
+ return residentMemory;
+ }
+
+ public void setResidentMemory(long residentMemory) {
+ this.residentMemory = residentMemory;
+ }
+
+ public long getSharedMemory() {
+ return sharedMemory;
+ }
+
+ public void setSharedMemory(long sharedMemory) {
+ this.sharedMemory = sharedMemory;
+ }
+
+ public long getPssMemory() {
+ return pssMemory;
+ }
+
+ public void setPssMemory(long pssMemory) {
+ this.pssMemory = pssMemory;
+ }
+
+ public long getTotalAllocSize() {
+ return totalAllocSize;
+ }
+
+ public void setTotalAllocSize(long totalAllocSize) {
+ this.totalAllocSize = totalAllocSize;
+ }
+
+ public int getThreadCount() {
+ return threadCount;
+ }
+
+ public void setThreadCount(int threadCount) {
+ this.threadCount = threadCount;
+ }
+
+ public String getThreadLoad() {
+ return threadLoad;
+ }
+
+ public void setThreadLoad(String threadLoad) {
+ this.threadLoad = threadLoad;
+ }
+}
* Copyright (c) 2013 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>
*
public class SystemData extends LogData {
- float appCpuUsage = 0;
String cpuFrequency = null;
String cpuLoad = null;
- int threadCount = 0;
- String threadLoad = null;
- int processCount = 0;
- String processLoad = null;
- int virtualMemory = 0;
- int residentMemory = 0;
- int sharedMemory = 0;
- int pssMemory = 0;
- long totalAllocSize = 0;
- long systemMemoryTotal = 0;
long systemMemoryUsed = 0;
+ int targetProcessCount = 0;
+ ProcessProfileData[] processProfileDataList = null;
+ int otherProcessCount = 0;
+ String otherProcessLoad = null;
int totalUsedDrive = 0;
int diskReadSize = 0;
int diskReadSectorCount = 0;
.getCpuCount();
int deviceCount = GlobalInformation.getCurrentDeviceInfo().getTargetInfo()
.getDeviceCount();
- appCpuUsage = ByteUtil.toFloat(data, index);
- index += FLOAT_SIZE;
cpuFrequency = parseCpu(index, data);
index += (FLOAT_SIZE * coreCount);
cpuLoad = parseCpu(index, data);
index += (FLOAT_SIZE * coreCount);
- threadCount = ByteUtil.toInt(data, index);
- index += INT_SIZE;
-
- threadLoad = parseLoad(index, data);
- index += (threadCount * (INT_SIZE + FLOAT_SIZE));
-
- processCount = ByteUtil.toInt(data, index);
- index += INT_SIZE;
-
- processLoad = parseLoad(index, data);
- index += (processCount * (INT_SIZE + FLOAT_SIZE));
-
- virtualMemory = ByteUtil.toInt(data, index);
- index += INT_SIZE;
-
- residentMemory = ByteUtil.toInt(data, index);
- index += INT_SIZE;
-
- sharedMemory = ByteUtil.toInt(data, index);
+ systemMemoryUsed = ByteUtil.toLong(data, index);
+ index += LONG_SIZE;
+
+ targetProcessCount = ByteUtil.toInt(data, index);
index += INT_SIZE;
-
- pssMemory = ByteUtil.toInt(data, index);
+
+ if (targetProcessCount == 0) {
+ System.err.println("targetProcessCount is 0");
+ } else if (targetProcessCount > 1) {
+ System.err.println("targetProcessCount : " + targetProcessCount);
+ }
+
+ parseTargetProcessInfo(data, targetProcessCount);
+
+ otherProcessCount = ByteUtil.toInt(data, index);
index += INT_SIZE;
- totalAllocSize = ByteUtil.toLong(data, index);
- index += LONG_SIZE;
-
- systemMemoryTotal = ByteUtil.toLong(data, index);
- index += LONG_SIZE;
-
- systemMemoryUsed = ByteUtil.toLong(data, index);
- index += LONG_SIZE;
+ otherProcessLoad = parseLoad(index, data);
+ index += (otherProcessCount * (INT_SIZE + FLOAT_SIZE));
totalUsedDrive = ByteUtil.toInt(data, index);
index += INT_SIZE;
}
return buffer.toString();
}
-
+
+ private void parseTargetProcessInfo(byte[] payload, int targetProcessCount) {
+ processProfileDataList = new ProcessProfileData[targetProcessCount];
+ for (int i = 0; i < targetProcessCount; i++) {
+ ProcessProfileData processData = new ProcessProfileData();
+ processData.setPid(ByteUtil.toInt(payload, index));
+ index += INT_SIZE;
+ processData.setProcessLoad(ByteUtil.toFloat(payload, index));
+ index += FLOAT_SIZE;
+ processData.setVirtualMemory(ByteUtil.toLong(payload, index));
+ index += LONG_SIZE;
+ processData.setResidentMemory(ByteUtil.toLong(payload, index));
+ index += LONG_SIZE;
+ processData.setSharedMemory(ByteUtil.toLong(payload, index));
+ index += LONG_SIZE;
+ processData.setPssMemory(ByteUtil.toLong(payload, index));
+ index += LONG_SIZE;
+ processData.setTotalAllocSize(ByteUtil.toLong(payload, index));
+ index += LONG_SIZE;
+ processData.setThreadCount(ByteUtil.toInt(payload, index));
+ index += INT_SIZE;
+ processData.setThreadLoad(parseLoad(index, payload));
+ index += (processData.getThreadCount() * (INT_SIZE + FLOAT_SIZE));
+ processProfileDataList[i] = processData;
+ }
+ }
+
public int getEnergy() {
return energyUsage;
}
this.networkReceiveSize = networkReceiveSize;
}
- public int getVirtualMemory() {
- return virtualMemory;
- }
-
- public void setVirtualMemory(int virtualMemory) {
- this.virtualMemory = virtualMemory;
- }
-
- public int getResidentMemory() {
- return residentMemory;
- }
-
- public void setResidentMemory(int residentMemory) {
- this.residentMemory = residentMemory;
- }
-
- public int getSharedMemory() {
- return sharedMemory;
- }
-
- public void setSharedMemory(int sharedMemory) {
- this.sharedMemory = sharedMemory;
- }
-
- public int getPssMemory() {
- return pssMemory;
- }
-
- public void setPssMemory(int pssMemory) {
- this.pssMemory = pssMemory;
- }
-
- public long getTotalAllocSize() {
- return totalAllocSize;
- }
-
- public void setTotalAllocSize(int totalAllocSize) {
- this.totalAllocSize = totalAllocSize;
- }
-
public int getTotalUsedDrive() {
return totalUsedDrive;
}
this.totalUsedDrive = totalUsedDrive;
}
- public int getThreadCount() {
- return threadCount;
- }
-
- public void setThreadCount(int threadCount) {
- this.threadCount = threadCount;
- }
-
- public int getProcessCount() {
- return processCount;
- }
-
- public void setProcessCount(int processCount) {
- this.processCount = processCount;
- }
-
public String getCpuFrequency() {
return cpuFrequency;
}
this.cpuFrequency = cpuFrequency;
}
- public float getAppCpuUsage() {
- return appCpuUsage;
- }
-
- public void setAppCpuUsage(float appCpuUsage) {
- this.appCpuUsage = appCpuUsage;
- }
-
public String getCpuLoad() {
return cpuLoad;
}
this.cpuLoad = cpuLoad;
}
- public long getSystemMemoryTotal() {
- return systemMemoryTotal;
- }
-
- public void setSystemMemoryTotal(long systemMemoryTotal) {
- this.systemMemoryTotal = systemMemoryTotal;
- }
-
public long getSystemMemoryUsed() {
return systemMemoryUsed;
}
this.systemMemoryUsed = systemMemoryUsed;
}
- public String getThreadLoad() {
- return threadLoad;
- }
-
- public void setThreadLoad(String threadLoad) {
- this.threadLoad = threadLoad;
- }
-
- public String getProcessLoad() {
- return processLoad;
- }
-
- public void setProcessLoad(String processLoad) {
- this.processLoad = processLoad;
- }
-
public int getDiskReadSize() {
return diskReadSize;
}
this.applicationEnergyUsage = applicationEnergyUsage;
}
+ public int getTargetProcessCount() {
+ return targetProcessCount;
+ }
+
+ public void setTargetProcessCount(int targetProcessCount) {
+ this.targetProcessCount = targetProcessCount;
+ }
+
+ public ProcessProfileData[] getProcessProfileDataList() {
+ return processProfileDataList;
+ }
+
+ public void setProcessProfileDataList(
+ ProcessProfileData[] processProfileDataList) {
+ this.processProfileDataList = processProfileDataList;
+ }
+
+ public int getOtherProcessCount() {
+ return otherProcessCount;
+ }
+
+ public void setOtherProcessCount(int otherProcessCount) {
+ this.otherProcessCount = otherProcessCount;
+ }
+
+ public String getOtherProcessLoad() {
+ return otherProcessLoad;
+ }
+
+ 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++, appCpuUsage);
+ prep.setFloat(index++, 0);
prep.setString(index++, cpuFrequency);
prep.setString(index++, cpuLoad);
- prep.setInt(index++, threadCount);
- prep.setString(index++, threadLoad);
- prep.setInt(index++, processCount);
- prep.setString(index++, processLoad);
- prep.setInt(index++, virtualMemory);
- prep.setInt(index++, residentMemory);
- prep.setInt(index++, sharedMemory);
- prep.setInt(index++, pssMemory);
- prep.setLong(index++, totalAllocSize);
- prep.setLong(index++, systemMemoryTotal);
+ 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++, totalUsedDrive);
prep.setInt(index++, diskReadSize);
// prep.setInt(index++, rssiAlpha);
}
+ /*
+ * TODO this method will be removed.
+ */
@Override
public void loadData(ResultSet rs) throws SQLException {
super.loadData(rs);
int index = LogData.STATE_COUNT + 1;
- appCpuUsage = rs.getFloat(index++);
+// appCpuUsage = rs.getFloat(index++);
cpuFrequency = rs.getString(index++);
cpuLoad = rs.getString(index++);
- threadCount = rs.getInt(index++);
- threadLoad = rs.getString(index++);
- processCount = rs.getInt(index++);
- processLoad = rs.getString(index++);
- virtualMemory = rs.getInt(index++);
- residentMemory = rs.getInt(index++);
- sharedMemory = rs.getInt(index++);
- pssMemory = rs.getInt(index++);
- totalAllocSize = rs.getInt(index++);
- systemMemoryTotal = rs.getLong(index++);
+// threadCount = rs.getInt(index++);
+// threadLoad = rs.getString(index++);
+// processCount = rs.getInt(index++);
+// processLoad = rs.getString(index++);
+// virtualMemory = rs.getInt(index++);
+// residentMemory = rs.getInt(index++);
+// sharedMemory = rs.getInt(index++);
+// pssMemory = rs.getInt(index++);
+// totalAllocSize = rs.getInt(index++);
+// systemMemoryTotal = rs.getLong(index++);
systemMemoryUsed = rs.getLong(index++);
totalUsedDrive = rs.getInt(index++);
diskReadSize = rs.getInt(index++);
import org.tizen.dynamicanalyzer.ui.summary.warning.WarningCase;
import org.tizen.dynamicanalyzer.ui.summary.warning.WarningChecker;
import org.tizen.dynamicanalyzer.ui.summary.warning.WarningData;
-import org.tizen.dynamicanalyzer.ui.timeline.chart.FileChart;
import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
import org.tizen.dynamicanalyzer.ui.toolbar.configuration.ConfigurationDialogDataManager;
import org.tizen.dynamicanalyzer.util.DALogger;
checkDuplicateOpen(event);
if (errno == 0) {
timeLineFileChartFDCount++;
- FileChart.getInstance().setFDCount(1, time);
}
} else if (fdApiType == LogCenterConstants.FD_API_TYPE_CLOSE) {
event.setApiType(LogCenterConstants.FD_API_TYPE_CLOSE);
if (errno == 0) {
timeLineFileChartFDCount--;
- if (timeLineFileChartFDCount >= 0) {
- FileChart.getInstance().setFDCount(-1, time);
- } else {
+ if (timeLineFileChartFDCount < 0) {
timeLineFileChartFDCount = 0;
}
}
if (fdApiType == LogCenterConstants.FD_API_TYPE_READ_END) {
event.setReadSize(fileSize);
event.setApiType(LogCenterConstants.FD_API_TYPE_READ_END);
- FileChart.getInstance().setReadByte((int) fileSize, time);
} else if (fdApiType == LogCenterConstants.FD_API_TYPE_WRITE_END) {
event.setFileSize(fileSize);
event.setWriteSize(fileSize);
event.setApiType(LogCenterConstants.FD_API_TYPE_WRITE_END);
- FileChart.getInstance().setWriteByte((int) fileSize, time);
}
}
event.setApiType(fdApiType);
import org.tizen.dynamicanalyzer.ui.summary.failed.FailedData;
import org.tizen.dynamicanalyzer.ui.summary.leaks.LeakDetector;
import org.tizen.dynamicanalyzer.ui.summary.warning.WarningChecker;
-import org.tizen.dynamicanalyzer.ui.timeline.chart.FileChart;
import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
import org.tizen.dynamicanalyzer.ui.toolbar.configuration.ConfigurationDialogDataManager;
import org.tizen.dynamicanalyzer.util.DALogger;
private FailedChecker failedChecker = null;
private WarningChecker warningChecker = null;
- private int timeLineFileChartFDCount = 0;
private List<FileStatus> fileStatusList = new ArrayList<FileStatus>();
private List<FileAccess> fileAccessList = new ArrayList<FileAccess>();
List<FileEvent> fileEventQueue = new ArrayList<FileEvent>();
- FileChart timeLineFileChart = FileChart.getInstance();
int size = inputs.size();
FileEvent event = null;
String key = null;
switch(apiType){
case LogCenterConstants.FD_API_TYPE_OPEN:
if (errNo == 0) {
- timeLineFileChartFDCount++;
- timeLineFileChart.setFDCount(1, eventTime);
addFileAccessor(key, event.getDentry());
addStatusData(new FileStatus(dentry, pid, tid, filePath, apiType, eventTime, errNo));
}
break;
case LogCenterConstants.FD_API_TYPE_CLOSE:
if (errNo == 0) {
- // TODO: legacy code, need to check
- timeLineFileChartFDCount--;
- if (timeLineFileChartFDCount >= 0) {
- timeLineFileChart.setFDCount(-1, eventTime);
- } else {
- timeLineFileChartFDCount = 0;
- }
+ // TODO: legacy code, need to check
+ // (code concern timelinechart is removed by jungwook. Is valid above TODO comment?)
addStatusData(new FileStatus(dentry, pid, tid, filePath, apiType, eventTime, errNo));
}
break;
addStartAccessData(readAccess);
break;
case LogCenterConstants.FD_API_TYPE_READ_END:
- timeLineFileChart.setReadByte((int) fileSize, eventTime);
deleteReadingCount(dentry);
addEndAccessData(dentry, pid, tid, filePath, eventTime, fileSize,
LogCenterConstants.FD_API_TYPE_READ_START);
addStartAccessData(writeAccess);
break;
case LogCenterConstants.FD_API_TYPE_WRITE_END:
- timeLineFileChart.setWriteByte((int) fileSize, eventTime);
deleteWritingCount(dentry);
addEndAccessData(dentry, pid, tid, filePath, eventTime, fileSize,
LogCenterConstants.FD_API_TYPE_WRITE_START);
lastCpuRate.add(new Long((long)Float.parseFloat(cpu)));
}
- lastProcessMemory = input.getResidentMemory();
+ /*
+ * TODO interface of SystemData is changed(by jungwook). removed getResidentMemory().
+ * residentMemory is possible one more per multi process.
+ */
+// lastProcessMemory = input.getResidentMemory();
lastStartTime = input.getTime();
}
}
long totalMem = AnalyzerManager.getProject().getSystemMemorySize();
maxMem = totalMem;
- processMem = ((SystemData) input).getResidentMemory();
+
+ /*
+ * TODO interface of SystemData is changed(by jungwook). removed getResidentMemory().
+ * residentMemory is possible one more per multi process.
+ */
+// processMem = ((SystemData) input).getResidentMemory();
}
@Override
String tid;
int load;
- loads = sysLog.getThreadLoad();
- // loads = input.get(LogCenterConstants.DEVICE_THREAD_LOAD_INDEX);
- String[] temp = loads.split(",");
- int tempSize = temp.length;
- double time;
- for (int j = 0; j + 1 < tempSize; j += 2) {
- try {
- tid = temp[j];
- } catch (NumberFormatException nfe) {
- DA_LOG.error("parseLoad - tid parsing");
- break;
- }
- // if (null == findParentData(tid)) {
- // continue;
- // }
- load = (int) (Double.parseDouble(temp[j + 1]));
- time = Double.parseDouble(Long.toString(input.getTime()))
- / TimelineConstants.MEGA_DOUBLE;
- ThreadPageThreadDataEvent event = new ThreadPageThreadDataEvent(
- ThreadPageThreadDataEvent.TYPE_LOAD, load, -1, time, tid,
- String.valueOf(load)
- + ThreadPageLabels.THREAD_CHART_ITEM_PERCENT, -1,
- null);
- pushEvent(event);
-
- }
- hasUpdate = true;
+// loads = sysLog.getThreadLoad(); // TODO SystemData interface changed.
+// // loads = input.get(LogCenterConstants.DEVICE_THREAD_LOAD_INDEX);
+// String[] temp = loads.split(",");
+// int tempSize = temp.length;
+// double time;
+// for (int j = 0; j + 1 < tempSize; j += 2) {
+// try {
+// tid = temp[j];
+// } catch (NumberFormatException nfe) {
+// DA_LOG.error("parseLoad - tid parsing");
+// break;
+// }
+// // if (null == findParentData(tid)) {
+// // continue;
+// // }
+// load = (int) (Double.parseDouble(temp[j + 1]));
+// time = Double.parseDouble(Long.toString(input.getTime()))
+// / TimelineConstants.MEGA_DOUBLE;
+// ThreadPageThreadDataEvent event = new ThreadPageThreadDataEvent(
+// ThreadPageThreadDataEvent.TYPE_LOAD, load, -1, time, tid,
+// String.valueOf(load)
+// + ThreadPageLabels.THREAD_CHART_ITEM_PERCENT, -1,
+// null);
+// pushEvent(event);
+//
+// }
+// hasUpdate = true;
}
private void parseLoad(LogPackage logPack) {
int load;
for (int i = 0; i < size; i++) {
input = (SystemData) inputs.get(i);
- loads = input.getThreadLoad();
- String[] temp = loads.split(",");
- int tempSize = temp.length;
- double time;
- for (int j = 0; j + 1 < tempSize; j += 2) {
- try {
- tid = temp[j];
- } catch (NumberFormatException nfe) {
- DA_LOG.error("parseLoad - tid parsing");
- break;
- }
- // if (null == findParentData(tid)) {
- // continue;
- // }
-
- load = (int) (Double.parseDouble(temp[j + 1]));
- time = Double.parseDouble(Long.toString(input.getTime()))
- / TimelineConstants.MEGA_DOUBLE;
- ThreadPageThreadDataEvent event = new ThreadPageThreadDataEvent(
- ThreadPageThreadDataEvent.TYPE_LOAD, load, -1, time,
- tid, String.valueOf(load)
- + ThreadPageLabels.THREAD_CHART_ITEM_PERCENT,
- -1, null);
- pushEvent(event);
- }
+// loads = input.getThreadLoad(); // TODO SystemData interface changed.
+// String[] temp = loads.split(",");
+// int tempSize = temp.length;
+// double time;
+// for (int j = 0; j + 1 < tempSize; j += 2) {
+// try {
+// tid = temp[j];
+// } catch (NumberFormatException nfe) {
+// DA_LOG.error("parseLoad - tid parsing");
+// break;
+// }
+// // if (null == findParentData(tid)) {
+// // continue;
+// // }
+//
+// load = (int) (Double.parseDouble(temp[j + 1]));
+// time = Double.parseDouble(Long.toString(input.getTime()))
+// / TimelineConstants.MEGA_DOUBLE;
+// ThreadPageThreadDataEvent event = new ThreadPageThreadDataEvent(
+// ThreadPageThreadDataEvent.TYPE_LOAD, load, -1, time,
+// tid, String.valueOf(load)
+// + ThreadPageLabels.THREAD_CHART_ITEM_PERCENT,
+// -1, null);
+// pushEvent(event);
+// }
}
}
public static enum COLUMN {
TIME,
- CPU_LOAD_APP,
CPU_LOAD_TOTAL,
- PROCESS_COUNT,
- HEAP_ALLOCATION_TOTAL,
- HEAP_ALLOCATION_APP,
- MEMORY_VIRTUAL,
- MEMORY_RESIDENT,
- MEMORY_SHARED,
- MEMORY_PSS,
- MEMORY_TOTAL_SYSTEM,
+ PROCESS_COUNT_OTHER,
+ PROCESS_COUNT_TARGET,
MEMORY_USAGE_SYSTEM,
NETWORK_SIZE_SEND,
NETWORK_SIZE_RECEIVE,
DISK_IO_WRITE_SIZE,
DISK_IO_WRITE_SECTOR,
ENERGY_USAGE,
- FD_COUNT,
- FD_ACTIVITY
}
public static final String TIME = "TIME";
- public static final String CPU_LOAD_APP = "CPU_LOAD_APP";
public static final String CPU_LOAD_TOTAL = "CPU_LOAD_TOTAL";
- public static final String PROCESS_COUNT = "PROCESS_COUNT";
- public static final String HEAP_ALLOCATION_TOTAL = "HEAP_ALLOCATION_TOTAL";
- public static final String HEAP_ALLOCATION_APP = "HEAP_ALLOCATION_APP";
- 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 PROCESS_COUNT_OTHER = "PROCESS_COUNT_OTHER";
+ public static final String PROCESS_COUNT_TARGET = "PROCESS_COUNT_TARGET";
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 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() {
}
public SystemDataDBTable() {
- addColumn(new DBColumn(TIME, DBConstants.NOT_NULL, DBConstants.LONG)); // 1
- addColumn(new DBColumn(CPU_LOAD_APP, DBConstants.EMPTY, DBConstants.FLOAT));
+ addColumn(new DBColumn(TIME, DBConstants.NOT_NULL, DBConstants.LONG));
addColumn(new DBColumn(CPU_LOAD_TOTAL, DBConstants.EMPTY, DBConstants.FLOAT));
- addColumn(new DBColumn(PROCESS_COUNT, DBConstants.EMPTY, DBConstants.INTEGER));
- addColumn(new DBColumn(HEAP_ALLOCATION_TOTAL, DBConstants.EMPTY, DBConstants.LONG));
- addColumn(new DBColumn(HEAP_ALLOCATION_APP, DBConstants.EMPTY, DBConstants.LONG));
- addColumn(new DBColumn(MEMORY_VIRTUAL, DBConstants.EMPTY, DBConstants.INTEGER));
- addColumn(new DBColumn(MEMORY_RESIDENT, DBConstants.EMPTY, DBConstants.INTEGER));
- addColumn(new DBColumn(MEMORY_SHARED, DBConstants.EMPTY, DBConstants.INTEGER));
- addColumn(new DBColumn(MEMORY_PSS, DBConstants.EMPTY, DBConstants.INTEGER)); // 10
- addColumn(new DBColumn(MEMORY_TOTAL_SYSTEM, DBConstants.EMPTY, DBConstants.LONG));
+ addColumn(new DBColumn(PROCESS_COUNT_OTHER, DBConstants.EMPTY, DBConstants.INTEGER));
+ addColumn(new DBColumn(PROCESS_COUNT_TARGET, DBConstants.EMPTY, DBConstants.INTEGER));
addColumn(new DBColumn(MEMORY_USAGE_SYSTEM, DBConstants.EMPTY, DBConstants.LONG));
addColumn(new DBColumn(NETWORK_SIZE_SEND, DBConstants.EMPTY, DBConstants.INTEGER));
addColumn(new DBColumn(NETWORK_SIZE_RECEIVE, DBConstants.EMPTY, DBConstants.INTEGER));
addColumn(new DBColumn(DEVICE_STATUS_GPS, DBConstants.EMPTY, DBConstants.INTEGER));
addColumn(new DBColumn(DEVICE_STATUS_BRIGHTNESS, DBConstants.EMPTY, DBConstants.INTEGER));
addColumn(new DBColumn(DEVICE_STATUS_DNET, DBConstants.EMPTY, DBConstants.INTEGER));
- addColumn(new DBColumn(DEVICE_STATUS_CAMERA, DBConstants.EMPTY, DBConstants.INTEGER)); // 20
+ addColumn(new DBColumn(DEVICE_STATUS_CAMERA, DBConstants.EMPTY, DBConstants.INTEGER));
addColumn(new DBColumn(DEVICE_STATUS_SOUND, DBConstants.EMPTY, DBConstants.INTEGER));
addColumn(new DBColumn(DEVICE_STATUS_AUDIO, DBConstants.EMPTY, DBConstants.INTEGER));
addColumn(new DBColumn(DEVICE_STATUS_VIBRATION, DBConstants.EMPTY, DBConstants.INTEGER));
addColumn(new DBColumn(DEVICE_STATUS_CALL, DBConstants.EMPTY, DBConstants.INTEGER));
addColumn(new DBColumn(DISK_TOTAL_USAGE, DBConstants.EMPTY, DBConstants.INTEGER));
addColumn(new DBColumn(DISK_IO_READ_SIZE, DBConstants.EMPTY, DBConstants.INTEGER));
- addColumn(new DBColumn(DISK_IO_READ_SECTOR, DBConstants.EMPTY, DBConstants.INTEGER)); // 30
+ addColumn(new DBColumn(DISK_IO_READ_SECTOR, DBConstants.EMPTY, DBConstants.INTEGER));
addColumn(new DBColumn(DISK_IO_WRITE_SIZE, DBConstants.EMPTY, DBConstants.INTEGER));
addColumn(new DBColumn(DISK_IO_WRITE_SECTOR, DBConstants.EMPTY, DBConstants.INTEGER));
addColumn(new DBColumn(ENERGY_USAGE, DBConstants.EMPTY, DBConstants.INTEGER));
-// addColumn(new DBColumn(FD_COUNT, DBConstants.NOT_NULL, DBConstants.INTEGER));
-// addColumn(new DBColumn(FD_ACTIVITY, DBConstants.NOT_NULL, DBConstants.INTEGER));
}
@Override
} else {
try {
prep.setLong(1, (Long) (rowData.get(COLUMN.TIME.ordinal())));
- prep.setFloat(2, (Float) (rowData.get(COLUMN.CPU_LOAD_APP.ordinal())));
- prep.setFloat(3, (Float) (rowData.get(COLUMN.CPU_LOAD_TOTAL.ordinal())));
- prep.setInt(4, (Integer) (rowData.get(COLUMN.PROCESS_COUNT.ordinal())));
- prep.setLong(5, (Long) (rowData.get(COLUMN.HEAP_ALLOCATION_TOTAL.ordinal())));
- prep.setLong(6, (Long) (rowData.get(COLUMN.HEAP_ALLOCATION_APP.ordinal())));
- prep.setInt(7, (Integer) (rowData.get(COLUMN.MEMORY_VIRTUAL.ordinal())));
- prep.setInt(8, (Integer) (rowData.get(COLUMN.MEMORY_RESIDENT.ordinal())));
- prep.setInt(9, (Integer) (rowData.get(COLUMN.MEMORY_SHARED.ordinal())));
- prep.setInt(10, (Integer) (rowData.get(COLUMN.MEMORY_PSS.ordinal())));
- prep.setLong(11, (Long) (rowData.get(COLUMN.MEMORY_TOTAL_SYSTEM.ordinal())));
- prep.setLong(12, (Long) (rowData.get(COLUMN.MEMORY_USAGE_SYSTEM.ordinal())));
- prep.setInt(13, (Integer) (rowData.get(COLUMN.NETWORK_SIZE_SEND.ordinal())));
- prep.setInt(14, (Integer) (rowData.get(COLUMN.NETWORK_SIZE_RECEIVE.ordinal())));
- prep.setInt(15, (Integer) (rowData.get(COLUMN.DEVICE_STATUS_WIFI.ordinal())));
- prep.setInt(16, (Integer) (rowData.get(COLUMN.DEVICE_STATUS_BLUETOOTH.ordinal())));
- prep.setInt(17, (Integer) (rowData.get(COLUMN.DEVICE_STATUS_GPS.ordinal())));
- prep.setInt(18, (Integer) (rowData.get(COLUMN.DEVICE_STATUS_BRIGHTNESS.ordinal())));
- prep.setInt(19, (Integer) (rowData.get(COLUMN.DEVICE_STATUS_DNET.ordinal())));
- prep.setInt(20, (Integer) (rowData.get(COLUMN.DEVICE_STATUS_CAMERA.ordinal())));
- prep.setInt(21, (Integer) (rowData.get(COLUMN.DEVICE_STATUS_SOUND.ordinal())));
- prep.setInt(22, (Integer) (rowData.get(COLUMN.DEVICE_STATUS_AUDIO.ordinal())));
- prep.setInt(23, (Integer) (rowData.get(COLUMN.DEVICE_STATUS_VIBRATION.ordinal())));
- prep.setInt(24, (Integer) (rowData.get(COLUMN.DEVICE_STATUS_VOLTAGE.ordinal())));
- prep.setInt(25, (Integer) (rowData.get(COLUMN.DEVICE_STATUS_RSSI.ordinal())));
- prep.setInt(26, (Integer) (rowData.get(COLUMN.DEVICE_STATUS_VIDEO.ordinal())));
- prep.setInt(27, (Integer) (rowData.get(COLUMN.DEVICE_STATUS_CALL.ordinal())));
- prep.setInt(28, (Integer) (rowData.get(COLUMN.DISK_TOTAL_USAGE.ordinal())));
- prep.setInt(29, (Integer) (rowData.get(COLUMN.DISK_IO_READ_SIZE.ordinal())));
- prep.setInt(30, (Integer) (rowData.get(COLUMN.DISK_IO_READ_SECTOR.ordinal())));
- prep.setInt(31, (Integer) (rowData.get(COLUMN.DISK_IO_WRITE_SIZE.ordinal())));
- prep.setInt(32, (Integer) (rowData.get(COLUMN.DISK_IO_WRITE_SECTOR.ordinal())));
- prep.setInt(33, (Integer) (rowData.get(COLUMN.ENERGY_USAGE.ordinal())));
+ prep.setFloat(2, (Float) (rowData.get(COLUMN.CPU_LOAD_TOTAL.ordinal())));
+ prep.setInt(3, (Integer) (rowData.get(COLUMN.PROCESS_COUNT_OTHER.ordinal())));
+ prep.setInt(4, (Integer) (rowData.get(COLUMN.PROCESS_COUNT_TARGET.ordinal())));
+ prep.setLong(5, (Long) (rowData.get(COLUMN.MEMORY_USAGE_SYSTEM.ordinal())));
+ prep.setInt(6, (Integer) (rowData.get(COLUMN.NETWORK_SIZE_SEND.ordinal())));
+ prep.setInt(7, (Integer) (rowData.get(COLUMN.NETWORK_SIZE_RECEIVE.ordinal())));
+ prep.setInt(8, (Integer) (rowData.get(COLUMN.DEVICE_STATUS_WIFI.ordinal())));
+ prep.setInt(9, (Integer) (rowData.get(COLUMN.DEVICE_STATUS_BLUETOOTH.ordinal())));
+ prep.setInt(10, (Integer) (rowData.get(COLUMN.DEVICE_STATUS_GPS.ordinal())));
+ prep.setInt(11, (Integer) (rowData.get(COLUMN.DEVICE_STATUS_BRIGHTNESS.ordinal())));
+ prep.setInt(12, (Integer) (rowData.get(COLUMN.DEVICE_STATUS_DNET.ordinal())));
+ prep.setInt(13, (Integer) (rowData.get(COLUMN.DEVICE_STATUS_CAMERA.ordinal())));
+ prep.setInt(14, (Integer) (rowData.get(COLUMN.DEVICE_STATUS_SOUND.ordinal())));
+ prep.setInt(15, (Integer) (rowData.get(COLUMN.DEVICE_STATUS_AUDIO.ordinal())));
+ prep.setInt(16, (Integer) (rowData.get(COLUMN.DEVICE_STATUS_VIBRATION.ordinal())));
+ prep.setInt(17, (Integer) (rowData.get(COLUMN.DEVICE_STATUS_VOLTAGE.ordinal())));
+ prep.setInt(18, (Integer) (rowData.get(COLUMN.DEVICE_STATUS_RSSI.ordinal())));
+ prep.setInt(19, (Integer) (rowData.get(COLUMN.DEVICE_STATUS_VIDEO.ordinal())));
+ prep.setInt(20, (Integer) (rowData.get(COLUMN.DEVICE_STATUS_CALL.ordinal())));
+ prep.setInt(21, (Integer) (rowData.get(COLUMN.DISK_TOTAL_USAGE.ordinal())));
+ prep.setInt(22, (Integer) (rowData.get(COLUMN.DISK_IO_READ_SIZE.ordinal())));
+ prep.setInt(23, (Integer) (rowData.get(COLUMN.DISK_IO_READ_SECTOR.ordinal())));
+ prep.setInt(24, (Integer) (rowData.get(COLUMN.DISK_IO_WRITE_SIZE.ordinal())));
+ prep.setInt(25, (Integer) (rowData.get(COLUMN.DISK_IO_WRITE_SECTOR.ordinal())));
+ prep.setInt(26, (Integer) (rowData.get(COLUMN.ENERGY_USAGE.ordinal())));
} catch (SQLException e) {
e.printStackTrace();
isPrepared = false;
--- /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 java.util.List;
+
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
+import org.tizen.dynamicanalyzer.common.AnalyzerManager;
+import org.tizen.dynamicanalyzer.swap.logparser.ReadBlockingQueue;
+import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineChartManager;
+
+public class TargetProcessDBInserter implements Runnable {
+ private static ReadBlockingQueue<List<List<Object>>> processDataQueue = new ReadBlockingQueue<List<List<Object>>>();
+
+ private static volatile Thread inserterThread = null;
+
+ public static void startThread() {
+ if (inserterThread == null || !inserterThread.isAlive()) {
+ synchronized (TargetProcessDBInserter.class) {
+ if (inserterThread == null || !inserterThread.isAlive()) {
+ inserterThread = new Thread(null,
+ new TargetProcessDBInserter());
+ inserterThread.start();
+ }
+ }
+ }
+ }
+
+ public static void stopThread() {
+ if (inserterThread != null && inserterThread.isAlive()) {
+ try {
+ sendNotify();
+ inserterThread.join(AnalyzerConstants.THREAD_JOIN_WAIT_TIME);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public static void pushContextData(List<List<Object>> data) {
+ processDataQueue.offer(data);
+ }
+
+ public static void clear() {
+ stopThread();
+ }
+
+ @Override
+ public void run() {
+ while (!AnalyzerManager.isExit()) {
+ List<List<Object>> processData = processDataQueue.poll();
+
+ if (processData != null && processData.size() != 0) {
+ for (int i = 0; i < processData.size(); i++) {
+ List<Object> row = processData.get(i);
+ }
+ TimelineChartManager.getInstance().getTargetProcessTable().insertData(processData);
+ }
+ }
+ }
+
+ public static void sendNotify() {
+ processDataQueue.wake();
+ }
+
+}
--- /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 java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.util.List;
+
+import org.tizen.dynamicanalyzer.database.DBColumn;
+import org.tizen.dynamicanalyzer.database.DBConstants;
+import org.tizen.dynamicanalyzer.database.DBTable;
+
+public class TargetProcessDBTable extends DBTable {
+ private static final String TABLENAME = "TIMELINE_TARGET_PROCESS";
+
+ public static enum COLUMN {
+ TIME,
+ PID,
+ CPU_LOAD,
+ MEMORY_VIRTUAL,
+ MEMORY_RESIDENT,
+ MEMORY_SHARED,
+ MEMORY_PSS,
+ HEAP_ALLOCATION_TOTAL,
+ HEAP_ALLOCATION,
+ }
+
+ public static final String TIME = "TIME";
+ public static final String PID = "PID";
+ public static final String CPU_LOAD = "CPU_LOAD";
+ 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 HEAP_ALLOCATION_TOTAL = "HEAP_ALLOCATION_TOTAL";
+ public static final String HEAP_ALLOCATION_APP = "HEAP_ALLOCATION_APP";
+
+ @Override
+ public String getTableName() {
+ return TABLENAME;
+ }
+
+ public TargetProcessDBTable() {
+ addColumn(new DBColumn(TIME, DBConstants.NOT_NULL, DBConstants.LONG));
+ addColumn(new DBColumn(PID, DBConstants.EMPTY, DBConstants.INTEGER));
+ addColumn(new DBColumn(CPU_LOAD, DBConstants.EMPTY, DBConstants.FLOAT));
+ addColumn(new DBColumn(MEMORY_VIRTUAL, DBConstants.EMPTY, DBConstants.LONG));
+ addColumn(new DBColumn(MEMORY_RESIDENT, DBConstants.EMPTY, DBConstants.LONG));
+ addColumn(new DBColumn(MEMORY_SHARED, DBConstants.EMPTY, DBConstants.LONG));
+ addColumn(new DBColumn(MEMORY_PSS, DBConstants.EMPTY, DBConstants.LONG));
+ addColumn(new DBColumn(HEAP_ALLOCATION_TOTAL, DBConstants.EMPTY, DBConstants.LONG));
+ addColumn(new DBColumn(HEAP_ALLOCATION_APP, DBConstants.EMPTY, DBConstants.LONG));
+ }
+
+ @Override
+ public boolean prepare(PreparedStatement prep, List<Object> rowData) {
+ boolean isPrepared = true;
+
+ int columnsize = getColumnSize();
+ if (columnsize != rowData.size()) {
+ isPrepared = false;
+ } else {
+ try {
+ prep.setLong(1, (Long) (rowData.get(COLUMN.TIME.ordinal())));
+ prep.setInt(2, (Integer) (rowData.get(COLUMN.PID.ordinal())));
+ prep.setFloat(3, (Float) (rowData.get(COLUMN.CPU_LOAD.ordinal())));
+ prep.setLong(4, (Long) (rowData.get(COLUMN.MEMORY_VIRTUAL.ordinal())));
+ prep.setLong(5, (Long) (rowData.get(COLUMN.MEMORY_RESIDENT.ordinal())));
+ prep.setLong(6, (Long) (rowData.get(COLUMN.MEMORY_SHARED.ordinal())));
+ prep.setLong(7, (Long) (rowData.get(COLUMN.MEMORY_PSS.ordinal())));
+ prep.setLong(8, (Long) (rowData.get(COLUMN.HEAP_ALLOCATION_TOTAL.ordinal())));
+ prep.setLong(9, (Long) (rowData.get(COLUMN.HEAP_ALLOCATION.ordinal())));
+ } catch (SQLException e) {
+ e.printStackTrace();
+ isPrepared = false;
+ }
+ }
+
+ return isPrepared;
+ }
+}
prep.setInt(3, (Integer) (rowData.get(COLUMN.DETAIL_TYPE.ordinal())));
prep.setInt(4, (Integer) (rowData.get(COLUMN.POINT_X.ordinal())));
prep.setInt(5, (Integer) (rowData.get(COLUMN.POINT_Y.ordinal())));
- prep.setString(6, (String) (rowData.get(COLUMN.INFO_INTEGER.ordinal())));
+ prep.setString(6, (String) (rowData.get(COLUMN.INFO_STRING.ordinal())));
prep.setInt(7, (Integer) (rowData.get(COLUMN.INFO_INTEGER.ordinal())));
} catch (SQLException e) {
e.printStackTrace();
package org.tizen.dynamicanalyzer.ui.timeline.chart;
+import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.eclipse.swt.widgets.Display;
+import org.tizen.dynamicanalyzer.common.GlobalInformation;
import org.tizen.dynamicanalyzer.nl.TimelineChartLabels;
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.resources.FontResources;
import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseTrackAdapter;
import org.tizen.dynamicanalyzer.ui.timeline.ProcessLoadDBTable;
import org.tizen.dynamicanalyzer.ui.timeline.SystemDataDBTable;
+import org.tizen.dynamicanalyzer.ui.timeline.TargetProcessDBTable;
import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
import org.tizen.dynamicanalyzer.utils.Formatter;
import org.tizen.dynamicanalyzer.widgets.chart.DAChart;
chartIcon = ImageResources.CHART_CPU;
addIcon = ImageResources.ADD_CHART_CPU;
- appLoadSeries = new DAChartSeries(
- TimelineChartLabels.CPU_CHART_SERIES_NAME_APP_LOAD,
- DAChartSeries.SERIES_STYLE_AREA,
- ColorResources.SERIES_COLOR_CPU_SYSTEM);
totalLoadSeries = new DAChartSeries(
TimelineChartLabels.CPU_CHART_SERIES_NAME_TOTAL_LOAD,
DAChartSeries.SERIES_STYLE_AREA,
+ ColorResources.SERIES_COLOR_CPU_SYSTEM);
+ appLoadSeries = new DAChartSeries(
+ TimelineChartLabels.CPU_CHART_SERIES_NAME_APP_LOAD,
+ DAChartSeries.SERIES_STYLE_AREA,
ColorResources.SERIES_COLOR_CPU_APP);
-
+
childSeriesMap = new HashMap<Integer, DAChartSeries>();
}
public void inputChartSeries(List<Object> dataList) {
appLoadSeries.clear();
totalLoadSeries.clear();
+
+ if (GlobalInformation.getCurrentDeviceInfo() == null) {
+ return;
+ }
+ int coreSize = GlobalInformation.getCurrentDeviceInfo().getTargetInfo()
+ .getCpuCount();
+
Collection<DAChartSeries> processSeries = childSeriesMap.values();
if (processSeries != null) {
Iterator<DAChartSeries> iter = processSeries.iterator();
List<List<Object>> systemData = (List<List<Object>>)dataList.get(TimelineConstants.SYSTEM_DB_DATA);
@SuppressWarnings("unchecked")
Map<Integer, List<List<Object>>> processDataMap = (Map<Integer, List<List<Object>>>)dataList.get(TimelineConstants.PROCESS_DB_DATA);
+ @SuppressWarnings("unchecked")
+ Map<Integer, List<List<Object>>> targetProcessDataMap =
+ (Map<Integer, List<List<Object>>>)dataList.get(TimelineConstants.TARGET_PROCESS_DB_DATA);
/*
- * Construct CPU Chart
+ * Make Total CPU Load Series
*/
for (int i = 0; i < systemData.size(); i++) {
List<Object> row = systemData.get(i);
/ TimelineConstants.MEGA_DOUBLE;
try {
- double appCpuRate = (Float)row.get(SystemDataDBTable.COLUMN.CPU_LOAD_APP.ordinal());
double systemAvgLoad = (Float)row.get(SystemDataDBTable.COLUMN.CPU_LOAD_TOTAL.ordinal());
-
- appLoadSeries.addSeriesItem(new DAChartSeriesItem(time, appCpuRate,
- Formatter.toPercentageFormat(appCpuRate)));
totalLoadSeries.addSeriesItem(new DAChartSeriesItem(time, systemAvgLoad,
Formatter.toPercentageFormat(systemAvgLoad)));
} catch (NumberFormatException ne) {
ne.printStackTrace();
}
}
-
+
+ /*
+ * Make Target Process CPU Load Series
+ * MultiProcess's cpu load sum / CPU Core
+ */
+ Iterator<Integer> iter = targetProcessDataMap.keySet().iterator();
+ Map<Long, Float> processLoadSumMap = new HashMap<Long, Float>();
+ while (iter.hasNext()) {
+ Integer pid = iter.next();
+ List<List<Object>> data = targetProcessDataMap.get(pid);
+ for (int i = 0; i < data.size(); i++) {
+ List<Object> oneTime = data.get(i);
+ Long time = (Long)oneTime.get(TargetProcessDBTable.COLUMN.TIME.ordinal());
+ Float cpuLoad = (Float)oneTime.get(TargetProcessDBTable.COLUMN.CPU_LOAD.ordinal());
+ Float processLoadSum = processLoadSumMap.get(time);
+ if (processLoadSum == null) {
+ processLoadSumMap.put(time, cpuLoad);
+ } else {
+ processLoadSumMap.put(time, processLoadSum + cpuLoad);
+ }
+ }
+ }
+
+ List<Long> timeSortedLoadList = new ArrayList<Long>(processLoadSumMap.keySet());
+ Collections.sort(timeSortedLoadList);
+
+ Iterator<Long> iterProcessLoadSum = timeSortedLoadList.iterator();
+ while (iterProcessLoadSum.hasNext()) {
+ Long time = iterProcessLoadSum.next();
+ Float cpuLoadSum = processLoadSumMap.get(time);
+ double cpuAvgLoad = cpuLoadSum / coreSize;
+ appLoadSeries.addSeriesItem(new DAChartSeriesItem(time / TimelineConstants.MEGA_DOUBLE, cpuAvgLoad,
+ Formatter.toPercentageFormat(cpuAvgLoad)));
+ }
+
/*
* Construct Process Chart
*/
});
}
- Iterator<Integer> iter = processDataMap.keySet().iterator();
+ iter = processDataMap.keySet().iterator();
int prevChildSize = childSeriesMap.size();
while (iter.hasNext()) {
Integer pid = iter.next();
List<Object> oneTime = data.get(i);
double time = (Long)oneTime.get(ProcessLoadDBTable.COLUMN.TIME.ordinal())
/ TimelineConstants.MEGA_DOUBLE;
- double load = (Float)oneTime.get(ProcessLoadDBTable.COLUMN.CPU_LOAD.ordinal());
+ double load = (Float)oneTime.get(ProcessLoadDBTable.COLUMN.CPU_LOAD.ordinal() / coreSize);
DAChartSeries series = childSeriesMap.get(pid);
if (series == null) {
wifiSeries = new DAChartSeries(
TimelineChartLabels.DEVICE_CHART_SERIES_WIFI,
- DAChartSeries.SERIES_STYLE_NONE, ColorResources.RED);
+ DAChartSeries.SERIES_STYLE_NONE, ColorResources.SERIES_COLOR_DEVICE_WIFI);
bluetoothSeries = new DAChartSeries(
TimelineChartLabels.DEVICE_CHART_SERIES_BLUETOOTH,
- DAChartSeries.SERIES_STYLE_NONE, ColorResources.BLUE);
+ DAChartSeries.SERIES_STYLE_NONE, ColorResources.SERIES_COLOR_DEVICE_BLUETOOTH);
gpsSeries = new DAChartSeries(
TimelineChartLabels.DEVICE_CHART_SERIES_GPS,
- DAChartSeries.SERIES_STYLE_NONE, ColorResources.BROWN);
+ DAChartSeries.SERIES_STYLE_NONE, ColorResources.SERIES_COLOR_DEVICE_GPS);
dnetSeries = new DAChartSeries(
TimelineChartLabels.DEVICE_CHART_SERIES_DNET,
- DAChartSeries.SERIES_STYLE_NONE, ColorResources.GREEN);
+ DAChartSeries.SERIES_STYLE_NONE, ColorResources.SERIES_COLOR_DEVICE_DNET);
cameraSeries = new DAChartSeries(
TimelineChartLabels.DEVICE_CHART_SERIES_CAMERA,
- DAChartSeries.SERIES_STYLE_NONE, ColorResources.BLACK);
+ DAChartSeries.SERIES_STYLE_NONE, ColorResources.SERIES_COLOR_DEVICE_CAMERA);
}
@Override
import org.tizen.dynamicanalyzer.nl.TimelineChartLabels;
import org.tizen.dynamicanalyzer.resources.ColorResources;
+import org.tizen.dynamicanalyzer.resources.FontResources;
import org.tizen.dynamicanalyzer.resources.ImageResources;
import org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants;
import org.tizen.dynamicanalyzer.ui.timeline.SystemDataDBTable;
private static volatile DiskIOChart instance = null;
private DAChartSeries readSeries;
+ private DAChartSeries readSectorSeries;
private DAChartSeries writeSeries;
+ private DAChartSeries writeSectorSeries;
+ private int maxSectorCount = 0;
+ private double maxReadWriteSize = 0;
+
public static DiskIOChart getInstance() {
if (instance == null) {
synchronized (DiskIOChart.class) {
readSeries = new DAChartSeries(
TimelineChartLabels.DISK_IO_CHART_SERIES_READ,
- DAChartSeries.SERIES_STYLE_LINE, ColorResources.RED);
- // readSeries.setBarAlign(DAChartSeries.SERIES_BAR_ALIGN_CENTER);
-
+ DAChartSeries.SERIES_STYLE_BAR, ColorResources.SERIES_COLOR_DISK_IO_READ_BYTE);
writeSeries = new DAChartSeries(
TimelineChartLabels.DISK_IO_CHART_SERIES_WRITE,
- DAChartSeries.SERIES_STYLE_LINE, ColorResources.BLUE);
- // writeSeries.setBarAlign(DAChartSeries.SERIES_BAR_ALIGN_CENTER);
+ DAChartSeries.SERIES_STYLE_BAR, ColorResources.SERIES_COLOR_DISK_IO_WRITE_BYTE);
+ readSectorSeries = new DAChartSeries(
+ TimelineChartLabels.DISK_IO_CHART_SERIES_READ_SECTOR,
+ DAChartSeries.SERIES_STYLE_BAR, ColorResources.SERIES_COLOR_DISK_IO_READ_SECTOR);
+ writeSectorSeries = new DAChartSeries(
+ TimelineChartLabels.DISK_IO_CHART_SERIES_WRITE_SECTOR,
+ DAChartSeries.SERIES_STYLE_BAR, ColorResources.SERIES_COLOR_DISK_IO_READ_WRITE_SECTOR);
+
+ readSeries.setFont(FontResources.TIMELINE_UIEVENT_FONT);
+ readSectorSeries.setFont(FontResources.TIMELINE_UIEVENT_FONT);
+ writeSeries.setFont(FontResources.TIMELINE_UIEVENT_FONT);
+ writeSectorSeries.setFont(FontResources.TIMELINE_UIEVENT_FONT);
}
@Override
chart.addSeries(readSeries);
chart.addSeries(writeSeries);
+ chart.addSeries(readSectorSeries);
+ chart.addSeries(writeSectorSeries);
+ chart.setChartRenderer(new DiskIOChartRenderer()); // need to custom Chart Render for disk io
chart.getPlot().setAxisUnit("B");
chart.getPlot().setAxisUnitType(DAChartPlot.UnitType.BINARY);
chart.getPlot().setShowAxis(true);
+
+ readSeries.setEndY(0);
+ writeSeries.setEndY(0);
+ readSectorSeries.setEndY(0);
+ writeSectorSeries.setEndY(0);
return item;
}
@Override
public void inputChartSeries(List<Object> dataList) {
readSeries.clear();
+ readSectorSeries.clear();
writeSeries.clear();
+ writeSectorSeries.clear();
@SuppressWarnings("unchecked")
List<List<Object>> data = (List<List<Object>>)dataList.get(TimelineConstants.SYSTEM_DB_DATA);
double time = (Long)row.get(SystemDataDBTable.COLUMN.TIME.ordinal())
/ TimelineConstants.MEGA_DOUBLE;
int readSize = (Integer)row.get(SystemDataDBTable.COLUMN.DISK_IO_READ_SIZE.ordinal());
+ int readSectorSize = (Integer)row.get(SystemDataDBTable.COLUMN.DISK_IO_READ_SECTOR.ordinal());
int writeSize = (Integer)row.get(SystemDataDBTable.COLUMN.DISK_IO_WRITE_SIZE.ordinal());
-
- readSeries.addSeriesItem(new DAChartSeriesItem(time, readSize,
- Formatter.toByteFormat(readSize)));
- writeSeries.addSeriesItem(new DAChartSeriesItem(time, writeSize,
- Formatter.toByteFormat(writeSize)));
+ int writeSectorSize = (Integer)row.get(SystemDataDBTable.COLUMN.DISK_IO_WRITE_SECTOR.ordinal());
+
+ readSeries.addSeriesItem(new DAChartSeriesItem(time, readSize,
+ Formatter.toByteFormat(readSize)));
+ readSectorSeries.addSeriesItem(new DAChartSeriesItem(time, readSectorSize,
+ String.valueOf(readSectorSize)));
+ writeSeries.addSeriesItem(new DAChartSeriesItem(time, writeSize,
+ Formatter.toByteFormat(writeSize)));
+ writeSectorSeries.addSeriesItem(new DAChartSeriesItem(time, writeSectorSize,
+ String.valueOf(writeSectorSize)));
+
+ if (maxReadWriteSize < readSize) {
+ maxReadWriteSize = readSize * 1.5;
+ }
+ if (maxReadWriteSize < writeSize) {
+ maxReadWriteSize = writeSize * 1.5;
+ }
+ if (maxSectorCount < readSectorSize) {
+ maxSectorCount = (int)(readSectorSize * 1.5);
+ }
+ if (maxSectorCount < writeSectorSize) {
+ maxSectorCount = (int)(writeSectorSize * 1.5);
+ }
}
+ readSeries.setEndY(maxReadWriteSize);
+ writeSeries.setEndY(maxReadWriteSize);
+ readSectorSeries.setEndY(maxSectorCount);
+ writeSectorSeries.setEndY(maxSectorCount);
}
}
--- /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.chart;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Rectangle;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChart;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotTooltip;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChartRenderer;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeries;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeriesItem;
+import org.tizen.dynamicanalyzer.widgets.chart.DAUIEventChartPlot;
+import org.tizen.dynamicanalyzer.widgets.helper.ColorResources;
+
+public class DiskIOChartRenderer extends DAChartRenderer {
+ @Override
+ protected void drawToGc(GC gc, DAChart chart) {
+ if (!preDraw(gc, chart)) {
+ return;
+ }
+ for (int i = 0; i < seriesList.size(); i++) {
+ drawSeries(gc, seriesList.get(i), i);
+ }
+ }
+
+ private void drawSeries(GC gc, DAChartSeries series,
+ int seriesIndex) {
+ int seriesSize = seriesList.size();
+ Rectangle rect = new Rectangle(r.x, r.y + r.height * seriesIndex
+ / seriesSize, r.width, r.height / seriesSize);
+
+ if (seriesIndex != 0) {
+ gc.setForeground(ColorResources.CHART_SEPERATE_LINE);
+ gc.drawLine(rect.x, r.height * seriesIndex / seriesSize,
+ rect.width, r.height * seriesIndex / seriesSize);
+ }
+
+ gc.setForeground(ColorResources.SERIES_NAME_ANNOTATION);
+ Font oriFont = gc.getFont();
+ Font nameAnnotationFont = series.getFont();
+ gc.setFont(nameAnnotationFont);
+ gc.drawText(series.getName(), rect.x + 3,
+ rect.y + rect.height / 2 - gc.stringExtent(series.getName()).y
+ / 2, true);
+ gc.setFont(oriFont);
+
+ List<DAChartSeriesItem> seriesItems = series.getSeriesItemList();
+ if (seriesItems == null) {
+ return;
+ }
+ int seriesItemSize = seriesItems.size();
+ if (seriesItemSize < 1) {
+ return;
+ }
+
+ int index = series.getPrevIndexByXvalue(plot.getVisibleStartX());
+ if (index < 0) {
+ index = 0;
+ }
+
+ DAChartSeriesItem seriesItem = seriesItems.get(0);
+
+ double maxY = series.getEndY();
+ int oldPixcelX = plot.getXPixcelFromX(seriesItem.getX(), r);
+
+ if (seriesItemSize == 1) {
+ if (oldPixcelX < r.x) {
+ return;
+ }
+ Color color = seriesItem.getColor();
+ if (color == null) {
+ color = series.getColor();
+ }
+ gc.setForeground(color);
+ gc.drawPoint(oldPixcelX,
+ plot.getYPixcelFromY(maxY, seriesItem.getY(), r));
+ return;
+ }
+
+ gc.setLineStyle(SWT.LINE_SOLID);
+ gc.setAntialias(SWT.ON);
+
+ seriesItem = seriesItems.get(index);
+ double currentX = seriesItem.getX();
+
+ int newPixcelX = plot.getXPixcelFromX(currentX, r);
+ double newY = seriesItem.getY();
+
+ for (int i = index; i < seriesItemSize; i++) {
+ seriesItem = seriesItems.get(i);
+ currentX = seriesItem.getX();
+
+ oldPixcelX = newPixcelX;
+
+ newPixcelX = plot.getXPixcelFromX(currentX, r);
+ newY = seriesItem.getY();
+
+ gc.setForeground(series.getColor());
+ gc.setBackground(series.getColor());
+
+ int startY = rect.y + rect.height;
+ int widthPixcel = 2;
+
+ int[] barPointArray = {newPixcelX, startY,
+ newPixcelX + widthPixcel, startY,
+ newPixcelX + widthPixcel, (int) (rect.y + rect.height * (1.0 - (newY / maxY))),
+ newPixcelX, (int) (rect.y + rect.height * (1.0 - (newY / maxY)))};
+
+ gc.fillPolygon(barPointArray);
+ if (currentX > plot.getVisibleEndX()) {
+ return;
+ }
+ }
+ }
+
+ @Override
+ protected void drawTooltip(GC gc) {
+ DAChartPlotTooltip tooltip = plot.getTooltip();
+ if (tooltip == null || tooltip.shouldBeDrawn() == false
+ || tooltip.getStartVal() == -1) {
+ return;
+ }
+
+ gc.setFont(tooltip.getFont());
+
+ List<String> tooltipTexts = new ArrayList<String>();
+ List<String> tooltipTimes = new ArrayList<String>();
+ List<Color> tooltipColor = new ArrayList<Color>();
+
+ // make text,time & draw auxiliary line
+ int textWidthMax = 0;
+ int textHeightMax = 0;
+ double realXVal = tooltip.getStartVal();
+ int tooltipSize = 0;
+ for (int i = 0; i < seriesList.size(); i++) {
+ DAChartSeries series = seriesList.get(i);
+ tooltipSize++;
+
+ int index = series.getPrevIndexByXvalue(realXVal);
+ String text = "";
+ String time = "";
+ Color color;
+ if (index >= 0) {
+ double xVal = series.getSeriesItemList().get(index).getX();
+
+ text += series.getName() + ": ";
+ time += toTimeFormat(xVal);
+
+ if (series.isSummarizeTooltip()
+ && checkOverlapFromPrevItem(series, index)) {
+ text += series.getSummarizeString();
+ } else {
+ text += series.getSeriesItemList().get(index)
+ .getTooltipText();
+ }
+
+ gc.setForeground(tooltip.getLineColor());
+ gc.setLineStyle(SWT.LINE_DOT);
+ gc.setLineWidth(1);
+
+ gc.drawLine(plot.getXPixcelFromX(xVal), 0,
+ plot.getXPixcelFromX(xVal), r.height);
+ gc.setLineStyle(SWT.LINE_CUSTOM);
+
+ // event color
+ color = series.getSeriesItemList().get(index).getColor();
+ } else {
+ text = series.getName();
+ color = null;
+ }
+
+ tooltipTexts.add(text);
+ tooltipTimes.add(time);
+ tooltipColor.add(color);
+
+ int textWidth = gc.textExtent(text).x
+ + DAChartPlotTooltip.TOOLTIP_TIME_MARGIN
+ + gc.textExtent(time).x;
+ int textHeight = gc.textExtent(text).y;
+ if (textWidthMax < textWidth) {
+ textWidthMax = textWidth;
+ }
+ if (textHeightMax < textHeight) {
+ textHeightMax = textHeight;
+ }
+ }
+
+ int preTextWidthMargin = DAChartPlotTooltip.TOOLTIP_MARGIN
+ + DAChartPlotTooltip.TOOLTIP_SERIES_RECT_LENGTH
+ + DAChartPlotTooltip.TOOLTIP_MARGIN;
+ int startX = getTooltipStartX(realXVal, textWidthMax
+ + preTextWidthMargin, DAChartPlotTooltip.TOOLTIP_MARGIN);
+
+ int totalHeight = tooltipSize * textHeightMax
+ + DAChartPlotTooltip.TOOLTIP_MARGIN
+ + DAChartPlotTooltip.TOOLTIP_MARGIN;
+
+ int startY = (r.y + r.height / 2) - (totalHeight / 2);
+
+ gc.setAlpha(150);
+ gc.setBackground(tooltip.getBackgroundColor());
+ gc.setForeground(tooltip.getForegroundColor());
+ gc.fillGradientRectangle(startX, startY, preTextWidthMargin
+ + textWidthMax + DAChartPlotTooltip.TOOLTIP_MARGIN,
+ totalHeight, true);
+ gc.setAlpha(255);
+ gc.setForeground(tooltip.getLineColor());
+ gc.drawRoundRectangle(startX, r.y, preTextWidthMargin + textWidthMax
+ + DAChartPlotTooltip.TOOLTIP_MARGIN, r.height, 5, 5);
+ gc.setFont(tooltip.getFont());
+
+ String timeStr;
+ tooltipSize = -1;
+ for (int i = 0; i < seriesList.size(); i++) {
+ DAChartSeries series;
+ if (plot instanceof DAUIEventChartPlot) {
+ series = seriesList.get((int) (seriesList.size() * tooltip
+ .getYPosRatio()));
+ } else {
+ series = seriesList.get(i);
+ if (series.isDisableTooltip()) {
+ continue;
+ } else {
+ tooltipSize++;
+ }
+ }
+
+ int yPosition = r.y + r.height * i / seriesList.size() + r.height
+ / seriesList.size() / 2 - textHeightMax / 2;
+
+ Color col = tooltipColor.get(i);
+ if (col == null) {
+ gc.setBackground(series.getColor());
+ } else {
+ gc.setBackground(col);
+ }
+ gc.fillRectangle(
+ startX + DAChartPlotTooltip.TOOLTIP_MARGIN,
+ yPosition + textHeightMax / 2
+ - DAChartPlotTooltip.TOOLTIP_SERIES_RECT_LENGTH / 2,
+ DAChartPlotTooltip.TOOLTIP_SERIES_RECT_LENGTH,
+ DAChartPlotTooltip.TOOLTIP_SERIES_RECT_LENGTH);
+ gc.setBackground(tooltip.getBackgroundColor());
+
+ gc.setForeground(tooltip.getTextColor());
+ gc.drawText(tooltipTexts.get(i), startX
+ + DAChartPlotTooltip.TOOLTIP_MARGIN
+ + DAChartPlotTooltip.TOOLTIP_SERIES_RECT_LENGTH
+ + DAChartPlotTooltip.TOOLTIP_MARGIN, yPosition,
+ SWT.DRAW_DELIMITER | SWT.DRAW_TRANSPARENT);
+
+ gc.setForeground(tooltip.getTimeColor());
+ timeStr = tooltipTimes.get(i);
+ gc.drawText(
+ tooltipTimes.get(i),
+ startX + DAChartPlotTooltip.TOOLTIP_MARGIN
+ + DAChartPlotTooltip.TOOLTIP_SERIES_RECT_LENGTH
+ + DAChartPlotTooltip.TOOLTIP_MARGIN + textWidthMax
+ - DAChartPlotTooltip.TOOLTIP_MARGIN
+ - gc.textExtent(timeStr).x, yPosition,
+ SWT.DRAW_DELIMITER | SWT.DRAW_TRANSPARENT);
+ }
+ }
+}
import java.util.List;
import org.tizen.dynamicanalyzer.common.GlobalInformation;
-import org.tizen.dynamicanalyzer.communicator.DACommunicator;
import org.tizen.dynamicanalyzer.constant.CommonConstants;
import org.tizen.dynamicanalyzer.nl.TimelineChartLabels;
import org.tizen.dynamicanalyzer.resources.ColorResources;
private List<DAChartSeries> deviceUsageSeriesList;
private List<DAChartSeries> deviceUsagePerAppSeriesList;
- private boolean isInitialized = false;
private DAChartBoardItem appUsageItem;
public static EnergyChart getInstance() {
public DAChartBoardItem createBoardItem(DAChartBoard board) {
DAChartBoardItem item = super.createBoardItem(board);
- chart.addSeries(energyUsageSeries);
-
chart.getPlot().setAxisUnit(UNIT);
chart.getPlot().setAxisUnitType(DAChartPlot.UnitType.MICRO_DECIMAL);
chart.getPlot().setShowAxis(true);
}
try {
- if (!isInitialized) {
+ if (chart.getSeriesList().isEmpty()) {
if (GlobalInformation.getCurrentDeviceInfo() == null) {
return;
}
+ chart.addSeries(energyUsageSeries);
+
String[] deviceList =
GlobalInformation.getCurrentDeviceInfo().getTargetInfo().getDevices()
.split(CommonConstants.COMMA);
for (DAChartSeries series : deviceUsagePerAppSeriesList) {
appUsageItem.getChart().addSeries(series);
}
-
- isInitialized = true;
}
@SuppressWarnings("unchecked")
@SuppressWarnings("unchecked")
List<List<Object>> energyData = (List<List<Object>>) dataList.get(TimelineConstants.ENERGY_DB_DATA);
+ if (energyData.size() != deviceUsageSeriesList.size()) {
+ return;
+ }
+
for (int i = 0; i < systemData.size(); i++) {
List<Object> row = systemData.get(i);
double time =
for (int i = 0; i < energyData.size(); i++) {
List<Object> row = energyData.get(i);
DAChartSeries deviceUsageSeries = deviceUsageSeriesList.get(i);
+ DAChartSeries deviceAppUsageSeries = deviceUsagePerAppSeriesList.get(i);
for (int ii = 0; ii < row.size(); ii++) {
@SuppressWarnings("unchecked")
List<Object> oneTime = (List<Object>) row.get(ii);
deviceUsageSeries
.addSeriesItem(new DAChartSeriesItem(time, usage, Formatter
.convertMicroDecimalPrefix(usage) + UNIT));
- deviceUsageSeries
- .addSeriesItem(new DAChartSeriesItem(time, usage, Formatter
+ deviceAppUsageSeries
+ .addSeriesItem(new DAChartSeriesItem(time, usageApp, Formatter
.convertMicroDecimalPrefix(usageApp) + UNIT));
}
}
ne.printStackTrace();
}
}
-
+
@Override
public void clear() {
- super.clear();
- deviceUsageSeriesList.clear();
- deviceUsagePerAppSeriesList.clear();
-
- isInitialized = false;
+ super.clear();
+ deviceUsageSeriesList.clear();
+ deviceUsagePerAppSeriesList.clear();
}
-}
+}
\ No newline at end of file
+++ /dev/null
-/*
- * Dynamic Analyzer
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Jungwook Ryu <jungwook.ryu@samsung.com>
- * Sanghyun Lee <sanghyunnim.lee@samsung.com>
- * Juyoung Kim <j0.kim@samsung.com>
- *
- * 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.chart;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.Semaphore;
-
-import org.tizen.dynamicanalyzer.nl.TimelineChartLabels;
-import org.tizen.dynamicanalyzer.resources.ColorResources;
-import org.tizen.dynamicanalyzer.resources.ImageResources;
-import org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants;
-import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
-import org.tizen.dynamicanalyzer.util.DALogger;
-import org.tizen.dynamicanalyzer.utils.Formatter;
-import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot;
-import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot.AutoRangeType;
-import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeries;
-import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeriesItem;
-import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
-import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardItem;
-
-
-public class FileChart extends TimelineChart {
- private static final DALogger DA_LOG = DALogger.getInstance();
-
- private static class FDCountData {
- private int type;
- private double time;
- private long data;
-
- private FDCountData(int type, double time, long data) {
- this.type = type;
- this.time = time;
- this.data = data;
- }
- }
-
- private static final int PERMIT = 1;
- private Semaphore semaphore = new Semaphore(PERMIT);
-
- private static volatile FileChart instance = null;
-
- private static final int MIN_FDCOUNT = 5;
- private static final int MIN_READ_WRITE_BYTE = 0;
-
- private static final int TYPE_FDCOUNT = 0;
- private static final int TYPE_READ = 1;
- private static final int TYPE_WRITE = 2;
-
- private long maxFDCount = MIN_FDCOUNT;
- private double maxReadWrite = MIN_READ_WRITE_BYTE;
- private int fdCount = 0;
-
- private List<Double> deviceLogTimeList = new ArrayList<Double>();
- private Map<Double, Integer> fdCountSeriesItemIndexMap = new HashMap<Double, Integer>();
- private Map<Double, Integer> deviceTimeIndexMap = new HashMap<Double, Integer>();
- private List<FDCountData> fileDataQ = new ArrayList<FDCountData>();
-
- private DAChartSeries readSeries;
- private DAChartSeries writeSeries;
- private DAChartSeries fdCountSeries;
-
- public static FileChart getInstance() {
- if (instance == null) {
- synchronized (FileChart.class) {
- if (instance == null) {
- instance = new FileChart();
- }
- }
- }
-
- return instance;
- }
-
- private FileChart() {
- chartType = TimelineConstants.CHART_TYPE_FILE;
- probeType = DataChannelConstants.MSG_DATA_SYSTEM;
- chartName = TimelineChartLabels.FILE_CHART_TITLE;
- chartIcon = ImageResources.CHART_FILE;
- addIcon = ImageResources.ADD_CHART_FILE;
-
- readSeries =
- new DAChartSeries(TimelineChartLabels.FILE_CHART_SERIES_NAME_READ,
- DAChartSeries.SERIES_STYLE_BAR,
- ColorResources.SERIES_COLOR_FILE_READ);
- readSeries.setBarAlign(DAChartSeries.SERIES_BAR_ALIGN_CENTER);
- writeSeries =
- new DAChartSeries(TimelineChartLabels.FILE_CHART_SERIES_NAME_WRITE,
- DAChartSeries.SERIES_STYLE_BAR,
- ColorResources.SERIES_COLOR_FILE_WRITE);
- writeSeries.setBarAlign(DAChartSeries.SERIES_BAR_ALIGN_CENTER);
- fdCountSeries =
- new DAChartSeries(TimelineChartLabels.FILE_CHART_SERIES_NAME_FD_COUNT,
- DAChartSeries.SERIES_STYLE_STEP,
- ColorResources.SERIES_COLOR_FILE_FD);
- }
-
- @Override
- public DAChartBoardItem createBoardItem(DAChartBoard board) {
- DAChartBoardItem item = super.createBoardItem(board);
-
- chart.addSeries(readSeries);
- chart.addSeries(fdCountSeries);
- chart.addSeries(writeSeries);
-
- chart.getPlot().setAutoHeightRange(AutoRangeType.MANUAL);
- chart.getPlot().setSeriesHeightRange(true);
- chart.getPlot().setAxisUnit("B");
- chart.getPlot().setSecondAxisUnit("");
- chart.getPlot().setAxisUnitType(DAChartPlot.UnitType.BINARY);
- chart.getPlot().setShowAxis(true);
-
- fdCountSeries.setEndY(maxFDCount);
- readSeries.setEndY(maxReadWrite);
- writeSeries.setEndY(maxReadWrite);
-
- return item;
- }
-
- @Override
- public void clear() {
- super.clear();
- fdCount = 0;
- maxFDCount = MIN_FDCOUNT;
- maxReadWrite = MIN_READ_WRITE_BYTE;
- deviceLogTimeList.clear();
- fdCountSeriesItemIndexMap.clear();
- deviceTimeIndexMap.clear();
- getFileDataQ().clear();
-
- fdCountSeries.addSeriesItem(new DAChartSeriesItem(0, 0, "0"));
- }
-
- private void processFileDataFromQueue() {
- try {
- semaphore.acquire();
- if (getFileDataQ().size() != 0) {
- // "getFileDataQ().get(0)" means that getting top data from file data queue.
- int deviceTimeIndex =
- getDeviceTimeIndexByTime(getFileDataQ().get(0).time
- / TimelineConstants.MEGA_DOUBLE);
- if (deviceTimeIndex == -1) {
- return;
- } else {
- double deviceTime = deviceLogTimeList.get(deviceTimeIndex);
- switch (getFileDataQ().get(0).type) {
- case TYPE_FDCOUNT:
- fdCount += getFileDataQ().get(0).data;
-
- Integer fdCountSeriesItemIndex =
- fdCountSeriesItemIndexMap.get(deviceTime);
- if (fdCountSeriesItemIndex == null) {
- fdCountSeries.addSeriesItem(new DAChartSeriesItem(deviceTime
- / TimelineConstants.MEGA_DOUBLE, fdCount, String
- .valueOf(fdCount)));
- fdCountSeriesItemIndexMap.put(deviceTime, fdCountSeries
- .getSeriesItemList().size() - 1);
- } else {
- DAChartSeriesItem item =
- fdCountSeries.getSeriesItemList()
- .get(fdCountSeriesItemIndex);
- item.setY(fdCount);
- item.setTooltipText(String.valueOf(fdCount));
- }
-
- if (fdCount > maxFDCount) {
- maxFDCount = fdCount;
- fdCountSeries.setEndY(maxFDCount * 1.1 + 1);
- }
- break;
- case TYPE_READ:
- DAChartSeriesItem readItem =
- readSeries.getSeriesItemList().get(deviceTimeIndexMap
- .get(deviceTime));
- double readSum = readItem.getY() + getFileDataQ().get(0).data;
- readItem.setY(readSum);
- readItem.setTooltipText(Formatter.toByteFormat(readSum));
- if (readSum > maxReadWrite) {
- maxReadWrite = readSum;
- readSeries.setEndY(maxReadWrite * 1.1);
- writeSeries.setEndY(maxReadWrite * 1.1);
- }
- break;
- case TYPE_WRITE:
- DAChartSeriesItem writeItem =
- writeSeries.getSeriesItemList().get(deviceTimeIndexMap
- .get(deviceTime));
- double writeSum = writeItem.getY() + getFileDataQ().get(0).data;
- writeItem.setY(writeSum);
- writeItem.setTooltipText(Formatter.toByteFormat(writeSum));
- if (writeSum > maxReadWrite) {
- maxReadWrite = writeSum;
- readSeries.setEndY(maxReadWrite * 1.1);
- writeSeries.setEndY(maxReadWrite * 1.1);
- }
- break;
- default:
- DA_LOG.debug("wrong file api type");//$NON-NLS-1$
- }
-
- getFileDataQ().remove(0);
- }
- }
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } finally {
- semaphore.release();
- }
-
- }
-
- private List<FDCountData> getFileDataQ() {
- return fileDataQ;
- }
-
- public void setFDCount(int count, double time) {
- getFileDataQ().add(new FDCountData(TYPE_FDCOUNT, time, count));
- processFileDataFromQueue();
- }
-
- public void setReadByte(long size, double time) {
- getFileDataQ().add(new FDCountData(TYPE_READ, time, size));
- processFileDataFromQueue();
- }
-
- public void setWriteByte(long size, double time) {
- getFileDataQ().add(new FDCountData(TYPE_WRITE, time, size));
- processFileDataFromQueue();
- }
-
- private int getDeviceTimeIndexByTime(double time) {
- int flat = (int) time;
- int i;
- for (i = flat; i < deviceLogTimeList.size(); i++) {
- Double deviceLogTime = deviceLogTimeList.get(i);
- if (deviceLogTime.isNaN() || deviceLogTime < time) {
- continue;
- }
-
- return i;
- }
-
- return -1;
- }
-}
package org.tizen.dynamicanalyzer.ui.timeline.chart;
+import java.util.ArrayList;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
+import java.util.Map;
+import org.eclipse.swt.widgets.Display;
+import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.nl.TimelineChartLabels;
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.resources.ImageResources;
import org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants;
-import org.tizen.dynamicanalyzer.ui.timeline.SystemDataDBTable;
+import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseEventListener;
+import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseTrackAdapter;
+import org.tizen.dynamicanalyzer.ui.timeline.TargetProcessDBTable;
import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
+import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
import org.tizen.dynamicanalyzer.utils.Formatter;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeries;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeriesItem;
import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardItem;
+import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenu;
public class HeapChart extends TimelineChart {
-
private static HeapChart instance = null;
- private DAChartSeries totalAllocationSeries;
- private DAChartSeries userAllocationSeries;
- private HashMap<Long, Long> allocationSeriesDataSetMap = new HashMap<Long, Long>();
+ private final int TOTAL_ALLOC = 0;
+ private final int USER_ALLOC = 1;
+
+ private Map<Integer, List<DAChartSeries>> seriesPerProcessMap =
+ new HashMap<Integer, List<DAChartSeries>>();
+ private DAChartBoardItem parentBoardItem;
+ private List<DAChartBoardItem> childBoardItemList = new ArrayList<DAChartBoardItem>();
public static HeapChart getInstance() {
if (instance == null) {
instance = new HeapChart();
}
-
return instance;
}
-
- private HeapChart() {
- chartType = TimelineConstants.CHART_TYPE_HEAP;
- probeType = DataChannelConstants.MSG_DATA_SYSTEM;
- chartName = TimelineChartLabels.HEAP_CHART_TITLE;
- chartIcon = ImageResources.CHART_HEAP;
- addIcon = ImageResources.ADD_CHART_HEAP;
-
- totalAllocationSeries = new DAChartSeries(
+
+ private List<DAChartSeries> createChartSeries() {
+ List<DAChartSeries> chartSeriesList = new ArrayList<DAChartSeries>();
+
+ DAChartSeries totalAllocationSeries = new DAChartSeries(
TimelineChartLabels.HEAP_CHART_SERIES_NAME_TOTAL_ALLOCATION,
DAChartSeries.SERIES_STYLE_AREA,
ColorResources.SERIES_COLOR_HEAP_SYSTEM);
- userAllocationSeries = new DAChartSeries(
+ DAChartSeries userAllocationSeries = new DAChartSeries(
TimelineChartLabels.HEAP_CHART_SERIES_NAME_APP_ALLOCATION,
DAChartSeries.SERIES_STYLE_AREA,
ColorResources.SERIES_COLOR_HEAP_USER);
+ /*
+ * Insert order is important.
+ */
+ chartSeriesList.add(totalAllocationSeries);
+ chartSeriesList.add(userAllocationSeries);
+
+ return chartSeriesList;
+ }
+
+ private HeapChart() {
+ chartType = TimelineConstants.CHART_TYPE_HEAP;
+ probeType = DataChannelConstants.MSG_DATA_SYSTEM;
+ chartName = TimelineChartLabels.HEAP_CHART_TITLE;
+ chartIcon = ImageResources.CHART_HEAP;
+ addIcon = ImageResources.ADD_CHART_HEAP;
}
@Override
public DAChartBoardItem createBoardItem(DAChartBoard board) {
- DAChartBoardItem item = super.createBoardItem(board);
-
- chart.addSeries(totalAllocationSeries);
- chart.addSeries(userAllocationSeries);
+ parentBoardItem = super.createBoardItem(board);
chart.getPlot().setAxisUnit("B");
chart.getPlot().setAxisUnitType(DAChartPlot.UnitType.BINARY);
chart.getPlot().setShowAxis(true);
- return item;
+ return parentBoardItem;
}
+ public DAChartBoardItem createChildBoardItem(DAChartBoardItem parent) {
+ DAChartBoardItem item = new DAChartBoardItem(parent, chartName,
+ chartIcon, chartStyle);
+ chart = item.getChart();
+ setChartStyle();
+
+ DAChartPlot parentPlot = parent.getChart().getPlot();
+ chart.getPlot().setTooltip(parentPlot.getTooltip());
+ chart.getPlot().setMarkers(parent.getChartBoard().getMarkers());
+ chart.getPlot().setAxisUnit(parentPlot.getAxisUnit());
+ chart.getPlot().setAxisUnitType(parentPlot.getAxisUnitType());
+ chart.getPlot().setShowAxis(parentPlot.isShowAxis());
+
+ popupMenu = new DAPopupMenu(chart);
+ initPopupMenu(parent.getChartBoard(), popupMenu);
+
+ TimelineChartMouseEventListener timelineChartMouseEventListener =
+ new TimelineChartMouseEventListener(popupMenu, parent.getChartBoard().getTimeline());
+ chart.addMouseListener(timelineChartMouseEventListener);
+ chart.addMouseMoveListener(timelineChartMouseEventListener);
+ chart.addMouseTrackListener(new TimelineChartMouseTrackAdapter(parent.getChartBoard().getTimeline()));
+
+ return item;
+ }
+
@Override
public void inputChartSeries(List<Object> dataList) {
- totalAllocationSeries.clear();
- userAllocationSeries.clear();
-
- @SuppressWarnings("unchecked")
- List<List<Object>> data = (List<List<Object>>) dataList.get(0);
-
- for (int i = 0; i < data.size(); i++) {
- List<Object> row = data.get(i);
- double time = (Long) row.get(SystemDataDBTable.COLUMN.TIME
- .ordinal()) / TimelineConstants.MEGA_DOUBLE;
- double totalAlloc = (Long) row
- .get(SystemDataDBTable.COLUMN.HEAP_ALLOCATION_TOTAL
- .ordinal());
- double userAlloc = (Long) row
- .get(SystemDataDBTable.COLUMN.HEAP_ALLOCATION_APP.ordinal());
-
- totalAllocationSeries.addSeriesItem(new DAChartSeriesItem(time,
- totalAlloc, Formatter.toByteFormat(totalAlloc)));
-
- userAllocationSeries.addSeriesItem(new DAChartSeriesItem(time,
- userAlloc, Formatter.toByteFormat(userAlloc)));
+ /*
+ * Clear series items
+ */
+ Iterator<List<DAChartSeries>> iterSeries = seriesPerProcessMap.values().iterator();
+ while (iterSeries.hasNext()) {
+ List<DAChartSeries> seriesList = iterSeries.next();
+ for (int i = 0; i < seriesList.size(); i++) {
+ seriesList.get(i).clear();
+ }
}
+
+ if (AnalyzerManager.getProject() == null) {
+ return;
+ }
+ @SuppressWarnings("unchecked")
+ Map<Integer, List<List<Object>>> processDataMap =
+ (Map<Integer, List<List<Object>>>)dataList.get(TimelineConstants.TARGET_PROCESS_DB_DATA);
+
+ Iterator<Integer> iterProcessData = processDataMap.keySet().iterator();
+ while (iterProcessData.hasNext()) {
+ final Integer pid = iterProcessData.next();
+ /*
+ * First process, use parentBoardItem.
+ */
+ if (seriesPerProcessMap.isEmpty()) {
+ List<DAChartSeries> seriesList = createChartSeries();
+ seriesPerProcessMap.put(pid, seriesList);
+ for (int i = 0; i < seriesList.size(); i++) {
+ chart.addSeries(seriesList.get(i));
+ }
+ final String processName = AnalyzerUtil.getProcessName(pid.intValue());
+ Display.getDefault().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ parentBoardItem.getItemCell().setAdditionalInfo(processName + "\nPID : " + pid.intValue());
+ }
+ });
+ }
+ /*
+ * If new Process created, Create ChartBoardItem, Chart, Series.
+ */
+ else if (seriesPerProcessMap.get(pid) == null) {
+ final List<DAChartSeries> seriesList = createChartSeries();
+ seriesPerProcessMap.put(pid, seriesList);
+ Display.getDefault().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ HeapChart childChart = new HeapChart();
+ DAChartBoardItem childBoardItem = childChart.createChildBoardItem(parentBoardItem);
+ String processName = AnalyzerUtil.getProcessName(pid.intValue());
+ childBoardItem.getItemCell().setAdditionalInfo(processName + "\nPID : " + pid.intValue());
+ for (int i = 0; i < seriesList.size(); i++) {
+ childBoardItem.getChart().addSeries(seriesList.get(i));
+ }
+ childBoardItemList.add(childBoardItem);
+ parentBoardItem.unFoldChild();
+ }
+ });
+ }
+
+ List<DAChartSeries> seriesList = seriesPerProcessMap.get(pid);
+ List<List<Object>> data = processDataMap.get(pid);
+ for (int i = 0; i < data.size(); i++) {
+ List<Object> row = data.get(i);
+ double time = (Long)row.get(TargetProcessDBTable.COLUMN.TIME.ordinal())
+ / TimelineConstants.MEGA_DOUBLE;
+ long totalAlloc = (Long)row.get(TargetProcessDBTable.COLUMN.HEAP_ALLOCATION_TOTAL.ordinal());
+ long userAlloc = (Long)row.get(TargetProcessDBTable.COLUMN.HEAP_ALLOCATION.ordinal());
+
+ seriesList.get(TOTAL_ALLOC).addSeriesItem(new DAChartSeriesItem(time, totalAlloc,
+ Formatter.toByteFormat(totalAlloc)));
+ seriesList.get(USER_ALLOC).addSeriesItem(new DAChartSeriesItem(time, userAlloc,
+ Formatter.toByteFormat(userAlloc)));
+ }
+ }
}
-
+
@Override
public void clear() {
- super.clear();
- allocationSeriesDataSetMap.clear();
+ seriesPerProcessMap.clear();
+ for (int i = 0; i < childBoardItemList.size(); i++) {
+ childBoardItemList.get(i).dispose();
+ }
}
}
sendSeries = new DAChartSeries(
TimelineChartLabels.NETWORK_IO_CHART_SERIES_SEND,
- DAChartSeries.SERIES_STYLE_LINE, ColorResources.RED);
+ DAChartSeries.SERIES_STYLE_LINE, ColorResources.SERIES_COLOR_NETWORK_IO_SEND);
receiveSeries = new DAChartSeries(
TimelineChartLabels.NETWORK_IO_CHART_SERIES_RECEIVE,
- DAChartSeries.SERIES_STYLE_LINE, ColorResources.BLUE);
+ DAChartSeries.SERIES_STYLE_LINE, ColorResources.SERIES_COLOR_NETWORK_IO_RECEIVE);
}
@Override
package org.tizen.dynamicanalyzer.ui.timeline.chart;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
+import java.util.Map;
+import org.eclipse.swt.widgets.Display;
+import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.nl.TimelineChartLabels;
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.resources.ImageResources;
import org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants;
-import org.tizen.dynamicanalyzer.ui.timeline.SystemDataDBTable;
+import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseEventListener;
+import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseTrackAdapter;
+import org.tizen.dynamicanalyzer.ui.timeline.TargetProcessDBTable;
import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
+import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
import org.tizen.dynamicanalyzer.utils.Formatter;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeries;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeriesItem;
import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardItem;
+import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenu;
public class ProcessMemoryChart extends TimelineChart {
private static ProcessMemoryChart instance = null;
- private DAChartSeries VSSMemorySeries;
- private DAChartSeries RSSMemorySeries;
- private DAChartSeries PSSMemorySeries;
+ private final int VSS = 0;
+ private final int RSS = 1;
+ private final int PSS = 2;
+ private Map<Integer, List<DAChartSeries>> seriesPerProcessMap =
+ new HashMap<Integer, List<DAChartSeries>>();
+ private DAChartBoardItem parentBoardItem;
+ private List<DAChartBoardItem> childBoardItemList = new ArrayList<DAChartBoardItem>();
+
public static ProcessMemoryChart getInstance() {
if (instance == null) {
instance = new ProcessMemoryChart();
}
-
return instance;
}
- private ProcessMemoryChart() {
- chartType = TimelineConstants.CHART_TYPE_PROCESS_MEMORY;
- probeType = DataChannelConstants.MSG_DATA_SYSTEM;
- chartName = TimelineChartLabels.PROCESS_MEMORY_CHART_TITLE;
- chartIcon = ImageResources.CHART_PROCESS_MEMORY;
- addIcon = ImageResources.ADD_CHART_PROCESS_MEMORY;
-
- VSSMemorySeries = new DAChartSeries(
+ private List<DAChartSeries> createChartSeries() {
+ List<DAChartSeries> chartSeriesList = new ArrayList<DAChartSeries>();
+
+ DAChartSeries vssMemorySeries = new DAChartSeries(
TimelineChartLabels.PROCESS_MEMORY_CHART_VSS,
DAChartSeries.SERIES_STYLE_AREA,
ColorResources.SERIES_COLOR_PROCESS_VSS);
- RSSMemorySeries = new DAChartSeries(
+ DAChartSeries rssMemorySeries = new DAChartSeries(
TimelineChartLabels.PROCESS_MEMORY_CHART_RSS,
DAChartSeries.SERIES_STYLE_AREA,
ColorResources.SERIES_COLOR_PROCESS_RSS);
- PSSMemorySeries = new DAChartSeries(
+ DAChartSeries pssMemorySeries = new DAChartSeries(
TimelineChartLabels.PROCESS_MEMORY_CHART_PSS,
DAChartSeries.SERIES_STYLE_AREA,
ColorResources.SERIES_COLOR_PROCESS_PSS);
+ /*
+ * Insert order is important.
+ */
+ chartSeriesList.add(vssMemorySeries);
+ chartSeriesList.add(rssMemorySeries);
+ chartSeriesList.add(pssMemorySeries);
+
+ return chartSeriesList;
+ }
+
+ private ProcessMemoryChart() {
+ chartType = TimelineConstants.CHART_TYPE_PROCESS_MEMORY;
+ probeType = DataChannelConstants.MSG_DATA_SYSTEM;
+ chartName = TimelineChartLabels.PROCESS_MEMORY_CHART_TITLE;
+ chartIcon = ImageResources.CHART_PROCESS_MEMORY;
+ addIcon = ImageResources.ADD_CHART_PROCESS_MEMORY;
}
@Override
public DAChartBoardItem createBoardItem(DAChartBoard board) {
- DAChartBoardItem item = super.createBoardItem(board);
-
- chart.addSeries(VSSMemorySeries);
- chart.addSeries(RSSMemorySeries);
- chart.addSeries(PSSMemorySeries);
+ parentBoardItem = super.createBoardItem(board);
chart.getPlot().setAxisUnit("B");
chart.getPlot().setAxisUnitType(DAChartPlot.UnitType.BINARY);
chart.getPlot().setShowAxis(true);
+
+ return parentBoardItem;
+ }
+
+ public DAChartBoardItem createChildBoardItem(DAChartBoardItem parent) {
+ DAChartBoardItem item = new DAChartBoardItem(parent, chartName,
+ chartIcon, chartStyle);
+ chart = item.getChart();
+ setChartStyle();
+ DAChartPlot parentPlot = parent.getChart().getPlot();
+ chart.getPlot().setTooltip(parentPlot.getTooltip());
+ chart.getPlot().setMarkers(parent.getChartBoard().getMarkers());
+ chart.getPlot().setAxisUnit(parentPlot.getAxisUnit());
+ chart.getPlot().setAxisUnitType(parentPlot.getAxisUnitType());
+ chart.getPlot().setShowAxis(parentPlot.isShowAxis());
+
+ popupMenu = new DAPopupMenu(chart);
+ initPopupMenu(parent.getChartBoard(), popupMenu);
+
+ TimelineChartMouseEventListener timelineChartMouseEventListener =
+ new TimelineChartMouseEventListener(popupMenu, parent.getChartBoard().getTimeline());
+ chart.addMouseListener(timelineChartMouseEventListener);
+ chart.addMouseMoveListener(timelineChartMouseEventListener);
+ chart.addMouseTrackListener(new TimelineChartMouseTrackAdapter(parent.getChartBoard().getTimeline()));
+
return item;
}
@Override
public void inputChartSeries(List<Object> dataList) {
- VSSMemorySeries.clear();
- RSSMemorySeries.clear();
- PSSMemorySeries.clear();
-
- @SuppressWarnings("unchecked")
- List<List<Object>> data = (List<List<Object>>)dataList.get(TimelineConstants.SYSTEM_DB_DATA);
-
+ /*
+ * Clear series items
+ */
+ Iterator<List<DAChartSeries>> iterSeries = seriesPerProcessMap.values().iterator();
+ while (iterSeries.hasNext()) {
+ List<DAChartSeries> seriesList = iterSeries.next();
+ for (int i = 0; i < seriesList.size(); i++) {
+ seriesList.get(i).clear();
+ }
+ }
+
+ if (AnalyzerManager.getProject() == null) {
+ return;
+ }
+ @SuppressWarnings("unchecked")
+ Map<Integer, List<List<Object>>> processDataMap =
+ (Map<Integer, List<List<Object>>>)dataList.get(TimelineConstants.TARGET_PROCESS_DB_DATA);
+
+ Iterator<Integer> iterProcessData = processDataMap.keySet().iterator();
+ while (iterProcessData.hasNext()) {
+ final Integer pid = iterProcessData.next();
+ /*
+ * First process, use parentBoardItem.
+ */
+ if (seriesPerProcessMap.isEmpty()) {
+ List<DAChartSeries> seriesList = createChartSeries();
+ seriesPerProcessMap.put(pid, seriesList);
+ for (int i = 0; i < seriesList.size(); i++) {
+ chart.addSeries(seriesList.get(i));
+ }
+ final String processName = AnalyzerUtil.getProcessName(pid.intValue());
+ Display.getDefault().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ parentBoardItem.getItemCell().setAdditionalInfo(processName + "\nPID : " + pid.intValue());
+ }
+ });
+ }
+ /*
+ * If new Process created, Create ChartBoardItem, Chart, Series.
+ */
+ else if (seriesPerProcessMap.get(pid) == null) {
+ final List<DAChartSeries> seriesList = createChartSeries();
+ seriesPerProcessMap.put(pid, seriesList);
+ Display.getDefault().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ ProcessMemoryChart childChart = new ProcessMemoryChart();
+ DAChartBoardItem childBoardItem = childChart.createChildBoardItem(parentBoardItem);
+ String processName = AnalyzerUtil.getProcessName(pid.intValue());
+ childBoardItem.getItemCell().setAdditionalInfo(processName + "\nPID : " + pid.intValue());
+ for (int i = 0; i < seriesList.size(); i++) {
+ childBoardItem.getChart().addSeries(seriesList.get(i));
+ }
+ childBoardItemList.add(childBoardItem);
+ parentBoardItem.unFoldChild();
+ }
+ });
+ }
+
+ /*
+ * Add seriesItem
+ */
+ List<DAChartSeries> seriesList = seriesPerProcessMap.get(pid);
+ List<List<Object>> data = processDataMap.get(pid);
for (int i = 0; i < data.size(); i++) {
- List<Object> row = data.get(i);
- double time = (Long)row.get(SystemDataDBTable.COLUMN.TIME.ordinal())
- / TimelineConstants.MEGA_DOUBLE;
- int vssMemory = (Integer)row.get(SystemDataDBTable.COLUMN.MEMORY_VIRTUAL.ordinal());
- int rssMemory = (Integer)row.get(SystemDataDBTable.COLUMN.MEMORY_RESIDENT.ordinal());
- int pssMemory = (Integer)row.get(SystemDataDBTable.COLUMN.MEMORY_PSS.ordinal());
-
- VSSMemorySeries.addSeriesItem(new DAChartSeriesItem(time, vssMemory,
- Formatter.toByteFormat(vssMemory)));
- RSSMemorySeries.addSeriesItem(new DAChartSeriesItem(time, rssMemory,
- Formatter.toByteFormat(rssMemory)));
- PSSMemorySeries.addSeriesItem(new DAChartSeriesItem(time, pssMemory,
- Formatter.toByteFormat(pssMemory)));
+ List<Object> row = data.get(i);
+ double time = (Long)row.get(TargetProcessDBTable.COLUMN.TIME.ordinal())
+ / TimelineConstants.MEGA_DOUBLE;
+ long vssMemory = (Long)row.get(TargetProcessDBTable.COLUMN.MEMORY_VIRTUAL.ordinal());
+ long rssMemory = (Long)row.get(TargetProcessDBTable.COLUMN.MEMORY_RESIDENT.ordinal());
+ long pssMemory = (Long)row.get(TargetProcessDBTable.COLUMN.MEMORY_PSS.ordinal());
+
+ seriesList.get(VSS).addSeriesItem(new DAChartSeriesItem(time, vssMemory,
+ Formatter.toByteFormat(vssMemory)));
+ seriesList.get(RSS).addSeriesItem(new DAChartSeriesItem(time, rssMemory,
+ Formatter.toByteFormat(rssMemory)));
+ seriesList.get(PSS).addSeriesItem(new DAChartSeriesItem(time, pssMemory,
+ Formatter.toByteFormat(pssMemory)));
}
+ }
+ }
+
+ @Override
+ public void clear() {
+ seriesPerProcessMap.clear();
+ for (int i = 0; i < childBoardItemList.size(); i++) {
+ childBoardItemList.get(i).dispose();
+ }
}
}
+
\ No newline at end of file
package org.tizen.dynamicanalyzer.ui.timeline.chart;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
+import java.util.Map;
+import org.tizen.dynamicanalyzer.common.GlobalInformation;
import org.tizen.dynamicanalyzer.nl.TimelineChartLabels;
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.resources.ImageResources;
import org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants;
import org.tizen.dynamicanalyzer.ui.timeline.SystemDataDBTable;
+import org.tizen.dynamicanalyzer.ui.timeline.TargetProcessDBTable;
import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
import org.tizen.dynamicanalyzer.utils.Formatter;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot;
systemSeries.clear();
totalSeries.clear();
+ if (GlobalInformation.getCurrentDeviceInfo() == null) {
+ return;
+ }
+
+ long systemMemorySize = GlobalInformation.getCurrentDeviceInfo().getTargetInfo().getSystemMemorySize();
+
@SuppressWarnings("unchecked")
- List<List<Object>> data = (List<List<Object>>)dataList.get(0);
+ List<List<Object>> systemData = (List<List<Object>>)dataList.get(TimelineConstants.SYSTEM_DB_DATA);
+ @SuppressWarnings("unchecked")
+ Map<Integer, List<List<Object>>> targetProcessDataMap =
+ (Map<Integer, List<List<Object>>>)dataList.get(TimelineConstants.TARGET_PROCESS_DB_DATA);
- for (int i = 0; i < data.size(); i++) {
- List<Object> row = data.get(i);
- double time = (Long)row.get(SystemDataDBTable.COLUMN.TIME.ordinal())
- / TimelineConstants.MEGA_DOUBLE;
- int processUsageMemory = (Integer)row.get(SystemDataDBTable.COLUMN.MEMORY_RESIDENT.ordinal());
- long systemUsageMemory = (Long)row.get(SystemDataDBTable.COLUMN.MEMORY_USAGE_SYSTEM.ordinal());
- long totalMemory = (Long)row.get(SystemDataDBTable.COLUMN.MEMORY_TOTAL_SYSTEM.ordinal());
-
- processSeries.addSeriesItem(new DAChartSeriesItem(time, processUsageMemory,
- Formatter.toByteFormat(processUsageMemory)));
- systemSeries.addSeriesItem(new DAChartSeriesItem(time, systemUsageMemory,
- Formatter.toByteFormat(systemUsageMemory)));
- totalSeries.addSeriesItem(new DAChartSeriesItem(time, totalMemory,
- Formatter.toByteFormat(totalMemory)));
- }
+ /*
+ * Make Total memory, System usage memory series
+ */
+ double maxTime = 0.0;
+ for (int i = 0; i < systemData.size(); i++) {
+ List<Object> row = systemData.get(i);
+ double time = (Long)row.get(SystemDataDBTable.COLUMN.TIME.ordinal())
+ / TimelineConstants.MEGA_DOUBLE;
+
+ try {
+ long systemMemoryUsage = (Long)row.get(SystemDataDBTable.COLUMN.MEMORY_USAGE_SYSTEM.ordinal());
+ totalSeries.addSeriesItem(new DAChartSeriesItem(time, systemMemorySize,
+ Formatter.toByteFormat(systemMemorySize)));
+ systemSeries.addSeriesItem(new DAChartSeriesItem(time, systemMemoryUsage,
+ Formatter.toByteFormat(systemMemoryUsage)));
+ } catch (NumberFormatException ne) {
+ ne.printStackTrace();
+ }
+ maxTime = time;
+ }
+
+ /*
+ * Make Process memory series
+ */
+ Iterator<Integer> iter = targetProcessDataMap.keySet().iterator();
+ Map<Long, Long> processLoadSumMap = new HashMap<Long, Long>();
+ while (iter.hasNext()) {
+ Integer pid = iter.next();
+ List<List<Object>> data = targetProcessDataMap.get(pid);
+ for (int i = 0; i < data.size(); i++) {
+ List<Object> oneTime = data.get(i);
+ Long time = (Long)oneTime.get(TargetProcessDBTable.COLUMN.TIME.ordinal());
+ Long processMemorySize = (Long)oneTime.get(TargetProcessDBTable.COLUMN.MEMORY_RESIDENT.ordinal());
+ Long processMemorySizeSum = processLoadSumMap.get(time);
+ if (processMemorySizeSum == null) {
+ processLoadSumMap.put(time, processMemorySize);
+ } else {
+ processLoadSumMap.put(time, processMemorySizeSum + processMemorySize);
+ }
+ }
+ }
+ List<Long> timeSortedLoadList = new ArrayList<Long>(processLoadSumMap.keySet());
+ Collections.sort(timeSortedLoadList);
+ Iterator<Long> iterProcessLoadSum = timeSortedLoadList.iterator();
+ while (iterProcessLoadSum.hasNext()) {
+ Long time = iterProcessLoadSum.next();
+ Long processMemorySizeSum = processLoadSumMap.get(time);
+ if (maxTime >= time / TimelineConstants.MEGA_DOUBLE) {
+ processSeries.addSeriesItem(new DAChartSeriesItem(time / TimelineConstants.MEGA_DOUBLE, processMemorySizeSum,
+ Formatter.toByteFormat(processMemorySizeSum)));
+ }
+ }
}
}
import org.tizen.dynamicanalyzer.swap.logparser.PageDataManager;
import org.tizen.dynamicanalyzer.swap.model.data.LogData;
import org.tizen.dynamicanalyzer.swap.model.data.MemoryData;
+import org.tizen.dynamicanalyzer.swap.model.data.ProcessProfileData;
import org.tizen.dynamicanalyzer.swap.model.data.ScreenShotData;
import org.tizen.dynamicanalyzer.swap.model.data.SystemData;
import org.tizen.dynamicanalyzer.swap.model.data.UIEventData;
import org.tizen.dynamicanalyzer.ui.timeline.ScreenShotDBTable;
import org.tizen.dynamicanalyzer.ui.timeline.SystemDataDBInserter;
import org.tizen.dynamicanalyzer.ui.timeline.SystemDataDBTable;
+import org.tizen.dynamicanalyzer.ui.timeline.TargetProcessDBInserter;
+import org.tizen.dynamicanalyzer.ui.timeline.TargetProcessDBTable;
import org.tizen.dynamicanalyzer.ui.timeline.UIEventDBInserter;
import org.tizen.dynamicanalyzer.ui.timeline.UIEventDBTable;
import org.tizen.dynamicanalyzer.ui.timeline.chart.CPUChart;
import org.tizen.dynamicanalyzer.ui.timeline.chart.DeviceChart;
import org.tizen.dynamicanalyzer.ui.timeline.chart.DiskIOChart;
import org.tizen.dynamicanalyzer.ui.timeline.chart.EnergyChart;
-import org.tizen.dynamicanalyzer.ui.timeline.chart.FileChart;
import org.tizen.dynamicanalyzer.ui.timeline.chart.HeapChart;
import org.tizen.dynamicanalyzer.ui.timeline.chart.NetworkIOChart;
import org.tizen.dynamicanalyzer.ui.timeline.chart.ProcessMemoryChart;
private ScreenShotDBTable screenShotDBTable = null;
private UIEventDBTable uiEventDBTable = null;
private CustomDataDBTable customDataDBTable = null;
+ private TargetProcessDBTable targetProcessDBTable = null;
private static final int MEM_API_TYPE_ALLOC = 0;
private static final int MEM_API_TYPE_FREE = 1;
private static final int MEM_API_TYPE_MANAGE = 2;
private static final int MEM_USER = 2;
- private long allocByte = 0;
+
+ private Map<Integer, Long> allocByteMap = new HashMap<Integer, Long>(); // Map<PID, allocByte>
private HashMap<Long, Long> allocationSeriesDataSetMap = new HashMap<Long, Long>();
public static TimelineChartManager getInstance() {
uiEventDBTable = new UIEventDBTable();
screenShotDBTable = new ScreenShotDBTable();
customDataDBTable = new CustomDataDBTable();
+ targetProcessDBTable = new TargetProcessDBTable();
addDBTable(systemDataTable);
addDBTable(cpuDBTable);
addDBTable(processLoadDBTable);
addDBTable(uiEventDBTable);
addDBTable(screenShotDBTable);
addDBTable(customDataDBTable);
+ addDBTable(targetProcessDBTable);
initChartMap(CPUChart.getInstance());
initChartMap(CPUCoreChart.getInstance());
initChartMap(HeapChart.getInstance());
initChartMap(ProcessMemoryChart.getInstance());
initChartMap(SystemMemoryChart.getInstance());
- initChartMap(FileChart.getInstance());
initChartMap(ScreenshotChart.getInstance());
initChartMap(UIEventChart.getInstance());
initChartMap(DiskIOChart.getInstance());
customChartMap.clear();
customLogParser.clear();
- allocByte = 0;
+ allocByteMap.clear();
allocationSeriesDataSetMap.clear();
}
int size = memoryLogList.size();
for (int i = 0; i < size; i++) {
MemoryData logData = (MemoryData) memoryLogList.get(i);
+ if (allocByteMap.get(logData.getPid()) == null) {
+ allocByteMap.put(Integer.valueOf(logData.getPid()), new Long(0));
+ }
+
int memApiType = logData.getMemoryApiType();
int internalFlag = logData.getInternalCall();
long errorNo = logData.getErrno();
if (systemLogList != null) {
ArrayList<List<Object>> systemDataList = new ArrayList<List<Object>>();
ArrayList<List<Object>> cpuDataList = new ArrayList<List<Object>>();
- ArrayList<List<Object>> processDataList = new ArrayList<List<Object>>();
+ ArrayList<List<Object>> otherProcessDataList = new ArrayList<List<Object>>();
ArrayList<List<Object>> energyDataList = new ArrayList<List<Object>>();
+ ArrayList<List<Object>> targetProcessDataList = new ArrayList<List<Object>>();
int size = systemLogList.size();
for (int i = 0; i < size; i++) {
SystemData log = (SystemData) systemLogList.get(i);
double systemAvgCPULoad = cpuLoadSum / coreSize;
ArrayList<Object> dbSystemData = new ArrayList<Object>();
dbSystemData.add(new Long(log.getTime()));
- dbSystemData.add(new Float(log.getAppCpuUsage()));
dbSystemData.add(new Float(systemAvgCPULoad));
- dbSystemData.add(new Integer(log.getProcessCount()));
- dbSystemData.add(new Long(log.getTotalAllocSize() + allocByte));
- dbSystemData.add(new Long(allocByte));
- dbSystemData.add(new Integer(log.getVirtualMemory()));
- dbSystemData.add(new Integer(log.getResidentMemory()));
- dbSystemData.add(new Integer(log.getSharedMemory()));
- dbSystemData.add(new Integer(log.getPssMemory()));
- dbSystemData.add(new Long(log.getSystemMemoryTotal()));
+ dbSystemData.add(new Integer(log.getOtherProcessCount()));
+ dbSystemData.add(new Integer(log.getTargetProcessCount()));
dbSystemData.add(new Long(log.getSystemMemoryUsed()));
dbSystemData.add(new Integer(log.getNetworkSendSize()));
dbSystemData.add(new Integer(log.getNetworkReceiveSize()));
dbSystemData.add(new Integer(log.getBrightness()));
dbSystemData.add(new Integer(log.getDnet()));
dbSystemData.add(new Integer(log.getCamera()));
- dbSystemData.add(new Integer(log.getSound())); // 20
+ dbSystemData.add(new Integer(log.getSound()));
dbSystemData.add(new Integer(log.getAudio()));
dbSystemData.add(new Integer(log.getVibration()));
dbSystemData.add(new Integer(log.getVoltage()));
dbSystemData.add(new Integer(log.getTotalUsedDrive()));
dbSystemData.add(new Integer(log.getDiskReadSize()));
dbSystemData.add(new Integer(log.getDiskReadSectorCount()));
- dbSystemData.add(new Integer(log.getDiskWriteSize())); // 30
+ dbSystemData.add(new Integer(log.getDiskWriteSize()));
dbSystemData.add(new Integer(log.getDiskWrittenSectorCount()));
dbSystemData.add(new Integer(log.getEnergyUsage()));
-
systemDataList.add(dbSystemData);
/*
- * Make Process Table data
+ * Make other Process Table data
*/
- String[] processLoadDatas = log.getProcessLoad().split(CommonConstants.COMMA);
+ String[] processLoadDatas = log.getOtherProcessLoad().split(CommonConstants.COMMA);
for (int ii = 0; ii < processLoadDatas.length; ii++) {
String processLoad = processLoadDatas[ii];
if (processLoad == null || processLoad.isEmpty()) {
dbProcessData.add(new Long(log.getTime()));
dbProcessData.add(new Integer(pid));
dbProcessData.add(new Float(load));
- processDataList.add(dbProcessData);
+ otherProcessDataList.add(dbProcessData);
+ }
+
+ /*
+ * Make target Process Table data
+ */
+ ProcessProfileData[] targetProcessList = log.getProcessProfileDataList();
+ if (targetProcessList != null) {
+ for (int ii = 0; ii < targetProcessList.length; ii++) {
+ ProcessProfileData process = targetProcessList[ii];
+ ArrayList<Object> dbTargetProcessData = new ArrayList<Object>();
+ dbTargetProcessData.add(new Long(log.getTime()));
+ dbTargetProcessData.add(new Integer(process.getPid()));
+ dbTargetProcessData.add(new Float(process.getProcessLoad()));
+ dbTargetProcessData.add(new Long(process.getVirtualMemory()));
+ dbTargetProcessData.add(new Long(process.getResidentMemory()));
+ dbTargetProcessData.add(new Long(process.getSharedMemory()));
+ dbTargetProcessData.add(new Long(process.getPssMemory()));
+ dbTargetProcessData.add(new Long(process.getTotalAllocSize()));
+
+
+ if (allocByteMap.get(process.getPid()) == null) {
+ dbTargetProcessData.add(new Long(0));
+ } else {
+ dbTargetProcessData.add(allocByteMap.get(process.getPid()));
+ }
+
+ targetProcessDataList.add(dbTargetProcessData);
+ }
}
/*
SystemDataDBInserter.startThread();
CPUDBInserter.pushContextData(cpuDataList);
CPUDBInserter.startThread();
- ProcessDataDBInserter.pushContextData(processDataList);
+ ProcessDataDBInserter.pushContextData(otherProcessDataList);
ProcessDataDBInserter.startThread();
EnergyDataDBInserter.pushContextData(energyDataList);
EnergyDataDBInserter.startThread();
+ TargetProcessDBInserter.pushContextData(targetProcessDataList);
+ TargetProcessDBInserter.startThread();
}
}
ScreenShotDBInserter.startThread();
}
}
-
+
private void addNewSeriesUserAllocData(int fdApiType, MemoryData log) {
long size = 0;
-
+ Long allocByte = allocByteMap.get(log.getPid());
+
long address = log.getAddress();
if (address == 0) {
return;
if (MEM_API_TYPE_ALLOC == fdApiType) {
try {
size = log.getSize();
-
- allocByte += size;
+ allocByteMap.put(log.getPid(), allocByte + size);
allocationSeriesDataSetMap.put(address, size);
} catch (NumberFormatException ne) {
ne.printStackTrace();
return;
}
size = allocationSeriesDataSetMap.get(address);
-
- allocByte -= size;
+ allocByteMap.put(log.getPid(), allocByte - size);
}
}
return customDataDBTable;
}
+ public DBTable getTargetProcessTable() {
+ return targetProcessDBTable;
+ }
+
public List<List<Object>> getSystemDataFromDB(long start, long end) {
String where =
"where TIME BETWEEN " + start + " AND " + end + " ORDER BY "
return new ArrayList<List<Object>>();
}
}
+
+ public Map<Integer, List<List<Object>>> getTargetProcessDataFromDB(long start, long end) {
+ Map<Integer, List<List<Object>>> processedResult =
+ new HashMap<Integer, List<List<Object>>>();
+
+ String where =
+ "where TIME BETWEEN " + start + " AND " + end + " ORDER BY "
+ + TargetProcessDBTable.TIME;
+ List<List<Object>> queryResult = targetProcessDBTable.selectData(null, where);
+ if (queryResult == null) {
+ return processedResult;
+ }
+
+ for (int i = 0; i < queryResult.size(); i++) {
+ List<Object> row = queryResult.get(i);
+ Integer pid = (Integer) row.get(TargetProcessDBTable.COLUMN.PID.ordinal());
+ List<List<Object>> processData = processedResult.get(pid);
+ if (processData == null) {
+ processData = new ArrayList<List<Object>>();
+ processedResult.put(pid, processData);
+ }
+ processData.add(row);
+ }
+ return processedResult;
+ }
@Override
public void makeChartSeries(long startTime, long endTime) {
List<List<Object>> uiEventDBData = getUIEventDataFromDB(startTime, endTime);
List<List<Object>> screenShotDBData = getScreenShotDataFromDB(startTime, endTime);
List<List<Object>> customDBData = getCustomDataFromDB(startTime, endTime);
+ Map<Integer, List<List<Object>>> targetProcessDBData = getTargetProcessDataFromDB(startTime, endTime);
/*
* 2. Make series of chart
dataList.add(cpuDBData);
dataList.add(processDBData);
dataList.add(energyDBData);
+ dataList.add(targetProcessDBData);
chart.inputChartSeries(dataList);
} else if (chart.getProbeType() == DataChannelConstants.MSG_PROBE_UIEVENT) {
List<Object> dataList = new ArrayList<Object>();
public static final int CPU_DB_DATA = 1;
public static final int PROCESS_DB_DATA = 2;
public static final int ENERGY_DB_DATA = 3;
+ public static final int TARGET_PROCESS_DB_DATA = 4;
public static final int UIEVENT_DB_DATA = 0; // same with SYSTEM_DB_DATA
public static final int SCREENSHOT_DB_DATA = 0; // same with SYSTEM_DB_DATA, UIEVENT_DB_DATA
}
if (null == data.get(ConfigureLabels.FEATURE_FILE)) {
data.put(ConfigureLabels.FEATURE_FILE,
Long.toString(AnalyzerConstants.FEATURE_FILE_API));
+// data.put(ConfigureLabels.FEATURE_SYSTEM_FD,
+// Long.toString(AnalyzerConstants.SYSTEM_FD));
}
if (null == data.get(ConfigureLabels.FEATURE_THREAD)) {
data.put(ConfigureLabels.FEATURE_THREAD,
Long.toString(AnalyzerConstants.FEATURE_THREAD_API));
+ data.put(ConfigureLabels.FEATURE_SYSTEM_THREAD,
+ Long.toString(AnalyzerConstants.SYSTEM_THREAD_LOAD));
}
// if (null == data.get(ConfigureLabels.FEATURE_USERINTERFACE)) {
// data.put(ConfigureLabels.FEATURE_USERINTERFACE,
state |= getValueLong(ConfigureLabels.FEATURE_CONTEXT_SWITCH);
state |= getValueLong(ConfigureLabels.FEATURE_NETWORK);
state |= getValueLong(ConfigureLabels.FEATURE_OPENGL);
- state |= getValueLong(ConfigureLabels.FEATURE_SYSTEM_CPU);
- state |= getValueLong(ConfigureLabels.FEATURE_SYSTEM_PROCESSES);
- state |= getValueLong(ConfigureLabels.FEATURE_SYSTEM_MEMORY);
- state |= getValueLong(ConfigureLabels.FEATURE_SYSTEM_DISK);
- state |= getValueLong(ConfigureLabels.FEATURE_SYSTEM_NETWORK);
- state |= getValueLong(ConfigureLabels.FEATURE_SYSTEM_DEVICE);
- state |= getValueLong(ConfigureLabels.FEATURE_SYSTEM_ENERGY);
-
state |= getValueLong(ConfigureLabels.INCLUDE_INSIDE_CALL_MEMORY);
state |= getValueLong(ConfigureLabels.INCLUDE_INSIDE_CALL_THREAD);
state |= getValueLong(ConfigureLabels.INCLUDE_INSIDE_CALL_FILE);
if (DACommunicator.isSWAPVersion(devInfo)) {
state |= getValueInt(ConfigureLabels.INCLUDE_INSIDE_CALL_NETWORK);
state |= getValueInt(ConfigureLabels.INCLUDE_INSIDE_OPENGL);
+ state |= getValueLong(ConfigureLabels.FEATURE_SYSTEM_CPU);
+ state |= getValueLong(ConfigureLabels.FEATURE_SYSTEM_PROCESSES);
+ state |= getValueLong(ConfigureLabels.FEATURE_SYSTEM_MEMORY);
+ state |= getValueLong(ConfigureLabels.FEATURE_SYSTEM_DISK);
+// state |= getValueLong(ConfigureLabels.FEATURE_SYSTEM_FD);
+ state |= getValueLong(ConfigureLabels.FEATURE_SYSTEM_THREAD);
+ state |= getValueLong(ConfigureLabels.FEATURE_SYSTEM_NETWORK);
+ state |= getValueLong(ConfigureLabels.FEATURE_SYSTEM_DEVICE);
+ state |= getValueLong(ConfigureLabels.FEATURE_SYSTEM_ENERGY);
}
return state;
}
processCombo.add(ALL_PROCESS);
List<ProcessInfoPackage> processInfoPkgList = new ArrayList<ProcessInfoPackage>();
- processInfoPkgList.addAll(project.getProcessInfoPackHash()
- .values());
+ processInfoPkgList.addAll(project.getProcessInfoPackHash().values());
for (ProcessInfoPackage pkg : processInfoPkgList) {
// String pid = Integer.toString(pkg.getPid());
String binName = CommonConstants.EMPTY;
public class ConfigurationDialogDataManager {
private static final DALogger DA_LOG = DALogger.getInstance();
-
+
private static ConfigurationDialogDataManager instance = null;
private DAMessageBox configDlg = null;
instance = new ConfigurationDialogDataManager();
tableFeaturesName = new String[] {
- ConfigureLabels.FEATURE_SYSTEM_CPU,
- ConfigureLabels.FEATURE_SYSTEM_PROCESSES,
+ ConfigureLabels.FEATURE_SYSTEM_CPU,
ConfigureLabels.FEATURE_SYSTEM_MEMORY,
+ ConfigureLabels.FEATURE_SYSTEM_PROCESSES,
ConfigureLabels.FEATURE_SYSTEM_DISK,
ConfigureLabels.FEATURE_SYSTEM_NETWORK,
ConfigureLabels.FEATURE_SYSTEM_DEVICE,
ConfigureLabels.FEATURE_NETWORK,
ConfigureLabels.FEATURE_FILE,
ConfigureLabels.FEATURE_OPENGL,
-// ConfigureLabels.FEATURE_USERINTERFACE,
+ // ConfigureLabels.FEATURE_USERINTERFACE,
ConfigureLabels.FEATURE_SCREENSHOT,
ConfigureLabels.FEATURE_USER_EVENT,
ConfigureLabels.FEATURE_RECORDING,
ConfigureLabels.INCLUDE_INSIDE_CALL_THREAD,
ConfigureLabels.INCLUDE_INSIDE_CALL_FILE,
ConfigureLabels.INCLUDE_INSIDE_CALL_NETWORK,
-// ConfigureLabels.INCLUDE_INSIDE_CALL_UI,
+ // ConfigureLabels.INCLUDE_INSIDE_CALL_UI,
ConfigureLabels.INCLUDE_INSIDE_OPENGL, };
optionalSettingName = new String[] { ConfigureLabels.SHOW_INITIAL,
|| featuresName
.equals(ConfigureLabels.FEATURE_SYSTEM_PROCESSES)
|| featuresName.equals(ConfigureLabels.FEATURE_SYSTEM_MEMORY)
+// || featuresName.equals(ConfigureLabels.FEATURE_SYSTEM_FD)
+ || featuresName.equals(ConfigureLabels.FEATURE_SYSTEM_THREAD)
|| featuresName.equals(ConfigureLabels.FEATURE_SYSTEM_DISK)
|| featuresName.equals(ConfigureLabels.FEATURE_SYSTEM_NETWORK)
|| featuresName.equals(ConfigureLabels.FEATURE_SYSTEM_DEVICE)
} else if (featuresName
.equals(ConfigureLabels.INCLUDE_INSIDE_CALL_NETWORK)) {
return ConfigureLabels.FEATURE_NETWORK;
-// } else if (featuresName.equals(ConfigureLabels.INCLUDE_INSIDE_CALL_UI)) {
-// return ConfigureLabels.FEATURE_USERINTERFACE;
+ // } else if
+ // (featuresName.equals(ConfigureLabels.INCLUDE_INSIDE_CALL_UI)) {
+ // return ConfigureLabels.FEATURE_USERINTERFACE;
} else if (featuresName.equals(ConfigureLabels.INCLUDE_INSIDE_OPENGL)) {
return ConfigureLabels.FEATURE_OPENGL;
} else {
|| featureName.equals(ConfigureLabels.FEATURE_SYSTEM_CPU)
|| featureName.equals(ConfigureLabels.FEATURE_SYSTEM_PROCESSES)
|| featureName.equals(ConfigureLabels.FEATURE_SYSTEM_MEMORY)
+// || featureName.equals(ConfigureLabels.FEATURE_SYSTEM_FD)
+ || featureName.equals(ConfigureLabels.FEATURE_SYSTEM_THREAD)
|| featureName.equals(ConfigureLabels.FEATURE_SYSTEM_DISK)
|| featureName.equals(ConfigureLabels.FEATURE_SYSTEM_NETWORK)
|| featureName.equals(ConfigureLabels.FEATURE_SYSTEM_DEVICE)
value = AnalyzerConstants.FEATURE_FILE_API;
} else if (featureName.equals(ConfigureLabels.FEATURE_THREAD)) {
value = AnalyzerConstants.FEATURE_THREAD_API;
-// } else if (featureName
-// .equals(ConfigureLabels.FEATURE_USERINTERFACE)) {
-// value = AnalyzerConstants.FEATURE_OSP_UI_API;
+ featuresValueHashMap.put(ConfigureLabels.FEATURE_SYSTEM_THREAD,
+ new ConfigurationDialogData(
+ ConfigureLabels.FEATURE_SYSTEM_THREAD,
+ AnalyzerConstants.SYSTEM_THREAD_LOAD));
+
+ // } else if (featureName
+ // .equals(ConfigureLabels.FEATURE_USERINTERFACE)) {
+ // value = AnalyzerConstants.FEATURE_OSP_UI_API;
} else if (featureName.equals(ConfigureLabels.FEATURE_SCREENSHOT)) {
value = AnalyzerConstants.FEATURE_SCREENSHOT;
} else if (featureName.equals(ConfigureLabels.FEATURE_USER_EVENT)) {
value = AnalyzerConstants.SYSTEM_MEMORY;
} else if (featureName.equals(ConfigureLabels.FEATURE_SYSTEM_DISK)) {
value = AnalyzerConstants.SYSTEM_DISK;
- } else if (featureName
+ }
+ else if (featureName.equals(ConfigureLabels.FEATURE_SYSTEM_THREAD)) {
+ value = AnalyzerConstants.SYSTEM_THREAD_LOAD;
+ }
+ else if (featureName
.equals(ConfigureLabels.FEATURE_SYSTEM_NETWORK)) {
value = AnalyzerConstants.SYSTEM_NETWORK;
} else if (featureName
} else if (featureName
.equals(ConfigureLabels.INCLUDE_INSIDE_CALL_THREAD)) {
value = AnalyzerConstants.THREAD_API_PROBING_NO_FILTER;
-// } else if (featureName
-// .equals(ConfigureLabels.INCLUDE_INSIDE_CALL_UI)) {
-// value = AnalyzerConstants.OSP_UI_API_PROBING_NO_FILTER;
+ // } else if (featureName
+ // .equals(ConfigureLabels.INCLUDE_INSIDE_CALL_UI)) {
+ // value = AnalyzerConstants.OSP_UI_API_PROBING_NO_FILTER;
} else if (featureName
.equals(ConfigureLabels.INCLUDE_INSIDE_CALL_NETWORK)) {
value = AnalyzerConstants.NETWORK_API_PROBING_NO_FILTER;
}
featuresValueHashMap.put(featureName, new ConfigurationDialogData(
featureName, value));
+
+ if (featureName.equals(ConfigureLabels.FEATURE_THREAD) && !status) {
+ featuresValueHashMap.put(ConfigureLabels.FEATURE_SYSTEM_THREAD,
+ new ConfigurationDialogData(
+ ConfigureLabels.FEATURE_SYSTEM_THREAD, value));
+ }
}
public void updateFeaturesValueFromConfigureManager() {
mConfig.setValue(featureName, Long.toString(featuresValueHashMap
.get(featureName).swapValue));
}
+ mConfig.setValue(ConfigureLabels.FEATURE_SYSTEM_THREAD, Long.toString(featuresValueHashMap
+ .get(ConfigureLabels.FEATURE_SYSTEM_THREAD).swapValue));
+
// optional Setting
for (String featureName : getOptionFeature()) {
mConfig.setValue(featureName, Long.toString(featuresValueHashMap
DACommunicator.MSG_TYPE_CONFIG, null);
if (!result.equals(HostResult.SUCCESS)) {
applyFailedSwapValue(featuresTable);
- } else if (!GlobalInformation.getCurrentDeviceInfo().isConfigSuccess()) {
+ } else if (!GlobalInformation.getCurrentDeviceInfo()
+ .isConfigSuccess()) {
GlobalInformation.getCurrentDeviceInfo().setConfigSuccess(true);
ToolbarArea.getInstance().setStartButtonEnablement(true);
} else {
|| featureName.equals(ConfigureLabels.FEATURE_SYSTEM_CPU)
|| featureName.equals(ConfigureLabels.FEATURE_SYSTEM_PROCESSES)
|| featureName.equals(ConfigureLabels.FEATURE_SYSTEM_MEMORY)
+// || featureName.equals(ConfigureLabels.FEATURE_SYSTEM_FD)
+ || featureName.equals(ConfigureLabels.FEATURE_SYSTEM_THREAD)
|| featureName.equals(ConfigureLabels.FEATURE_SYSTEM_DISK)
|| featureName.equals(ConfigureLabels.FEATURE_SYSTEM_NETWORK)
|| featureName.equals(ConfigureLabels.FEATURE_SYSTEM_DEVICE)
.equals(ConfigureLabels.FEATURE_SYSTEM_PROCESSES)
|| featuresName.equals(ConfigureLabels.FEATURE_SYSTEM_MEMORY)
|| featuresName.equals(ConfigureLabels.FEATURE_SYSTEM_DISK)
+// || featuresName.equals(ConfigureLabels.FEATURE_SYSTEM_FD)
+ || featuresName.equals(ConfigureLabels.FEATURE_SYSTEM_THREAD)
|| featuresName.equals(ConfigureLabels.FEATURE_SYSTEM_NETWORK)
|| featuresName.equals(ConfigureLabels.FEATURE_SYSTEM_DEVICE)
|| featuresName.equals(ConfigureLabels.FEATURE_SYSTEM_ENERGY)
.equals(ConfigureLabels.FEATURE_SYSTEM_PROCESSES)
|| featuresName.equals(ConfigureLabels.FEATURE_SYSTEM_MEMORY)
|| featuresName.equals(ConfigureLabels.FEATURE_SYSTEM_DISK)
+// || featuresName.equals(ConfigureLabels.FEATURE_SYSTEM_FD)
+ || featuresName.equals(ConfigureLabels.FEATURE_SYSTEM_THREAD)
|| featuresName.equals(ConfigureLabels.FEATURE_SYSTEM_NETWORK)
|| featuresName.equals(ConfigureLabels.FEATURE_SYSTEM_DEVICE)
|| featuresName.equals(ConfigureLabels.FEATURE_SYSTEM_ENERGY)) {
public static long translateSecToMicroSec(double sec) {
return (long)(sec * 1000000.0);
}
+
+ public static String getProcessName(int pid) {
+ List<ProcessInfoPackage> processInfoPkgList = new ArrayList<ProcessInfoPackage>();
+
+ if (AnalyzerManager.getProject() == null) {
+ return null;
+ }
+ processInfoPkgList.addAll(AnalyzerManager.getProject().getProcessInfoPackHash().values());
+ for (ProcessInfoPackage pkg : processInfoPkgList) {
+ if (pkg.getPid() == pid) {
+ String binName = CommonConstants.EMPTY;
+
+ String cmdLineName = pkg.getCmdLineName();
+ if(cmdLineName != null && !cmdLineName.isEmpty()) {
+ binName = cmdLineName;
+ } else {
+ String binPath = pkg.getTargetBinaryPath();
+ if (null != binPath && !binPath.isEmpty()) {
+ int index = binPath.lastIndexOf(CommonConstants.SLASH);
+ binName = binPath.substring(index + 1, binPath.length());
+ }
+ }
+ return binName;
+ }
+ }
+ return null;
+ }
}