From 8f508bb462e944e2d2c3ef97a9535cc9377577a5 Mon Sep 17 00:00:00 2001 From: "jungwook.ryu" Date: Sat, 31 May 2014 15:14:11 +0900 Subject: [PATCH] Timeline : revision some Timeline Chart according to change MSG_SYSTEM 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 --- .../dynamicanalyzer/resources/ColorResources.java | 20 +- .../tizen/dynamicanalyzer/theme/DAThemeWhite.java | 48 ++-- .../widgets/chart/DAChartRenderer.java | 40 +-- .../widgets/chartBoard/DAChartBoardItem.java | 17 +- .../widgets/chartBoard/DAChartBoardItemCell.java | 84 +++++- .../dynamicanalyzer/common/AnalyzerConstants.java | 28 +- .../tizen/dynamicanalyzer/nl/ConfigureLabels.java | 1 + .../dynamicanalyzer/nl/ConfigureLabels.properties | 1 + .../nl/TimelineChartLabels.properties | 10 +- .../swap/channel/control/RunTimeConfiguration.java | 1 + .../swap/model/data/ProcessProfileData.java | 111 ++++++++ .../swap/model/data/SystemData.java | 262 ++++++++---------- .../dynamicanalyzer/ui/file/FileDataMaker.java | 8 +- .../ui/file/manager/FileChartDataMaker.java | 16 +- .../ui/info/screenshot/ScreenshotDataManager.java | 6 +- .../ui/info/screenshot/ScreenshotView.java | 7 +- .../thread/thread/ThreadPageThreadDataManager.java | 104 ++++---- .../ui/timeline/SystemDataDBTable.java | 102 +++---- .../ui/timeline/TargetProcessDBInserter.java | 90 +++++++ .../ui/timeline/TargetProcessDBTable.java | 105 ++++++++ .../ui/timeline/UIEventDBTable.java | 2 +- .../ui/timeline/chart/CPUChart.java | 70 ++++- .../ui/timeline/chart/DeviceChart.java | 10 +- .../ui/timeline/chart/DiskIOChart.java | 67 ++++- .../ui/timeline/chart/DiskIOChartRenderer.java | 294 +++++++++++++++++++++ .../ui/timeline/chart/EnergyChart.java | 31 ++- .../ui/timeline/chart/FileChart.java | 274 ------------------- .../ui/timeline/chart/HeapChart.java | 189 +++++++++---- .../ui/timeline/chart/NetworkIOChart.java | 4 +- .../ui/timeline/chart/ProcessMemoryChart.java | 195 +++++++++++--- .../ui/timeline/chart/SystemMemoryChart.java | 85 ++++-- .../ui/timeline/common/TimelineChartManager.java | 116 ++++++-- .../ui/timeline/common/TimelineConstants.java | 1 + .../ui/toolbar/ConfigureManager.java | 21 +- .../dynamicanalyzer/ui/toolbar/ToolbarArea.java | 3 +- .../ConfigurationDialogDataManager.java | 54 ++-- .../ConfigurationDialogFeaturesPage.java | 6 + .../tizen/dynamicanalyzer/utils/AnalyzerUtil.java | 27 ++ 38 files changed, 1670 insertions(+), 840 deletions(-) create mode 100644 org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/data/ProcessProfileData.java create mode 100644 org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/TargetProcessDBInserter.java create mode 100644 org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/TargetProcessDBTable.java create mode 100644 org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/DiskIOChartRenderer.java delete mode 100644 org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/FileChart.java diff --git a/org.tizen.dynamicanalyzer.appearance/src/org/tizen/dynamicanalyzer/resources/ColorResources.java b/org.tizen.dynamicanalyzer.appearance/src/org/tizen/dynamicanalyzer/resources/ColorResources.java index aeeac0a..ba9af90 100755 --- a/org.tizen.dynamicanalyzer.appearance/src/org/tizen/dynamicanalyzer/resources/ColorResources.java +++ b/org.tizen.dynamicanalyzer.appearance/src/org/tizen/dynamicanalyzer/resources/ColorResources.java @@ -379,8 +379,6 @@ public class ColorResources { public static Color SERIES_COLOR_CPUCORE_CORE2 = getColor("seriesColorCPUCoreCore2"); //$NON-NLS-1$ public static Color SERIES_COLOR_CPUCORE_CORE3 = getColor("seriesColorCPUCoreCore3"); //$NON-NLS-1$ - public static Color SERIES_COLOR_CPU_FREQ = getColor("seriesColorCPUFreq"); //$NON-NLS-1$ - public static Color SERIES_COLOR_HEAP_SYSTEM = getColor("seriesColorHeapSystem"); //$NON-NLS-1$ public static Color SERIES_COLOR_HEAP_USER = getColor("seriesColorHeapApp"); //$NON-NLS-1$ @@ -392,10 +390,20 @@ public class ColorResources { public static Color SERIES_COLOR_MEMORY_SYS_USED = getColor("seriesColorMemorySysUsed"); //$NON-NLS-1$ public static Color SERIES_COLOR_MEMORY_APP_USED = getColor("seriesColorMemoryAppUsed"); //$NON-NLS-1$ - public static Color SERIES_COLOR_FILE_READ = getColor("seriesColorFileRead"); //$NON-NLS-1$ - public static Color SERIES_COLOR_FILE_WRITE = getColor("seriesColorFileWrite"); //$NON-NLS-1$ - public static Color SERIES_COLOR_FILE_FD = getColor("seriesColorFileFD"); //$NON-NLS-1$ - + public static Color SERIES_COLOR_NETWORK_IO_SEND = getColor("seriesColorNetworkIOSend"); //$NON-NLS-1$ + public static Color SERIES_COLOR_NETWORK_IO_RECEIVE = getColor("seriesColorNetworkIOReceive"); //$NON-NLS-1$ + + public static Color SERIES_COLOR_DISK_IO_READ_BYTE = getColor("seriesColorDiskIOReadByte"); //$NON-NLS-1$ + public static Color SERIES_COLOR_DISK_IO_WRITE_BYTE = getColor("seriesColorDiskIOWriteByte"); //$NON-NLS-1$ + public static Color SERIES_COLOR_DISK_IO_READ_SECTOR = getColor("seriesColorDiskIOReadSector"); //$NON-NLS-1$ + public static Color SERIES_COLOR_DISK_IO_READ_WRITE_SECTOR = getColor("seriesColorDiskIOWriteSector"); //$NON-NLS-1$ + + public static Color SERIES_COLOR_DEVICE_WIFI = getColor("seriesColorDeviceWifi"); //$NON-NLS-1$ + public static Color SERIES_COLOR_DEVICE_BLUETOOTH = getColor("seriesColorDeviceBluetooth"); //$NON-NLS-1$ + public static Color SERIES_COLOR_DEVICE_GPS = getColor("seriesColorDeviceGPS"); //$NON-NLS-1$ + public static Color SERIES_COLOR_DEVICE_DNET = getColor("seriesColorDeviceDNet"); //$NON-NLS-1$ + public static Color SERIES_COLOR_DEVICE_CAMERA = getColor("seriesColorDeviceCamera"); //$NON-NLS-1$ + public static Color SERIES_COLOR_UI_EVENT_KEY = getColor("seriesColorUIEventKey");//$NON-NLS-1$ public static Color SERIES_COLOR_UI_EVENT_TOUCH = getColor("seriesColorUIEventTouch");//$NON-NLS-1$ public static Color SERIES_COLOR_UI_EVENT_GESTURE = getColor("seriesColorUIEventGesture");//$NON-NLS-1$ diff --git a/org.tizen.dynamicanalyzer.appearance/src/org/tizen/dynamicanalyzer/theme/DAThemeWhite.java b/org.tizen.dynamicanalyzer.appearance/src/org/tizen/dynamicanalyzer/theme/DAThemeWhite.java index 67efc57..68c53a1 100644 --- a/org.tizen.dynamicanalyzer.appearance/src/org/tizen/dynamicanalyzer/theme/DAThemeWhite.java +++ b/org.tizen.dynamicanalyzer.appearance/src/org/tizen/dynamicanalyzer/theme/DAThemeWhite.java @@ -386,36 +386,44 @@ public class DAThemeWhite extends DATheme { 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$ diff --git a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/chart/DAChartRenderer.java b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/chart/DAChartRenderer.java index b91a53d..821ca80 100644 --- a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/chart/DAChartRenderer.java +++ b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/chart/DAChartRenderer.java @@ -1231,27 +1231,29 @@ public class DAChartRenderer { .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; + } } } diff --git a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/chartBoard/DAChartBoardItem.java b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/chartBoard/DAChartBoardItem.java index 38033bd..e3d0f77 100644 --- a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/chartBoard/DAChartBoardItem.java +++ b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/chartBoard/DAChartBoardItem.java @@ -4,6 +4,7 @@ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. * * Contact: + * Jungwook Ryu * yeongtaik byeon * Juyoung Kim * @@ -65,7 +66,7 @@ public class DAChartBoardItem extends Composite { itemCell.setLayoutData(data); this.layout(); } - + public DAChartBoardItem(DAChartBoard parent, String itemName) { super(parent.getItemList(), SWT.NONE); parentBoard = parent; @@ -89,6 +90,15 @@ public class DAChartBoardItem extends Composite { 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) { @@ -169,13 +179,14 @@ public class DAChartBoardItem extends Composite { callNotifyResizeChild(); } - void unFoldChild() { + public void unFoldChild() { childFolded = false; FormData childListData = (FormData) childItemList.getLayoutData(); childListData.height = childItemList.getListHeight(); childItemList.setLayoutData(childListData); - + + itemCell.setFoldButtonTrue(); callNotifyResizeChild(); } diff --git a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/chartBoard/DAChartBoardItemCell.java b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/chartBoard/DAChartBoardItemCell.java index a5906b6..cdab0b2 100644 --- a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/chartBoard/DAChartBoardItemCell.java +++ b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/chartBoard/DAChartBoardItemCell.java @@ -64,7 +64,8 @@ public class DAChartBoardItemCell extends Composite { private String itemName; private Image itemIcon; private Image foldBackBuffer; - + private PaintListener nameCellPaintListener; + //FIXME for debugging public String getItemName() { return itemName; @@ -89,23 +90,23 @@ public class DAChartBoardItemCell extends Composite { } 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 @@ -168,7 +169,7 @@ public class DAChartBoardItemCell extends Composite { chartCell.setLayoutData(data); } - void setFoldButtonTrue() { + public void setFoldButtonTrue() { if (null == childFoldButton) { return; } @@ -351,4 +352,77 @@ public class DAChartBoardItemCell extends Composite { 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(); + } } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/AnalyzerConstants.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/AnalyzerConstants.java index 185433f..7550bfc 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/AnalyzerConstants.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/AnalyzerConstants.java @@ -154,12 +154,25 @@ public class AnalyzerConstants { 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 @@ -176,16 +189,6 @@ public class AnalyzerConstants { 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 @@ -194,6 +197,7 @@ public class AnalyzerConstants { // 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 diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/ConfigureLabels.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/ConfigureLabels.java index 01eb4b4..5d5fc6c 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/ConfigureLabels.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/ConfigureLabels.java @@ -81,6 +81,7 @@ public class ConfigureLabels extends NLS { 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; diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/ConfigureLabels.properties b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/ConfigureLabels.properties index 3e73ef6..3dcb71b 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/ConfigureLabels.properties +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/ConfigureLabels.properties @@ -38,6 +38,7 @@ FEATURE_SYSTEM_DISK=System disk 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. diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/TimelineChartLabels.properties b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/TimelineChartLabels.properties index 2c9984f..ffd17fb 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/TimelineChartLabels.properties +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/TimelineChartLabels.properties @@ -16,7 +16,7 @@ CPU_CORE_CHART_TITLE=CPU core 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 @@ -44,10 +44,10 @@ UI_EVENT_CHART_SERIES_NAME_ORIENTATION=Orientation 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 diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/channel/control/RunTimeConfiguration.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/channel/control/RunTimeConfiguration.java index 27cb1e5..15c30db 100755 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/channel/control/RunTimeConfiguration.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/channel/control/RunTimeConfiguration.java @@ -39,6 +39,7 @@ public class RunTimeConfiguration implements Streamable { public void setFeatures(long low, long high) { lowFeatures = low; highFeatures = high; + System.out.println("lowFeatures : "+lowFeatures+" highFeatures : "+highFeatures); } @Override diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/data/ProcessProfileData.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/data/ProcessProfileData.java new file mode 100644 index 0000000..6ad3ddb --- /dev/null +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/data/ProcessProfileData.java @@ -0,0 +1,111 @@ +/* + * Dynamic Analyzer + * + * Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Jungwook Ryu + * Juyoung Kim + * + * 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; + } +} diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/data/SystemData.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/data/SystemData.java index 62ab207..93cdb9c 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/data/SystemData.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/data/SystemData.java @@ -4,6 +4,7 @@ * Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved. * * Contact: + * Jungwook Ryu * Jooyoul Lee * Juyoung Kim * @@ -39,20 +40,13 @@ import org.tizen.dynamicanalyzer.util.ByteUtil; 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; @@ -90,8 +84,6 @@ public class SystemData extends LogData { .getCpuCount(); int deviceCount = GlobalInformation.getCurrentDeviceInfo().getTargetInfo() .getDeviceCount(); - appCpuUsage = ByteUtil.toFloat(data, index); - index += FLOAT_SIZE; cpuFrequency = parseCpu(index, data); index += (FLOAT_SIZE * coreCount); @@ -99,38 +91,25 @@ public class SystemData extends LogData { 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; @@ -257,7 +236,33 @@ public class SystemData extends LogData { } 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; } @@ -386,46 +391,6 @@ public class SystemData extends LogData { 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; } @@ -434,22 +399,6 @@ public class SystemData extends LogData { 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; } @@ -458,14 +407,6 @@ public class SystemData extends LogData { this.cpuFrequency = cpuFrequency; } - public float getAppCpuUsage() { - return appCpuUsage; - } - - public void setAppCpuUsage(float appCpuUsage) { - this.appCpuUsage = appCpuUsage; - } - public String getCpuLoad() { return cpuLoad; } @@ -474,14 +415,6 @@ public class SystemData extends LogData { this.cpuLoad = cpuLoad; } - public long getSystemMemoryTotal() { - return systemMemoryTotal; - } - - public void setSystemMemoryTotal(long systemMemoryTotal) { - this.systemMemoryTotal = systemMemoryTotal; - } - public long getSystemMemoryUsed() { return systemMemoryUsed; } @@ -490,22 +423,6 @@ public class SystemData extends LogData { 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; } @@ -578,25 +495,61 @@ public class SystemData extends LogData { 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); @@ -625,24 +578,27 @@ public class SystemData extends LogData { // 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++); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/FileDataMaker.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/FileDataMaker.java index 2df3e20..3540042 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/FileDataMaker.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/FileDataMaker.java @@ -57,7 +57,6 @@ import org.tizen.dynamicanalyzer.ui.summary.leaks.LeakDetector; 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; @@ -185,15 +184,12 @@ public class FileDataMaker { 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; } } @@ -206,12 +202,10 @@ public class FileDataMaker { 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); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/manager/FileChartDataMaker.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/manager/FileChartDataMaker.java index 5dec904..85f6212 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/manager/FileChartDataMaker.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/manager/FileChartDataMaker.java @@ -60,7 +60,6 @@ import org.tizen.dynamicanalyzer.ui.summary.failed.FailedChecker; 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; @@ -73,7 +72,6 @@ public class FileChartDataMaker { private FailedChecker failedChecker = null; private WarningChecker warningChecker = null; - private int timeLineFileChartFDCount = 0; private List fileStatusList = new ArrayList(); private List fileAccessList = new ArrayList(); @@ -108,7 +106,6 @@ public class FileChartDataMaker { List fileEventQueue = new ArrayList(); - FileChart timeLineFileChart = FileChart.getInstance(); int size = inputs.size(); FileEvent event = null; String key = null; @@ -167,21 +164,14 @@ public class FileChartDataMaker { 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; @@ -191,7 +181,6 @@ public class FileChartDataMaker { 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); @@ -202,7 +191,6 @@ public class FileChartDataMaker { 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); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/info/screenshot/ScreenshotDataManager.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/info/screenshot/ScreenshotDataManager.java index e450664..5501841 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/info/screenshot/ScreenshotDataManager.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/info/screenshot/ScreenshotDataManager.java @@ -54,7 +54,11 @@ public class ScreenshotDataManager extends PageDataManager { 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(); } } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/info/screenshot/ScreenshotView.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/info/screenshot/ScreenshotView.java index d4e9de1..d7dd1d1 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/info/screenshot/ScreenshotView.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/info/screenshot/ScreenshotView.java @@ -308,7 +308,12 @@ public class ScreenshotView extends DAViewComposite { 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 diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/thread/thread/ThreadPageThreadDataManager.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/thread/thread/ThreadPageThreadDataManager.java index 9faf516..c8ee782 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/thread/thread/ThreadPageThreadDataManager.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/thread/thread/ThreadPageThreadDataManager.java @@ -350,33 +350,33 @@ public class ThreadPageThreadDataManager { 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) { @@ -393,31 +393,31 @@ public class ThreadPageThreadDataManager { 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); +// } } } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/SystemDataDBTable.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/SystemDataDBTable.java index ca44b4a..7e11893 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/SystemDataDBTable.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/SystemDataDBTable.java @@ -39,16 +39,9 @@ public class SystemDataDBTable extends DBTable { 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, @@ -71,21 +64,12 @@ public class SystemDataDBTable extends DBTable { 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"; @@ -108,8 +92,6 @@ public class SystemDataDBTable extends DBTable { 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() { @@ -117,17 +99,10 @@ public class SystemDataDBTable extends DBTable { } 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)); @@ -136,7 +111,7 @@ public class SystemDataDBTable extends DBTable { 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)); @@ -146,12 +121,10 @@ public class SystemDataDBTable extends DBTable { 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 @@ -164,38 +137,31 @@ public class SystemDataDBTable extends DBTable { } 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; diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/TargetProcessDBInserter.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/TargetProcessDBInserter.java new file mode 100644 index 0000000..a1799b3 --- /dev/null +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/TargetProcessDBInserter.java @@ -0,0 +1,90 @@ +/* + * Dynamic Analyzer + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Jungwook Ryu + * Juyoung Kim + * + * 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>> processDataQueue = new ReadBlockingQueue>>(); + + 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> data) { + processDataQueue.offer(data); + } + + public static void clear() { + stopThread(); + } + + @Override + public void run() { + while (!AnalyzerManager.isExit()) { + List> processData = processDataQueue.poll(); + + if (processData != null && processData.size() != 0) { + for (int i = 0; i < processData.size(); i++) { + List row = processData.get(i); + } + TimelineChartManager.getInstance().getTargetProcessTable().insertData(processData); + } + } + } + + public static void sendNotify() { + processDataQueue.wake(); + } + +} diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/TargetProcessDBTable.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/TargetProcessDBTable.java new file mode 100644 index 0000000..8794eec --- /dev/null +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/TargetProcessDBTable.java @@ -0,0 +1,105 @@ +/* + * Dynamic Analyzer + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Jungwook Ryu + * Juyoung Kim + * + * 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 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; + } +} diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/UIEventDBTable.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/UIEventDBTable.java index 5e7ce3c..98b4112 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/UIEventDBTable.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/UIEventDBTable.java @@ -86,7 +86,7 @@ public class UIEventDBTable extends DBTable { 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(); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/CPUChart.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/CPUChart.java index 391310b..e8b936d 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/CPUChart.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/CPUChart.java @@ -27,13 +27,16 @@ 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; @@ -43,6 +46,7 @@ import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseEventListener; 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; @@ -82,15 +86,15 @@ public class CPUChart extends TimelineChart { 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(); } @@ -115,6 +119,13 @@ public class CPUChart extends TimelineChart { public void inputChartSeries(List dataList) { appLoadSeries.clear(); totalLoadSeries.clear(); + + if (GlobalInformation.getCurrentDeviceInfo() == null) { + return; + } + int coreSize = GlobalInformation.getCurrentDeviceInfo().getTargetInfo() + .getCpuCount(); + Collection processSeries = childSeriesMap.values(); if (processSeries != null) { Iterator iter = processSeries.iterator(); @@ -127,9 +138,12 @@ public class CPUChart extends TimelineChart { List> systemData = (List>)dataList.get(TimelineConstants.SYSTEM_DB_DATA); @SuppressWarnings("unchecked") Map>> processDataMap = (Map>>)dataList.get(TimelineConstants.PROCESS_DB_DATA); + @SuppressWarnings("unchecked") + Map>> targetProcessDataMap = + (Map>>)dataList.get(TimelineConstants.TARGET_PROCESS_DB_DATA); /* - * Construct CPU Chart + * Make Total CPU Load Series */ for (int i = 0; i < systemData.size(); i++) { List row = systemData.get(i); @@ -137,18 +151,48 @@ public class CPUChart extends TimelineChart { / 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 iter = targetProcessDataMap.keySet().iterator(); + Map processLoadSumMap = new HashMap(); + while (iter.hasNext()) { + Integer pid = iter.next(); + List> data = targetProcessDataMap.get(pid); + for (int i = 0; i < data.size(); i++) { + List 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 timeSortedLoadList = new ArrayList(processLoadSumMap.keySet()); + Collections.sort(timeSortedLoadList); + + Iterator 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 */ @@ -192,7 +236,7 @@ public class CPUChart extends TimelineChart { }); } - Iterator iter = processDataMap.keySet().iterator(); + iter = processDataMap.keySet().iterator(); int prevChildSize = childSeriesMap.size(); while (iter.hasNext()) { Integer pid = iter.next(); @@ -201,7 +245,7 @@ public class CPUChart extends TimelineChart { List 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) { diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/DeviceChart.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/DeviceChart.java index fcd1185..922c8f7 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/DeviceChart.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/DeviceChart.java @@ -65,19 +65,19 @@ public class DeviceChart extends TimelineChart { 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 diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/DiskIOChart.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/DiskIOChart.java index 69724c3..545666b 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/DiskIOChart.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/DiskIOChart.java @@ -31,6 +31,7 @@ import java.util.List; 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; @@ -46,8 +47,13 @@ public class DiskIOChart extends TimelineChart { 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) { @@ -69,13 +75,21 @@ public class DiskIOChart extends TimelineChart { 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 @@ -84,10 +98,18 @@ public class DiskIOChart extends TimelineChart { 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; } @@ -95,7 +117,9 @@ public class DiskIOChart extends TimelineChart { @Override public void inputChartSeries(List dataList) { readSeries.clear(); + readSectorSeries.clear(); writeSeries.clear(); + writeSectorSeries.clear(); @SuppressWarnings("unchecked") List> data = (List>)dataList.get(TimelineConstants.SYSTEM_DB_DATA); @@ -105,12 +129,35 @@ public class DiskIOChart extends TimelineChart { 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); } } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/DiskIOChartRenderer.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/DiskIOChartRenderer.java new file mode 100644 index 0000000..cf9189e --- /dev/null +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/DiskIOChartRenderer.java @@ -0,0 +1,294 @@ +/* + * Dynamic Analyzer + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Jungwook Ryu + * Juyoung Kim + * + * 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 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 tooltipTexts = new ArrayList(); + List tooltipTimes = new ArrayList(); + List tooltipColor = new ArrayList(); + + // 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); + } + } +} diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/EnergyChart.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/EnergyChart.java index 87b31a9..4751c72 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/EnergyChart.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/EnergyChart.java @@ -6,7 +6,6 @@ import java.util.ArrayList; 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; @@ -39,7 +38,6 @@ public class EnergyChart extends TimelineChart { private List deviceUsageSeriesList; private List deviceUsagePerAppSeriesList; - private boolean isInitialized = false; private DAChartBoardItem appUsageItem; public static EnergyChart getInstance() { @@ -69,8 +67,6 @@ public class EnergyChart extends TimelineChart { 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); @@ -112,10 +108,12 @@ public class EnergyChart extends TimelineChart { } try { - if (!isInitialized) { + if (chart.getSeriesList().isEmpty()) { if (GlobalInformation.getCurrentDeviceInfo() == null) { return; } + chart.addSeries(energyUsageSeries); + String[] deviceList = GlobalInformation.getCurrentDeviceInfo().getTargetInfo().getDevices() .split(CommonConstants.COMMA); @@ -132,8 +130,6 @@ public class EnergyChart extends TimelineChart { for (DAChartSeries series : deviceUsagePerAppSeriesList) { appUsageItem.getChart().addSeries(series); } - - isInitialized = true; } @SuppressWarnings("unchecked") @@ -141,6 +137,10 @@ public class EnergyChart extends TimelineChart { @SuppressWarnings("unchecked") List> energyData = (List>) dataList.get(TimelineConstants.ENERGY_DB_DATA); + if (energyData.size() != deviceUsageSeriesList.size()) { + return; + } + for (int i = 0; i < systemData.size(); i++) { List row = systemData.get(i); double time = @@ -162,6 +162,7 @@ public class EnergyChart extends TimelineChart { for (int i = 0; i < energyData.size(); i++) { List 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 oneTime = (List) row.get(ii); @@ -177,8 +178,8 @@ public class EnergyChart extends TimelineChart { 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)); } } @@ -186,13 +187,11 @@ public class EnergyChart extends TimelineChart { 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 diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/FileChart.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/FileChart.java deleted file mode 100644 index 3b0ef41..0000000 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/FileChart.java +++ /dev/null @@ -1,274 +0,0 @@ -/* - * Dynamic Analyzer - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: - * Jungwook Ryu - * Sanghyun Lee - * Juyoung Kim - * - * 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 deviceLogTimeList = new ArrayList(); - private Map fdCountSeriesItemIndexMap = new HashMap(); - private Map deviceTimeIndexMap = new HashMap(); - private List fileDataQ = new ArrayList(); - - 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 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; - } -} diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/HeapChart.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/HeapChart.java index 1dd47d7..5c72fac 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/HeapChart.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/HeapChart.java @@ -27,98 +27,197 @@ 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 allocationSeriesDataSetMap = new HashMap(); + private final int TOTAL_ALLOC = 0; + private final int USER_ALLOC = 1; + + private Map> seriesPerProcessMap = + new HashMap>(); + private DAChartBoardItem parentBoardItem; + private List childBoardItemList = new ArrayList(); 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 createChartSeries() { + List chartSeriesList = new ArrayList(); + + 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 dataList) { - totalAllocationSeries.clear(); - userAllocationSeries.clear(); - - @SuppressWarnings("unchecked") - List> data = (List>) dataList.get(0); - - for (int i = 0; i < data.size(); i++) { - List 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> iterSeries = seriesPerProcessMap.values().iterator(); + while (iterSeries.hasNext()) { + List seriesList = iterSeries.next(); + for (int i = 0; i < seriesList.size(); i++) { + seriesList.get(i).clear(); + } } + + if (AnalyzerManager.getProject() == null) { + return; + } + @SuppressWarnings("unchecked") + Map>> processDataMap = + (Map>>)dataList.get(TimelineConstants.TARGET_PROCESS_DB_DATA); + + Iterator iterProcessData = processDataMap.keySet().iterator(); + while (iterProcessData.hasNext()) { + final Integer pid = iterProcessData.next(); + /* + * First process, use parentBoardItem. + */ + if (seriesPerProcessMap.isEmpty()) { + List 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 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 seriesList = seriesPerProcessMap.get(pid); + List> data = processDataMap.get(pid); + for (int i = 0; i < data.size(); i++) { + List 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(); + } } } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/NetworkIOChart.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/NetworkIOChart.java index ab7eaa1..d1762f7 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/NetworkIOChart.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/NetworkIOChart.java @@ -69,11 +69,11 @@ public class NetworkIOChart extends TimelineChart { 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 diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/ProcessMemoryChart.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/ProcessMemoryChart.java index 0114b07..a64f2c9 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/ProcessMemoryChart.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/ProcessMemoryChart.java @@ -27,95 +27,210 @@ 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> seriesPerProcessMap = + new HashMap>(); + private DAChartBoardItem parentBoardItem; + private List childBoardItemList = new ArrayList(); + 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 createChartSeries() { + List chartSeriesList = new ArrayList(); + + 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 dataList) { - VSSMemorySeries.clear(); - RSSMemorySeries.clear(); - PSSMemorySeries.clear(); - - @SuppressWarnings("unchecked") - List> data = (List>)dataList.get(TimelineConstants.SYSTEM_DB_DATA); - + /* + * Clear series items + */ + Iterator> iterSeries = seriesPerProcessMap.values().iterator(); + while (iterSeries.hasNext()) { + List seriesList = iterSeries.next(); + for (int i = 0; i < seriesList.size(); i++) { + seriesList.get(i).clear(); + } + } + + if (AnalyzerManager.getProject() == null) { + return; + } + @SuppressWarnings("unchecked") + Map>> processDataMap = + (Map>>)dataList.get(TimelineConstants.TARGET_PROCESS_DB_DATA); + + Iterator iterProcessData = processDataMap.keySet().iterator(); + while (iterProcessData.hasNext()) { + final Integer pid = iterProcessData.next(); + /* + * First process, use parentBoardItem. + */ + if (seriesPerProcessMap.isEmpty()) { + List 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 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 seriesList = seriesPerProcessMap.get(pid); + List> data = processDataMap.get(pid); for (int i = 0; i < data.size(); i++) { - List 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 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 diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/SystemMemoryChart.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/SystemMemoryChart.java index ccc14db..776f364 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/SystemMemoryChart.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/SystemMemoryChart.java @@ -27,13 +27,20 @@ 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; @@ -99,23 +106,69 @@ public class SystemMemoryChart extends TimelineChart { systemSeries.clear(); totalSeries.clear(); + if (GlobalInformation.getCurrentDeviceInfo() == null) { + return; + } + + long systemMemorySize = GlobalInformation.getCurrentDeviceInfo().getTargetInfo().getSystemMemorySize(); + @SuppressWarnings("unchecked") - List> data = (List>)dataList.get(0); + List> systemData = (List>)dataList.get(TimelineConstants.SYSTEM_DB_DATA); + @SuppressWarnings("unchecked") + Map>> targetProcessDataMap = + (Map>>)dataList.get(TimelineConstants.TARGET_PROCESS_DB_DATA); - for (int i = 0; i < data.size(); i++) { - List 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 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 iter = targetProcessDataMap.keySet().iterator(); + Map processLoadSumMap = new HashMap(); + while (iter.hasNext()) { + Integer pid = iter.next(); + List> data = targetProcessDataMap.get(pid); + for (int i = 0; i < data.size(); i++) { + List 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 timeSortedLoadList = new ArrayList(processLoadSumMap.keySet()); + Collections.sort(timeSortedLoadList); + Iterator 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))); + } + } } } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/common/TimelineChartManager.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/common/TimelineChartManager.java index 74f4d15..a73f088 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/common/TimelineChartManager.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/common/TimelineChartManager.java @@ -45,6 +45,7 @@ import org.tizen.dynamicanalyzer.swap.logparser.Logs; 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; @@ -62,6 +63,8 @@ import org.tizen.dynamicanalyzer.ui.timeline.ScreenShotDBInserter; 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; @@ -70,7 +73,6 @@ import org.tizen.dynamicanalyzer.ui.timeline.chart.CPUFrequencyChart; 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; @@ -112,12 +114,14 @@ public class TimelineChartManager extends PageDataManager implements IDAChartSer 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 allocByteMap = new HashMap(); // Map private HashMap allocationSeriesDataSetMap = new HashMap(); public static TimelineChartManager getInstance() { @@ -144,6 +148,7 @@ public class TimelineChartManager extends PageDataManager implements IDAChartSer uiEventDBTable = new UIEventDBTable(); screenShotDBTable = new ScreenShotDBTable(); customDataDBTable = new CustomDataDBTable(); + targetProcessDBTable = new TargetProcessDBTable(); addDBTable(systemDataTable); addDBTable(cpuDBTable); addDBTable(processLoadDBTable); @@ -151,6 +156,7 @@ public class TimelineChartManager extends PageDataManager implements IDAChartSer addDBTable(uiEventDBTable); addDBTable(screenShotDBTable); addDBTable(customDataDBTable); + addDBTable(targetProcessDBTable); initChartMap(CPUChart.getInstance()); initChartMap(CPUCoreChart.getInstance()); @@ -158,7 +164,6 @@ public class TimelineChartManager extends PageDataManager implements IDAChartSer initChartMap(HeapChart.getInstance()); initChartMap(ProcessMemoryChart.getInstance()); initChartMap(SystemMemoryChart.getInstance()); - initChartMap(FileChart.getInstance()); initChartMap(ScreenshotChart.getInstance()); initChartMap(UIEventChart.getInstance()); initChartMap(DiskIOChart.getInstance()); @@ -347,7 +352,7 @@ public class TimelineChartManager extends PageDataManager implements IDAChartSer customChartMap.clear(); customLogParser.clear(); - allocByte = 0; + allocByteMap.clear(); allocationSeriesDataSetMap.clear(); } @@ -361,6 +366,10 @@ public class TimelineChartManager extends PageDataManager implements IDAChartSer 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(); @@ -378,8 +387,9 @@ public class TimelineChartManager extends PageDataManager implements IDAChartSer if (systemLogList != null) { ArrayList> systemDataList = new ArrayList>(); ArrayList> cpuDataList = new ArrayList>(); - ArrayList> processDataList = new ArrayList>(); + ArrayList> otherProcessDataList = new ArrayList>(); ArrayList> energyDataList = new ArrayList>(); + ArrayList> targetProcessDataList = new ArrayList>(); int size = systemLogList.size(); for (int i = 0; i < size; i++) { SystemData log = (SystemData) systemLogList.get(i); @@ -407,16 +417,9 @@ public class TimelineChartManager extends PageDataManager implements IDAChartSer double systemAvgCPULoad = cpuLoadSum / coreSize; ArrayList dbSystemData = new ArrayList(); 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())); @@ -426,7 +429,7 @@ public class TimelineChartManager extends PageDataManager implements IDAChartSer 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())); @@ -436,16 +439,15 @@ public class TimelineChartManager extends PageDataManager implements IDAChartSer 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()) { @@ -457,7 +459,35 @@ public class TimelineChartManager extends PageDataManager implements IDAChartSer 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 dbTargetProcessData = new ArrayList(); + 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); + } } /* @@ -482,10 +512,12 @@ public class TimelineChartManager extends PageDataManager implements IDAChartSer 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(); } } @@ -544,10 +576,11 @@ public class TimelineChartManager extends PageDataManager implements IDAChartSer 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; @@ -556,8 +589,7 @@ public class TimelineChartManager extends PageDataManager implements IDAChartSer 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(); @@ -567,8 +599,7 @@ public class TimelineChartManager extends PageDataManager implements IDAChartSer return; } size = allocationSeriesDataSetMap.get(address); - - allocByte -= size; + allocByteMap.put(log.getPid(), allocByte - size); } } @@ -600,6 +631,10 @@ public class TimelineChartManager extends PageDataManager implements IDAChartSer return customDataDBTable; } + public DBTable getTargetProcessTable() { + return targetProcessDBTable; + } + public List> getSystemDataFromDB(long start, long end) { String where = "where TIME BETWEEN " + start + " AND " + end + " ORDER BY " @@ -720,6 +755,31 @@ public class TimelineChartManager extends PageDataManager implements IDAChartSer return new ArrayList>(); } } + + public Map>> getTargetProcessDataFromDB(long start, long end) { + Map>> processedResult = + new HashMap>>(); + + String where = + "where TIME BETWEEN " + start + " AND " + end + " ORDER BY " + + TargetProcessDBTable.TIME; + List> queryResult = targetProcessDBTable.selectData(null, where); + if (queryResult == null) { + return processedResult; + } + + for (int i = 0; i < queryResult.size(); i++) { + List row = queryResult.get(i); + Integer pid = (Integer) row.get(TargetProcessDBTable.COLUMN.PID.ordinal()); + List> processData = processedResult.get(pid); + if (processData == null) { + processData = new ArrayList>(); + processedResult.put(pid, processData); + } + processData.add(row); + } + return processedResult; + } @Override public void makeChartSeries(long startTime, long endTime) { @@ -733,6 +793,7 @@ public class TimelineChartManager extends PageDataManager implements IDAChartSer List> uiEventDBData = getUIEventDataFromDB(startTime, endTime); List> screenShotDBData = getScreenShotDataFromDB(startTime, endTime); List> customDBData = getCustomDataFromDB(startTime, endTime); + Map>> targetProcessDBData = getTargetProcessDataFromDB(startTime, endTime); /* * 2. Make series of chart @@ -744,6 +805,7 @@ public class TimelineChartManager extends PageDataManager implements IDAChartSer dataList.add(cpuDBData); dataList.add(processDBData); dataList.add(energyDBData); + dataList.add(targetProcessDBData); chart.inputChartSeries(dataList); } else if (chart.getProbeType() == DataChannelConstants.MSG_PROBE_UIEVENT) { List dataList = new ArrayList(); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/common/TimelineConstants.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/common/TimelineConstants.java index 38aafce..9b94168 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/common/TimelineConstants.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/common/TimelineConstants.java @@ -56,6 +56,7 @@ public class TimelineConstants { 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 } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/ConfigureManager.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/ConfigureManager.java index 663425e..fec8f84 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/ConfigureManager.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/ConfigureManager.java @@ -139,10 +139,14 @@ public class ConfigureManager { 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, @@ -486,14 +490,6 @@ public class ConfigureManager { 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); @@ -507,6 +503,15 @@ public class ConfigureManager { 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; } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/ToolbarArea.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/ToolbarArea.java index 7c8417e..c98babd 100755 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/ToolbarArea.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/ToolbarArea.java @@ -313,8 +313,7 @@ public class ToolbarArea { processCombo.add(ALL_PROCESS); List processInfoPkgList = new ArrayList(); - processInfoPkgList.addAll(project.getProcessInfoPackHash() - .values()); + processInfoPkgList.addAll(project.getProcessInfoPackHash().values()); for (ProcessInfoPackage pkg : processInfoPkgList) { // String pid = Integer.toString(pkg.getPid()); String binName = CommonConstants.EMPTY; diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/ConfigurationDialogDataManager.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/ConfigurationDialogDataManager.java index e03fee2..6af8b99 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/ConfigurationDialogDataManager.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/ConfigurationDialogDataManager.java @@ -48,7 +48,7 @@ import org.tizen.dynamicanalyzer.widgets.da.base.DAMessageBox; public class ConfigurationDialogDataManager { private static final DALogger DA_LOG = DALogger.getInstance(); - + private static ConfigurationDialogDataManager instance = null; private DAMessageBox configDlg = null; @@ -64,9 +64,9 @@ public class ConfigurationDialogDataManager { 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, @@ -78,7 +78,7 @@ public class ConfigurationDialogDataManager { 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, @@ -95,7 +95,7 @@ public class ConfigurationDialogDataManager { 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, @@ -172,6 +172,8 @@ public class ConfigurationDialogDataManager { || 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) @@ -189,8 +191,9 @@ public class ConfigurationDialogDataManager { } 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 { @@ -211,6 +214,8 @@ public class ConfigurationDialogDataManager { || 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) @@ -233,9 +238,14 @@ public class ConfigurationDialogDataManager { 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)) { @@ -274,7 +284,11 @@ public class ConfigurationDialogDataManager { 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 @@ -298,9 +312,9 @@ public class ConfigurationDialogDataManager { } 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; @@ -324,6 +338,12 @@ public class ConfigurationDialogDataManager { } 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() { @@ -395,6 +415,9 @@ public class ConfigurationDialogDataManager { 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 @@ -568,7 +591,8 @@ public class ConfigurationDialogDataManager { 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 { diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/ConfigurationDialogFeaturesPage.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/ConfigurationDialogFeaturesPage.java index 6b42297..abc02ae 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/ConfigurationDialogFeaturesPage.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/ConfigurationDialogFeaturesPage.java @@ -355,6 +355,8 @@ public class ConfigurationDialogFeaturesPage extends DAPageComposite { || 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) @@ -562,6 +564,8 @@ public class ConfigurationDialogFeaturesPage extends DAPageComposite { .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) @@ -580,6 +584,8 @@ public class ConfigurationDialogFeaturesPage extends DAPageComposite { .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)) { diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/utils/AnalyzerUtil.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/utils/AnalyzerUtil.java index 34850cd..68fe34f 100755 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/utils/AnalyzerUtil.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/utils/AnalyzerUtil.java @@ -479,4 +479,31 @@ public class AnalyzerUtil { public static long translateSecToMicroSec(double sec) { return (long)(sec * 1000000.0); } + + public static String getProcessName(int pid) { + List processInfoPkgList = new ArrayList(); + + 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; + } } -- 2.7.4