org.tizen.dynamicanalyzer.widgets.chart,
org.tizen.dynamicanalyzer.widgets.chartBoard,
org.tizen.dynamicanalyzer.widgets.combo,
- org.tizen.dynamicanalyzer.widgets.graph.bar,
org.tizen.dynamicanalyzer.widgets.contextMenu,
+ org.tizen.dynamicanalyzer.widgets.graph.bar,
org.tizen.dynamicanalyzer.widgets.graph.circular,
org.tizen.dynamicanalyzer.widgets.helper,
org.tizen.dynamicanalyzer.widgets.lifecycle,
+ org.tizen.dynamicanalyzer.widgets.popupMenu,
org.tizen.dynamicanalyzer.widgets.progress,
org.tizen.dynamicanalyzer.widgets.scale,
org.tizen.dynamicanalyzer.widgets.timeline,
public static Color CONTEXT_MENU_STORKE_IN = getColor("context_menu_storke_in", new RGB(50, 185, 231)); //$NON-NLS-1$\r
\r
\r
+ /*** popup menu colors ***/\r
+ public static Color POPUP_MENU_TEXT_NORMAL = getColor("popup_menu_text_normal", new RGB(0, 0, 0)); //$NON-NLS-1$\r
+ public static Color POPUP_MENU_TEXT_SELECTED = getColor("popup_menu_text_selected", new RGB(255, 255, 255)); //$NON-NLS-1$\r
+ public static Color POPUP_MENU_TEXT_DISABLED = getColor("popup_menu_text_disabled", new RGB(189, 189, 189)); //$NON-NLS-1$\r
+ \r
+ public static Color POPUP_MENU_ITEM_NORMAL = getColor("popup_menu_item_normal", new RGB(230, 230, 230)); //$NON-NLS-1$);\r
+ public static Color POPUP_MENU_ITEM_SELECTED = getColor("popup_menu_item_selected", new RGB(50, 185, 231)); //$NON-NLS-1$\r
+\r
+ public static Color POPUP_MENU_SEPARATOR1 = getColor("popup_menu_separator1", new RGB(189, 189, 189)); //$NON-NLS-1$\r
+ public static Color POPUP_MENU_SEPARATOR2 = getColor("popup_menu_separator2", new RGB(255, 255, 255)); //$NON-NLS-1$\r
+ \r
+ public static Color POPUP_MENU_OUTLINE_STORKE1 = getColor("popup_menu_outline_stroke1", new RGB(145, 145, 145)); //$NON-NLS-1$\r
+ public static Color POPUP_MENU_OUTLINE_STORKE2 = getColor("popup_menu_outline_stroke2", new RGB(255, 255, 255)); //$NON-NLS-1$\r
+ \r
+ \r
//\r
// /** device and application combo specific colors start **/\r
// public static final Color DEVICE_APPLICATION_ENABLE = WHITE;\r
--- /dev/null
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * yeongtaik byeon <yeongtaik.byeon@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.dynamicanalyzer.widgets.popupMenu;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Timer;
+import java.util.TimerTask;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.events.ShellEvent;
+import org.eclipse.swt.events.ShellListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Drawable;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
+import org.tizen.dynamicanalyzer.widgets.helper.ColorResources;
+import org.tizen.dynamicanalyzer.widgets.helper.ImageResources;
+
+public class DAPopupMenu {
+ private Composite parent;
+ private DAPopupMenuItem parentItem;
+ private static Shell topShell;
+ private Shell shell;
+ private DAPopupMenu childMenu;
+ private List<DAPopupMenuItem> children;
+ private Font itemFont; // FIXME
+
+ private static final int MOUSE_LEFT = 1;
+ private static final int MOUSE_RIGHT = 3;
+
+ private Point contextMenuPoint = null;
+ private int contextMenuHeight = 0;
+ private int contextMenuWidth = 0;
+ private Timer checkEnableTimer = null;
+ private static final int STAUES_ITEMS_CHECK_TIME = 500;
+
+ public DAPopupMenu(Composite parent) {
+ this.parent = parent;
+
+ parent.getShell().addShellListener(new ShellListener() {
+
+ @Override
+ public void shellIconified(ShellEvent e) {
+ closeChild();
+ }
+
+ @Override
+ public void shellDeiconified(ShellEvent e) {
+ }
+
+ @Override
+ public void shellDeactivated(ShellEvent e) {
+ }
+
+ @Override
+ public void shellClosed(ShellEvent e) {
+ closeChild();
+ }
+
+ @Override
+ public void shellActivated(ShellEvent e) {
+ }
+ });
+
+ parent.addMouseListener(new MouseListener() {
+ @Override
+ public void mouseUp(MouseEvent e) {
+ switch (e.button) {
+ case 1:
+ break;
+ case 2:
+ break;
+ case 3:
+ Point pt = Display.getCurrent().getCursorLocation();
+
+ if (true == isInParent(pt)) {
+ open(topShell, pt.x - 5, pt.y - 5);
+ }
+ break;
+ }
+ }
+
+ @Override
+ public void mouseDown(MouseEvent event) {
+ // TODO Auto-generated method stub
+ switch (event.button) {
+ case MOUSE_LEFT: {
+ closeParent();
+ break;
+ }
+ case MOUSE_RIGHT: {
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ }
+
+ @Override
+ public void mouseDoubleClick(MouseEvent e) {
+ // TODO Auto-generated method stub
+ }
+ });
+ }
+
+ private void disposeContextMenu() {
+ Point pt = Display.getCurrent().getCursorLocation();
+ if (isInParent(pt) == false && isOverContextMenu() == false) {
+ closeChild();
+ }
+ }
+
+ private void disposeContextMenuTimer(int milliseconds) {
+ this.checkEnableTimer = new Timer();
+ this.checkEnableTimer.schedule(new TimerTask() {
+ public void run() {
+ Display.getDefault().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ disposeContextMenu();
+ }
+ });
+ }
+ }, milliseconds, milliseconds);
+ }
+
+ private boolean isOverContextMenu() {
+ if (null == contextMenuPoint) {
+ return false;
+ }
+ Point pt = Display.getCurrent().getCursorLocation();
+ if ((contextMenuPoint.x <= pt.x && pt.x <= (contextMenuPoint.x + contextMenuWidth))
+ && (contextMenuPoint.y <= pt.y && pt.y <= contextMenuPoint.y
+ + contextMenuHeight)) {
+ return true;
+
+ }
+ return false;
+ }
+
+ private boolean isInParent(Point pt) {
+ if (null == parent) {
+ return false;
+ }
+ Point parentSize = parent.getSize();
+ Point parentPt = parent.getLocation();
+ Composite comp = parent.getParent();
+
+ while (comp != null) {
+ parentPt.x += comp.getLocation().x;
+ parentPt.y += comp.getLocation().y;
+ comp = comp.getParent();
+ }
+
+ if (pt.x < parentPt.x || pt.x > parentPt.x + parentSize.x) {
+ return false;
+ }
+
+ return true;
+ }
+
+ private Point getPopupPosition(int x, int y, int width, int height) {
+ Rectangle rt = Display.getCurrent().getBounds();
+ Point ret = new Point(x, y);
+
+ if (x + width > rt.width) {
+ ret.x -= (x + width - rt.width);
+ }
+ if (y + height > rt.height) {
+ ret.y -= (y + height - rt.height);
+ }
+ return ret;
+ }
+
+ public DAPopupMenu(DAPopupMenuItem parent) {
+ this.parentItem = parent;
+ if (null != parent) {
+ parent.setChild(this);
+ }
+ }
+
+ private boolean makeItem(Shell shell, int x, int y) {
+ if (null == children) {
+ return false;
+ }
+
+ shell.setLayout(new FormLayout());
+ int childSize = children.size();
+ int itemHeight = 0;
+ int itemWidth = 0;
+ // int iconWidth = ICONWIDTH;
+ DAPopupMenuItem child;
+ DACustomButton oldItem = null;
+ DACustomButton newItem = null;
+
+ FormData data;
+
+ for (int i = 0; i < childSize; i++) {
+ child = children.get(i);
+ if (null == child) {
+ return false;
+ }
+
+ oldItem = newItem;
+ data = new FormData();
+ if (null == oldItem) {
+ data.top = new FormAttachment(0,
+ DAPopupMenuItemButtonRenderer.MARGIN);
+ } else {
+ data.top = new FormAttachment(oldItem, 0);
+ }
+
+ if (DAPopupMenuItem.SEPARATOR == child.getType()) {
+ newItem = new DACustomButton(shell, SWT.NONE);
+ newItem.setRenderer(new DAPopupMenuItemButtonRenderer());
+ newItem.setColors(ColorResources.POPUP_MENU_SEPARATOR1,
+ ColorResources.POPUP_MENU_SEPARATOR1,
+ ColorResources.POPUP_MENU_SEPARATOR1,
+ ColorResources.POPUP_MENU_SEPARATOR1);
+ newItem.setButtonEnabled(false);
+ data.height = DAPopupMenuItemButtonRenderer.MARGIN;
+ itemHeight += DAPopupMenuItemButtonRenderer.MARGIN;
+ } else {
+ newItem = new DACustomButton(shell, child.getText());
+ newItem.setRenderer(new DAPopupMenuItemButtonRenderer());
+ newItem.setColors(ColorResources.POPUP_MENU_ITEM_NORMAL,
+ ColorResources.POPUP_MENU_ITEM_SELECTED,
+ ColorResources.POPUP_MENU_ITEM_SELECTED,
+ ColorResources.POPUP_MENU_ITEM_NORMAL);
+ newItem.setFontColors(ColorResources.POPUP_MENU_TEXT_NORMAL,
+ ColorResources.POPUP_MENU_TEXT_SELECTED,
+ ColorResources.POPUP_MENU_TEXT_SELECTED,
+ ColorResources.POPUP_MENU_TEXT_DISABLED);
+ if (itemFont != null) {
+ newItem.setFont(itemFont);
+ }
+ data.height = 24;
+ itemHeight += 24;
+ int width = getTextWidth(newItem, child.getText());
+ if (width > itemWidth) {
+ itemWidth = width;
+ }
+ if (DAPopupMenuItem.NONE == child.getType()) {
+ List<DAPopupMenuListener> listeners = child.getListeners();
+ for (int index = 0; index < listeners.size(); index++) {
+ newItem.addClickListener(listeners.get(index));
+ }
+
+ if (child.isEnabled() == false) {
+ newItem.setButtonEnabled(false);
+ }
+ } else {
+ newItem.setButtonImage(ImageResources.TREE_FOLD);
+ newItem.addListener(SWT.MouseHover, mouseListener);
+ }
+ Image icon = child.getIcon();
+ if (null != icon) {
+ newItem.setIcon(icon);
+ }
+
+ newItem.addListener(SWT.MouseUp, mouseListener);
+ }
+ newItem.addListener(SWT.MouseEnter, mouseListener);
+ child.setControl(newItem);
+ newItem.setData(child);
+ data.left = new FormAttachment(0,
+ DAPopupMenuItemButtonRenderer.MARGIN);
+ data.right = new FormAttachment(100,
+ -DAPopupMenuItemButtonRenderer.MARGIN);
+ newItem.setLayoutData(data);
+ }
+ shell.layout();
+ int popupWidth = itemWidth + DAPopupMenuItemButtonRenderer.MARGIN * 2
+ + DAPopupMenuItemButtonRenderer.TEXT_MARGIN
+ + DAPopupMenuItemButtonRenderer.DEFAULT_ICON_SIZE * 2;
+ int popupHeight = itemHeight + DAPopupMenuItemButtonRenderer.MARGIN * 2;
+
+ Point popupPt = getPopupPosition(x, y, popupWidth, popupHeight);
+
+ contextMenuPoint = popupPt;
+ contextMenuHeight = popupHeight;
+ contextMenuWidth = popupWidth;
+
+ shell.setBounds(popupPt.x, popupPt.y, popupWidth, popupHeight);
+ shell.addPaintListener(new PaintListener() {
+
+ @Override
+ public void paintControl(PaintEvent e) {
+ // TODO Auto-generated method stub
+ e.gc.setForeground(ColorResources.POPUP_MENU_OUTLINE_STORKE1);
+ e.gc.drawRectangle(0, 0, e.width - 1, e.height - 1);
+ e.gc.setForeground(ColorResources.POPUP_MENU_OUTLINE_STORKE2);
+ e.gc.drawRectangle(1, 1, e.width - 3, e.height - 3);
+ }
+
+ });
+ return true;
+ }
+
+ private int getTextWidth(Drawable drawable, String text) {
+ GC gc = new GC(drawable);
+ int nTextWidth = gc.textExtent(text).x;
+ gc.dispose();
+ return nTextWidth;
+ }
+
+ protected boolean open(Shell shell, int x, int y) {
+ if (null != shell) {
+ shell.dispose();
+ shell = null;
+ }
+ if (null != parent) {
+ topShell = new Shell(parent.getShell(), SWT.NO_TRIM);
+ this.shell = topShell;
+ } else if (null != parentItem) {
+ this.shell = new Shell(parentItem.getControl().getShell(),
+ SWT.NO_TRIM);
+ } else {
+ return false;
+ }
+ shell = this.shell;
+ if (false == makeItem(shell, x, y)) {
+ shell.dispose();
+ shell = null;
+ return false;
+ }
+ shell.addShellListener(new ShellListener() {
+
+ @Override
+ public void shellIconified(ShellEvent e) {
+ }
+
+ @Override
+ public void shellDeiconified(ShellEvent e) {
+ }
+
+ @Override
+ public void shellDeactivated(ShellEvent e) {
+ if (null == childMenu) {
+ Point pt = Display.getCurrent().getCursorLocation();
+
+ if (isInCursorOnMenu(pt) == false) {
+ closeParent();
+ }
+ }
+ }
+
+ @Override
+ public void shellClosed(ShellEvent e) {
+ }
+
+ @Override
+ public void shellActivated(ShellEvent e) {
+ }
+ });
+ shell.open();
+ if (checkEnableTimer != null) {
+ checkEnableTimer.cancel();
+ checkEnableTimer = null;
+ }
+ disposeContextMenuTimer(STAUES_ITEMS_CHECK_TIME);
+ return true;
+ }
+
+ protected boolean isInCursorOnShell(Shell shell) {
+ Rectangle rt = shell.getBounds();
+ Point pt = Display.getCurrent().getCursorLocation();
+
+ if (pt.x > rt.x && pt.x < rt.x + rt.width && pt.y > rt.y
+ && pt.y < rt.y + rt.height) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ protected boolean isInCursorOnMenu(Point pt) {
+
+ boolean ret = false;
+ Rectangle rt = shell.getBounds();
+ if (pt.x > rt.x && pt.x < rt.x + rt.width && pt.y > rt.y
+ && pt.y < rt.y + rt.height) {
+ return true;
+ } else {
+ ret = false;
+ }
+
+ if (null != parentItem) {
+ return parentItem.isInCursorInMenu(pt);
+ } else {
+ return ret;
+ }
+ }
+
+ private void close() {
+ if (null != shell) {
+ shell.dispose();
+ shell = null;
+ }
+ if (null != topShell) {
+ topShell.dispose();
+ topShell = null;
+ }
+ childMenu = null;
+ contextMenuPoint = null;
+ if (checkEnableTimer != null) {
+ checkEnableTimer.cancel();
+ checkEnableTimer = null;
+ }
+ }
+
+ protected void closeParent() {
+ close();
+ if (null != parentItem) {
+ parentItem.closeParent();
+ }
+ }
+
+ protected void closeChild() {
+ if (null != childMenu) {
+ childMenu.closeChild();
+ }
+ close();
+ }
+
+ protected void addChild(DAPopupMenuItem item) {
+ if (null == children) {
+ children = new ArrayList<DAPopupMenuItem>();
+ }
+ children.add(item);
+ }
+
+ protected void removeChild(DAPopupMenuItem item) {
+ if (null == children) {
+ return;
+ }
+ int childSize = children.size();
+ for (int i = 0; i < childSize; i++) {
+ if (item.equals(children.get(i))) {
+ children.remove(i);
+ return;
+ }
+ }
+ }
+
+ protected void removechild(int index) {
+ if (null == children || children.size() <= index) {
+ return;
+ }
+ children.remove(index);
+ }
+
+ public List<DAPopupMenuItem> getChildren() {
+ return children;
+ }
+
+ protected void setChildren(List<DAPopupMenuItem> children) {
+ this.children = children;
+ }
+
+ public DAPopupMenuItem getItem(int index) {
+ if (children == null || children.size() <= index) {
+ return null;
+ }
+ return children.get(index);
+ }
+
+ public List<DAPopupMenuItem> getItems() {
+ return children;
+ }
+
+ public DAPopupMenu getChildMenu() {
+ return childMenu;
+ }
+
+ public void setChildMenu(DAPopupMenu childMenu) {
+ if (null != this.childMenu) {
+ this.childMenu.close();
+ }
+ this.childMenu = childMenu;
+ }
+
+ public Composite getParent() {
+ return parent;
+ }
+
+ public DAPopupMenuItem getParentItem() {
+ return parentItem;
+ }
+
+ protected Shell getShell() {
+ return shell;
+ }
+
+ protected Shell getTopShell() {
+ return topShell;
+ }
+
+ private void itemNormalColorChange(DACustomButton button, Color background,
+ Color text) {
+ if (null == button) {
+ return;
+ }
+ button.setColor(DACustomButton.STATE_NORMAL, background);
+ button.setFontColor(DACustomButton.STATE_NORMAL, text);
+ }
+
+ private void closeChildMenu(DAPopupMenuItem item, DAPopupMenu menu) {
+ if (null != childMenu) {
+ DAPopupMenuItem oldItem = childMenu.getParentItem();
+ if (null != oldItem) {
+ itemNormalColorChange(oldItem.getControl(),
+ ColorResources.POPUP_MENU_ITEM_NORMAL,
+ ColorResources.POPUP_MENU_TEXT_NORMAL);
+ }
+ }
+ item.closeParentsChildMenu();
+ }
+
+ public void setFont(Font font) {
+ this.itemFont = font;
+ }
+
+ public Font getFont() {
+ return itemFont;
+ }
+
+ private Listener mouseListener = new Listener() {
+
+ @Override
+ public void handleEvent(Event event) {
+ int eventType = event.type;
+ Object obj = event.widget;
+ if (!(obj instanceof DACustomButton)) {
+ return;
+ }
+
+ DACustomButton button = (DACustomButton) obj;
+ obj = button.getData();
+ if (!(obj instanceof DAPopupMenuItem)) {
+ return;
+ }
+ DAPopupMenuItem item = (DAPopupMenuItem) obj;
+ DAPopupMenu menu = item.getChild();
+ switch (eventType) {
+ case SWT.MouseEnter:
+ if (null != menu && menu.equals(childMenu)) {
+ return;
+ }
+ closeChildMenu(item, menu);
+ break;
+ case SWT.MouseHover:
+ if (null != childMenu) {
+ return;
+ }
+ if (null != item.open()) {
+ itemNormalColorChange(button,
+ ColorResources.POPUP_MENU_ITEM_SELECTED,
+ ColorResources.POPUP_MENU_TEXT_SELECTED);
+ }
+ break;
+ case SWT.MouseUp:
+ int itemType = item.getType();
+ if (itemType == DAPopupMenuItem.NONE) {
+ if (item.isEnabled() == true) {
+ item.closeParentsChildMenu();
+ item.closeParent();
+ }
+ } else if (itemType == DAPopupMenuItem.CASCADE) {
+ if (null != childMenu) {
+ closeChildMenu(item, menu);
+ } else {
+ if (null != item.open()) {
+ itemNormalColorChange(button,
+ ColorResources.POPUP_MENU_ITEM_SELECTED,
+ ColorResources.POPUP_MENU_TEXT_SELECTED);
+ }
+ }
+ }
+
+ break;
+ default:
+ return;
+ }
+ }
+ };
+}
--- /dev/null
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * yeongtaik byeon <yeongtaik.byeon@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.dynamicanalyzer.widgets.popupMenu;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
+
+public class DAPopupMenuItem {
+ public final static int NONE = 0;
+ public final static int SEPARATOR = 1;
+ public final static int CASCADE = 2;
+ private DAPopupMenu parent;
+ private DAPopupMenu child;
+ private DACustomButton control;
+ private String text;
+ private int type;
+ private Image icon;
+ private boolean enabled = true;
+ private List<DAPopupMenuListener> listeners;
+ private double doubleData;
+
+ public DAPopupMenuItem(DAPopupMenu menu, int type) {
+ setParent(menu);
+ this.setType(type);
+
+ if (null != menu) {
+ menu.addChild(this);
+ }
+ }
+
+ public DAPopupMenuItem(DAPopupMenu menu) {
+ this(menu, NONE);
+ }
+
+ public DAPopupMenu getParent() {
+ return parent;
+ }
+
+ public void setParent(DAPopupMenu parent) {
+ this.parent = parent;
+ }
+
+ public DAPopupMenu getChild() {
+ return child;
+ }
+
+ public void setChild(DAPopupMenu child) {
+ this.child = child;
+ }
+
+ public String getText() {
+ return text;
+ }
+
+ public void setText(String name) {
+ this.text = name;
+ }
+
+ public int getType() {
+ return type;
+ }
+
+ public void setType(int type) {
+ this.type = type;
+ }
+
+ protected void setControl(DACustomButton control) {
+ this.control = control;
+ }
+
+ protected DACustomButton getControl() {
+ return control;
+ }
+
+ protected DAPopupMenu open() {
+ if (null == child) {
+ return null;
+ }
+ if (null == control) {
+ return null;
+ }
+ parent.setChildMenu(child);
+ Rectangle parentRt = control.getParent().getBounds();
+ Rectangle rt = control.getBounds();
+ child.open(null, parentRt.x + parentRt.width + rt.x, parentRt.y + rt.y);
+ return child;
+ }
+
+ protected void closeParent() {
+ if (null != parent) {
+ parent.closeParent();
+ }
+ }
+
+ protected boolean isInCursorInMenu(Point pt) {
+ if (null != parent) {
+ return parent.isInCursorOnMenu(pt);
+ } else {
+ return false;
+ }
+ }
+
+ protected void closeParentsChildMenu() {
+ if (null == parent) {
+ return;
+ }
+ DAPopupMenu child = parent.getChildMenu();
+ if (null == child) {
+ return;
+ }
+ child.closeChild();
+ parent.setChildMenu(null);
+ }
+
+ public void addListener(DAPopupMenuListener listener) {
+ if (null == listeners) {
+ listeners = new ArrayList<DAPopupMenuListener>();
+ }
+ listeners.add(listener);
+ }
+
+ public List<DAPopupMenuListener> getListeners() {
+ return listeners;
+ }
+
+ public Image getIcon() {
+ return icon;
+ }
+
+ public void setIcon(Image icon) {
+ this.icon = icon;
+ }
+
+ public boolean isEnabled() {
+ return enabled;
+ }
+
+ public void setEnabled(boolean enabled) {
+ this.enabled = enabled;
+ }
+
+ public double getDoubleData() {
+ return doubleData;
+ }
+
+ public void setDoubleData(double data) {
+ doubleData = data;
+ }
+}
--- /dev/null
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * yeongtaik byeon <yeongtaik.byeon@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.dynamicanalyzer.widgets.popupMenu;
+
+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.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Display;
+import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
+import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonAttribute;
+import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonRenderer;
+import org.tizen.dynamicanalyzer.widgets.helper.ColorResources;
+
+public class DAPopupMenuItemButtonRenderer extends DACustomButtonRenderer {
+ protected static final int MARGIN = 2;
+ protected static final int TEXT_MARGIN = 5;
+ protected static final int DEFAULT_ITEM_HEIGHT = 24;
+ protected static final int DEFAULT_ICON_SIZE = 16;
+ protected static final int DEFAULT_FONT_SIZE = 9;
+
+ @Override
+ public void draw(GC gc, Canvas canvas, int state,
+ DACustomButtonAttribute attr) {
+ Rectangle rect = canvas.getClientArea();
+ drawButton(gc, rect, state, attr);
+ drawIcon(gc, rect, state, attr);
+ drawButtonImage(gc, rect, attr);
+ }
+
+ protected void drawButton(GC gc, Rectangle rect, int state,
+ DACustomButtonAttribute attr) {
+
+ gc.setBackground(attr.getColor(state));
+ gc.fillRectangle(rect);
+
+ Rectangle r = new Rectangle(0, 0, rect.width - 1, rect.height - 1);
+
+ drawButtonText(gc, r, attr, state);
+ }
+
+ protected void drawButtonText(GC gc, Rectangle rect,
+ DACustomButtonAttribute attr, int state) {
+ String text = null;
+ Font font = null;
+ Point p = null;
+
+ Rectangle textRect = new Rectangle(rect.x + DEFAULT_ICON_SIZE, rect.y,
+ rect.width, rect.height);
+
+ if (null != (text = attr.getText())) {
+ if (null == (font = attr.getFont())) {
+ font = new Font(Display.getCurrent(), "Arial", //$NON-NLS-1$
+ computeFontSize(textRect), SWT.NONE);
+ attr.setFont(font);
+ }
+ gc.setFont(font);
+
+ int x = 0, y = 0;
+ int offset = MARGIN * 3;
+
+ p = gc.textExtent(text, SWT.DRAW_MNEMONIC);
+ x = textRect.x;
+ y = textRect.height / 2 - p.y / 2;
+
+ if (null != attr.getFontColor(state)) {
+ gc.setForeground(attr.getFontColor(state));
+ } else {
+ gc.setForeground(ColorResources.BLACK);
+ }
+
+ if (state == DACustomButton.STATE_PUSH) {
+ x += 1;
+ y += 1;
+ }
+ gc.drawString(text, x + offset, y, true);
+ } else {
+ Color old = gc.getForeground();
+ gc.setForeground(ColorResources.POPUP_MENU_SEPARATOR2);
+ gc.drawLine(0, rect.height, rect.width, rect.height);
+ gc.setForeground(old);
+ }
+ }
+
+ protected void drawIcon(GC gc, Rectangle parentRect, int state,
+ DACustomButtonAttribute attr) {
+ Image icon = attr.getIcon();
+ if (null == icon) {
+ return;
+ }
+ if (state == DACustomButton.STATE_DISABLE) {
+ int old = gc.getAlpha();
+ gc.setAlpha(70);
+ gc.drawImage(icon, 0, 0, icon.getBounds().width,
+ icon.getBounds().height, parentRect.x + MARGIN,
+ parentRect.height / 2 - DEFAULT_ICON_SIZE / 2,
+ DEFAULT_ICON_SIZE, DEFAULT_ICON_SIZE);
+ gc.setAlpha(old);
+
+ } else {
+ gc.drawImage(icon, 0, 0, icon.getBounds().width,
+ icon.getBounds().height, parentRect.x + MARGIN,
+ parentRect.height / 2 - DEFAULT_ICON_SIZE / 2,
+ DEFAULT_ICON_SIZE, DEFAULT_ICON_SIZE);
+ }
+ }
+
+ protected void drawButtonImage(GC gc, Rectangle rect,
+ DACustomButtonAttribute attr) {
+ if (attr != null && attr.getButtonImage() != null) {
+ Image img = attr.getButtonImage();
+ gc.drawImage(img, rect.width - img.getBounds().width - MARGIN,
+ rect.height / 2 - img.getBounds().height / 2);
+ }
+ }
+
+ public int computeFontSize(Rectangle rect) {
+ return DEFAULT_FONT_SIZE;
+ }
+}
--- /dev/null
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * yeongtaik byeon <yeongtaik.byeon@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.dynamicanalyzer.widgets.popupMenu;
+
+import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
+import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonClickEventListener;
+
+public abstract class DAPopupMenuListener extends
+ DACustomButtonClickEventListener {
+ public void handleClickEvent(DACustomButton button) {
+ if (null == button) {
+ return;
+ }
+ Object obj = button.getData();
+ if (!(obj instanceof DAPopupMenuItem)) {
+ return;
+ }
+ DAPopupMenuItem item = (DAPopupMenuItem) obj;
+ widgetSelected(item);
+ }
+
+ /**
+ * call when click item of popupMenu
+ *
+ * @param menuItem
+ */
+ public abstract void widgetSelected(DAPopupMenuItem menuItem);
+}
public static final String START_STOP_THREAD = "Start stop thread"; //$NON-NLS-1$\r
public static final String FILE_CHART_MANAGER_THREAD = "File Chart Manager thread"; //$NON-NLS-1$\r
public static final String THREAD_CHART_MANAGER_THREAD = "Thread Chart Manager thread"; //$NON-NLS-1$\r
+ public static final String NETWORK_CHART_MANAGER_THREAD = "Network Chart Manager thread"; //$NON-NLS-1$\r
public static final String FUNCTION_USAGE_PROFILING_THREAD = "Function usage profiling thread"; //$NON-NLS-1$\r
public static final String USER_INTERFACE_PAGE_MANAGER_THREAD = "User Interface Page Managerthread"; //$NON-NLS-1$ \r
public static final String SQL_INSERTER_THREAD = "sql_inserter_thread"; //$NON-NLS-1$\r
public final static int MSG_PROBE_THREAD = 0x3008;\r
public final static int MSG_PROBE_CUSTOM = 0x3009;\r
public final static int MSG_PROBE_SYNC = 0x3010;\r
+ public final static int MSG_PROBE_NETWORK = 0x3011;\r
\r
}\r
import org.tizen.dynamicanalyzer.swap.model.control.EventObject;
import org.tizen.dynamicanalyzer.swap.model.control.ReplayEvent;
import org.tizen.dynamicanalyzer.ui.file.FileChartManager;
+import org.tizen.dynamicanalyzer.ui.network.NetworkChartManager;
import org.tizen.dynamicanalyzer.ui.summary.profiling.FunctionUsageProfiler;
import org.tizen.dynamicanalyzer.ui.thread.ThreadChartManager;
import org.tizen.dynamicanalyzer.ui.toolbar.ConfigureManager;
ToolbarArea.getInstance().startTimer();
LogParser.startLogParser();
FileChartManager.getInstance().startUpdateLogThread();
+ NetworkChartManager.getInstance().startUpdateLogThread();
ThreadChartManager.getInstance().startUpdateLogThread();
UIDataManager.getInstance().startUpdateLogThread();
FunctionUsageProfiler.startProfiler();
import org.eclipse.swt.graphics.Point;
import org.tizen.dynamicanalyzer.swap.model.probe2.FileData;
import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
+import org.tizen.dynamicanalyzer.swap.model.probe2.NetworkData;
import org.tizen.dynamicanalyzer.swap.model.probe2.ThreadData;
import org.tizen.dynamicanalyzer.swap.model.probe2.UIEventData;
import org.tizen.dynamicanalyzer.ui.file.FilePage;
pageId = ThreadPage.ID;
} else if (data instanceof UIEventData) {
pageId = UIPage.ID;
+ } else if (data instanceof NetworkData) {
+ pageId = UIPage.ID;
} else {
return;
}
public static final int LOG_THREAD = 12;
public static final int LOG_CUSTOM_CHART = 13;
public static final int LOG_SYNC = 14;
+ public static final int LOG_NETWORK = 15;
public static final int TYPE_CALLSTACK = 99;
public static final int FD_API_TYPE_PERMISSION = 7;
public static final int FD_API_TYPE_OTHERS = 8;
+ /* Log Network */
+ public static final int SOCKET_API_FD_OPEN = 0;
+ public static final int SOCKET_API_FD_CLOSE = 1;
+ public static final int SOCKET_API_RECV_START = 2;
+ public static final int SOCKET_API_RECV_END = 3;
+ public static final int SOCKET_API_SEND_START = 4;
+ public static final int SOCKET_API_SEND_END = 5;
+ public static final int SOCKET_API_BIND = 6;
+ public static final int SOCKET_API_LISTEN = 7;
+ public static final int SOCKET_API_CONNECT = 8;
+ public static final int SOCKET_API_ACCEPT_START = 9;
+ public static final int SOCKET_API_ACCEPT_END = 10;
+ public static final int SOCKET_API_EVENT_START = 11;
+ public static final int SOCKET_API_EVENT_END = 12;
+ public static final int SOCKET_API_OTHER = 13;
+ public static final int HTTP_API_SESSION_CONSTRUCT = 14;
+ public static final int HTTP_API_SESSION_CLOSE = 15;
+ public static final int HTTP_API_TRANSACTION_OPEN = 16;
+ public static final int HTTP_API_TRANSACTION_CLOSE = 17;
+ public static final int HTTP_API_ALLOCATION = 18;
+ public static final int HTTP_API_SUBMIT = 19;
+ public static final int HTTP_API_REQUEST = 20;
+ public static final int HTTP_API_RESPONSE = 21;
+ public static final int HTTP_API_OTHER = 22;
+ public static final int HTTP_API_CLOSE = 23;
+
+
/* Log snapshot */
public static final int SNAPSHOT_IMAGE_PATH_INDEX = 12;
public static final int SNAPSHOT_ROTATE_INDEX = 13;
public static final int SYNC_API_TYPE_NOTIFY_ALL = 8;
public static final int SYNC_API_TYPE_OTHER = 9;
+ /* network log : 15 */
+ public static final int NETWORK_OBJECT_INDEX = 12;
+ public static final int NETWORK_FD_INDEX = 13;
+ public static final int NETWORK_FDTYPE_INDEX = 14;
+ public static final int NETWORK_APITYPE_INDEX = 15;
+ public static final int NETWORK_MESSAGE_INDEX = 16;
+ public static final int NETWORK_MESSAGE_SIZE_INDEX = 17;
+ public static final int NETWORK_DESTINATION_ADDRESS_INDEX = 18;
+ public static final int NETWORK_RESERVED_INDEX = 19;
+
/* Common Column Size */
public static final int COMMON_COLUMN_SIZE_RID = 80;
public static final int COMMON_COLUMN_SIZE_ID = 20;
public static String COOLBAR_AREA_UI;
public static String COOLBAR_AREA_TIMELINE;
public static String COOLBAR_AREA_RANGE;
+ public static String COOLBAR_AREA_NETWORK;
public static String COOLBAR_AREA_FILE_TOOLTIP;
public static String COOLBAR_AREA_SUMMARY_TOOLTIP;
COOLBAR_AREA_UI=UI
COOLBAR_AREA_TIMELINE=Timeline
COOLBAR_AREA_RANGE=Range
+COOLBAR_AREA_NETWORK=Network
+
+#COOLBAR_AREA_TIMELINE_TOOLTIP=Timeline [Ctrl + 1]
+#COOLBAR_AREA_FILE_TOOLTIP=File [Ctrl + 2]
+#COOLBAR_AREA_THREAD_TOOLTIP=Thread [Ctrl + 3]
+#COOLBAR_AREA_UI_TOOLTIP=UI [Ctrl + 4]
+#COOLBAR_AREA_SUMMARY_TOOLTIP=Summary [Ctrl + 5]
+#COOLBAR_AREA_RANGE_TOOLTIP=Range [Ctrl + 6]
COOLBAR_AREA_TIMELINE_TOOLTIP=Timeline [Ctrl + 1]
COOLBAR_AREA_FILE_TOOLTIP=File [Ctrl + 2]
-COOLBAR_AREA_THREAD_TOOLTIP=Thread [Ctrl + 3]
-COOLBAR_AREA_UI_TOOLTIP=UI [Ctrl + 4]
-COOLBAR_AREA_SUMMARY_TOOLTIP=Summary [Ctrl + 5]
-COOLBAR_AREA_RANGE_TOOLTIP=Range [Ctrl + 6]
-
+COOLBAR_AREA_NETWORK_TOOLTIP=Network [Ctrl + 3]
+COOLBAR_AREA_THREAD_TOOLTIP=Thread [Ctrl + 4]
+COOLBAR_AREA_UI_TOOLTIP=UI [Ctrl + 5]
+COOLBAR_AREA_GRAPHICS_TOOLTIP=Graphics [Command + 6]
+COOLBAR_AREA_SUMMARY_TOOLTIP=Summary [Ctrl + 7]
+COOLBAR_AREA_RANGE_TOOLTIP=Range [Ctrl + 8]
+
+
+#COOLBAR_AREA_TIMELINE_TOOLTIP_MAC=Timeline [Command + 1]
+#COOLBAR_AREA_FILE_TOOLTIP_MAC=File [Command + 2]
+#COOLBAR_AREA_THREAD_TOOLTIP_MAC=Thread [Command + 3]
+#COOLBAR_AREA_UI_TOOLTIP_MAC=UI [Command + 4]
+#COOLBAR_AREA_SUMMARY_TOOLTIP_MAC=Summary [Command + 5]
+#COOLBAR_AREA_RANGE_TOOLTIP_MAC=Range [Command + 6]
COOLBAR_AREA_TIMELINE_TOOLTIP_MAC=Timeline [Command + 1]
COOLBAR_AREA_FILE_TOOLTIP_MAC=File [Command + 2]
-COOLBAR_AREA_THREAD_TOOLTIP_MAC=Thread [Command + 3]
-COOLBAR_AREA_UI_TOOLTIP_MAC=UI [Command + 4]
-COOLBAR_AREA_SUMMARY_TOOLTIP_MAC=Summary [Command + 5]
-COOLBAR_AREA_RANGE_TOOLTIP_MAC=Range [Command + 6]
+COOLBAR_AREA_NETWORK_TOOLTIP_MAC=Network [Command + 3]
+COOLBAR_AREA_THREAD_TOOLTIP_MAC=Thread [Command + 4]
+COOLBAR_AREA_UI_TOOLTIP_MAC=UI [Command + 5]
+COOLBAR_AREA_GRAPHICS_TOOLTIP_MAC=Graphics [Command +6]
+COOLBAR_AREA_SUMMARY_TOOLTIP_MAC=Summary [Command + 7]
+COOLBAR_AREA_RANGE_TOOLTIP_MAC=Range [Command + 8]
COOLBAR_AREA_CONFIGURATION_FEATURES=Features
COOLBAR_AREA_CONFIGURATION_SETTING=Configuration
--- /dev/null
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Hyun Jong Park <phjwithyou.park@samsung.com>
+ * Jooyoul Lee <jy.exe.lee@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.dynamicanalyzer.nl;
+
+import org.eclipse.osgi.util.NLS;
+
+public class NetworkPageLabels extends NLS {
+ private static final String BUNDLE_NAME = "org.tizen.dynamicanalyzer.nl.NetworkPageLabels"; //$NON-NLS-1$
+
+ public static String NETWORK_API_LIST_VIEW_TITLE;
+ public static String NETWORK_API_LIST_VIEW_INDEX;
+ public static String NETWORK_API_LIST_VIEW_START_TIME;
+ public static String NETWORK_API_LIST_VIEW_END_TIME;
+ public static String NETWORK_API_LIST_VIEW_API;
+ public static String NETWORK_API_LIST_VIEW_OBJECT;
+ public static String NETWORK_API_LIST_VIEW_PARAMETER;
+ public static String NETWORK_API_LIST_VIEW_THREAD_ID;
+ public static String NETWORK_API_LIST_VIEW_RETURN;
+ public static String NETWORK_API_LIST_VIEW_BYTE_SIZE;
+ public static String NETWORK_API_LIST_VIEW_MESSAGE;
+ public static String NETWORK_API_LIST_VIEW_ERRNO;
+
+ public static String NETWORK_CHART;
+ public static String NETWORK_CHART_NOTCONNECT;
+
+ public static String NETWORK_DETAILS_TITLE;
+ public static String NETWORK_DETAILS_API_COUNT;
+ public static String NETWORK_DETAILS_FAILED_API_COUNT;
+ public static String NETWORK_DETAILS_NAME_NEWLINE;
+ public static String NETWORK_DETAILS_ADDRESS;
+ public static String NETWORK_DETAILS_RECV_SIZE;
+ public static String NETWORK_DETAILS_TOTAL_USE_TIME;
+ public static String NETWORK_DETAILS_SEND_SIZE;
+ public static String NETWORK_DETAILS_TOTAL_SIZE;
+ public static String NETWORK_DETAILS_PACKET_MESSAGE;
+
+ public static String NETWORK_CHART_SERIES;
+ public static String NETWORK_CHART_API;
+ public static String NETWORK_CHART_ACCESS;
+
+ public static String NETWORK_CHART_TOOLTIP_FD_OPEND;
+ public static String NETWORK_CHART_TOOLTIP_CONNECTED;
+ public static String NETWORK_CHART_TOOLTIP_CLOSED;
+ public static String NETWORK_CHART_TOOLTIP_NOT_CLOSED;
+
+ public static String NETWORK_CHART_TRAFFIC_TITLE;
+ public static String NETWORK_CHART_TRAFFIC_FD;
+ public static String NETWORK_CHART_TRAFFIC_SEND;
+ public static String NETWORK_CHART_TRAFFIC_RECV;
+
+ public static String NETWORK_CHART_SERVER_NAME;
+ public static String NETWORK_CHART_CLIENT_NAME;
+ public static String NETWORK_CHART_SESSION_NAME;
+ public static String NETWORK_CHART_TRANSACTION_NAME;
+
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, NetworkPageLabels.class);
+ }
+
+ private NetworkPageLabels() {
+ }
+}
--- /dev/null
+NETWORK_API_LIST_VIEW_TITLE=Network API List
+NETWORK_API_LIST_VIEW_INDEX=\#
+NETWORK_API_LIST_VIEW_START_TIME=Start Time
+NETWORK_API_LIST_VIEW_END_TIME=End Time
+NETWORK_API_LIST_VIEW_API=API
+NETWORK_API_LIST_VIEW_OBJECT=Parent Pointer
+NETWORK_API_LIST_VIEW_PARAMETER=Parameter
+NETWORK_API_LIST_VIEW_THREAD_ID=Thread ID
+NETWORK_API_LIST_VIEW_RETURN=Return value
+NETWORK_API_LIST_VIEW_BYTE_SIZE=Byte size
+NETWORK_API_LIST_VIEW_MESSAGE=Packet Message
+NETWORK_API_LIST_VIEW_ERRNO=Error code
+
+NETWORK_CHART=Network
+NETWORK_CHART_NOTCONNECT= Unknown\n Address
+
+NETWORK_DETAILS_TITLE=Network Details
+NETWORK_DETAILS_ADDRESS=Address :
+NETWORK_DETAILS_TOTAL_SIZE=Packet size :
+NETWORK_DETAILS_RECV_SIZE=Recv size :
+NETWORK_DETAILS_SEND_SIZE=Send size :
+NETWORK_DETAILS_TOTAL_USE_TIME=Usage time :
+NETWORK_DETAILS_API_COUNT=API count :
+NETWORK_DETAILS_FAILED_API_COUNT=Failed API count :
+NETWORK_DETAILS_NAME_NEWLINE=Network name : \n
+NETWORK_DETAILS_PACKET_MESSAGE=Packet Message
+
+NETWORK_CHART_SERIES=STATE
+NETWORK_CHART_API=API
+NETWORK_CHART_ACCESS=WAIT
+
+
+NETWORK_CHART_TOOLTIP_FD_OPEND=FD OPEND
+NETWORK_CHART_TOOLTIP_CONNECTED = CONNECTED
+NETWORK_CHART_TOOLTIP_CLOSED=CLOSED
+NETWORK_CHART_TOOLTIP_NOT_CLOSED=NOT CLOSED
+
+NETWORK_CHART_TRAFFIC_TITLE=Traffic
+NETWORK_CHART_TRAFFIC_FD=FD
+NETWORK_CHART_TRAFFIC_SEND=Send
+NETWORK_CHART_TRAFFIC_RECV=recv
+
+NETWORK_CHART_SERVER_NAME=Server\n
+NETWORK_CHART_CLIENT_NAME=Client\n
+NETWORK_CHART_SESSION_NAME=Session\n
+NETWORK_CHART_TRANSACTION_NAME=Transaction\n
\ No newline at end of file
public static Color TABLE_CONTENTS_SELECTED_FONT_COLOR = getColor("table_contents_selected_font_color"); //$NON-NLS-1$\r
public static Color TABLE_HEADER_FONT_COLOR = getColor("table_title_font_color"); //$NON-NLS-1$\r
public static Color TABLE_CONTENTS_FONT_COLOR = getColor("table_contents_font_color"); //$NON-NLS-1$\r
+ public static Color TABLE_CONTENTS_FAILED_BACGOUND_COLOR = getColor("table_contents_failed_bacgound_color"); //$NON-NLS-1$\r
+ public static Color TABLE_CONTENTS_FAILED_FONT_COLOR = getColor("table_contents_failed_font_color"); //$NON-NLS-1$\r
/** common table colors end **/\r
\r
/** range color **/\r
public static Color FILE_ACCESS_READ = getColor("file_access_read"); //$NON-NLS-1$\r
public static Color FILE_ACCESS_WRITE = getColor("file_access_write"); //$NON-NLS-1$\r
\r
+ /** Network chart colors **/ \r
+ public static Color NETWORK_API_USED = getColor("network_api_used"); //$NON-NLS-1$\r
+ public static Color NETWORK_API_FAILED = getColor("network_api_failed"); //$NON-NLS-1$\r
+ public static Color NETWORK_AREA_FD_USED_START = getColor("network_area_fd_used_start"); //$NON-NLS-1$\r
+ public static Color NETWORK_AREA_FD_USED_END = getColor("network_area_fd_used_end"); //$NON-NLS-1$\r
+ public static Color NETWORK_AREA_CONNECTED_START = getColor("network_area_connected_start"); //$NON-NLS-1$\r
+ public static Color NETWORK_AREA_CONNECTED_END = getColor("network_area_connected_end"); //$NON-NLS-1$\r
+ public static Color NETWORK_AREA_CLOSED_START = getColor("network_area_closed_start"); //$NON-NLS-1$\r
+ public static Color NETWORK_AREA_CLOSED_END = getColor("network_area_closed_end"); //$NON-NLS-1$\r
+ public static Color NETWORK_AREA_NOT_CLOSED_START = getColor("network_area_not_closed_start"); //$NON-NLS-1$\r
+ public static Color NETWORK_AREA_NOT_CLOSED_END = getColor("network_area_not_closed_end"); //$NON-NLS-1$\r
+ public static Color NETWORK_ACCESS_RECV = getColor("network_access_recv"); //$NON-NLS-1$\r
+ public static Color NETWORK_ACCESS_SEND = getColor("network_access_send"); //$NON-NLS-1$\r
+ public static Color NETWORK_ACCESS_WAIT = getColor("network_access_wait"); //$NON-NLS-1$\r
+ \r
public static Color UNSELECTED_TAB_FIRST = getColor("unselected_tab_first"); //$NON-NLS-1$\r
public static Color UNSELECTED_TAB_SECOND = getColor("unselected_tab_second"); //$NON-NLS-1$\r
public static Color SELECTED_TAB_FIRST = getColor("selected_tab_first"); //$NON-NLS-1$\r
TABLE_CONTENTS_SELECTED_FONT_COLOR = getColor("table_contents_selected_font_color"); //$NON-NLS-1$\r
TABLE_HEADER_FONT_COLOR = getColor("table_title_font_color"); //$NON-NLS-1$\r
TABLE_CONTENTS_FONT_COLOR = getColor("table_contents_font_color"); //$NON-NLS-1$\r
+ TABLE_CONTENTS_FAILED_BACGOUND_COLOR = getColor("table_contents_failed_bacgound_color"); //$NON-NLS-1$\r
+ TABLE_CONTENTS_FAILED_FONT_COLOR = getColor("table_contents_failed_font_color"); //$NON-NLS-1$\r
/** common table colors end **/\r
\r
/** open trace popup colors **/\r
SELECTED_TAB_FIRST = getColor("selected_tab_first"); //$NON-NLS-1$\r
SELECTED_TAB_SECOND = getColor("selected_tab_second"); //$NON-NLS-1$\r
\r
+ /** Network chart colors **/\r
+ NETWORK_API_USED = getColor("network_api_used"); //$NON-NLS-1$\r
+ NETWORK_API_FAILED = getColor("network_api_failed"); //$NON-NLS-1$\r
+ NETWORK_AREA_FD_USED_START = getColor("network_area_fd_used_start"); //$NON-NLS-1$\r
+ NETWORK_AREA_FD_USED_END = getColor("network_area_fd_used_end"); //$NON-NLS-1$\r
+ NETWORK_AREA_CONNECTED_START = getColor("network_area_connected_start"); //$NON-NLS-1$\r
+ NETWORK_AREA_CONNECTED_END = getColor("network_area_connected_end"); //$NON-NLS-1$\r
+ NETWORK_AREA_CLOSED_START = getColor("network_area_closed_start"); //$NON-NLS-1$\r
+ NETWORK_AREA_CLOSED_END = getColor("network_area_closed_end"); //$NON-NLS-1$\r
+ NETWORK_AREA_NOT_CLOSED_START = getColor("network_area_not_closed_start"); //$NON-NLS-1$\r
+ NETWORK_AREA_NOT_CLOSED_END = getColor("network_area_not_closed_end"); //$NON-NLS-1$\r
+ NETWORK_ACCESS_RECV = getColor("network_access_recv"); //$NON-NLS-1$\r
+ NETWORK_ACCESS_SEND = getColor("network_access_send"); //$NON-NLS-1$\r
+ NETWORK_ACCESS_WAIT = getColor("network_access_wait"); //$NON-NLS-1$\r
+ \r
TOOLTIP = getColor("tooltip"); //$NON-NLS-1$\r
\r
BAR_GRAY1 = getColor("barGRAY1"); //$NON-NLS-1$\r
public static final Image CHECKBOX_UNSELECTED_HOVER = getPngImage("checkbox_unselected_hover"); //$NON-NLS-1$\r
public static final Image CHECKBOX_UNSELECTED_DISABLE = getPngImage("checkbox_unselected_disable"); //$NON-NLS-1$\r
public static final Image CHECKBOX_SELECTED_DISABLE = getPngImage("checkbox_selected_disable"); //$NON-NLS-1$\r
+ \r
+ // Failed API icon in table\r
+ public static final Image FAILED_API_ICON_TABLE = getPngImage("fail_api"); //$NON-NLS-1$\r
\r
// latest button\r
public static final Image LATEST_SNAPSHOT_NORMAL = getPngImage("latest_snapshot_normal"); //$NON-NLS-1$\r
public static final Image CHART_DEVICES = getPngImage("time_line_icon_devices"); //$NON-NLS-1$\r
public static final Image UI_EVENT = getPngImage("time_line_icon_UI_events"); //$NON-NLS-1$\r
public static final Image CHART_CUSTOM = getPngImage("time_line_icon_custom"); //$NON-NLS-1$\r
+ public static final Image CHART_NETWORK = getPngImage("time_line_icon_traffic"); //$NON-NLS-1$\r
\r
/* Resource */\r
public static final Image TYPE_FILE = getPngImage("resource/resource_file"); //$NON-NLS-1$\r
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.internal.WorkbenchWindow;
import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.handlers.ReplayTraceHandler;
import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
import org.tizen.dynamicanalyzer.ui.file.FilePage;
+import org.tizen.dynamicanalyzer.ui.network.NetworkPage;
import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
import org.tizen.dynamicanalyzer.ui.range.RangePage;
import org.tizen.dynamicanalyzer.ui.summary.SummaryPage;
public static String COOLBAR_AREA_UI_TOOLTIP = null;
public static String COOLBAR_AREA_TIMELINE_TOOLTIP = null;
public static String COOLBAR_AREA_RANGE_TOOLTIP = null;
+ public static String COOLBAR_AREA_NETWORK_TOOLTIP = null;
public static String COOLBAR_AREA_ABOUT = null;
public static String COOLBAR_AREA_SETTING = null;
COOLBAR_AREA_UI_TOOLTIP = AnalyzerLabels.COOLBAR_AREA_UI_TOOLTIP_MAC;
COOLBAR_AREA_TIMELINE_TOOLTIP = AnalyzerLabels.COOLBAR_AREA_TIMELINE_TOOLTIP_MAC;
COOLBAR_AREA_RANGE_TOOLTIP = AnalyzerLabels.COOLBAR_AREA_RANGE_TOOLTIP_MAC;
+
COOLBAR_AREA_ABOUT = AnalyzerLabels.ABOUT_MAC;
COOLBAR_AREA_SETTING = AnalyzerLabels.SETTING_MAC;
System.out.println("file page");
AnalyzerUtil.changePage(FilePage.ID);
} else if (event.stateMask == CTRL_STATE_MASK && event.keyCode == 51) {
+ System.out.println("NetworkPage page");
+ AnalyzerUtil.changePage(NetworkPage.ID);
+ } else if (event.stateMask == CTRL_STATE_MASK && event.keyCode == 52) {
System.out.println("thread page");
AnalyzerUtil.changePage(ThreadPage.ID);
- } else if (event.stateMask == CTRL_STATE_MASK && event.keyCode == 52) {
+ } else if (event.stateMask == CTRL_STATE_MASK && event.keyCode == 53) {
System.out.println("ui page");
AnalyzerUtil.changePage(UIPage.ID);
- } else if (event.stateMask == CTRL_STATE_MASK && event.keyCode == 53) {
+ } else if (event.stateMask == CTRL_STATE_MASK && event.keyCode == 54) {
System.out.println("summary page");
AnalyzerUtil.changePage(SummaryPage.ID);
- } else if (event.stateMask == CTRL_STATE_MASK && event.keyCode == 54) {
+ } else if (event.stateMask == CTRL_STATE_MASK && event.keyCode == 55) {
System.out.println("range page");
AnalyzerUtil.changePage(RangePage.ID);
}
buffer.append(",");
}
}
- query = String.format("select %s from %s ;", buffer.toString(),
+ query = String.format("select * from %s", buffer.toString(),
"replay");
stat = conn.createStatement();
- rs = stat.executeQuery(query);
+ rs = stat.executeQuery("select * from replay;");
if (null == rs) {
return null;
}
}
String strCallerAddr = Long.toString(callerAddr);
- System.out.println("tid :" + tid);
+ // System.out.println("tid :" + tid);
List<CallStackUnit> probeCallstack = new ArrayList<CallStackUnit>(
getUserCallstack(tid));
// List<CallStackUnit> probeCallstack =
import org.tizen.dynamicanalyzer.communicator.BaseCommunicator;
import org.tizen.dynamicanalyzer.communicator.CommunicatorUtils;
import org.tizen.dynamicanalyzer.communicator.DACommunicator;
-import org.tizen.dynamicanalyzer.handlers.ReplayTraceHandler;
import org.tizen.dynamicanalyzer.model.AddrSymbolPair;
import org.tizen.dynamicanalyzer.model.DeviceInfo;
import org.tizen.dynamicanalyzer.nl.ConfigureLabels;
import org.tizen.dynamicanalyzer.project.AppInfo;
-import org.tizen.dynamicanalyzer.sql.SqlManager;
import org.tizen.dynamicanalyzer.swap.logparser.SWAPLogParser;
import org.tizen.dynamicanalyzer.swap.model.ByteUtils;
-import org.tizen.dynamicanalyzer.swap.model.DATime;
import org.tizen.dynamicanalyzer.swap.model.control.ApplicationInfo;
import org.tizen.dynamicanalyzer.swap.model.control.ApplicationInst;
import org.tizen.dynamicanalyzer.swap.model.control.BinaryInfo;
import org.tizen.dynamicanalyzer.swap.model.control.RunTimeConfiguration;
import org.tizen.dynamicanalyzer.swap.model.control.TargetInfo;
import org.tizen.dynamicanalyzer.swap.model.control.UserSpaceInst;
-import org.tizen.dynamicanalyzer.swap.model.probe2.ReplayData;
import org.tizen.dynamicanalyzer.ui.file.FileChartManager;
+import org.tizen.dynamicanalyzer.ui.network.NetworkChartManager;
import org.tizen.dynamicanalyzer.ui.summary.profiling.FunctionUsageProfiler;
import org.tizen.dynamicanalyzer.ui.thread.ThreadChartManager;
import org.tizen.dynamicanalyzer.ui.toolbar.ConfigureManager;
ToolbarArea.getInstance().startTimer();
SWAPLogParser.startLogParser();
FileChartManager.getInstance().startUpdateLogThread();
+ NetworkChartManager.getInstance().startUpdateLogThread();
ThreadChartManager.getInstance().startUpdateLogThread();
UIDataManager.getInstance().startUpdateLogThread();
FunctionUsageProfiler.startProfiler();
int line = 0;
for (int i = 0; i < input.length; i++, line++) {
String b = String.format("%2x", input[i]);
- System.out.print(b + " ");
+ // System.out.print(b + " ");
if (line == 9) {
- System.out.print(" ");
+ // System.out.print(" ");
}
if (line == 19) {
- System.out.println();
+ // System.out.println();
line = -1;
}
}
case LogCenterConstants.LOG_RESOURCE:
newId = AnalyzerConstants.MSG_PROBE_FILE;
break;
+ case LogCenterConstants.LOG_NETWORK:
+ newId = AnalyzerConstants.MSG_PROBE_NETWORK;
+ break;
case LogCenterConstants.LOG_LIFECYCLE:
newId = AnalyzerConstants.MSG_PROBE_LIFECYCLE;
break;
logFormats.add(ControlLogFormat.getInstance());
logFormats.add(CustomChartLogFormat.getInstance());
logFormats.add(FileLogFormat.getInstance());
+ logFormats.add(NetworkLogFormat.getInstance());
logFormats.add(LifeCycleLogFormat.getInstance());
logFormats.add(MemoryLogFormat.getInstance());
logFormats.add(ProfilingLogFormat.getInstance());
--- /dev/null
+package org.tizen.dynamicanalyzer.swap.model.probe;
+
+import java.util.Arrays;
+
+public class NetworkLogFormat extends LogFormat {
+ public static final String NAME = "Network";
+
+ private static NetworkLogFormat instance = null;
+
+ public static NetworkLogFormat getInstance() {
+ if (null == instance) {
+ instance = new NetworkLogFormat();
+ }
+ return instance;
+ }
+
+ private NetworkLogFormat() {
+ setName(NAME);
+
+ String[] dcn = { "ObjetAddress", "FDValue", "FDApiType", "DestinationIPAddress",
+ "DestinationPortAddress", "Message" };
+ dbColumnNames = CommonColumns.getDBColumnNames();
+ dbColumnNames.addAll(Arrays.asList(dcn));
+
+ Integer[] dct = { L, L, I, I, I, T };
+ dbColumnTypes = CommonColumns.getDBColumntypes();
+ dbColumnTypes.addAll(Arrays.asList(dct));
+
+ String[] tcn = { "ObjetAddress", "FDValue", "FDApiType", "DestinationIPAddress",
+ "DestinationPortAddress", "Message" };
+ tableColumnNames = CommonColumns.getTableColumnNames();
+ tableColumnNames.addAll(Arrays.asList(tcn));
+
+ Integer[] types = { L, L, I, I, I, T };
+ logColumnTypes = CommonColumns.getLogColumnTypes();
+ logColumnTypes.addAll(Arrays.asList(types));
+ }
+}
import static org.tizen.dynamicanalyzer.common.AnalyzerConstants.MSG_FUNCTION_EXIT;
import static org.tizen.dynamicanalyzer.common.AnalyzerConstants.MSG_PROBE_CUSTOM;
import static org.tizen.dynamicanalyzer.common.AnalyzerConstants.MSG_PROBE_FILE;
+import static org.tizen.dynamicanalyzer.common.AnalyzerConstants.MSG_PROBE_NETWORK;
import static org.tizen.dynamicanalyzer.common.AnalyzerConstants.MSG_PROBE_LIFECYCLE;
import static org.tizen.dynamicanalyzer.common.AnalyzerConstants.MSG_PROBE_MEMORY;
import static org.tizen.dynamicanalyzer.common.AnalyzerConstants.MSG_PROBE_SCENE;
case MSG_PROBE_FILE:
createFileData(data, paylaod);
break;
-
+ case MSG_PROBE_NETWORK:
+ System.out.println("MSG_PROBE_NETWORK paylaod : "+paylaod);
+ break;
case MSG_PROBE_LIFECYCLE:
createLifecycleData(data, paylaod);
break;
import static org.tizen.dynamicanalyzer.common.AnalyzerConstants.MSG_FUNCTION_EXIT;
import static org.tizen.dynamicanalyzer.common.AnalyzerConstants.MSG_PROBE_CUSTOM;
import static org.tizen.dynamicanalyzer.common.AnalyzerConstants.MSG_PROBE_FILE;
+import static org.tizen.dynamicanalyzer.common.AnalyzerConstants.MSG_PROBE_NETWORK;
import static org.tizen.dynamicanalyzer.common.AnalyzerConstants.MSG_PROBE_LIFECYCLE;
import static org.tizen.dynamicanalyzer.common.AnalyzerConstants.MSG_PROBE_MEMORY;
import static org.tizen.dynamicanalyzer.common.AnalyzerConstants.MSG_PROBE_SCENE;
import static org.tizen.dynamicanalyzer.common.AnalyzerConstants.MSG_PROBE_UICONTROL;
import static org.tizen.dynamicanalyzer.common.AnalyzerConstants.MSG_PROBE_UIEVENT;
+
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import org.tizen.dynamicanalyzer.swap.model.probe.ControlLogFormat;
import org.tizen.dynamicanalyzer.swap.model.probe.CustomChartLogFormat;
import org.tizen.dynamicanalyzer.swap.model.probe.FileLogFormat;
+import org.tizen.dynamicanalyzer.swap.model.probe.NetworkLogFormat;
import org.tizen.dynamicanalyzer.swap.model.probe.LifeCycleLogFormat;
import org.tizen.dynamicanalyzer.swap.model.probe.LogFormat;
import org.tizen.dynamicanalyzer.swap.model.probe.MemoryLogFormat;
logList.add(MSG_PROBE_UICONTROL);
logList.add(MSG_PROBE_UIEVENT);
logList.add(MSG_PROBE_FILE);
+ logList.add(MSG_PROBE_NETWORK);
logList.add(MSG_PROBE_LIFECYCLE);
logList.add(MSG_PROBE_SCREENSHOT);
logList.add(MSG_PROBE_SCENE);
public static LogData createInstance(byte[] data) {
int id = ByteUtils.toInt(data, 0);
+
+ if (id == 8208 || id == 8209 || id == 8198 || id == 8199 || id == 8210
+ || id == 8211 || id == 12292 || id == 12290 || id == 12295 || id == 12289 || id == 12291|| id == 8201) {
+
+ } else {
+ System.out.println("createInstance id : " + id);
+ }
+
LogData output = null;
switch (id) {
case MSG_PROBE_MEMORY:
// file
output = new FileData();
break;
+ case MSG_PROBE_NETWORK:
+ System.out.println("MSG_PROBE_NETWORK ");
+ output = new NetworkData();
+ break;
case MSG_PROBE_LIFECYCLE:
// life cycle
output = new LifeCycleData();
// file
output = new FileData();
break;
+ case MSG_PROBE_NETWORK:
+ // network
+ System.out.println("MSG_PROBE_NETWORK");
+ output = new NetworkData();
+ break;
case MSG_PROBE_LIFECYCLE:
// life cycle
output = new LifeCycleData();
case MSG_PROBE_FILE:
format = FileLogFormat.getInstance();
break;
+ case MSG_PROBE_NETWORK:
+ System.out.println("MSG_PROBE_NETWORK");
+ format = NetworkLogFormat.getInstance();
+ break;
case MSG_PROBE_LIFECYCLE:
format = LifeCycleLogFormat.getInstance();
break;
count = 19;
break;
case MSG_PROBE_FILE:
+ case MSG_PROBE_NETWORK:
+ // file
+ System.out.println("MSG_PROBE_NETWORK");
+ break;
case LogCenterConstants.LOG_RESOURCE:
// file
count = 19;
--- /dev/null
+package org.tizen.dynamicanalyzer.swap.model.probe2;
+
+import static org.tizen.dynamicanalyzer.common.CommonConstants.INT_SIZE;
+import static org.tizen.dynamicanalyzer.common.CommonConstants.LONG_SIZE;
+
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+import org.tizen.dynamicanalyzer.swap.model.ByteUtils;
+
+public class NetworkData extends ProbeCommonData {
+
+ long objectAddress = 0;
+ long fdValue = 0;
+ int fdApiType = 0;
+ int destinationIPAddress = 0;
+ int destinationPortAddress = 0;
+ String packetMessage = null;
+
+// public long getSize() {
+// return size;
+// }
+//
+// public void setSize(long size) {
+// this.size = size;
+// }
+//
+ public long getObjectAddress() {
+ return objectAddress;
+ }
+
+ public long getFdValue() {
+ return fdValue;
+ }
+
+ public void setFdValue(long fdValue) {
+ this.fdValue = fdValue;
+ }
+
+ public int getFdApiType() {
+ return fdApiType;
+ }
+
+ public int getPacketMessageSize() {
+ return packetMessage.getBytes().length;
+ }
+
+ public String getPacketMessage() {
+ return packetMessage;
+ }
+
+ public String getdestinationIPAddress() {
+ return Integer.toString(destinationIPAddress);
+ }
+
+ public String getDestinationPortAddress() {
+ return Integer.toString(destinationPortAddress);
+ }
+
+ public void setFdApiType(int fdApiType) {
+ this.fdApiType = fdApiType;
+ }
+
+
+
+// public long getFileSize() {
+// return fileSize;
+// }
+//
+// public void setFileSize(long fileSize) {
+// this.fileSize = fileSize;
+// }
+//
+
+//
+// public void setFilePath(String filePath) {
+// this.filePath = filePath;
+// }
+
+ public NetworkData() {
+ }
+
+ public void makeData(byte[] data) {
+ super.makeData(data);
+
+ objectAddress = ByteUtils.toLong(data, index);
+ index += LONG_SIZE;
+
+ fdValue = ByteUtils.toLong(data, index);
+ index += LONG_SIZE;
+
+ fdApiType = ByteUtils.toInt(data, index);
+ index += INT_SIZE;
+
+ destinationIPAddress = ByteUtils.toInt(data, index);
+ index += INT_SIZE;
+
+ destinationPortAddress = ByteUtils.toInt(data, index);
+ index += INT_SIZE;
+
+ packetMessage = LogDataUtils.getString(index, data);
+ }
+
+ @Override
+ public int getKey() {
+ Long key = getFdValue();
+ return key.hashCode();
+ }
+
+ @Override
+ public void makePreparedStatement(PreparedStatement prep)
+ throws SQLException {
+ super.makePreparedStatement(prep);
+ int index = ProbeCommonData.STATE_COUNT + 1;
+
+ prep.setLong(index++, objectAddress);
+ prep.setLong(index++, fdValue);
+ prep.setInt(index++, fdApiType);
+ prep.setInt(index++, destinationIPAddress);
+ prep.setInt(index++, destinationPortAddress);
+ prep.setString(index++, packetMessage);
+ }
+
+ @Override
+ public void loadData(ResultSet rs) throws SQLException {
+ super.loadData(rs);
+ int index = ProbeCommonData.STATE_COUNT + 1;
+ objectAddress = rs.getLong(index++);
+ fdValue = rs.getLong(index++);
+ fdApiType = rs.getInt(index++);
+ destinationIPAddress = rs.getInt(index++);
+ destinationPortAddress = rs.getInt(index++);
+ packetMessage = rs.getString(index++);
+ }
+}
setColor("table_contents_selected_font_color", new RGB(255, 255, 255)); //$NON-NLS-1$
setColor("table_title_font_color", new RGB(151, 230, 255)); //$NON-NLS-1$
setColor("table_contents_font_color", new RGB(216, 216, 216)); //$NON-NLS-1$
+ setColor("table_contents_failed_bacgound_color", new RGB(244,199,197)); //$NON-NLS-1$
+ setColor("table_contents_failed_font_color", new RGB(212,75,69)); //$NON-NLS-1$
/** common table colors end **/
/** open trace popup colors **/
setColor("file_access_read", new RGB(64, 126, 18)); //$NON-NLS-1$
setColor("file_access_write", new RGB(147, 21, 173)); //$NON-NLS-1$
+ /** Network chart colors **/
+ setColor("network_api_used", new RGB(15, 153, 232)); //$NON-NLS-1$
+ setColor("network_api_failed", new RGB(226, 65, 73)); //$NON-NLS-1$
+ setColor("network_area_fd_used_start", new RGB(255,222,125)); //$NON-NLS-1$
+ setColor("network_area_fd_used_end", new RGB(255,186,29)); //$NON-NLS-1$
+ setColor("network_area_closed_start", new RGB(168, 198, 71)); //$NON-NLS-1$
+ setColor("network_area_closed_end", new RGB(130, 152, 54)); //$NON-NLS-1$
+ setColor("network_area_not_closed_start", new RGB(178, 178, 178)); //$NON-NLS-1$
+ setColor("network_area_not_closed_end", new RGB(106, 106, 106)); //$NON-NLS-1$
+ setColor("network_area_connected_start", new RGB(123,182,240)); //$NON-NLS-1$
+ setColor("network_area_connected_end", new RGB(65,141,218)); //$NON-NLS-1$
+ setColor("network_access_recv", new RGB(64, 126, 18)); //$NON-NLS-1$
+ setColor("network_access_send", new RGB(147, 21, 173)); //$NON-NLS-1$
+ setColor("network_access_wait", new RGB(190,190,190)); //$NON-NLS-1$
+
setColor("unselected_tab_first", new RGB(51, 51, 51)); //$NON-NLS-1$
setColor("unselected_tab_second", new RGB(42, 42, 42)); //$NON-NLS-1$
setColor("selected_tab_first", new RGB(74, 74, 74)); //$NON-NLS-1$
setColor("table_contents_selected_font_color", new RGB(216, 216, 216)); //$NON-NLS-1$
setColor("table_title_font_color", new RGB(0, 45, 96)); //$NON-NLS-1$
setColor("table_contents_font_color", new RGB(70, 70, 70)); //$NON-NLS-1$
+ setColor("table_contents_failed_bacgound_color", new RGB(244,199,197)); //$NON-NLS-1$
+ setColor("table_contents_failed_font_color", new RGB(212,75,69)); //$NON-NLS-1$
/** common table colors end **/
/** range color **/
setColor("file_access_read", new RGB(64, 126, 18)); //$NON-NLS-1$
setColor("file_access_write", new RGB(147, 21, 173)); //$NON-NLS-1$
-
+ /** Network chart colors **/
+ setColor("network_api_used", new RGB(15, 153, 232)); //$NON-NLS-1$
+ setColor("network_api_failed", new RGB(226, 65, 73)); //$NON-NLS-1$
+ setColor("network_area_fd_used_start", new RGB(255,222,125)); //$NON-NLS-1$
+ setColor("network_area_fd_used_end", new RGB(255,186,29)); //$NON-NLS-1$
+ setColor("network_area_closed_start", new RGB(168, 198, 71)); //$NON-NLS-1$
+ setColor("network_area_closed_end", new RGB(130, 152, 54)); //$NON-NLS-1$
+ setColor("network_area_not_closed_start", new RGB(178, 178, 178)); //$NON-NLS-1$
+ setColor("network_area_not_closed_end", new RGB(106, 106, 106)); //$NON-NLS-1$
+ setColor("network_area_connected_start", new RGB(123,182,240)); //$NON-NLS-1$
+ setColor("network_area_connected_end", new RGB(65,141,218)); //$NON-NLS-1$
+ setColor("network_access_recv", new RGB(64, 126, 18)); //$NON-NLS-1$
+ setColor("network_access_send", new RGB(147, 21, 173)); //$NON-NLS-1$
+ setColor("network_access_wait", new RGB(190,190,190)); //$NON-NLS-1$
setColor("unselected_tab_first", new RGB(51, 51, 51)); //$NON-NLS-1$
setColor("unselected_tab_second", new RGB(42, 42, 42)); //$NON-NLS-1$
--- /dev/null
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * yeongtaik byeon <yeongtaik.byeon@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.dynamicanalyzer.ui.common;
+
+import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
+import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenuItem;
+import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenuListener;
+
+public class PopupAnalysisMenuItemClickListener extends DAPopupMenuListener {
+
+ @Override
+ public void widgetSelected(DAPopupMenuItem menuItem) {
+ // TODO Auto-generated method stub
+ RangeDataManager.getInstance().startRangeAnalysis();
+ }
+
+}
--- /dev/null
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * yeongtaik byeon <yeongtaik.byeon@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.dynamicanalyzer.ui.common;
+
+import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
+import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenuItem;
+import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenuListener;
+
+public class PopupClearMenuItemClickListener extends DAPopupMenuListener {
+
+ @Override
+ public void widgetSelected(DAPopupMenuItem menuItem) {
+ // TODO Auto-generated method stub
+ RangeDataManager.getInstance().initRange();
+ }
+
+}
--- /dev/null
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * yeongtaik byeon <yeongtaik.byeon@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.dynamicanalyzer.ui.common;
+
+import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
+import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotIntervalMarker;
+import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
+import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenuItem;
+import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenuListener;
+
+public class PopupEndMenuItemClickListener extends DAPopupMenuListener {
+ private DAPopupMenuItem endItem;
+ private DAChartBoard chartBoard;
+ private RangeDataManager rangeDataManager = RangeDataManager.getInstance();
+
+ public PopupEndMenuItemClickListener(DAPopupMenuItem item, DAChartBoard board){
+ endItem = item;
+ chartBoard = board;
+ }
+
+ @Override
+ public void widgetSelected(DAPopupMenuItem menuItem) {
+ // TODO Auto-generated method stub
+ double endTime = endItem.getDoubleData();
+ rangeDataManager
+ .setMarkerEndTime((long) (endTime * TimelineConstants.MEGA));
+
+ double startTime = rangeDataManager.getMarkerStartTime()
+ / TimelineConstants.MEGA;
+
+
+ chartBoard.setTimelineMarkerStartTime(startTime);
+ chartBoard.setTimelineMarkerEndTime(endTime);
+ ((DAChartPlotIntervalMarker) chartBoard.getMarkers().get(
+ UICommonConstants.RANGE_MARKER_INDEX)).setStartVal(startTime);
+ ((DAChartPlotIntervalMarker) chartBoard.getMarkers().get(
+ UICommonConstants.RANGE_MARKER_INDEX)).setEndVal(endTime);
+ }
+
+}
--- /dev/null
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * yeongtaik byeon <yeongtaik.byeon@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.dynamicanalyzer.ui.common;
+
+import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
+import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotIntervalMarker;
+import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
+import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenuItem;
+import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenuListener;
+
+public class PopupFromSelectionMenuItemClickListener extends
+ DAPopupMenuListener {
+ private DAChartBoard chartBoard;
+ private RangeDataManager rangeDataManager = RangeDataManager.getInstance();
+
+ public PopupFromSelectionMenuItemClickListener(DAPopupMenuItem item,
+ DAChartBoard board) {
+ chartBoard = board;
+ }
+
+ @Override
+ public void widgetSelected(DAPopupMenuItem menuItem) {
+ // TODO Auto-generated method stub
+ double startTime = ((DAChartPlotIntervalMarker) chartBoard.getMarkers()
+ .get(UICommonConstants.SELECTION_MARKER_INDEX)).getStartVal();
+ double endTime = ((DAChartPlotIntervalMarker) chartBoard.getMarkers()
+ .get(UICommonConstants.SELECTION_MARKER_INDEX)).getEndVal();
+ double temp;
+
+ if (startTime > endTime) {
+ temp = startTime;
+ startTime = endTime;
+ endTime = temp;
+ }
+ rangeDataManager
+ .setMarkerStartTime((long) (startTime * TimelineConstants.MEGA));
+ rangeDataManager
+ .setMarkerEndTime((long) (endTime * TimelineConstants.MEGA));
+ chartBoard.setTimelineMarkerStartTime(startTime);
+ chartBoard.setTimelineMarkerEndTime(endTime);
+ ((DAChartPlotIntervalMarker) chartBoard.getMarkers().get(
+ UICommonConstants.RANGE_MARKER_INDEX)).setStartVal(startTime);
+ ((DAChartPlotIntervalMarker) chartBoard.getMarkers().get(
+ UICommonConstants.RANGE_MARKER_INDEX)).setEndVal(endTime);
+ }
+
+}
--- /dev/null
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * yeongtaik byeon <yeongtaik.byeon@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.dynamicanalyzer.ui.common;
+
+import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
+import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotIntervalMarker;
+import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
+import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenuItem;
+import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenuListener;
+
+public class PopupStartMenuItemClickListener extends DAPopupMenuListener {
+ private DAPopupMenuItem startItem;
+ private DAChartBoard chartBoard;
+ private RangeDataManager rangeDataManager = RangeDataManager.getInstance();
+
+ public PopupStartMenuItemClickListener(DAPopupMenuItem item, DAChartBoard board){
+ startItem = item;
+ chartBoard = board;
+ }
+
+ @Override
+ public void widgetSelected(DAPopupMenuItem menuItem) {
+ // TODO Auto-generated method stub
+ double startTime = startItem.getDoubleData();
+ rangeDataManager
+ .setMarkerStartTime((long) (startTime * TimelineConstants.MEGA));
+
+ double endTime = rangeDataManager.getMarkerEndTime()
+ / TimelineConstants.MEGA;
+
+ chartBoard.setTimelineMarkerStartTime(startTime);
+ chartBoard.setTimelineMarkerEndTime(endTime);
+
+ ((DAChartPlotIntervalMarker) chartBoard.getMarkers().get(
+ UICommonConstants.RANGE_MARKER_INDEX)).setStartVal(startTime);
+ ((DAChartPlotIntervalMarker) chartBoard.getMarkers().get(
+ UICommonConstants.RANGE_MARKER_INDEX)).setEndVal(endTime);
+ }
+
+}
--- /dev/null
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Hyunjong Park <phjwithyou.park@samsung.com>
+ * yeongtaik byeon <yeongtaik.byeon@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.dynamicanalyzer.ui.network;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import org.eclipse.nebula.widgets.grid.GridItem;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.Composite;
+import org.tizen.dynamicanalyzer.common.AnalyzerManager;
+import org.tizen.dynamicanalyzer.common.CommonConstants;
+import org.tizen.dynamicanalyzer.common.DASelectionData;
+import org.tizen.dynamicanalyzer.error.ErrorCodeManager;
+import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
+import org.tizen.dynamicanalyzer.model.TableInput;
+import org.tizen.dynamicanalyzer.swap.model.probe2.NetworkData;
+import org.tizen.dynamicanalyzer.ui.common.UICommonConstants;
+import org.tizen.dynamicanalyzer.ui.file.FileApiListView;
+import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
+import org.tizen.dynamicanalyzer.ui.widgets.table.DAApiListTableComposite;
+import org.tizen.dynamicanalyzer.ui.widgets.table.DATableDataFormat;
+import org.tizen.dynamicanalyzer.utils.Formatter;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotIntervalMarker;
+import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
+
+public class NetworkApiListTable extends DAApiListTableComposite {
+ private DAChartBoard chartBoard = null;
+
+ public NetworkApiListTable(Composite parent, int compStyle, int tableStyle) {
+ super(parent, compStyle, tableStyle);
+ table.addSelectionListener(new SelectionListener() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+
+ GridItem[] items = table.getSelection();
+ if (null == items) {
+ return;
+ }
+ long startTime = 0;
+ long endTime = 0;
+
+ DATableDataFormat dataFormat;
+ long itemTime;
+ for (int i = 0; i < items.length; i++) {
+ dataFormat = (DATableDataFormat) items[i].getData();
+ itemTime = dataFormat.getLogData().getTime();
+ if (0 == startTime) {
+ startTime = itemTime;
+ }
+ if (startTime > itemTime) {
+ startTime = itemTime;
+ }
+ if (endTime < itemTime) {
+ endTime = itemTime;
+ }
+ }
+
+ DASelectionData selData = new DASelectionData(
+ NetworkApiListView.ID, startTime, endTime, items, table);
+ AnalyzerManager.getCurrentPage().updatePage(selData);
+ AnalyzerManager.getCurrentPage().controlSelection(
+ NetworkApiListView.ID);
+
+ // DATableDataFormat dataFormats = (DATableDataFormat)
+ // items[0].getData();
+ // String packetMessage =
+ // dataFormats.getData().get(LogCenterConstants.NETWORK_MESSAGE_INDEX);
+ // NetworkChartManager.getInstance().setPacketMessage(packetMessage);
+
+ }
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // TODO Auto-generated method stub
+ }
+ });
+ }
+
+ @Override
+ protected List<TableInput> makeTableInput() {
+ NetworkApiListView view = (NetworkApiListView) AnalyzerManager
+ .getCurrentPage().getViewMap().get(NetworkApiListView.ID);
+
+ NetworkChartData data = view.getPageData();
+ if (null == data) {
+ return null;
+ }
+
+ long rangeStartTime = view.getRangeStartTime();
+ long rangeEndTime = view.getRangeEndTime();
+
+ List<TableInput> input = new ArrayList<TableInput>();
+ List<NetworkChartDataEvent> contents = data.getContents();
+ NetworkChartDataEvent content;
+ HashMap<String, Integer> findStartAPITableIndexHashMap = new HashMap<String, Integer>();
+ List<Integer> removeTableIndex = new ArrayList<Integer>();
+ for (int i = 0; i < contents.size(); i++) {
+ content = contents.get(i);
+ NetworkData contentTemp = content.getContents();
+ List<String> contentText = new ArrayList<String>();
+ List<String> contentData = new ArrayList<String>();
+
+ Integer startLogIndex = 0;
+ String fdApiType = Integer.toString(contentTemp.getFdApiType());
+ if (fdApiType.equals(Integer
+ .toString(LogCenterConstants.SOCKET_API_RECV_START))
+ || fdApiType
+ .equals(Integer
+ .toString(LogCenterConstants.SOCKET_API_SEND_START))
+ || fdApiType
+ .equals(Integer
+ .toString(LogCenterConstants.SOCKET_API_ACCEPT_START))
+ || fdApiType
+ .equals(Integer
+ .toString(LogCenterConstants.SOCKET_API_EVENT_START))) {
+
+ findStartAPITableIndexHashMap.put(contentTemp.getArgs(), i);
+
+ } else if (fdApiType.equals(Integer
+ .toString(LogCenterConstants.SOCKET_API_RECV_END))
+ || fdApiType.equals(Integer
+ .toString(LogCenterConstants.SOCKET_API_SEND_END))
+ || fdApiType
+ .equals(Integer
+ .toString(LogCenterConstants.SOCKET_API_ACCEPT_END))
+ || fdApiType.equals(Integer
+ .toString(LogCenterConstants.SOCKET_API_EVENT_END))) {
+
+ startLogIndex = findStartAPITableIndexHashMap.get(contentTemp
+ .getArgs());
+ if (null != startLogIndex) {
+ removeTableIndex.add((int) startLogIndex);
+ }
+ }
+
+ String seq = Integer.toString(contentTemp.getSeq());
+ contentText.add(0, seq);
+ contentData.add(seq);
+
+ if (fdApiType.equals(Integer
+ .toString(LogCenterConstants.SOCKET_API_RECV_END))
+ || fdApiType.equals(Integer
+ .toString(LogCenterConstants.SOCKET_API_SEND_END))
+ || fdApiType
+ .equals(Integer
+ .toString(LogCenterConstants.SOCKET_API_ACCEPT_END))
+ || fdApiType.equals(Integer
+ .toString(LogCenterConstants.SOCKET_API_EVENT_END))) {
+ if (null != startLogIndex) {
+ contentText.add(input.get((int) startLogIndex).getText()
+ .get(1));
+ contentData.add(input.get((int) startLogIndex).getText()
+ .get(1));
+ } else {
+ contentText.add(Formatter.toTimeFormat(contentTemp
+ .getTime()));
+ contentData.add(Long.toString(contentTemp.getTime()));
+ }
+ } else {
+ contentText.add(Formatter.toTimeFormat(contentTemp.getTime()));
+ contentData.add(Long.toString(contentTemp.getTime()));
+ }
+
+ contentText.add(Formatter.toTimeFormat(contentTemp.getTime()));
+ contentData.add(Long.toString(contentTemp.getTime()));
+
+ contentText.add(contentTemp.getApiName());
+ contentData.add(contentTemp.getApiName());
+ contentText.add(Long.toString(contentTemp.getObjectAddress()));
+ contentData.add(Long.toString(contentTemp.getObjectAddress()));
+
+ contentText.add(contentTemp.getArgs());
+ contentData.add(contentTemp.getArgs());
+ contentText.add(Integer.toString(contentTemp.getTid()));
+ contentData.add(Integer.toString(contentTemp.getTid()));
+ contentText.add(Long.toString(contentTemp.getReturn()));
+ contentData.add(Long.toString(contentTemp.getReturn()));
+
+ int apiType = contentTemp.getFdApiType();
+ if (apiType == LogCenterConstants.SOCKET_API_SEND_END
+ || apiType == LogCenterConstants.SOCKET_API_RECV_END
+ || apiType == LogCenterConstants.HTTP_API_REQUEST
+ || apiType == LogCenterConstants.HTTP_API_RESPONSE) {
+ contentText.add(Integer.toString(contentTemp
+ .getPacketMessageSize()));
+ contentData.add(Integer.toString(contentTemp
+ .getPacketMessageSize()));
+ } else {
+ contentText.add(CommonConstants.EMPTY);
+ contentData.add(CommonConstants.EMPTY);
+ }
+
+ contentText.add(contentTemp.getPacketMessage());
+ contentData.add(contentTemp.getPacketMessage());
+
+ String errMsg = ErrorCodeManager.getInatance().getErrorCode(
+ Long.toString(contentTemp.getErrno()));
+ if (null == errMsg) {
+ errMsg = "undefined error code"; //$NON-NLS-1$
+ }
+ contentText.add(errMsg);
+ contentData.add(errMsg);
+ contentText.add(Long.toString(contentTemp.getReturn()));
+ contentData.add(Long.toString(contentTemp.getReturn()));
+
+ DATableDataFormat tableData = new DATableDataFormat(
+ contentTemp.getSeq());
+ tableData.setLogData(contentTemp);
+ tableData.getData().addAll(contentData);
+ TableInput tableInput = new TableInput();
+ tableInput.setText(contentText);
+ tableInput.setData(tableData);
+ input.add(tableInput);
+
+ long time = contentTemp.getTime();
+ if (time >= rangeStartTime && time <= rangeEndTime) {
+ tableInput.setInRange(true);
+ }
+ }
+
+ int removeCount = 0;
+ for (int index : removeTableIndex) {
+ input.remove(index - removeCount);
+ removeCount++;
+ }
+ return input;
+ }
+
+ private DAChartBoard getChartBoard() {
+ if (chartBoard == null) {
+ chartBoard = (DAChartBoard) (AnalyzerManager.getCurrentPage()
+ .getView(NetworkChartView.ID).getControl());
+ }
+ return chartBoard;
+ }
+
+ protected void actionSetStartEnd(int type) {
+ GridItem item = table.getItem(mousePoint);
+ if (null != item) {
+ List<String> data = ((DATableDataFormat) item.getData()).getData();
+ String time = data.get(LogCenterConstants.TIME_INDEX);
+ long inputTime = -1;
+ try {
+ inputTime = Long.parseLong(time);
+ } catch (NumberFormatException e) {
+ e.printStackTrace();
+ return;
+ }
+ double startTime = -1;
+ double endTime = -1;
+ DAChartBoard board = getChartBoard();
+
+ if (type == START_TIME) {
+ rangeDataManager.setMarkerStartTime(inputTime);
+ startTime = inputTime / TimelineConstants.MEGA;
+ endTime = rangeDataManager.getMarkerEndTime()
+ / TimelineConstants.MEGA;
+
+ } else if (type == END_TIME) {
+ rangeDataManager.setMarkerEndTime(inputTime);
+ endTime = inputTime / TimelineConstants.MEGA;
+ startTime = rangeDataManager.getMarkerStartTime()
+ / TimelineConstants.MEGA;
+ }
+
+ board.setTimelineMarkerStartTime(startTime);
+ board.setTimelineMarkerEndTime(endTime);
+
+ ((DAChartPlotIntervalMarker) board.getMarkers().get(
+ UICommonConstants.RANGE_MARKER_INDEX))
+ .setStartVal(startTime);
+ ((DAChartPlotIntervalMarker) board.getMarkers().get(
+ UICommonConstants.RANGE_MARKER_INDEX)).setEndVal(endTime);
+ }
+ }
+}
--- /dev/null
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Hyunjong Park <phjwithyou.park@samsung.com>
+ * yeongtaik byeon <yeongtaik.byeon@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.dynamicanalyzer.ui.network;
+
+import org.eclipse.nebula.widgets.grid.Grid;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
+import org.tizen.dynamicanalyzer.common.AnalyzerManager;
+import org.tizen.dynamicanalyzer.common.DASelectionData;
+import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
+import org.tizen.dynamicanalyzer.model.DAView;
+import org.tizen.dynamicanalyzer.nl.NetworkPageLabels;
+import org.tizen.dynamicanalyzer.resources.ColorResources;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
+import org.tizen.dynamicanalyzer.ui.file.FileApiListView;
+import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
+import org.tizen.dynamicanalyzer.ui.widgets.ViewContainer;
+import org.tizen.dynamicanalyzer.ui.widgets.table.TableColumnSizePackListener;
+
+public class NetworkApiListView extends DAView {
+
+ public static final String ID = NetworkApiListView.class.getName();
+ private NetworkChartData data;
+ private long analysisStartTime = 0;
+ private long analysisEndTime = 0;
+ private long selectionStartTime = 0;
+ private long selectionEndTime = 0;
+ int[] innerMaxWeight = { 0, 100 };
+ int[] outerMaxWeight = { 100, 0 };
+
+ private String[] columnNames = {
+ NetworkPageLabels.NETWORK_API_LIST_VIEW_INDEX,
+ NetworkPageLabels.NETWORK_API_LIST_VIEW_START_TIME,
+ NetworkPageLabels.NETWORK_API_LIST_VIEW_END_TIME,
+ NetworkPageLabels.NETWORK_API_LIST_VIEW_API,
+ NetworkPageLabels.NETWORK_API_LIST_VIEW_OBJECT,
+ NetworkPageLabels.NETWORK_API_LIST_VIEW_PARAMETER,
+ NetworkPageLabels.NETWORK_API_LIST_VIEW_THREAD_ID,
+ NetworkPageLabels.NETWORK_API_LIST_VIEW_RETURN,
+ NetworkPageLabels.NETWORK_API_LIST_VIEW_BYTE_SIZE,
+ NetworkPageLabels.NETWORK_API_LIST_VIEW_MESSAGE,
+ NetworkPageLabels.NETWORK_API_LIST_VIEW_ERRNO };
+
+ private int[] columnSizes = { 40, 70, 70, 120, 90, 70, 70, 100, 70, 100,
+ 100 };
+ private int[] columnAlignment = { SWT.RIGHT, SWT.LEFT, SWT.LEFT, SWT.LEFT,
+ SWT.LEFT, SWT.LEFT, SWT.LEFT, SWT.LEFT, SWT.LEFT, SWT.LEFT,
+ SWT.LEFT };
+
+ int[] sortTypes = { AnalyzerConstants.SORT_TYPE_NUM,
+ AnalyzerConstants.SORT_TYPE_NUM, AnalyzerConstants.SORT_TYPE_NUM,
+ AnalyzerConstants.SORT_TYPE_STRING,
+ AnalyzerConstants.SORT_TYPE_STRING,
+ AnalyzerConstants.SORT_TYPE_STRING,
+ AnalyzerConstants.SORT_TYPE_NUM,
+ AnalyzerConstants.SORT_TYPE_STRING,
+ AnalyzerConstants.SORT_TYPE_STRING,
+ AnalyzerConstants.SORT_TYPE_STRING,
+ AnalyzerConstants.SORT_TYPE_STRING };
+
+ int[] sourceColumns = { LogCenterConstants.SEQUENCE_NUMBER_INDEX,
+ LogCenterConstants.TIME_INDEX, LogCenterConstants.TIME_INDEX,
+ LogCenterConstants.APINAME_INDEX,
+ LogCenterConstants.NETWORK_OBJECT_INDEX,
+ LogCenterConstants.INPUTPARM_INDEX,
+ LogCenterConstants.THREAD_ID_INDEX,
+ LogCenterConstants.RETURN_INDEX, LogCenterConstants.RETURN_INDEX,
+ LogCenterConstants.NETWORK_MESSAGE_INDEX,
+ LogCenterConstants.ERROR_INDEX };
+
+ NetworkApiListTable tableComp = null;
+
+ public NetworkApiListView(Composite parent, int style) {
+ super(parent, style);
+ this.setLayout(new FillLayout());
+
+ ViewContainer viewContainer = new ViewContainer(this, true);
+ viewContainer
+ .setTitleText(NetworkPageLabels.NETWORK_API_LIST_VIEW_TITLE);
+ setMaxWeight(innerMaxWeight, outerMaxWeight);
+
+ Composite contents = viewContainer.getContentArea();
+ contents.setBackground(ColorResources.WINDOW_BG_COLOR);
+ contents.setLayout(new FillLayout());
+ tableComp = new NetworkApiListTable(contents, SWT.NONE, SWT.MULTI
+ | SWT.BORDER | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL);
+ tableComp.setSortTypes(sortTypes);
+ tableComp.setSourceColumns(sourceColumns);
+ tableComp.setFailedAPIColor(true);
+ tableComp.setColumnAlignment(columnAlignment);
+ tableComp.setColumns(columnNames);
+ tableComp.setColumnSize(columnSizes);
+ tableComp.setTableName(NetworkPageLabels.NETWORK_API_LIST_VIEW_TITLE);
+ contents.addControlListener(new TableColumnSizePackListener(tableComp,
+ columnSizes));
+ }
+
+ @Override
+ public void updateView() {
+ if (null == data) {
+ return;
+ }
+
+ long newAnalysisStartTime = 0;
+ long newAnalysisEndTime = 0;
+
+ if (RangeDataManager.getInstance().isBeingAnalyzed()) {
+ newAnalysisStartTime = RangeDataManager.getInstance()
+ .getAnalysisStartTime();
+ newAnalysisEndTime = RangeDataManager.getInstance()
+ .getAnalysisEndTime();
+ } else {
+ newAnalysisStartTime = 0;
+ newAnalysisEndTime = 0;
+ }
+
+ if (newAnalysisStartTime != analysisStartTime
+ || newAnalysisEndTime != analysisEndTime) {
+ analysisStartTime = newAnalysisStartTime;
+ analysisEndTime = newAnalysisEndTime;
+ tableComp.updateTable();
+ return;
+ }
+
+ if (data.getContents().size() != tableComp.getTable().getItemCount()) {
+ tableComp.updateTable();
+ }
+
+ }
+
+ @Override
+ public void updateView(DASelectionData data) {
+ NetworkChartManager.getInstance().setPacketMessage("");
+ NetworkChartData pageData = (NetworkChartData) data.getData();
+
+ if (!(pageData instanceof NetworkChartData)) {
+ selectionStartTime = data.getStartTime();
+ selectionEndTime = data.getEndTime();
+ } else {
+ this.data = pageData;
+ }
+ tableComp.getTable().removeAll();
+ tableComp.updateTable();
+ tableComp.setSelectionByTime(selectionStartTime, selectionEndTime);
+
+ }
+
+ @Override
+ public void setSelection(LogData data) {
+ if (null == data) {
+ return;
+ }
+ int seq = data.getSeq();
+ tableComp.updateTable();
+ int nSize = tableComp.getTable().getItemCount();
+ for (int ii = 0; ii < nSize; ii++) {
+ if (tableComp.getTable().getItem(ii).getText(0)
+ .equals(Integer.toString(seq))) {
+ tableComp.getTable().setSelection(ii);
+ tableComp
+ .getTable()
+ .getVerticalBar()
+ .setSelection(
+ getScrollSelectionIndex(tableComp.getTable(),
+ ii));
+ tableComp.updateTable();
+ }
+ }
+ long selectedTime = data.getTime();
+ DASelectionData selData = new DASelectionData(FileApiListView.ID,
+ selectedTime, selectedTime,
+ tableComp.getTable().getSelection(), tableComp.getTable());
+ AnalyzerManager.getCurrentPage().updatePage(selData);
+ }
+
+// @Override
+// public void setSelection(List<String> data) {
+// if (null == data || data.isEmpty()) {
+// return;
+// }
+// String seq = data.get(LogCenterConstants.SEQUENCE_NUMBER_INDEX);
+// tableComp.updateTable();
+// int nSize = tableComp.getTable().getItemCount();
+// for (int ii = 0; ii < nSize; ii++) {
+// if (tableComp.getTable().getItem(ii).getText(0).equals(seq)) {
+// tableComp.getTable().setSelection(ii);
+// tableComp
+// .getTable()
+// .getVerticalBar()
+// .setSelection(
+// getScrollSelectionIndex(tableComp.getTable(),
+// ii));
+// tableComp.updateTable();
+// }
+// }
+// String logTime = data.get(LogCenterConstants.TIME_INDEX);
+// long selectedTime = Long.parseLong(logTime);
+// DASelectionData selData = new DASelectionData(NetworkApiListView.ID,
+// selectedTime, selectedTime,
+// tableComp.getTable().getSelection(), tableComp.getTable());
+// AnalyzerManager.getCurrentPage().updatePage(selData);
+// }
+
+ private int getScrollSelectionIndex(Grid table, int selection) {
+ int size = table.getVerticalBar().getThumb() / 2;
+ int output = selection - size;
+ output = (output < 0) ? 0 : output;
+ return output;
+ }
+
+ @Override
+ public Control getControl() {
+ return tableComp;
+ }
+
+ @Override
+ public void clear() {
+ tableComp.getTable().removeAll();
+ data = null;
+ }
+
+ public NetworkChartData getPageData() {
+ return data;
+ }
+
+ public long getRangeStartTime() {
+ return analysisStartTime;
+ }
+
+ public long getRangeEndTime() {
+ return analysisEndTime;
+ }
+}
--- /dev/null
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Hyunjong Park <phjwithyou.park@samsung.com>
+ * yeongtaik byeon <yeongtaik.byeon@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.dynamicanalyzer.ui.network;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.swt.graphics.Color;
+import org.tizen.dynamicanalyzer.common.AnalyzerManager;
+import org.tizen.dynamicanalyzer.common.CommonConstants;
+import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
+import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
+import org.tizen.dynamicanalyzer.nl.NetworkPageLabels;
+import org.tizen.dynamicanalyzer.resources.ColorResources;
+import org.tizen.dynamicanalyzer.swap.model.probe2.FailedData2;
+import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChart;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeries;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeriesItem;
+import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardItem;
+
+public class NetworkChartData {
+ private List<NetworkChartData> children = new ArrayList<NetworkChartData>();
+ private NetworkChartData parent = null;
+
+ private DAChartSeries apiSeries;
+ private DAChartSeries accessSeries;
+ private DAChartSeries statueSeries;
+
+ private String fd = AnalyzerLabels.EMPTY_STRING;
+ private List<String> hasFd = new ArrayList<String>();
+ private String address = AnalyzerLabels.EMPTY_STRING;
+ private String thread = AnalyzerLabels.EMPTY_STRING;
+
+ private boolean isFDConnected = true;
+ private boolean isClosedSocket = true;
+ private boolean isFailedAPI = false;
+ // for Detail View Data
+ private List<FailedData2> failedData = null;
+ private long messageSize = 0;
+ private long sendSize = 0;
+ private long recvSize = 0;
+ private double socketOpendTime = 0;
+ private double socketClosedTime = 0;
+ private double socketLastUsedTime = 0;
+ private double socketTotalUsedTime = 0;
+
+ protected DAChartBoardItem item;
+ protected List<NetworkChartDataEvent> contents = new ArrayList<NetworkChartDataEvent>();
+ protected List<NetworkChartDataEvent> contentsQueue = new ArrayList<NetworkChartDataEvent>();
+
+ protected DAChart chart;
+ protected boolean hasUpdate = false;
+
+ private NetworkChartDataEvent event = null;
+
+ private int lastAccessIndexForParent = -1;
+
+ public NetworkChartData(NetworkChartDataEvent event, boolean isRoot) {
+ setEvent(event);
+ setAddress(event.getAddress());
+ setFD(event.getFD());
+ setThread(event.getThread());
+ this.isFailedAPI = event.isFailedAPI();
+ }
+
+ public void pushChild(NetworkChartData data) {
+ children.add(data);
+ hasUpdate = true;
+ }
+
+ public DAChartBoardItem getItem() {
+ return item;
+ }
+
+ public DAChart getChart() {
+ return chart;
+ }
+
+ public void setChart(DAChart chart) {
+ this.chart = chart;
+ }
+
+ public void pushEvent(NetworkChartDataEvent event) {
+ contentsQueue.add(event);
+ makeDetailViewData(event);
+ hasUpdate = true;
+ }
+
+ public void makeDetailViewData(NetworkChartDataEvent event) {
+ setMessageSize(event.getMessageSize());
+ setSendSize(event.getSendSize());
+ setRecvSize(event.getRecvSize());
+ if (event.getFailedData() != null) {
+ getFailedData().add(event.getFailedData());
+ }
+ }
+
+ public List<FailedData2> getFailedData() {
+ if (null == failedData) {
+ failedData = new ArrayList<FailedData2>();
+ }
+ return failedData;
+ }
+
+ public List<String> getFailedRelations() {
+ List<String> output = new ArrayList<String>();
+ int size = getFailedData().size();
+ for (int i = 0; i < size; i++) {
+ FailedData2 ffd = failedData.get(i);
+ String seq = Integer.toString(ffd.getSeq());
+ output.add(seq);
+ }
+ return output;
+ }
+
+ public void setHasUpdate() {
+ hasUpdate = true;
+ }
+
+ public List<NetworkChartDataEvent> getContents() {
+ return contents;
+ }
+
+ public int getChildCount() {
+ return children.size();
+ }
+
+ public List<NetworkChartData> getChild() {
+ return children;
+ }
+
+ public String getFD() {
+ if (null == fd) {
+ return CommonConstants.EMPTY;
+ }
+ return fd;
+ }
+
+ public void setFD(String data) {
+ this.fd = data;
+ }
+
+ public void setClosed(boolean data) {
+ this.isClosedSocket = data;
+ }
+
+ public boolean isClosed(NetworkChartDataEvent event) {
+ if (event == null) {
+ return this.isClosedSocket;
+ }
+ if (isParent()) {
+ this.isClosedSocket = true;
+ for (int i = 0; i < children.size(); i++) {
+
+ double socketOpendTime = children.get(i).getSocketOpendTime();
+ double socketClosedTime = children.get(i).getSocketClosedTime();
+ if (event.getApiChartTime() == socketOpendTime) {
+ this.isClosedSocket = true;
+ break;
+ }
+ if (event.getApiChartTime() < socketOpendTime) {
+ continue;
+ }
+ if ((event.getApiChartTime() > socketClosedTime)
+ && (socketClosedTime != 0)) {
+ continue;
+ }
+ if (socketClosedTime == 0) {
+ if (!children.get(i).isClosed(null)) {
+ this.isClosedSocket = false;
+ break;
+ }
+ }
+ if (socketOpendTime < event.getApiChartTime()
+ && event.getApiChartTime() < socketClosedTime) {
+ this.isClosedSocket = false;
+ break;
+ }
+ }
+ return this.isClosedSocket;
+ }
+ return this.isClosedSocket;
+ }
+
+ public boolean isFDOpenFailed() {
+ if (isParent()) {
+ this.isClosedSocket = true;
+ for (int i = 0; i < children.size(); i++) {
+ if (!children.get(i).isFDOpenFailed()) {
+ return false;
+ }
+ }
+ return true;
+ } else {
+ return isFailedAPI;
+ }
+ }
+
+ public void setAddress(String name) {
+ this.address = name;
+ }
+
+ public String getAddress() {
+ return address;
+ }
+
+ public String getAddressName() {
+ String[] parentKeyName = this.address.split(":");//$NON-NLS-1$
+ String keyname = null;
+ if (parentKeyName.length == 2) {
+ keyname = parentKeyName[0] + "\n:" + parentKeyName[1];//$NON-NLS-1$
+ } else {
+ keyname = this.address;
+ }
+
+ return keyname;
+ }
+
+ public int getFailedApiCount() {
+ return getFailedData().size();
+ }
+
+ public int getApiCount() {
+ int nAPICallCound = 0;
+ for (NetworkChartDataEvent data : getContents()) {
+ if (!data.getApiName().contains("start")) {//$NON-NLS-1$
+ nAPICallCound++;
+ }
+ }
+ return nAPICallCound;
+ }
+
+ public void setMessageSize(long data) {
+ if (data > 0) {
+ this.messageSize = data;
+ }
+ }
+
+ public long getMessageSize() {
+ return this.messageSize;
+ }
+
+ public void setSendSize(long data) {
+ this.sendSize += data;
+ }
+
+ public long getRecvSize() {
+ if (this.recvSize < 0) {
+ return 0;
+ }
+ return this.recvSize;
+ }
+
+ public void setRecvSize(long data) {
+ this.recvSize += data;
+ }
+
+ public long getSendSize() {
+ if (this.sendSize < 0) {
+ return 0;
+ }
+ return this.sendSize;
+ }
+
+ public boolean isParent() {
+ boolean isParent = false;
+ if (children.size() > 0) {
+ isParent = true;
+ } else {
+ isParent = false;
+ }
+ return isParent;
+ }
+
+ public NetworkChartData findChildData(NetworkChartDataEvent event) {
+ int size = children.size();
+ NetworkChartData ret;
+ for (int i = 0; i < size; i++) {
+ ret = children.get(i);
+ if (null == ret || null == event) {
+ continue;
+ }
+ if (ret.getFD().equals(event.getFD())) {
+ return ret;
+ }
+ }
+ return null;
+ }
+
+ public void setItem(DAChartBoardItem item) {
+ this.item = item;
+ setChart(item.getChart());
+ apiSeries = chart.getSeries(NetworkPageLabels.NETWORK_CHART_API);
+ accessSeries = chart.getSeries(NetworkPageLabels.NETWORK_CHART_ACCESS);
+ statueSeries = chart.getSeries(NetworkPageLabels.NETWORK_CHART_SERIES);
+
+ }
+
+ public void checkUpdate() {
+ if (false == hasUpdate
+ && !AnalyzerManager.isRunning() ) {
+ return;
+ } else {
+ hasUpdate = false;
+ }
+
+ int size = contentsQueue.size();
+ NetworkChartDataEvent event = null;
+ if (size > 0) {
+ for (int i = 0; i < size; i++) {
+ event = contentsQueue.get(0);
+ setStatusColor(event);
+ getContents().add(event);
+ createChartItem(event);
+ contentsQueue.remove(0);
+ }
+ chart.redraw();
+ }
+
+ size = children.size();
+ if (size > 0) {
+ NetworkChartData data;
+ for (int i = 0; i < size; i++) {
+ data = children.get(i);
+ data.checkUpdate();
+ }
+ }
+
+ if (!AnalyzerManager.isRunning()) {
+ if (isParent() && (event == null)) {
+ for (int i = 0; i < size; i++) {
+ if ((!children.get(i).isClosed(null))
+ && (!children.get(i).getFD().contains("-1"))) {//$NON-NLS-1$
+ setNotFDClosedStatus();
+ break;
+ }
+ }
+ } else {
+ if (!isClosed(event)) {
+ setNotFDClosedStatus();
+ }
+ }
+ }
+ }
+
+ private void setStatusColor(NetworkChartDataEvent event) {
+
+ switch (event.getApiType()) {
+ // Socket
+ case LogCenterConstants.SOCKET_API_FD_OPEN: {
+ if (isParent()) {
+ if (isClosed(event)) {
+ setFDOpendStatus(event);
+ }
+ } else {
+ setFDOpendStatus(event);
+ }
+ break;
+ }
+ case LogCenterConstants.SOCKET_API_CONNECT: {
+ if (event.isFailedAPI()) {
+ setFDCloseStatusManager(event);
+ return;
+ }
+ if (isParent()) {
+ setConnectedParentStatus(event);
+ } else {
+ setConnectedChildStatus(event);
+ }
+ break;
+ }
+ case LogCenterConstants.SOCKET_API_ACCEPT_START:
+ break;
+ case LogCenterConstants.SOCKET_API_ACCEPT_END: {
+ if (event.isFailedAPI()) {
+ setFDCloseStatusManager(event);
+ return;
+ }
+ if (isParent()) {
+ setConnectedParentStatus(event);
+ } else {
+ if (event.connectedType() != NetworkChartDataEvent.NETWORK_CHART_SERVER_NAME) {
+ setConnectedChildStatus(event);
+ }
+ }
+ break;
+ }
+ case LogCenterConstants.SOCKET_API_FD_CLOSE: {
+ if ((isFDOpenFailed()) == true || (event.isFailedAPI() == true)) {
+ return;
+ }
+ setFDCloseStatusManager(event);
+ break;
+ }
+ case LogCenterConstants.SOCKET_API_RECV_START:
+ break;
+ case LogCenterConstants.SOCKET_API_RECV_END: {
+ if (event.getRecvSize() <= 0) {
+ if (isParent()) {
+ if (isClosed(event)) {
+ setNotFDClosedStatus(event);
+ }
+ } else {
+ setNotFDClosedStatus(event);
+ }
+ }
+ break;
+ }
+ case LogCenterConstants.SOCKET_API_SEND_START:
+ break;
+ case LogCenterConstants.SOCKET_API_SEND_END:
+ break;
+ case LogCenterConstants.SOCKET_API_EVENT_START:
+ break;
+ case LogCenterConstants.SOCKET_API_EVENT_END:
+ break;
+ case LogCenterConstants.SOCKET_API_BIND: {
+ if (event.isFailedAPI() == true) {
+ setFDCloseStatusManager(event);
+ }
+ break;
+ }
+ case LogCenterConstants.SOCKET_API_LISTEN: {
+ if (event.isFailedAPI() == true) {
+ setFDCloseStatusManager(event);
+ }
+ break;
+ }
+ case LogCenterConstants.SOCKET_API_OTHER:
+ break;
+ // HTTP
+ case LogCenterConstants.HTTP_API_SESSION_CONSTRUCT: {
+ if (isParent()) {
+ if (isClosed(event)) {
+ setFDOpendStatus(event);
+ }
+ } else {
+ setFDOpendStatus(event);
+ }
+ break;
+ }
+ case LogCenterConstants.HTTP_API_TRANSACTION_OPEN: {
+ if (isParent()) {
+ if (isClosed(event)) {
+ setFDOpendStatus(event);
+ }
+ } else {
+ setFDOpendStatus(event);
+ }
+ break;
+ }
+ case LogCenterConstants.HTTP_API_TRANSACTION_CLOSE:
+ setFDCloseStatusManager(event);
+ break;
+ case LogCenterConstants.HTTP_API_ALLOCATION:
+ break;
+ case LogCenterConstants.HTTP_API_SUBMIT: {
+ if (event.isFailedAPI()) {
+ setFDCloseStatusManager(event);
+ return;
+ }
+ setConnectedParentStatus(event);
+ break;
+ }
+ case LogCenterConstants.HTTP_API_REQUEST:
+ setDisConnectedStatus(event);
+ break;
+ case LogCenterConstants.HTTP_API_RESPONSE:
+ break;
+ case LogCenterConstants.HTTP_API_OTHER:
+ break;
+ case LogCenterConstants.HTTP_API_CLOSE: {
+ if ((isFDOpenFailed()) == true || (event.isFailedAPI() == true)) {
+ return;
+ }
+ setFDCloseStatusManager(event);
+ break;
+ }
+
+ default:
+ System.out
+ .println("setStatusColor : no case NetworkChartDataEvent : "
+ + event.getApiType());//$NON-NLS-1$
+ return;
+ }
+
+ }
+
+ private void setFDCloseStatusManager(NetworkChartDataEvent event) {
+ if (isParent()) {
+ if (isClosed(event)) {
+ setFDClosedStatus(event);
+ } else {
+ if (!isFDConnected()) {
+ setFDOpenParentStatus(event);
+ }
+ }
+ } else {
+ setFDClosedStatus(event);
+ }
+ }
+
+ private void setFDOpendStatus(NetworkChartDataEvent event) {
+ if ((isFDOpenFailed()) == true || (event.isFailedAPI() == true)) {
+ return;
+ }
+ DAChartSeriesItem seriesItem = new DAChartSeriesItem(
+ event.getApiChartTime(),
+ DAChartSeriesItem.SERIES_STATE_CONTINUE,
+ ColorResources.NETWORK_AREA_FD_USED_END,
+ ColorResources.NETWORK_AREA_FD_USED_START,
+ NetworkPageLabels.NETWORK_CHART_TOOLTIP_FD_OPEND);
+ statueSeries.addSeriesItem(seriesItem);
+ }
+
+ private void setConnectedChildStatus(NetworkChartDataEvent event) {
+ if ((isFDOpenFailed()) == true || (event.isFailedAPI() == true)) {
+ return;
+ }
+ DAChartSeriesItem seriesItem = new DAChartSeriesItem(
+ event.getApiChartTime(),
+ DAChartSeriesItem.SERIES_STATE_CONTINUE,
+ ColorResources.NETWORK_AREA_CONNECTED_END,
+ ColorResources.NETWORK_AREA_CONNECTED_START,
+ NetworkPageLabels.NETWORK_CHART_TOOLTIP_CONNECTED);
+ statueSeries.addSeriesItem(seriesItem);
+
+ }
+
+ private void setDisConnectedStatus(NetworkChartDataEvent event) {
+ if ((isFDOpenFailed()) == true || (event.isFailedAPI() == true)) {
+ return;
+ }
+ int nStatusLastIndex = statueSeries.getSeriesItemList().size() - 1;
+ if (nStatusLastIndex > -1) {
+ statueSeries.getSeriesItemList().get(nStatusLastIndex)
+ .setEventColor(ColorResources.NETWORK_AREA_FD_USED_END);
+
+ statueSeries
+ .getSeriesItemList()
+ .get(nStatusLastIndex)
+ .setEventGradationForegroundColor(
+ ColorResources.NETWORK_AREA_FD_USED_START);
+
+ statueSeries
+ .getSeriesItemList()
+ .get(nStatusLastIndex)
+ .setTooltipText(
+ NetworkPageLabels.NETWORK_CHART_TOOLTIP_FD_OPEND);
+ }
+ }
+
+ private void setConnectedParentStatus(NetworkChartDataEvent event) {
+ if ((isFDOpenFailed()) == true || (event.isFailedAPI() == true)) {
+ return;
+ }
+ int nStatusLastIndex = statueSeries.getSeriesItemList().size() - 1;
+ if (nStatusLastIndex > -1) {
+ statueSeries.getSeriesItemList().get(nStatusLastIndex)
+ .setEventColor(ColorResources.NETWORK_AREA_CONNECTED_END);
+
+ statueSeries
+ .getSeriesItemList()
+ .get(nStatusLastIndex)
+ .setEventGradationForegroundColor(
+ ColorResources.NETWORK_AREA_CONNECTED_START);
+
+ statueSeries
+ .getSeriesItemList()
+ .get(nStatusLastIndex)
+ .setTooltipText(
+ NetworkPageLabels.NETWORK_CHART_TOOLTIP_CONNECTED);
+ }
+ }
+
+ private void setFDOpenParentStatus(NetworkChartDataEvent event) {
+ if ((isFDOpenFailed()) == true || (event.isFailedAPI() == true)) {
+ return;
+ }
+ int nStatusLastIndex = statueSeries.getSeriesItemList().size() - 1;
+ if (nStatusLastIndex > -1) {
+ statueSeries.getSeriesItemList().get(nStatusLastIndex)
+ .setEventColor(ColorResources.NETWORK_AREA_FD_USED_END);
+ statueSeries
+ .getSeriesItemList()
+ .get(nStatusLastIndex)
+ .setEventGradationForegroundColor(
+ ColorResources.NETWORK_AREA_FD_USED_START);
+ statueSeries
+ .getSeriesItemList()
+ .get(nStatusLastIndex)
+ .setTooltipText(
+ NetworkPageLabels.NETWORK_CHART_TOOLTIP_FD_OPEND);
+ }
+ }
+
+ private void setFDClosedStatus(NetworkChartDataEvent event) {
+ int nStatusLastIndex = statueSeries.getSeriesItemList().size() - 1;
+ if (nStatusLastIndex > -1) {
+ statueSeries.getSeriesItemList().get(nStatusLastIndex)
+ .setEventColor(ColorResources.NETWORK_AREA_CLOSED_END);
+ statueSeries
+ .getSeriesItemList()
+ .get(nStatusLastIndex)
+ .setEventGradationForegroundColor(
+ ColorResources.NETWORK_AREA_CLOSED_START);
+ DAChartSeriesItem seriesItem = new DAChartSeriesItem(
+ event.getApiChartTime(),
+ DAChartSeriesItem.SERIES_STATE_BAR,
+ ColorResources.NETWORK_AREA_CLOSED_END,
+ ColorResources.NETWORK_AREA_CLOSED_START,
+ NetworkPageLabels.NETWORK_CHART_TOOLTIP_CLOSED);
+ seriesItem.setBarWidth(0);
+ statueSeries.addSeriesItem(seriesItem);
+ statueSeries
+ .getSeriesItemList()
+ .get(nStatusLastIndex)
+ .setTooltipText(
+ NetworkPageLabels.NETWORK_CHART_TOOLTIP_CLOSED);
+ }
+ }
+
+ private void setNotFDClosedStatus() {
+ int nStatusLastIndex = statueSeries.getSeriesItemList().size() - 1;
+ if (nStatusLastIndex > -1) {
+ statueSeries.getSeriesItemList().get(nStatusLastIndex)
+ .setEventColor(ColorResources.NETWORK_AREA_NOT_CLOSED_END);
+ statueSeries
+ .getSeriesItemList()
+ .get(nStatusLastIndex)
+ .setEventGradationForegroundColor(
+ ColorResources.NETWORK_AREA_NOT_CLOSED_START);
+ statueSeries
+ .getSeriesItemList()
+ .get(nStatusLastIndex)
+ .setTooltipText(
+ NetworkPageLabels.NETWORK_CHART_TOOLTIP_NOT_CLOSED);
+ }
+ }
+
+ private void setNotFDClosedStatus(NetworkChartDataEvent event) {
+
+ int nStatusLastIndex = statueSeries.getSeriesItemList().size() - 1;
+ if (nStatusLastIndex > -1) {
+ statueSeries.getSeriesItemList().get(nStatusLastIndex)
+ .setEventColor(ColorResources.NETWORK_AREA_NOT_CLOSED_END);
+ statueSeries
+ .getSeriesItemList()
+ .get(nStatusLastIndex)
+ .setEventGradationForegroundColor(
+ ColorResources.NETWORK_AREA_NOT_CLOSED_START);
+ DAChartSeriesItem seriesItem = new DAChartSeriesItem(
+ event.getApiChartTime(),
+ DAChartSeriesItem.SERIES_STATE_BAR,
+ ColorResources.NETWORK_AREA_CLOSED_END,
+ ColorResources.NETWORK_AREA_CLOSED_START,
+ NetworkPageLabels.NETWORK_CHART_TOOLTIP_CLOSED);
+ seriesItem.setBarWidth(0);
+ statueSeries.addSeriesItem(seriesItem);
+ statueSeries
+ .getSeriesItemList()
+ .get(nStatusLastIndex)
+ .setTooltipText(
+ NetworkPageLabels.NETWORK_CHART_TOOLTIP_NOT_CLOSED);
+ }
+ }
+
+ protected int createChartItem(NetworkChartDataEvent event) {
+ DAChartSeriesItem seriesItem = null;
+ DAChartSeriesItem accessItem = null;
+ int apiType = event.getApiType();
+
+ if (event.isFailedAPI() == true) {
+ seriesItem = new DAChartSeriesItem(event.getApiChartTime(),
+ DAChartSeriesItem.SERIES_STATE_BAR,
+ ColorResources.NETWORK_API_FAILED, event.getApiName());
+ apiSeries.addSeriesItem(seriesItem);
+
+ if (apiType == LogCenterConstants.SOCKET_API_CONNECT
+ || apiType == LogCenterConstants.SOCKET_API_ACCEPT_END
+ || apiType == LogCenterConstants.SOCKET_API_SEND_END
+ || apiType == LogCenterConstants.SOCKET_API_RECV_END) {
+ setSocketEndFunc(seriesItem, event);
+ }
+
+ if (apiType == LogCenterConstants.HTTP_API_RESPONSE) {
+ setHTTPEndFunc(seriesItem, event);
+ }
+ return apiType;
+ }
+
+ switch (apiType) {
+ // Socket
+ case LogCenterConstants.SOCKET_API_FD_OPEN:
+ setEventFunc(seriesItem, event);
+ break;
+ case LogCenterConstants.SOCKET_API_CONNECT:
+ setSocketEndFunc(seriesItem, event);
+ break;
+ case LogCenterConstants.SOCKET_API_ACCEPT_START:
+ setStartFunc(seriesItem, accessItem, event);
+ break;
+ case LogCenterConstants.SOCKET_API_ACCEPT_END:
+ setSocketEndFunc(seriesItem, event);
+ break;
+ case LogCenterConstants.SOCKET_API_FD_CLOSE:
+ setEventFunc(seriesItem, event);
+ break;
+ case LogCenterConstants.SOCKET_API_RECV_START:
+ setStartFunc(seriesItem, accessItem, event);
+ break;
+ case LogCenterConstants.SOCKET_API_RECV_END:
+ setSocketEndFunc(seriesItem, event);
+ break;
+ case LogCenterConstants.SOCKET_API_SEND_START:
+ setStartFunc(seriesItem, accessItem, event);
+ break;
+ case LogCenterConstants.SOCKET_API_SEND_END:
+ setSocketEndFunc(seriesItem, event);
+ break;
+ case LogCenterConstants.SOCKET_API_EVENT_START:
+ setStartFunc(seriesItem, accessItem, event);
+ break;
+ case LogCenterConstants.SOCKET_API_EVENT_END:
+ setSocketEndFunc(seriesItem, event);
+ break;
+ case LogCenterConstants.SOCKET_API_BIND:
+ setEventFunc(seriesItem, event);
+ break;
+ case LogCenterConstants.SOCKET_API_LISTEN:
+ setEventFunc(seriesItem, event);
+ break;
+ case LogCenterConstants.SOCKET_API_OTHER:
+ setEventFunc(seriesItem, event);
+ break;
+ // HTTP
+ case LogCenterConstants.HTTP_API_SESSION_CONSTRUCT:
+ setEventFunc(seriesItem, event);
+ break;
+ case LogCenterConstants.HTTP_API_TRANSACTION_OPEN:
+ setEventFunc(seriesItem, event);
+ break;
+ case LogCenterConstants.HTTP_API_TRANSACTION_CLOSE:
+ setEventFunc(seriesItem, event);
+ break;
+ case LogCenterConstants.HTTP_API_ALLOCATION:
+ setEventFunc(seriesItem, event);
+ break;
+ case LogCenterConstants.HTTP_API_SUBMIT:
+ setStartFunc(seriesItem, accessItem, event);
+ break;
+ case LogCenterConstants.HTTP_API_REQUEST:
+ setEventFunc(seriesItem, event);
+ break;
+ case LogCenterConstants.HTTP_API_RESPONSE:
+ setHTTPEndFunc(seriesItem, event);
+ break;
+ case LogCenterConstants.HTTP_API_OTHER:
+ setEventFunc(seriesItem, event);
+ break;
+ case LogCenterConstants.HTTP_API_CLOSE:
+ setEventFunc(seriesItem, event);
+ break;
+
+ default:
+ System.out
+ .println("createChartItem : no case NetworkChartDataEvent : "
+ + apiType);//$NON-NLS-1$
+ return -1;
+ }
+ return apiType;
+ }
+
+ private void setEventFunc(DAChartSeriesItem seriesItem,
+ NetworkChartDataEvent event) {
+ seriesItem = new DAChartSeriesItem(event.getApiChartTime(),
+ DAChartSeriesItem.SERIES_STATE_BAR,
+ ColorResources.NETWORK_API_USED, event.getApiName());
+ if (seriesItem != null) {
+ apiSeries.addSeriesItem(seriesItem);
+ }
+ }
+
+ private void setStartFunc(DAChartSeriesItem seriesItem,
+ DAChartSeriesItem accessItem, NetworkChartDataEvent event) {
+ seriesItem = new DAChartSeriesItem(event.getApiChartTime(),
+ DAChartSeriesItem.SERIES_STATE_BAR,
+ ColorResources.NETWORK_API_USED, event.getApiName());
+
+ Color waitiColor = null;
+ if (event.getApiType() == LogCenterConstants.SOCKET_API_SEND_START) {
+ waitiColor = ColorResources.NETWORK_ACCESS_SEND;
+ } else if (event.getApiType() == LogCenterConstants.SOCKET_API_RECV_START) {
+ waitiColor = ColorResources.NETWORK_ACCESS_RECV;
+ } else if (event.getApiType() == LogCenterConstants.HTTP_API_SUBMIT) {
+ waitiColor = ColorResources.NETWORK_ACCESS_RECV;
+ } else {
+ waitiColor = ColorResources.NETWORK_ACCESS_WAIT;
+ }
+
+ accessItem = new DAChartSeriesItem(event.getApiChartTime(),
+ event.getApiChartTime(), waitiColor, event.getApiName());
+
+ if (seriesItem != null) {
+ apiSeries.addSeriesItem(seriesItem);
+ }
+ if (accessItem != null) {
+ accessSeries.addSeriesItem(accessItem);
+ }
+ }
+
+ private void setHTTPEndFunc(DAChartSeriesItem seriesItem,
+ NetworkChartDataEvent event) {
+ seriesItem = new DAChartSeriesItem(event.getApiChartTime(),
+ DAChartSeriesItem.SERIES_STATE_BAR,
+ ColorResources.NETWORK_API_USED, event.getApiName());
+
+ int lastIndex = accessSeries.getSeriesItemList().size() - 1;
+ if (lastIndex >= 0) {
+ accessSeries.getSeriesItemList().get(lastIndex)
+ .setY(event.getApiChartTime());
+ }
+
+ if (seriesItem != null) {
+ apiSeries.addSeriesItem(seriesItem);
+ }
+ }
+
+ private void setSocketEndFunc(DAChartSeriesItem seriesItem,
+ NetworkChartDataEvent event) {
+ seriesItem = new DAChartSeriesItem(event.getApiChartTime(),
+ DAChartSeriesItem.SERIES_STATE_BAR,
+ ColorResources.NETWORK_API_USED, event.getApiName());
+
+ setSocketAccessSeriesEnd(accessSeries.getSeriesItemList().size() - 1,
+ event.getApiChartTime());
+
+ if (seriesItem != null) {
+ apiSeries.addSeriesItem(seriesItem);
+ }
+ }
+
+ public void setSocketAccessSeriesEnd(int lastIndex, double endTime) {
+ if (lastIndex < 0) {
+ return;
+ }
+ if (isParent()) {
+ for (int i = lastAccessIndexForParent; i < lastIndex; i++) {
+ accessSeries.getSeriesItemList().get(lastIndex).setY(endTime);
+
+ }
+ lastAccessIndexForParent = lastIndex;
+ } else {
+ accessSeries.getSeriesItemList().get(lastIndex).setY(endTime);
+ }
+ }
+
+ public void setSocketOpendTime(double data) {
+ this.socketOpendTime = data;
+ }
+
+ public double getSocketOpendTime() {
+ return this.socketOpendTime / TimelineConstants.MEGA;
+ }
+
+ public void setSocketClosedTime(double data) {
+ socketClosedTime = data;
+ }
+
+ public double getSocketClosedTime() {
+ return this.socketClosedTime / TimelineConstants.MEGA;
+ }
+
+ public void setSocketLastUsedTime(double data) {
+ socketLastUsedTime = data;
+ }
+
+ public double getSocketLastUsedTime() {
+ return this.socketLastUsedTime / TimelineConstants.MEGA;
+ }
+
+ public void setSocketUsedTime(double data) {
+ if (this.socketOpendTime == 0) {
+ this.socketTotalUsedTime = 0;
+ } else {
+ this.socketTotalUsedTime = data - this.socketOpendTime;
+ }
+ setSocketLastUsedTime(data);
+ }
+
+ private double parentTotalUsedTime() {
+ List<String> totalUsedTimeList = new ArrayList<String>();
+ boolean firstInputData = false;
+ double socketTotalUsedTime = 0;
+ NetworkChartData networkData;
+ double firstUsedTime = 0;
+ double lastUsedTime = 0;
+ for (int i = 0; i < children.size(); i++) {
+ networkData = children.get(i);
+ firstUsedTime = networkData.getSocketOpendTime()
+ * TimelineConstants.MEGA;
+ lastUsedTime = networkData.getSocketLastUsedTime()
+ * TimelineConstants.MEGA;
+ if (lastUsedTime == 0) {
+ continue;
+ } else if (!networkData.isFDOpenFailed() && firstInputData == false) {
+ firstInputData = true;
+ totalUsedTimeList
+ .add(Double.toString(firstUsedTime)
+ + CommonConstants.COLON
+ + Double.toString(lastUsedTime));
+ }
+ int nLastIndex = totalUsedTimeList.size() - 1;
+ if (nLastIndex < 0) {
+ continue;
+ }
+ String data = totalUsedTimeList.get(nLastIndex);
+ String[] splitTimeDataList = data.split(CommonConstants.COLON);
+ double savedFirstUsedTime = Double
+ .parseDouble(splitTimeDataList[0]);
+ double savedLastUsedTime = Double.parseDouble(splitTimeDataList[1]);
+ if ((savedFirstUsedTime < firstUsedTime)
+ && (firstUsedTime < savedLastUsedTime)
+ && (savedFirstUsedTime < savedLastUsedTime)
+ && (savedLastUsedTime < lastUsedTime)) {
+ totalUsedTimeList.remove(nLastIndex);
+ totalUsedTimeList
+ .add(Double.toString(savedFirstUsedTime)
+ + CommonConstants.COLON
+ + Double.toString(lastUsedTime));
+ } else if ((savedLastUsedTime < firstUsedTime)
+ && (savedLastUsedTime < lastUsedTime)) {
+ totalUsedTimeList
+ .add(Double.toString(firstUsedTime)
+ + CommonConstants.COLON
+ + Double.toString(lastUsedTime));
+ } else if ((lastUsedTime < savedFirstUsedTime)
+ && (lastUsedTime < savedLastUsedTime)) {
+ totalUsedTimeList
+ .add(Double.toString(firstUsedTime)
+ + CommonConstants.COLON
+ + Double.toString(lastUsedTime));
+ }
+ }
+ int nSize = totalUsedTimeList.size();
+ for (int i = 0; i < nSize; i++) {
+ String data = totalUsedTimeList.get(i);
+ String[] splitTimeDataList = data.split(CommonConstants.COLON); //$NON-NLS-1$
+ double savedFirstUsedTime = Double
+ .parseDouble(splitTimeDataList[0]);
+ double savedLastUsedTime = Double.parseDouble(splitTimeDataList[1]);
+ socketTotalUsedTime += (savedLastUsedTime - savedFirstUsedTime);
+ }
+ return socketTotalUsedTime;
+ }
+
+ public double getTotalUseTime() {
+ if (isParent()) {
+ return parentTotalUsedTime();
+ }
+ if (isClosed(null) == true) {
+ return this.socketLastUsedTime - this.socketOpendTime;
+ } else {
+ return this.socketTotalUsedTime;
+ }
+ }
+
+ public String getThread() {
+ return thread;
+ }
+
+ public void setThread(String thread) {
+ this.thread = thread;
+ }
+
+ public boolean isContainChildFD(String fd) {
+ for (String data : getHasFd()) {
+ if (data.equals(fd)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public List<String> getHasFd() {
+ return hasFd;
+ }
+
+ public void setHasFd(String hasFd) {
+ this.hasFd.add(hasFd);
+ }
+
+ public NetworkChartData getParent() {
+ return parent;
+ }
+
+ public void setParent(NetworkChartData parent) {
+ this.parent = parent;
+ }
+
+ public boolean isFDConnected() {
+ return isFDConnected;
+ }
+
+ public void setFDConnected(boolean isFDConnected) {
+ if (isParent()) {
+ for (int i = 0; i < children.size(); i++) {
+ if (!children.get(i).isFDConnected()) {
+ this.isFDConnected = false;
+ return;
+ }
+ }
+ } else {
+ this.isFDConnected = isFDConnected;
+ }
+ }
+
+ public boolean isServerFD() {
+ for (NetworkChartDataEvent event : getContents()) {
+ if (event.getApiType() == LogCenterConstants.SOCKET_API_BIND) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public NetworkChartDataEvent getEvent() {
+ return event;
+ }
+
+ public void setEvent(NetworkChartDataEvent event) {
+ this.event = event;
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Hyunjong Park <phjwithyou.park@samsung.com>
+ * yeongtaik byeon <yeongtaik.byeon@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.dynamicanalyzer.ui.network;
+
+import org.tizen.dynamicanalyzer.common.CommonConstants;
+import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
+import org.tizen.dynamicanalyzer.swap.model.probe2.FailedData2;
+import org.tizen.dynamicanalyzer.swap.model.probe2.NetworkData;
+import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
+
+public class NetworkChartDataEvent {
+
+ private FailedData2 failedData = null;
+ private String FD = AnalyzerLabels.EMPTY_STRING;
+ private String address = AnalyzerLabels.EMPTY_STRING;
+ private String thread = AnalyzerLabels.EMPTY_STRING;
+
+ private String apiName = AnalyzerLabels.EMPTY_STRING;
+
+ private int apiType = -1;
+
+ private NetworkData contents;
+ private double logTime = -1;
+ private long messageSize = 0;
+ private long sendSize = 0;
+ private long recvSize = 0;
+
+ private boolean isFailedAPI = false;
+
+ private int connectedType = 0;
+ public static final int NETWORK_CHART_SERVER_NAME = 0;
+ public static final int NETWORK_CHART_CLIENT_NAME = 1;
+ public static final int NETWORK_CHART_SESSION_NAME = 2;
+ public static final int NETWORK_CHART_TRANSACTION_NAME =3;
+
+
+ public NetworkChartDataEvent(String address, String Fd, String thread, double time,
+ String apiName, int apyType, int connectedType,NetworkData contents) {
+ setAddress(address);
+ setFD(Fd);
+ setThread(thread);
+ setLogTime(time);
+ setApiName(apiName);
+ setApiType(apyType);
+ setContents(contents);
+ setConnectedType(connectedType);
+ }
+
+ public NetworkChartDataEvent(NetworkData contents) {
+ setContents(contents);
+ }
+
+ public NetworkData getContents() {
+ return contents;
+ }
+
+ public void setContents(NetworkData contents) {
+ this.contents = contents;
+ }
+
+ public String getFD() {
+ if(null == FD){
+ return CommonConstants.EMPTY;
+ }
+ return FD;
+ }
+
+ public void setFD(String fd) {
+ this.FD = fd;
+ }
+
+ public boolean isFailedAPI() {
+ return isFailedAPI;
+ }
+
+ public void setFailedAPI() {
+ this.isFailedAPI = true;
+ }
+
+ public int getApiType() {
+ return apiType;
+ }
+
+ public void setApiType(int apiType) {
+ this.apiType = apiType;
+ }
+
+ public double getLogTime() {
+ return logTime;
+ }
+
+ public void setLogTime(double data) {
+ this.logTime = data;
+ }
+
+ public double getApiChartTime() {
+ return getLogTime() / TimelineConstants.MEGA;
+ }
+
+ public void setAddress(String data) {
+ this.address = data;
+ }
+
+ public String getAddress() {
+ return address;
+ }
+
+ public void setMessageSize(long data) {
+ this.messageSize = data;
+ }
+
+ public long getMessageSize() {
+ return this.messageSize;
+ }
+
+ public void setSendSize(long data) {
+ this.sendSize = data;
+ setMessageSize(data);
+ }
+
+ public long getSendSize() {
+ return this.sendSize;
+ }
+
+ public void setRecvSize(long data) {
+ this.recvSize = data;
+ setMessageSize(data);
+ }
+
+ public long getRecvSize() {
+ return this.recvSize;
+ }
+
+ public void setFailedData(FailedData2 data) {
+ failedData = data;
+ }
+
+ public FailedData2 getFailedData() {
+ return failedData;
+ }
+
+ public String getApiName() {
+ return apiName;
+ }
+
+ public void setApiName(String tooltip) {
+ this.apiName = tooltip;
+ }
+
+ public String getThread() {
+ return thread;
+ }
+
+ public void setThread(String thread) {
+ this.thread = thread;
+ }
+
+ public int connectedType() {
+ return connectedType;
+ }
+
+ public void setConnectedType(int connectedType) {
+ this.connectedType = connectedType;
+ }
+}
--- /dev/null
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Hyunjong Park <phjwithyou.park@samsung.com>
+ * Jooyoul Lee <jy.exe.lee@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.dynamicanalyzer.ui.network;
+
+import java.util.List;
+
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
+import org.tizen.dynamicanalyzer.common.AnalyzerManager;
+import org.tizen.dynamicanalyzer.common.CommonConstants;
+import org.tizen.dynamicanalyzer.logparser.LogListQueue;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
+
+public class NetworkChartManager implements Runnable {
+
+ private LogListQueue logListQueue = null;
+ private Thread updateLogThread = null;
+
+ private NetworkDataMaker networkDataMaker = null;
+
+ private static NetworkChartManager instance = null;
+
+ private String packetMessage = CommonConstants.EMPTY;
+
+ public NetworkChartManager() {
+ networkDataMaker = new NetworkDataMaker(
+ AnalyzerManager.getFailedChecker(),
+ AnalyzerManager.getLeakDetector(),
+ AnalyzerManager.getWarningChecker());
+ }
+
+ public synchronized static NetworkChartManager getInstance() {
+ if (null == instance) {
+ instance = new NetworkChartManager();
+ }
+ return instance;
+ }
+
+ public LogListQueue getLogListQueue() {
+ if (null == logListQueue) {
+ logListQueue = new LogListQueue();
+ }
+ return logListQueue;
+ }
+
+ public void startUpdateLogThread() {
+ if (null == updateLogThread || !updateLogThread.isAlive()) {
+ updateLogThread = new Thread(null, getInstance(),
+ AnalyzerConstants.NETWORK_CHART_MANAGER_THREAD);
+ updateLogThread.start();
+ }
+ }
+
+ public void stopUpdateLogThread() {
+ if (null != updateLogThread && updateLogThread.isAlive()) {
+ try {
+ sendNotify();
+ updateLogThread.join(AnalyzerManager.THREAD_JOIN_WAIT_TIME);
+ System.out.println("network chart manager joined!"); //$NON-NLS-1$
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public boolean isThreadAlive() {
+ if (null == updateLogThread || !updateLogThread.isAlive()) {
+ return false;
+ }
+ return true;
+ }
+
+ public NetworkDataMaker getNetworkDataMaker() {
+ return networkDataMaker;
+ }
+
+ /*** make network data thread ***/
+ @Override
+ public void run() {
+ LogListQueue logListQueue = getInstance().getLogListQueue();
+ while (!AnalyzerManager.isExit()) {
+ List<LogData> logs = logListQueue.getFirst();
+ if (null == logs) {
+ break;
+ }
+ getInstance().getNetworkDataMaker().makeData(logs);
+ }
+
+ /* log for debug */
+ System.out.println("file manager thread end!!"); //$NON-NLS-1$
+ }
+
+
+ public void clear() {
+ instance = null;
+ networkDataMaker.clear();
+ }
+
+ public static void sendNotify() {
+ LogListQueue logListQueue = getInstance().getLogListQueue();
+ synchronized (logListQueue) {
+ logListQueue.notifyAll();
+ }
+ }
+
+ public int[] getParentChartIndex(String seq) {
+ int parentChartIndex = -1;
+ NetworkChartData chartData = null;
+ List<NetworkChartData> networkChartDataLow = NetworkChartManager
+ .getInstance().getNetworkDataMaker().getNetworkChartLow();
+ for (int i = 0; i < networkChartDataLow.size(); i++) {
+ chartData = networkChartDataLow.get(i);
+ if (chartData.getChildCount() != 0) {
+ parentChartIndex++;
+ if (isEqulasSeq(chartData, seq)) {
+ return new int[] { parentChartIndex, i };
+ }
+ }
+ }
+ return new int[] { 0, 0 };
+ }
+
+ public int getChildChartIndex(int parentChartIndex, String seq) {
+ List<NetworkChartData> networkChartDataLow = NetworkChartManager
+ .getInstance().getNetworkDataMaker().getNetworkChartLow();
+ List<NetworkChartData> childData = networkChartDataLow.get(
+ parentChartIndex).getChild();
+ NetworkChartData childChartData = null;
+ for (int i = 0; i < childData.size(); i++) {
+ childChartData = childData.get(i);
+ if (isEqulasSeq(childChartData, seq)) {
+ return i;
+ }
+ }
+ return 0;
+ }
+
+ public boolean isEqulasSeq(NetworkChartData chartData, String seq) {
+ for (int j = 0; j < chartData.getContents().size(); j++) {
+ Long seqlong = chartData.getContents().get(j).getContents().getTime();
+ if (Long.toString(seqlong).equals(seq)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public String getPacketMessage() {
+ return this.packetMessage;
+ }
+
+ public void setPacketMessage(String packetMessage) {
+ final String LeftForm = CommonConstants.SPACE + CommonConstants.SPACE
+ + CommonConstants.SPACE + CommonConstants.SPACE;
+ if (!packetMessage.equals(CommonConstants.EMPTY)
+ && packetMessage != null) {
+ StringBuffer out = new StringBuffer();
+ StringBuffer strHex = new StringBuffer();
+ StringBuffer strAscii = new StringBuffer();
+ int nIndex = 0;
+ boolean isPreNewLineFirtChart = false;
+ for (byte sbyte : packetMessage.getBytes()) {
+ strHex.append(String.format("0x%02X ",
+ (int) packetMessage.charAt(nIndex)));//$NON-NLS-1$
+ strAscii.append(packetMessage.charAt(nIndex));
+ if (sbyte == 92) {
+ isPreNewLineFirtChart = true;
+ } else if (sbyte == 110 && isPreNewLineFirtChart == true) {
+ strAscii.append(CommonConstants.NEW_LINE + LeftForm);
+ strHex.append(CommonConstants.NEW_LINE + LeftForm);
+ } else {
+ isPreNewLineFirtChart = false;
+ }
+
+ nIndex++;
+ if (nIndex >= packetMessage.length()) {
+ break;
+ }
+ }
+ out.append("<ASCII>" + CommonConstants.NEW_LINE + LeftForm);//$NON-NLS-1$
+ out.append(strAscii.toString());
+ out.append(CommonConstants.NEW_LINE + CommonConstants.SPACE
+ + CommonConstants.SPACE
+ + "<HEX>" + CommonConstants.NEW_LINE + LeftForm);//$NON-NLS-1$
+ out.append(strHex.toString());
+ this.packetMessage = out.toString();
+ }
+
+ }
+}
--- /dev/null
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Hyunjong Park <phjwithyou.park@samsung.com>
+ * yeongtaik byeon <yeongtaik.byeon@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.dynamicanalyzer.ui.network;
+
+import java.util.List;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StackLayout;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
+import org.tizen.dynamicanalyzer.common.AnalyzerManager;
+import org.tizen.dynamicanalyzer.common.DASelectionData;
+import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
+import org.tizen.dynamicanalyzer.model.DAView;
+import org.tizen.dynamicanalyzer.nl.NetworkPageLabels;
+import org.tizen.dynamicanalyzer.resources.ColorResources;
+import org.tizen.dynamicanalyzer.resources.FontResources;
+import org.tizen.dynamicanalyzer.resources.ImageResources;
+import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
+import org.tizen.dynamicanalyzer.swap.logparser.Logs;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
+import org.tizen.dynamicanalyzer.ui.common.SetRangeMarkerMouseMoveListener;
+import org.tizen.dynamicanalyzer.ui.common.UICommonConstants;
+import org.tizen.dynamicanalyzer.ui.file.FileChartManager;
+import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
+import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
+import org.tizen.dynamicanalyzer.ui.timeline.logparser.LifecycleLogParser;
+import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
+import org.tizen.dynamicanalyzer.ui.widgets.TitleComboPopupRenderer;
+import org.tizen.dynamicanalyzer.ui.widgets.TitleComboRenderer;
+import org.tizen.dynamicanalyzer.ui.widgets.ViewContainer;
+import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonRenderer;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotIntervalMarker;
+import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
+import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardItem;
+import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardSelectionListener;
+import org.tizen.dynamicanalyzer.widgets.combo.DACustomCombo;
+import org.tizen.dynamicanalyzer.widgets.timeline.DATimeline;
+
+
+public class NetworkChartView extends DAView {
+ public static final String ID = NetworkChartView.class.getName();
+ public final static int NETWORK_CHART_HEIGHT = 40;
+
+ private final Composite contents;
+ private DAChartBoard networkChart;
+ private DACustomCombo networkCombo;
+ private final StackLayout stackLayout;
+
+ private final RangeDataManager rangeDataManager = RangeDataManager
+ .getInstance();
+
+ public NetworkChartView(Composite parent, int style) {
+ super(parent, style);
+ this.setLayout(new FillLayout());
+
+ ViewContainer viewContainer = new ViewContainer(this, false);
+ viewContainer.setTitleText(NetworkPageLabels.NETWORK_CHART);
+
+ contents = viewContainer.getContentArea();
+ contents.setBackground(ColorResources.WINDOW_BG_COLOR);
+ stackLayout = new StackLayout();
+ contents.setLayout(stackLayout);
+ networkChart = new DAChartBoard(contents,
+ NetworkPageLabels.NETWORK_CHART);
+ networkChart.setNameFont(FontResources.CHART_NAME_FONT);
+ networkChart.addSelectionListener(new DAChartBoardSelectionListener() {
+
+ @Override
+ public void handleSelectionEvent(DAChartBoardItem item) {
+ AnalyzerManager
+ .getCurrentPage()
+ .updatePage(
+ new DASelectionData(
+ NetworkChartView.ID,
+ (long) (((DAChartPlotIntervalMarker) networkChart
+ .getMarkers()
+ .get(UICommonConstants.SELECTION_MARKER_INDEX))
+ .getStartVal() * TimelineConstants.MEGA),
+ (long) (((DAChartPlotIntervalMarker) networkChart
+ .getMarkers()
+ .get(UICommonConstants.SELECTION_MARKER_INDEX))
+ .getEndVal() * TimelineConstants.MEGA),
+ item.getData(), null));
+ }
+ });
+
+ initIntervalMarkers(networkChart);
+
+ stackLayout.topControl = networkChart;
+ networkCombo = new DACustomCombo(networkChart.getTitleComp(), SWT.NONE);
+ networkCombo.setImages(ImageResources.TIMELINE_DROPDOWN_NORMAL,
+ ImageResources.TIMELINE_DROPDOWN_HOVER,
+ ImageResources.TIMELINE_DROPDOWN_PUSH,
+ ImageResources.TIMELINE_DROPDOWN_NORMAL);
+ networkCombo.add(NetworkPageLabels.NETWORK_CHART);
+ networkCombo.setTextAlign(DACustomCombo.TEXT_ALIGN_CENTER);
+ networkCombo.select(0);
+ networkCombo.setEnabled(false);
+ networkCombo.setComboRender(new TitleComboRenderer());
+ networkCombo.setComboPopupRender(new TitleComboPopupRenderer());
+ networkCombo.setButtonRenderer(new DACustomButtonRenderer());
+
+ DATimeline timeline = networkChart.getTimeline();
+
+ timeline.setTimeTickFont(FontResources.TIMELINE_TICK_FONT);
+ timeline.setTimeBalloonFont(FontResources.TIMELINE_BALLOON_FONT);
+
+ LifecycleLogParser.getInstance().registerLifecycleBar(
+ networkChart.getLifecycleBar());
+ LifecycleLogParser.getInstance().registerTimeline(timeline);
+
+ timeline.addMouseMoveListener(new SetRangeMarkerMouseMoveListener(
+ rangeDataManager, networkChart, timeline));
+
+ clear();
+ }
+
+ @Override
+ public void updateView() {
+ NetworkChartManager.getInstance().getNetworkDataMaker().checkUpdate();
+
+ networkChart.setTotalEndTime(ToolbarArea.getInstance().getTime());
+
+ networkChart.setTimelineMarkerStartTime(rangeDataManager
+ .getMarkerStartTime() / TimelineConstants.MEGA);
+ networkChart.setTimelineMarkerEndTime(rangeDataManager.getMarkerEndTime()
+ / TimelineConstants.MEGA);
+
+ if (RangeDataManager.getInstance().isBeingAnalyzed()) {
+ ((DAChartPlotIntervalMarker) networkChart.getMarkers().get(
+ UICommonConstants.RANGE_ANALYSIS_MARKER_INDEX))
+ .setInterval(rangeDataManager.getAnalysisStartTime()
+ / TimelineConstants.MEGA,
+ rangeDataManager.getAnalysisEndTime()
+ / TimelineConstants.MEGA);
+ } else {
+ ((DAChartPlotIntervalMarker) networkChart.getMarkers().get(
+ UICommonConstants.RANGE_ANALYSIS_MARKER_INDEX))
+ .setInterval(-1, -1);
+ }
+
+ ((DAChartPlotIntervalMarker) networkChart.getMarkers().get(
+ UICommonConstants.RANGE_MARKER_INDEX)).setInterval(
+ rangeDataManager.getMarkerStartTime() / TimelineConstants.MEGA,
+ rangeDataManager.getMarkerEndTime() / TimelineConstants.MEGA);
+
+ }
+
+ @Override
+ public void updateView(DASelectionData selData) {
+ long start = selData.getStartTime();
+ long end = selData.getEndTime();
+
+ double startTime = (double) start / TimelineConstants.MEGA;
+ double endTime = (double) end / TimelineConstants.MEGA;
+ double middleTime = (startTime + endTime) / 2.0;
+ if (start == end) {
+ middleTime = startTime;
+ }
+
+ DAChartBoard chartBoard = (DAChartBoard) stackLayout.topControl;
+
+ chartBoard.setVisibleMiddleTime(middleTime);
+ DAChartPlotIntervalMarker intervalMarker = (DAChartPlotIntervalMarker) chartBoard
+ .getMarkers().get(UICommonConstants.SELECTION_MARKER_INDEX);
+ intervalMarker.setStartVal(startTime);
+ intervalMarker.setEndVal(endTime);
+ }
+
+ @Override
+ public void setSelection(LogData data) {
+ if (null == data) {
+ return;
+ }
+ int seq = data.getSeq();
+ int selectedIndex[] = FileChartManager.getInstance().getParentChartIndex(seq);
+ networkChart.selectItem(selectedIndex[0], FileChartManager.getInstance()
+ .getChildChartIndex(selectedIndex[1], seq));
+ }
+
+ @Override
+ public void updateLog(LogPackage logPack) {
+ Logs logs = logPack.getLogs(AnalyzerConstants.MSG_PROBE_NETWORK);
+ if (null == logs || logs.getLogs().size() == 0) {
+ return;
+ }
+ List<LogData> inputs = logs.getCloneLogs();
+
+ NetworkChartManager.getInstance().getLogListQueue().putLog(inputs);
+ }
+
+
+ @Override
+ public void clear() {
+ networkChart.clear();
+ initIntervalMarkers(networkChart);
+ NetworkChartManager.getInstance().getNetworkDataMaker().clear();
+ NetworkChartManager.getInstance().getNetworkDataMaker()
+ .setBoard(networkChart);
+ }
+
+ @Override
+ public Control getControl() {
+ return networkChart;
+ }
+
+ private void initIntervalMarkers(DAChartBoard board) {
+ // selection marker
+ DAChartPlotIntervalMarker selectionMarker = new DAChartPlotIntervalMarker(
+ -1, -1, DAChartPlotIntervalMarker.INTERVAL_MARKER_STYLE_AREA);
+ selectionMarker.setBackgroundColor(ColorResources.SELECTION_RANGE);
+ selectionMarker.setAlpha((int) (255 * 0.25));
+ board.addIntervalMarker(selectionMarker);
+
+ // range analysis marker
+ DAChartPlotIntervalMarker rangeAnalyzeMarker = new DAChartPlotIntervalMarker(
+ -1, -1, DAChartPlotIntervalMarker.INTERVAL_MARKER_STYLE_AREA);
+ rangeAnalyzeMarker.setBackgroundColor(ColorResources.YELLOW);
+ rangeAnalyzeMarker.setAlpha((int) (255 * 0.25));
+ board.addIntervalMarker(rangeAnalyzeMarker);
+
+ // range marker
+ DAChartPlotIntervalMarker rangeMarker = new DAChartPlotIntervalMarker(
+ -1, -1, DAChartPlotIntervalMarker.INTERVAL_MARKER_STYLE_LINE);
+ rangeMarker.setForegroundColor(ColorResources.RED);
+ rangeMarker.setAlpha((int) (255 * 0.25));
+ board.addIntervalMarker(rangeMarker);
+ }
+
+}
--- /dev/null
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Hyunjong Park <phjwithyou.park@samsung.com>
+ * Jooyoul Lee <jy.exe.lee@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.dynamicanalyzer.ui.network;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import org.tizen.dynamicanalyzer.common.AnalyzerManager;
+import org.tizen.dynamicanalyzer.common.CommonConstants;
+import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
+import org.tizen.dynamicanalyzer.nl.NetworkPageLabels;
+import org.tizen.dynamicanalyzer.nl.ThreadPageLabels;
+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.model.probe2.FailedData2;
+import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
+import org.tizen.dynamicanalyzer.swap.model.probe2.NetworkData;
+import org.tizen.dynamicanalyzer.ui.common.PopupAnalysisMenuItemClickListener;
+import org.tizen.dynamicanalyzer.ui.common.PopupClearMenuItemClickListener;
+import org.tizen.dynamicanalyzer.ui.common.PopupEndMenuItemClickListener;
+import org.tizen.dynamicanalyzer.ui.common.PopupFromSelectionMenuItemClickListener;
+import org.tizen.dynamicanalyzer.ui.common.PopupStartMenuItemClickListener;
+import org.tizen.dynamicanalyzer.ui.summary.failed.FailedChecker;
+import org.tizen.dynamicanalyzer.ui.summary.leaks.LeakDetector;
+import org.tizen.dynamicanalyzer.ui.summary.warning.WarningChecker;
+import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChart;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotTooltip;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeries;
+import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
+import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardItem;
+import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenu;
+import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenuItem;
+
+public class NetworkDataMaker {
+ private DAChartBoard board;
+ private List<NetworkChartData> unConnectedDataList = new ArrayList<NetworkChartData>();
+ private List<NetworkChartData> connectedDataList = new ArrayList<NetworkChartData>();
+
+ private List<NetworkChartDataEvent> networkEventQueue = new ArrayList<NetworkChartDataEvent>();
+
+ private List<NetworkChartDataEvent> unConnectedEventQueue = new ArrayList<NetworkChartDataEvent>();
+
+ private HashMap<String, String> addressByFdHashMap = new HashMap<String, String>();
+ private HashMap<String, String> parentFDByFdHashMap = new HashMap<String, String>();
+
+ private DAChartBoardItem networkTrafficItem;
+
+ private WarningChecker warningChecker = null;
+ private FailedChecker failedChecker = null;
+
+ public NetworkDataMaker(FailedChecker failedChecker,
+ LeakDetector leakDetector, WarningChecker warningChecker) {
+ this.failedChecker = failedChecker;
+ this.warningChecker = warningChecker;
+ }
+
+ public void setBoard(DAChartBoard board) {
+ this.board = board;
+ }
+
+ public void clear() {
+ unConnectedDataList.clear();
+ connectedDataList.clear();
+ networkEventQueue.clear();
+ addressByFdHashMap.clear();
+ parentFDByFdHashMap.clear();
+ networkTrafficItem = null;
+ NetworkTrafficChart.getInstance().clear();
+
+ }
+
+ public List<NetworkChartData> getNetworkChartLow() {
+ return connectedDataList;
+ }
+
+ /**
+ *
+ * @param inputs
+ */
+ public void makeData(List<LogData> inputs) {
+ int size = inputs.size();
+ for (int i = 0; i < size; i++) {
+ NetworkData input = (NetworkData) inputs.get(i);
+
+ if (AnalyzerUtil.isInternal(input)) {
+ continue;
+ }
+
+ NetworkChartDataEvent event = makeEventData(input);
+
+ if (event.isFailedAPI()) {
+ FailedData2 ffd = new FailedData2(input);
+ event.setFailedData(ffd);
+ this.failedChecker.getFailedList().add(ffd);
+ }
+
+ setTrafficData(event);
+
+ checkClosedFDForFailedFD(event);
+ networkEventQueue.add(event);
+ }
+ }
+
+ private NetworkChartDataEvent makeEventData(NetworkData input) {
+ String apiAddress = input.getdestinationIPAddress();
+ String apiFD = Long.toString(input.getFdValue());
+ String apiThread = Integer.toString(input.getTid());
+ String apiName = input.getApiName();
+ int apiType = input.getFdApiType();
+ double time = input.getTime();
+ long errno = input.getErrno();
+
+ int connectedType = 5;
+
+ String parentAddress = addressByFdHashMap.get(apiFD);
+ if (null != parentAddress) { // get Address by FD
+ apiAddress = parentAddress;
+ }
+
+ switch (apiType) {
+ // Socket
+ case LogCenterConstants.SOCKET_API_FD_OPEN:
+ break;
+ case LogCenterConstants.SOCKET_API_CONNECT: {
+ connectedType = NetworkChartDataEvent.NETWORK_CHART_CLIENT_NAME;
+ updatePreviousEventData(apiFD, apiAddress, connectedType);
+ break;
+ }
+ case LogCenterConstants.SOCKET_API_ACCEPT_START:
+ break;
+ case LogCenterConstants.SOCKET_API_ACCEPT_END: {
+ String clientFD = Long.toString(input.getReturn());
+ addressByFdHashMap.put(clientFD, parentAddress);
+ if (errno == 0) {
+ NetworkChartDataEvent event = new NetworkChartDataEvent(
+ apiAddress, apiFD, apiThread, time, apiName, apiType,
+ NetworkChartDataEvent.NETWORK_CHART_SERVER_NAME, input);
+ networkEventQueue.add(event);
+ }
+ apiFD = clientFD;
+ connectedType = NetworkChartDataEvent.NETWORK_CHART_CLIENT_NAME;
+ break;
+ }
+ case LogCenterConstants.SOCKET_API_FD_CLOSE: {
+ if (errno == 0) {
+ addressByFdHashMap.remove(apiFD);
+ }
+ break;
+ }
+ case LogCenterConstants.SOCKET_API_RECV_START:
+ break;
+ case LogCenterConstants.SOCKET_API_RECV_END:
+ break;
+ case LogCenterConstants.SOCKET_API_SEND_START:
+ break;
+ case LogCenterConstants.SOCKET_API_SEND_END:
+ break;
+ case LogCenterConstants.SOCKET_API_EVENT_START:
+ break;
+ case LogCenterConstants.SOCKET_API_EVENT_END:
+ break;
+ case LogCenterConstants.SOCKET_API_BIND: {
+ connectedType = NetworkChartDataEvent.NETWORK_CHART_SERVER_NAME;
+ updatePreviousEventData(apiFD, apiAddress, connectedType);
+ break;
+ }
+ case LogCenterConstants.SOCKET_API_LISTEN:
+ break;
+ case LogCenterConstants.SOCKET_API_OTHER: {
+ if (apiName.contains("epoll_ctl")) { //$NON-NLS-1$
+ String[] strInput = input.getArgs()
+ .split(CommonConstants.COMMA);
+ if (strInput.length <= 0) {
+ return null;
+ }
+ String clientFD = strInput[0];
+ addressByFdHashMap.put(clientFD, parentAddress);
+ if (errno == 0) {
+ }
+ apiFD = clientFD;
+ connectedType = NetworkChartDataEvent.NETWORK_CHART_SERVER_NAME;
+ updatePreviousEventData(apiFD, apiAddress, connectedType);
+ }
+ break;
+ }
+ // HTTP
+ case LogCenterConstants.HTTP_API_SESSION_CONSTRUCT:
+ addressByFdHashMap.put(apiFD, apiAddress);
+ parentFDByFdHashMap.put(apiFD, apiFD);
+ connectedType = NetworkChartDataEvent.NETWORK_CHART_SESSION_NAME;
+ break;
+ case LogCenterConstants.HTTP_API_TRANSACTION_OPEN: {
+ String clientFD = Long.toString(input.getReturn());
+ String parrentAddress = addressByFdHashMap.get(apiFD);
+ if (null != parrentAddress) {
+ apiAddress = parrentAddress;
+ }
+ addressByFdHashMap.put(clientFD, apiAddress);
+ apiFD = clientFD;
+ connectedType = NetworkChartDataEvent.NETWORK_CHART_TRANSACTION_NAME;
+ break;
+ }
+ case LogCenterConstants.HTTP_API_TRANSACTION_CLOSE: {
+ String clientFD = input.getArgs().trim();
+ if (!clientFD.contains(CommonConstants.EMPTY)) {
+ apiFD = clientFD;
+ }
+ break;
+ }
+ case LogCenterConstants.HTTP_API_ALLOCATION: {
+ String clientFD = Long.toString(input.getReturn());
+ String parretnFD = parentFDByFdHashMap.get(apiFD);
+ if (null != parretnFD) {
+ apiFD = parretnFD;
+ }
+ String parrentAddress = addressByFdHashMap.get(apiFD);
+ if (null != parrentAddress) {
+ apiAddress = parrentAddress;
+ }
+
+ addressByFdHashMap.put(clientFD, apiAddress);
+ parentFDByFdHashMap.put(clientFD, apiFD);
+ break;
+ }
+ case LogCenterConstants.HTTP_API_SUBMIT: {
+ String parretnFD = parentFDByFdHashMap.get(apiFD);
+ if (null != parretnFD) {
+ apiFD = parretnFD;
+ }
+ String parrentAddress = addressByFdHashMap.get(apiFD);
+ if (null != parrentAddress) {
+ apiAddress = parrentAddress;
+ }
+ break;
+ }
+ case LogCenterConstants.HTTP_API_REQUEST: {
+ String parretnFD = parentFDByFdHashMap.get(apiFD);
+ if (null != parretnFD) {
+ apiFD = parretnFD;
+ }
+ String parrentAddress = addressByFdHashMap.get(apiFD);
+ if (null != parrentAddress) {
+ apiAddress = parrentAddress;
+ }
+ break;
+ }
+ case LogCenterConstants.HTTP_API_RESPONSE: {
+ String clientFD = Long.toString(input.getReturn());
+ String parretnFD = parentFDByFdHashMap.get(apiFD);
+ if (null != parretnFD) {
+ apiFD = parretnFD;
+ }
+ String parrentAddress = addressByFdHashMap.get(apiFD);
+ if (null != parrentAddress) {
+ apiAddress = parrentAddress;
+ }
+
+ addressByFdHashMap.put(clientFD, apiAddress);
+ parentFDByFdHashMap.put(clientFD, apiFD);
+ break;
+ }
+ case LogCenterConstants.HTTP_API_OTHER: {
+ String parretnFD = parentFDByFdHashMap.get(apiFD);
+ if (null != parretnFD) {
+ apiFD = parretnFD;
+ }
+ String parrentAddress = addressByFdHashMap.get(apiFD);
+ if (null != parrentAddress) {
+ apiAddress = parrentAddress;
+ }
+ break;
+ }
+ case LogCenterConstants.HTTP_API_CLOSE: {
+ if (errno == 0) {
+ addressByFdHashMap.remove(apiFD);
+ }
+
+ break;
+ }
+ default:
+ System.out
+ .println("makeEventData : no case NetworkChartDataEvent : "
+ + apiType);//$NON-NLS-1$
+ return null;
+ }
+
+ NetworkChartDataEvent event = new NetworkChartDataEvent(apiAddress,
+ apiFD, apiThread, time, apiName, apiType, connectedType, input);
+ if (errno != 0) {
+ event.setFailedAPI();
+ }
+ return event;
+ }
+
+ private void setTrafficData(NetworkChartDataEvent event) {
+ if (event.getApiType() == LogCenterConstants.SOCKET_API_SEND_END
+ || event.getApiType() == LogCenterConstants.HTTP_API_REQUEST) {
+ event.setSendSize(event.getContents().getPacketMessageSize());
+ NetworkTrafficChart.getInstance().setSendSize(
+ event.getContents().getPacketMessageSize(),
+ Long.toString(event.getContents().getTime()));
+ } else if (event.getApiType() == LogCenterConstants.SOCKET_API_RECV_END
+ || event.getApiType() == LogCenterConstants.HTTP_API_RESPONSE) {
+ event.setRecvSize(event.getContents().getPacketMessageSize());
+ NetworkTrafficChart.getInstance().setRecvSize(
+ event.getContents().getPacketMessageSize(),
+ Long.toString(event.getContents().getTime()));
+ }
+ }
+
+ private void updatePreviousEventData(String apiFD, String apiAddress,
+ int connectType) {
+ addressByFdHashMap.put(apiFD, apiAddress);
+ List<NetworkChartDataEvent> removeEventQueue = new ArrayList<NetworkChartDataEvent>();
+ for (NetworkChartDataEvent event : unConnectedEventQueue) {
+ if (event.getFD().equals(apiFD)) {
+ event.setAddress(apiAddress);
+ event.setConnectedType(connectType);
+ networkEventQueue.add(event);
+ removeEventQueue.add(event);
+ }
+ }
+ unConnectedEventQueue.removeAll(removeEventQueue);
+ for (NetworkChartDataEvent event : networkEventQueue) {
+ if (event.getFD().equals(apiFD)) {
+ event.setAddress(apiAddress);
+ event.setConnectedType(connectType);
+ }
+ }
+ }
+
+ private void checkClosedFDForFailedFD(NetworkChartDataEvent data) {
+ // if (data.isFailedAPI()
+ // && data.getApiType() != LogCenterConstants.SOCKET_API_OTHER) {
+ // if (!warningChecker.isChecked(data.getFD(),
+ // WarningCase.CLOSED_NETWORK_FD.getType())) {
+ // WarningData wData = new WarningData(
+ // LogCenterConstants.LOG_NETWORK,
+ // WarningCase.CLOSED_NETWORK_FD.getType(),
+ // data.getContents(), data.getFD());
+ // warningChecker.getWarningData().add(wData);
+ // }
+ // }
+ // if (data.getApiType() == LogCenterConstants.SOCKET_API_RECV_END
+ // && data.getRecvSize() <= 0) {
+ // if (!warningChecker.isChecked(data.getFD(),
+ // WarningCase.CLOSED_NETWORK_FD.getType())) {
+ // WarningData wData = new WarningData(
+ // LogCenterConstants.LOG_NETWORK,
+ // WarningCase.CLOSED_NETWORK_FD.getType(),
+ // data.getContents(), data.getFD());
+ // warningChecker.getWarningData().add(wData);
+ // }
+ // }
+ // if (data.getApiType() == LogCenterConstants.SOCKET_API_FD_CLOSE) {
+ // if (warningChecker.isChecked(data.getFD(),
+ // WarningCase.CLOSED_NETWORK_FD.getType())) {
+ // warningChecker.removeData(data.getFD(),
+ // WarningCase.CLOSED_NETWORK_FD.getType());
+ //
+ // }
+ // }
+ }
+
+ private void initNetworkChart(DAChart chart, boolean isParent) {
+ if (null == chart) {
+ return;
+ }
+
+ DAChartPlot plot = chart.getPlot();
+ if (null == plot) {
+ return;
+ }
+ if (true == isParent) {
+ plot.setBackgroundImage(ImageResources.BG_GRADIENT);
+ } else {
+ plot.setBackgroundImage(ImageResources.BG_CHILD_GRADIENT);
+ }
+ // plot.setAutoHeightRange(AutoRangeType.MANUAL);
+ plot.setAxisFont(FontResources.CHART_AXIS_FONT);
+ plot.setAxisRangeY(0, 101);
+ plot.setAxisRangeX(board.getVisibleStartTime(),
+ board.getVisibleEndTime());
+
+ DAChartPlotTooltip tooltip = new DAChartPlotTooltip(-1);
+ tooltip.setFont(FontResources.CHART_TOOLTIP_FONT);
+ plot.setTooltip(tooltip);
+ plot.setMarkers(board.getMarkers());
+
+ DAPopupMenu popupMenu = new DAPopupMenu(chart);
+ popupMenu.setFont(FontResources.CONTEXT_MENU_ITEM_FONT);
+ DAPopupMenuItem startItem = new DAPopupMenuItem(popupMenu,
+ DAPopupMenuItem.NONE);
+ startItem.setText(TimelineChartLabels.RANGE_CONTEXT_SET_START);
+ startItem.addListener(new PopupStartMenuItemClickListener(startItem,
+ board));
+
+ DAPopupMenuItem endItem = new DAPopupMenuItem(popupMenu,
+ DAPopupMenuItem.NONE);
+ endItem.setText(TimelineChartLabels.RANGE_CONTEXT_SET_END);
+ endItem.addListener(new PopupEndMenuItemClickListener(endItem, board));
+
+ DAPopupMenuItem fromSelectionItem = new DAPopupMenuItem(popupMenu,
+ DAPopupMenuItem.NONE);
+ fromSelectionItem
+ .setText(TimelineChartLabels.RANGE_CONTEXT_SET_FROM_SELECTION);
+ fromSelectionItem
+ .addListener(new PopupFromSelectionMenuItemClickListener(
+ fromSelectionItem, board));
+
+ DAPopupMenuItem analysisItem = new DAPopupMenuItem(popupMenu,
+ DAPopupMenuItem.NONE);
+ analysisItem.setText(TimelineChartLabels.RANGE_CONTEXT_ANALYSIS);
+ analysisItem.addListener(new PopupAnalysisMenuItemClickListener());
+
+ DAPopupMenuItem clearItem = new DAPopupMenuItem(popupMenu,
+ DAPopupMenuItem.NONE);
+ clearItem.setText(TimelineChartLabels.RANGE_CONTEXT_CLEAR);
+ clearItem.addListener(new PopupClearMenuItemClickListener());
+
+ // TimelineChartMouseEventListener timelineChartMouseEventListener = new
+ // TimelineChartMouseEventListener(
+ // popupMenu, board.getTimeline());
+ // chart.addMouseListener(timelineChartMouseEventListener);
+ // chart.addMouseMoveListener(timelineChartMouseEventListener);
+ // chart.addMouseTrackListener(new TimelineChartMouseTrackAdapter(board
+ // .getTimeline()));
+ }
+
+ private boolean createNetworkBoardItem(NetworkChartData parent,
+ NetworkChartData sync, int connectedType) {
+ DAChartBoardItem item;
+ DAChart chart;
+ if (null == parent) {
+ item = new DAChartBoardItem(board, sync.getAddressName());
+ chart = item.getChart();
+ initNetworkChart(chart, true);
+ } else {
+ DAChartBoardItem parentItem = parent.getItem();
+ String objectName = "";
+ if (connectedType == NetworkChartDataEvent.NETWORK_CHART_SERVER_NAME) {
+ objectName = NetworkPageLabels.NETWORK_CHART_SERVER_NAME;
+ } else if (connectedType == NetworkChartDataEvent.NETWORK_CHART_CLIENT_NAME) {
+ objectName = NetworkPageLabels.NETWORK_CHART_CLIENT_NAME;
+ } else if (connectedType == NetworkChartDataEvent.NETWORK_CHART_SESSION_NAME) {
+ objectName = NetworkPageLabels.NETWORK_CHART_SESSION_NAME;
+ } else if (connectedType == NetworkChartDataEvent.NETWORK_CHART_TRANSACTION_NAME) {
+ objectName = NetworkPageLabels.NETWORK_CHART_TRANSACTION_NAME;
+ }
+
+ item = new DAChartBoardItem(parentItem, objectName + sync.getFD());
+
+ chart = item.getChart();
+ initNetworkChart(chart, false);
+ }
+
+ DAChartSeries apiSeries = new DAChartSeries(
+ NetworkPageLabels.NETWORK_CHART_API,
+ DAChartSeries.SERIES_STYLE_EVENT, ColorResources.YELLOW);
+
+ DAChartSeries stateSeries = new DAChartSeries(
+ NetworkPageLabels.NETWORK_CHART_SERIES,
+ DAChartSeries.SERIES_STYLE_STATE, ColorResources.WHITE);
+
+ DAChartSeries accessSeries = new DAChartSeries(
+ NetworkPageLabels.NETWORK_CHART_ACCESS,
+ DAChartSeries.SERIES_STYLE_EVENT_AREA, ColorResources.WHITE);
+
+ apiSeries.setSummarizeTooltipText(ThreadPageLabels.THREAD_TOOLTIP_APIS);
+
+ chart.addSeries(stateSeries);
+ chart.addSeries(apiSeries);
+ chart.addSeries(accessSeries);
+
+ sync.setItem(item);
+ item.setData(sync);
+ chart.setData(sync);
+ chart.redraw();
+ return true;
+ }
+
+ private boolean createNetworkTrafficBoardItem() {
+ if (null == networkTrafficItem) {
+ if (null == board) {
+ return false;
+ }
+ DAChart chart;
+ networkTrafficItem = NetworkTrafficChart.getInstance()
+ .createBoardItem(board);
+ chart = networkTrafficItem.getChart();
+ initNetworkChart(chart, true);
+
+ }
+ return true;
+ }
+
+ private NetworkChartData findAddressChart(NetworkChartDataEvent data) {
+
+ String address = addressByFdHashMap.get(data.getFD());
+ if (null != address) {
+ data.setAddress(address);
+ }
+ NetworkChartData returnData = null;
+ for (int i = 0; i < connectedDataList.size(); i++) {
+ returnData = connectedDataList.get(i);
+ if (returnData.getAddress().equals(data.getAddress())) {
+ return returnData;
+ }
+ }
+ return null;
+ }
+
+ public void checkUpdate() {
+
+ createNetworkTrafficBoardItem();
+
+ if (!AnalyzerManager.isRunning()) {
+ int size = unConnectedDataList.size();
+ NetworkChartData data;
+ for (int i = 0; i < size; i++) {
+ data = unConnectedDataList.get(i);
+ data.checkUpdate();
+ }
+
+ size = connectedDataList.size();
+ for (int i = 0; i < size; i++) {
+ data = connectedDataList.get(i);
+ data.checkUpdate();
+ }
+ }
+
+ NetworkTrafficChart.getInstance().updateTrafficChart();
+
+ int size = networkEventQueue.size();
+ if (size > 0) {
+ NetworkChartData parentChart = null;
+ NetworkChartData childChart = null;
+ NetworkChartDataEvent event = null;
+ for (int i = 0; i < size; i++) {
+ event = networkEventQueue.get(0);
+ int apiType = event.getApiType();
+
+ parentChart = findAddressChart(event);
+ if (parentChart == null) {
+ if (unConnectedDataList.size() > 0) {
+ parentChart = unConnectedDataList.get(0);
+ }
+ if (event.getAddress().equals(CommonConstants.EMPTY)) {
+ event.setAddress(NetworkPageLabels.NETWORK_CHART_NOTCONNECT);
+ unConnectedEventQueue.add(event);
+ } else {
+ parentChart = null;
+ }
+ } else {
+ event.setAddress(parentChart.getAddress());
+ }
+
+ if (null == parentChart) {
+ parentChart = new NetworkChartData(event, true);
+ childChart = new NetworkChartData(event, false);
+
+ parentChart.pushChild(childChart);
+ createNetworkBoardItem(null, parentChart,
+ event.connectedType());
+ createNetworkBoardItem(parentChart, childChart,
+ event.connectedType());
+
+ if (!event.isFailedAPI()) {
+ parentChart.setClosed(false);
+ childChart.setClosed(false);
+ childChart.setFDConnected(false);
+ parentChart.setFDConnected(false);
+ parentChart.setSocketOpendTime((long) event
+ .getLogTime());
+ childChart
+ .setSocketOpendTime((long) event.getLogTime());
+ }
+
+ parentChart.pushEvent(event);
+ childChart.pushEvent(event);
+
+ if (event.getAddress().equals(
+ NetworkPageLabels.NETWORK_CHART_NOTCONNECT)) {
+ unConnectedDataList.add(parentChart);
+ unConnectedDataList.add(childChart);
+ } else {
+ connectedDataList.add(parentChart);
+ connectedDataList.add(childChart);
+ }
+ } else {
+ childChart = parentChart.findChildData(event);
+ if (null == childChart) {
+ childChart = new NetworkChartData(event, false);
+
+ if (event.getAddress().equals(
+ NetworkPageLabels.NETWORK_CHART_NOTCONNECT)) {
+ unConnectedDataList.add(childChart);
+ } else {
+ connectedDataList.add(childChart);
+ }
+ createNetworkBoardItem(parentChart, childChart,
+ event.connectedType());
+ if (!event.isFailedAPI()) {
+ childChart.setClosed(false);
+ childChart.setFDConnected(false);
+ childChart.setSocketOpendTime((long) event
+ .getLogTime());
+ }
+ childChart.pushEvent(event);
+ parentChart.pushChild(childChart);
+ } else {
+ if (apiType == LogCenterConstants.SOCKET_API_FD_CLOSE) {
+ if (!event.isFailedAPI()) {
+ childChart.setClosed(true);
+ childChart.setSocketClosedTime((long) event
+ .getLogTime());
+ childChart.setFDConnected(false);
+ parentChart.setFDConnected(false);
+ }
+ } else if (apiType == LogCenterConstants.SOCKET_API_CONNECT
+ || apiType == LogCenterConstants.SOCKET_API_ACCEPT_END) {
+ if (event.isFailedAPI()) {
+ childChart.setClosed(true);
+ childChart.setSocketClosedTime((long) event
+ .getLogTime());
+ } else {
+ childChart.setFDConnected(true);
+ parentChart.setFDConnected(true);
+ }
+ } else if (apiType == LogCenterConstants.SOCKET_API_BIND
+ || apiType == LogCenterConstants.SOCKET_API_LISTEN) {
+ if (event.isFailedAPI()) {
+ childChart.setClosed(true);
+ childChart.setSocketClosedTime((long) event
+ .getLogTime());
+ childChart.setFDConnected(false);
+ parentChart.setFDConnected(false);
+ }
+ }
+
+ if (apiType == LogCenterConstants.SOCKET_API_RECV_END
+ && event.getRecvSize() <= 0) {
+ childChart.setClosed(true);
+ childChart.setSocketClosedTime((long) event
+ .getLogTime());
+ childChart.setFDConnected(false);
+ parentChart.setFDConnected(false);
+ }
+
+ childChart.pushEvent(event);
+ }
+ parentChart.pushEvent(event);
+ parentChart.setSocketUsedTime(event.getLogTime());
+ childChart.setSocketUsedTime(event.getLogTime());
+ }
+
+ networkEventQueue.remove(0);
+ parentChart.checkUpdate();
+ childChart.checkUpdate();
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Hyunjong Park <phjwithyou.park@samsung.com>
+ * yeongtaik byeon <yeongtaik.byeon@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.dynamicanalyzer.ui.network;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.ScrollBar;
+import org.eclipse.swt.widgets.Text;
+import org.tizen.dynamicanalyzer.common.AnalyzerManager;
+import org.tizen.dynamicanalyzer.common.CommonConstants;
+import org.tizen.dynamicanalyzer.common.DASelectionData;
+import org.tizen.dynamicanalyzer.model.DAView;
+import org.tizen.dynamicanalyzer.nl.NetworkPageLabels;
+import org.tizen.dynamicanalyzer.resources.ColorResources;
+import org.tizen.dynamicanalyzer.resources.FontResources;
+import org.tizen.dynamicanalyzer.ui.widgets.ViewContainer;
+import org.tizen.dynamicanalyzer.utils.Formatter;
+
+public class NetworkDetailInfoView extends DAView {
+
+ public static final String ID = NetworkDetailInfoView.class.getName();
+
+ // private Canvas canvas = null;
+ private Composite contents = null;
+ private Text detailText = null;
+ private Label labelMessage = null;
+ private int indexScrolledTop = 0;
+
+ private final static String leftFormAttachment = CommonConstants.SPACE
+ + CommonConstants.SPACE;
+ private final static String heightFormAttachment = CommonConstants.NEW_LINE
+ + CommonConstants.NEW_LINE;
+
+ int[] innerMaxWeight = { 0, 100 };
+ int[] outerMaxWeight = { 0, 100 };
+
+ private void init() {
+ detailText.setText(CommonConstants.EMPTY);
+ }
+
+ public NetworkDetailInfoView(Composite parent, int style) {
+ super(parent, style);
+ this.setLayout(new FillLayout());
+
+ ViewContainer viewContainer = new ViewContainer(this, true);
+ viewContainer.setTitleText(NetworkPageLabels.NETWORK_DETAILS_TITLE);
+ setMaxWeight(innerMaxWeight, outerMaxWeight);
+
+ Composite detailCom = viewContainer.getContentArea();
+ detailCom.setBackground(ColorResources.VIEW_BG_COLOR);
+ detailCom.setLayout(new FormLayout());
+ FormData labelData = new FormData();
+ labelData.top = new FormAttachment(0, 0);
+ labelData.left = new FormAttachment(0, 0);
+ labelData.right = new FormAttachment(100, 0);
+ labelData.bottom = new FormAttachment(100, 0);
+ detailCom.setLayoutData(labelData);
+
+ Composite contents = detailCom;
+ contents.setBackground(ColorResources.VIEW_BG_COLOR);
+ contents.setLayout(new FormLayout());
+
+ detailText = new Text(contents, SWT.BORDER | SWT.V_SCROLL
+ | SWT.H_SCROLL);
+ detailText.setBackground(ColorResources.VIEW_BG_COLOR);
+ detailText.setForeground(ColorResources.TABLE_CONTENTS_FONT_COLOR);
+ detailText.setFont(FontResources.DETAIL_INFO_FONT);
+
+ FormData buttonData = new FormData();
+ buttonData.top = new FormAttachment(labelMessage, 0);
+ buttonData.left = new FormAttachment(0, 0);
+ buttonData.right = new FormAttachment(100, 0);
+ buttonData.bottom = new FormAttachment(100, 0);
+ detailText.setLayoutData(buttonData);
+
+ Listener listener = new Listener() {
+ public void handleEvent(Event e) {
+ indexScrolledTop = detailText.getTopIndex();
+ }
+ };
+ ScrollBar hBar = detailText.getHorizontalBar();
+ if (hBar != null) {
+ hBar.addListener(SWT.Selection, listener);
+ }
+ ScrollBar vBar = detailText.getVerticalBar();
+ if (vBar != null) {
+ vBar.addListener(SWT.Selection, listener);
+ }
+
+ StringBuffer strDetailView = new StringBuffer();
+ strDetailView.append(CommonConstants.NEW_LINE);
+ strDetailView.append(leftFormAttachment
+ + NetworkPageLabels.NETWORK_DETAILS_ADDRESS
+ + heightFormAttachment);
+ strDetailView.append(leftFormAttachment
+ + NetworkPageLabels.NETWORK_DETAILS_RECV_SIZE
+ + heightFormAttachment);
+ strDetailView.append(leftFormAttachment
+ + NetworkPageLabels.NETWORK_DETAILS_SEND_SIZE
+ + heightFormAttachment);
+ strDetailView.append(leftFormAttachment
+ + NetworkPageLabels.NETWORK_DETAILS_TOTAL_USE_TIME
+ + heightFormAttachment);
+ strDetailView.append(leftFormAttachment
+ + NetworkPageLabels.NETWORK_DETAILS_API_COUNT
+ + heightFormAttachment);
+ strDetailView.append(leftFormAttachment
+ + NetworkPageLabels.NETWORK_DETAILS_FAILED_API_COUNT
+ + heightFormAttachment);
+ strDetailView.append(leftFormAttachment
+ + NetworkPageLabels.NETWORK_DETAILS_PACKET_MESSAGE
+ + heightFormAttachment);
+ strDetailView.append(NetworkChartManager.getInstance()
+ .getPacketMessage());
+ detailText.setText(strDetailView.toString());
+ }
+
+ @Override
+ public void updateView(DASelectionData data) {
+ updateData();
+ indexScrolledTop = 0;
+ }
+
+ @Override
+ public void updateView() {
+ updateData();
+ }
+
+ private void updateData() {
+ NetworkApiListView view = (NetworkApiListView) AnalyzerManager
+ .getCurrentPage().getViewMap().get(NetworkApiListView.ID);
+ NetworkChartData selectData = view.getPageData();
+
+ if (null == selectData) {
+ return;
+ }
+
+ StringBuffer strDetailView = new StringBuffer();
+ strDetailView.append(heightFormAttachment);
+ strDetailView.append(leftFormAttachment
+ + NetworkPageLabels.NETWORK_DETAILS_ADDRESS
+ + selectData.getAddress() + heightFormAttachment);
+ strDetailView.append(leftFormAttachment
+ + NetworkPageLabels.NETWORK_DETAILS_RECV_SIZE
+ + selectData.getRecvSize() + heightFormAttachment);
+ strDetailView.append(leftFormAttachment
+ + NetworkPageLabels.NETWORK_DETAILS_SEND_SIZE
+ + selectData.getSendSize() + heightFormAttachment);
+ strDetailView.append(leftFormAttachment
+ + NetworkPageLabels.NETWORK_DETAILS_TOTAL_USE_TIME
+ + Formatter.toTimeFormat(Long.toString((long) selectData
+ .getTotalUseTime())) + heightFormAttachment);
+ strDetailView.append(leftFormAttachment
+ + NetworkPageLabels.NETWORK_DETAILS_API_COUNT
+ + selectData.getApiCount() + heightFormAttachment);
+ strDetailView.append(leftFormAttachment
+ + NetworkPageLabels.NETWORK_DETAILS_FAILED_API_COUNT
+ + selectData.getFailedApiCount() + heightFormAttachment);
+ strDetailView.append(leftFormAttachment
+ + NetworkPageLabels.NETWORK_DETAILS_PACKET_MESSAGE
+ + heightFormAttachment);
+ strDetailView.append(leftFormAttachment
+ + NetworkChartManager.getInstance().getPacketMessage());
+
+ if (indexScrolledTop == 0) {
+ detailText.setText(strDetailView.toString());
+ }
+
+ }
+
+ public void setTetailViewData() {
+
+ }
+
+ @Override
+ public Control getControl() {
+ return contents;
+ }
+
+ @Override
+ public void clear() {
+ init();
+ }
+}
--- /dev/null
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Hyunjong Park <phjwithyou.park@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.dynamicanalyzer.ui.network;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.SashForm;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
+import org.tizen.dynamicanalyzer.shortcut.ShortCutManager;
+import org.tizen.dynamicanalyzer.ui.network.NetworkApiListView;
+import org.tizen.dynamicanalyzer.ui.network.NetworkDetailInfoView;
+import org.tizen.dynamicanalyzer.ui.info.callstack.CallstackView;
+import org.tizen.dynamicanalyzer.ui.info.snapshot.SnapshotView;
+import org.tizen.dynamicanalyzer.ui.page.DAPageComposite;
+import org.tizen.dynamicanalyzer.ui.widgets.DATabComposite;
+
+public class NetworkPage extends DAPageComposite {
+ public static final String ID = NetworkPage.class.getName();
+ SashForm baseForm;
+ SashForm leftForm;
+ SashForm rightForm;
+
+ public NetworkPage(Composite parent, int style) {
+ super(parent, style);
+ name = AnalyzerLabels.COOLBAR_AREA_NETWORK;
+ this.setData(DAPageComposite.KEY_TOOLTIP, ShortCutManager.COOLBAR_AREA_NETWORK_TOOLTIP);
+ this.setLayout(new FillLayout());
+
+ baseForm = new SashForm(this, SWT.HORIZONTAL);
+ baseForm.setLayout(new FillLayout());
+
+ leftForm = new SashForm(baseForm, SWT.VERTICAL);
+ NetworkChartView networkChartView = new NetworkChartView(leftForm, SWT.NONE);
+ addView(networkChartView);
+ NetworkApiListView networkApiListView = new NetworkApiListView(leftForm,
+ SWT.NONE);
+ addView(networkApiListView);
+
+ leftForm.setWeights(new int[] { 60, 40 });
+
+ rightForm = new SashForm(baseForm, SWT.VERTICAL);
+ DATabComposite tabView = new DATabComposite(rightForm, SWT.NONE);
+ addView(tabView);
+ {
+ SnapshotView snapshotView = new SnapshotView(
+ tabView.getContentComposite(), SWT.NONE, false);
+ snapshotView.setObservingViews(new String[] { NetworkApiListView.ID });
+ tabView.addView(snapshotView, false);
+
+ CallstackView callstack = new CallstackView(
+ tabView.getContentComposite(), SWT.NONE);
+ callstack.setObservingViews(new String[] { NetworkApiListView.ID });
+ tabView.addView(callstack, false);
+ }
+
+ NetworkDetailInfoView detailInfo = new NetworkDetailInfoView(rightForm,
+ SWT.NONE);
+ addView(detailInfo);
+
+ rightForm.setWeights(new int[] { 50, 50 });
+ baseForm.setWeights(new int[] { 75, 25 });
+ }
+
+ @Override
+ protected void setFormWeights() {
+ baseForm.setWeights(new int[] { 100 - wRate, wRate });
+ rightForm.setWeights(new int[] { hRate, 100 - hRate });
+ }
+}
--- /dev/null
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Sanghyun Lee <sanghyunnim.lee@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.dynamicanalyzer.ui.network;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.swt.graphics.Image;
+import org.tizen.dynamicanalyzer.common.CommonConstants;
+import org.tizen.dynamicanalyzer.nl.NetworkPageLabels;
+import org.tizen.dynamicanalyzer.resources.ColorResources;
+import org.tizen.dynamicanalyzer.resources.ImageResources;
+import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
+import org.tizen.dynamicanalyzer.utils.Formatter;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChart;
+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;
+
+public class NetworkTrafficChart {
+
+ private static class FDCountData {
+ private int type;
+ private String time;
+ private long data;
+
+ private FDCountData(int type, String time, long data) {
+ this.type = type;
+ this.time = time;
+ this.data = data;
+ }
+ }
+
+ protected DAChart chart;
+ protected int chartStyle = DAChart.CHART_STYLE_NORMAL;
+ protected String chartName;
+ protected Image chartIcon = ImageResources.CHART_NETWORK;
+ private static NetworkTrafficChart instance = null;
+
+ private Map<String, Integer> recvTimeIndexMap = new HashMap<String, Integer>();
+ private Map<String, Integer> sendTimeIndexMap = new HashMap<String, Integer>();
+ private List<FDCountData> trafficDataList = new ArrayList<FDCountData>();
+
+ private DAChartSeries recvSeries;
+ private DAChartSeries sendSeries;
+
+ static final int TYPE_FDCOUNT = 0;
+ static final int TYPE_RECV = 1;
+ static final int TYPE_SEND = 2;
+
+ private double maxTraffic = 0;
+
+ public static NetworkTrafficChart getInstance() {
+ if (instance == null) {
+ instance = new NetworkTrafficChart();
+ }
+
+ return instance;
+ }
+
+ public void clear() {
+
+ maxTraffic = 0;
+ recvTimeIndexMap.clear();
+ sendTimeIndexMap.clear();
+ trafficDataList.clear();
+
+ chartName = NetworkPageLabels.NETWORK_CHART_TRAFFIC_TITLE;
+ recvSeries = new DAChartSeries(
+ NetworkPageLabels.NETWORK_CHART_TRAFFIC_RECV,
+ DAChartSeries.SERIES_STYLE_BAR,
+ ColorResources.NETWORK_ACCESS_RECV);
+ recvSeries.setBarAlign(DAChartSeries.SERIES_BAR_ALIGN_CENTER);
+
+ sendSeries = new DAChartSeries(
+ NetworkPageLabels.NETWORK_CHART_TRAFFIC_SEND,
+ DAChartSeries.SERIES_STYLE_BAR,
+ ColorResources.NETWORK_ACCESS_SEND);
+ sendSeries.setBarAlign(DAChartSeries.SERIES_BAR_ALIGN_CENTER);
+
+ }
+
+ private NetworkTrafficChart() {
+
+ }
+
+ public DAChartBoardItem createBoardItem(DAChartBoard board) {
+
+ DAChartBoardItem item = new DAChartBoardItem(board, chartName,
+ chartIcon, chartStyle);
+ chart = item.getChart();
+
+ chart.addSeries(recvSeries);
+ chart.addSeries(sendSeries);
+
+ // chart.getPlot().setAutoHeightRange(AutoRangeType.MANUAL);
+ chart.getPlot().setSeriesHeightRange(true);
+
+ chart.getPlot().setAxisUnit(CommonConstants.EMPTY);
+ chart.getPlot().setSecondAxisUnit(CommonConstants.EMPTY);
+
+ chart.getPlot().setAxisUnitType(DAChartPlot.UnitType.BINARY);
+ chart.getPlot().setShowAxis(true);
+
+ recvSeries.setEndY(maxTraffic);
+ sendSeries.setEndY(maxTraffic);
+
+ return item;
+ }
+
+ private void sumTrafficDataList() {
+ if (trafficDataList.size() == 0) {
+ return;
+ }
+ FDCountData recvData = new FDCountData(TYPE_RECV, "", 0);
+ FDCountData sendData = new FDCountData(TYPE_SEND, "", 0);
+ for (FDCountData trafficData : trafficDataList) {
+ switch (trafficData.type) {
+ case TYPE_RECV: {
+ recvData.time = trafficData.time;
+ recvData.data += trafficData.data;
+ break;
+ }
+ case TYPE_SEND: {
+ sendData.time = trafficData.time;
+ sendData.data += trafficData.data;
+ break;
+ }
+ default:
+ System.out.println("FileChart.java : wrong file api type");//$NON-NLS-1$
+ }
+ }
+ trafficDataList.clear();
+ if (recvData.data != 0) {
+ trafficDataList.add(recvData);
+ }
+ if (sendData.data != 0) {
+ trafficDataList.add(sendData);
+ }
+ }
+
+ public void updateTrafficChart() {
+
+ sumTrafficDataList();
+
+ int size = trafficDataList.size();
+ if (size > 0) {
+ for (int i = 0; i < size; i++) {
+ FDCountData trafficData = trafficDataList.get(0);
+
+ double doubleTime = Double.parseDouble(trafficData.time)
+ / TimelineConstants.MEGA;
+ switch (trafficData.type) {
+ case TYPE_RECV: {
+ DAChartSeriesItem item = new DAChartSeriesItem(doubleTime,
+ 0, Formatter.toByteFormat(0));
+ double readSum = item.getY() + trafficData.data;
+ item.setY(readSum);
+ item.setTooltipText(Formatter.toByteFormat(readSum));
+ if (readSum > maxTraffic) {
+ maxTraffic = readSum;
+ recvSeries.setEndY(maxTraffic * 1.1);
+ sendSeries.setEndY(maxTraffic * 1.1);
+ }
+ recvSeries.addSeriesItem(item);
+ break;
+ }
+ case TYPE_SEND: {
+ DAChartSeriesItem item = new DAChartSeriesItem(doubleTime,
+ 0, Formatter.toByteFormat(0));
+ double writeSum = item.getY() + trafficData.data;
+ item.setY(writeSum);
+ item.setTooltipText(Formatter.toByteFormat(writeSum));
+ if (writeSum > maxTraffic) {
+ maxTraffic = writeSum;
+ recvSeries.setEndY(maxTraffic * 1.1);
+ sendSeries.setEndY(maxTraffic * 1.1);
+ }
+ sendSeries.addSeriesItem(item);
+ break;
+ }
+ default:
+ System.out.println("FileChart.java : wrong file api type");//$NON-NLS-1$
+ }
+ trafficDataList.remove(0);
+ }
+ }
+ }
+
+ public void setRecvSize(long size, String time) {
+ Integer dataInputIndex = recvTimeIndexMap.get(Formatter
+ .toTimeFormat(time));
+ if (null == dataInputIndex) {
+ trafficDataList.add(new FDCountData(TYPE_RECV, time, size));
+ recvTimeIndexMap.put(Formatter.toTimeFormat(time),
+ trafficDataList.size() - 1);
+ } else {
+ if (dataInputIndex < trafficDataList.size()) {
+ trafficDataList.get(dataInputIndex).data += size;
+ }
+ }
+ }
+
+ public void setSendSize(int size, String time) {
+ Integer dataInputIndex = sendTimeIndexMap.get(Formatter
+ .toTimeFormat(time));
+ if (null == dataInputIndex) {
+ trafficDataList.add(new FDCountData(TYPE_SEND, time, size));
+ sendTimeIndexMap.put(Formatter.toTimeFormat(time),
+ trafficDataList.size() - 1);
+ } else {
+ if (dataInputIndex < trafficDataList.size()) {
+ trafficDataList.get(dataInputIndex).data += size;
+ }
+
+ }
+ }
+}
import org.eclipse.ui.part.ViewPart;
import org.tizen.dynamicanalyzer.model.DAView;
import org.tizen.dynamicanalyzer.ui.file.FilePage;
+import org.tizen.dynamicanalyzer.ui.network.NetworkPage;
import org.tizen.dynamicanalyzer.ui.summary.SummaryPage;
import org.tizen.dynamicanalyzer.ui.thread.ThreadPage;
import org.tizen.dynamicanalyzer.ui.timeline.TimelinePage;
Composite filePage = new FilePage(tabView.getContentComposite(),
SWT.NONE);
tabView.addView(filePage, false);
+
+ Composite networkPage = new NetworkPage(tabView.getContentComposite(),
+ SWT.NONE);
+ tabView.addView(networkPage, false);
Composite threadPage = new ThreadPage(
tabView.getContentComposite(), SWT.NONE);
if (logData.getId() == 0x3004)
{
- System.out.println("file arrived");
+ // System.out.println("file arrived");
}
HashMap<Integer, LeakData2> leaks = getLeakHash();
if (chk.getApiType() == API_TYPE_OPEN) {
import org.tizen.dynamicanalyzer.sql.SqlManager;
import org.tizen.dynamicanalyzer.swap.logparser.SWAPLogParser;
import org.tizen.dynamicanalyzer.ui.file.FileChartManager;
+import org.tizen.dynamicanalyzer.ui.network.NetworkChartManager;
import org.tizen.dynamicanalyzer.ui.summary.profiling.FunctionUsageProfiler;
import org.tizen.dynamicanalyzer.ui.thread.ThreadChartManager;
import org.tizen.dynamicanalyzer.ui.userinterface.UIDataManager;
FileChartManager.getInstance().stopUpdateLogThread();
percent += 5;
StopProcessManager.getInstance().setValue(percent);
+
+ NetworkChartManager.getInstance().stopUpdateLogThread();
+ percent += 5;
+ StopProcessManager.getInstance().setValue(percent);
ThreadChartManager.getInstance().stopUpdateLogThread();
import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
import org.tizen.dynamicanalyzer.project.Project;
import org.tizen.dynamicanalyzer.ui.file.FileChartManager;
+import org.tizen.dynamicanalyzer.ui.network.NetworkChartManager;
import org.tizen.dynamicanalyzer.ui.thread.ThreadChartManager;
import org.tizen.dynamicanalyzer.ui.timeline.TimelinePage;
import org.tizen.dynamicanalyzer.ui.userinterface.UIDataManager;
public void runThreads() {
OpenTraceInputReader.startOpenTraceInputReader();
FileChartManager.getInstance().startUpdateLogThread();
+ NetworkChartManager.getInstance().startUpdateLogThread();
ThreadChartManager.getInstance().startUpdateLogThread();
UIDataManager.getInstance().startUpdateLogThread();
}
while (!AnalyzerManager.isExit()) {
OpenTraceInputReader.stopOpenTraceInputReader();
FileChartManager.getInstance().stopUpdateLogThread();
+ NetworkChartManager.getInstance().stopUpdateLogThread();
ThreadChartManager.getInstance().stopUpdateLogThread();
UIDataManager.getInstance().stopUpdateLogThread();
try {
import org.eclipse.swt.widgets.Shell;
import org.tizen.dynamicanalyzer.common.CommonConstants;
import org.tizen.dynamicanalyzer.listeners.TableTooltipListener;
+import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
import org.tizen.dynamicanalyzer.model.FindProperty;
import org.tizen.dynamicanalyzer.model.TableInput;
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.model.probe2.LogData;
import org.tizen.dynamicanalyzer.ui.common.ContextAnalysisMenuItemClickListener;
import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
protected DefaultTableComparator comparator = null;
protected int[] sortTypes = null;
protected int[] sourceColumns = null;
+ protected int[] columnAlignment = null;
protected boolean findEnabled = true;
protected boolean autoColumnPack = true;
private DAContextMenu popupMenu = null;
protected Point mousePoint = new Point(0, 0);
+
+ private boolean failedAPIColor = false;
protected RangeDataManager rangeDataManager = RangeDataManager
.getInstance();
}
column.setCellRenderer(new DATableCellRenderer());
column.setHeaderRenderer(new DATableHeaderRenderer());
+
+ if (isTree == false && columnAlignment != null) {
+ if (columnAlignment.length > i) {
+ column.setAlignment(columnAlignment[i]);
+ }
+ }
+
column.pack();
if (null != comparator && null != sourceColumns
gridItem.setBackground(rangeColor);
}
+ if (isTree == false && isFailedAPIColor()) {
+// if (!gridData.getData().get(LogCenterConstants.ERROR_INDEX)
+// .equals(CommonConstants.ZERO)) {
+// gridItem.setBackground(ColorResources.TABLE_CONTENTS_FAILED_BACGOUND_COLOR);
+// gridItem.setForeground(ColorResources.TABLE_CONTENTS_FAILED_FONT_COLOR);
+// gridItem.setImage(0, ImageResources.FAILED_API_ICON_TABLE);
+// }
+ }
+
if (gridData != null) {
long seqNum = gridData.getSelectionKey();
for (int ii = 0; ii < selSeqs.size(); ii++) {
sourceColumns = columns;
}
+ public void setColumnAlignment(int[] columns) {
+ columnAlignment = columns;
+ }
+
public void deselectAll() {
getSelectionIndex().clear();
getSelections().clear();
public boolean isAutoColumnPackEnabled() {
return autoColumnPack;
}
+
+ public boolean isFailedAPIColor() {
+ return failedAPIColor;
+ }
+
+ public void setFailedAPIColor(boolean failedAPIColor) {
+ this.failedAPIColor = failedAPIColor;
+ }
}
fileSize, filePath);
result = ByteUtils.concatByteArray(front, rear);
break;
+ case AnalyzerConstants.MSG_PROBE_NETWORK:
+ System.out.println("case AnalyzerConstants.MSG_PROBE_NETWORK");
+ break;
case AnalyzerConstants.MSG_PROBE_LIFECYCLE:
result = front;
break;
public static void printHexdecimal(long value) {
String output = String.format("%x", value);
- System.out.print(output);
+ // System.out.print(output);
}
}