[Title] CPU graph and Process graph bug fix
authorjy.exe.lee <jy.exe.lee@samsung.com>
Mon, 16 Jul 2012 09:23:15 +0000 (18:23 +0900)
committerjy.exe.lee <jy.exe.lee@samsung.com>
Mon, 16 Jul 2012 09:23:15 +0000 (18:23 +0900)
[Type] bug fix
[Module] DynamicAnalyzer
[Priority] major
[CQ#]
[Redmine#]
[Problem]
[Cause]
[Solution]
[TestCase]

org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/views/SnapshotView.java

index 13d5c8c..0f0372b 100644 (file)
@@ -32,6 +32,7 @@ import org.tizen.dynamicanalyzer.ui.widgets.imageViewer.ImageViewer;
 import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
 import org.tizen.dynamicanalyzer.utils.Formatter;
 import org.tizen.dynamicanalyzer.widgets.graph.bar.FourBarGraph;
+import org.tizen.dynamicanalyzer.widgets.graph.circular.CircularGraph;
 
 public class SnapshotView extends DAView {
 
@@ -40,9 +41,9 @@ public class SnapshotView extends DAView {
        Composite iconComp;
        ImageViewer snapshot;
        // CircularGraph cpuGrp;
-       // CircularGraph processGraph;
+        CircularGraph processGraph;
        FourBarGraph cpuGrp;
-       FourBarGraph processGraph;
+//     FourBarGraph processGraph;
        CurrentTable table;
        boolean test = true;
        private String[] gpsTooltip = {
@@ -68,8 +69,8 @@ public class SnapshotView extends DAView {
        private static List<Long> cpuUsage;
        private static long maxCpuUsage = 100;
        private static long maxMem = 100;
-       // private static long processMem = 0;
-       private static List<Long> processMem;
+        private static long processMem = 0;
+//     private static List<Long> processMem;
 
        private long startTime = 0;
        // private long endTime = 0;
@@ -230,9 +231,9 @@ public class SnapshotView extends DAView {
                cpuUsage = new ArrayList<Long>();
 
                // process graph
-               // processGraph = new CircularGraph(graphComp, SWT.NONE,
-               // CircularGraph.TYPE_CUSTOM);
-               processGraph = new FourBarGraph(graphComp, SWT.NONE, FourBarGraph.TYPE_BYTE);
+                processGraph = new CircularGraph(graphComp, SWT.NONE,
+                CircularGraph.TYPE_CUSTOM);
+//             processGraph = new FourBarGraph(graphComp, SWT.NONE, FourBarGraph.TYPE_BYTE);
                data = new FormData();
                data.top = new FormAttachment(cpuGrp, 5);
                data.left = new FormAttachment(0, 0);
@@ -240,17 +241,17 @@ public class SnapshotView extends DAView {
                // data.bottom = new FormAttachment(100, 0);
                data.height = 95;
                processGraph.setLayoutData(data);
-               processGraph.setBgColor(ColorResources.PROCESS_BAR_GRAPH_BG_COLOR);
-               processGraph.setTextBgColor(ColorResources.VIEW_BG_COLOR);
-               processGraph.setGraphColor(ColorResources.PROCESS_BAR_GRAPH_COLOR,
-                               ColorResources.PROCESS_BAR_GRAPH_GRAY_COLOR,
-                               ColorResources.PROCESS_BAR_GRAPH_COLOR);
-               // processGraph.setMeasure(InformationViewLables.SNAPSHOT_VIEW_BYTE);
-               // processGraph.setGraphColor(ColorResources.PROCESS_CIRCULAR_GRAPH_COLOR);
-               // processGraph.update(maxMem, processMem);
+//             processGraph.setBgColor(ColorResources.PROCESS_BAR_GRAPH_BG_COLOR);
+//             processGraph.setTextBgColor(ColorResources.VIEW_BG_COLOR);
+//             processGraph.setGraphColor(ColorResources.PROCESS_BAR_GRAPH_COLOR,
+//                             ColorResources.PROCESS_BAR_GRAPH_GRAY_COLOR,
+//                             ColorResources.PROCESS_BAR_GRAPH_COLOR);
+                processGraph.setMeasure(InformationViewLables.SNAPSHOT_VIEW_BYTE);
+                processGraph.setGraphColor(ColorResources.PROCESS_BAR_GRAPH_COLOR);
+                processGraph.update(maxMem, processMem);
                processGraph.setTextColor(ColorResources.PROCESS_BAR_GRAPH_COLOR);
                processGraph.setText(InformationViewLables.SNAPSHOT_VIEW_PROCESS);
-               processMem = new ArrayList<Long>();
+//             processMem = new ArrayList<Long>();
 
                // table
                Composite tableComp = new Composite(innerComp, SWT.NONE);
@@ -344,8 +345,9 @@ public class SnapshotView extends DAView {
                time = input.get(LogCenterConstants.TIME_INDEX + 1);
                // cpuUsage = cpus;
                maxMem = totalMem;
-               processMem.clear();
-               processMem.add(Long.parseLong(virtualMem));
+//             processMem.clear();
+//             processMem.add(Long.parseLong(virtualMem));
+               processMem = Long.parseLong(virtualMem);
 
                gpsState = Integer.parseInt(input
                                .get(LogCenterConstants.DEVICE_GPS_INDEX + 1));
@@ -378,11 +380,11 @@ public class SnapshotView extends DAView {
                                                + InformationViewLables.SNAPSHOT_VIEW_MB;
                                table.update(heap, threadCount, brightness);
                                // cpuGrp.update(100, cpuUsage);
-                               // processGraph.update(maxMem, processMem);
+                                processGraph.update(maxMem, processMem);
                                cpuGrp.setMaxSize(maxCpuUsage);
                                cpuGrp.setCurrentValue(cpuUsage);
-                               processGraph.setMaxSize(maxMem);
-                               processGraph.setCurrentValue(processMem);
+//                             processGraph.setMaxSize(maxMem);
+//                             processGraph.setCurrentValue(processMem);
                                snapshot.drawSnapshot(time);
                                updateIcon();
                        }
@@ -403,7 +405,7 @@ public class SnapshotView extends DAView {
                                LogCenterConstants.DEVICE_SYSTEM_CPU_USAGE_INDEX).split(",");
 //             String cpu = cpuRates[cpuRates.length - 1].trim();
                cpuUsage.clear();
-               for (int i = 0; i < cpuRates.length; i++) {
+               for (int i = 0; i < cpuRates.length - 1; i++) {
                        String cpu = cpuRates[i].trim();
                        long value = (long) Float.parseFloat(cpu);
                        cpuUsage.add(value);
@@ -436,9 +438,9 @@ public class SnapshotView extends DAView {
                time = input.get(LogCenterConstants.TIME_INDEX);
 //             cpuUsage = (long) Float.parseFloat(cpu);
                maxMem = totalMem;
-//             processMem = Long.parseLong(virtualMem);
-               processMem.clear();
-               processMem.add(Long.parseLong(virtualMem));
+               processMem = Long.parseLong(virtualMem);
+//             processMem.clear();
+//             processMem.add(Long.parseLong(virtualMem));
 
                gpsState = Integer.parseInt(input
                                .get(LogCenterConstants.DEVICE_GPS_INDEX));
@@ -460,8 +462,8 @@ public class SnapshotView extends DAView {
                cpuUsage.clear();
                maxCpuUsage = 100;
                maxMem = 100;
-               // processMem = 0;
-               processMem.clear();
+                processMem = 0;
+//             processMem.clear();
                gpsState = 0;
                wifiState = 0;
                bluetoothState = 0;