public static Color EDIT_CHART_DIALOG_LOWER = getColor("edit_chart_dialog_lower");//$NON-NLS-1$\r
\r
public static Color VIEW_BORDER = getColor("view_border"); //$NON-NLS-1$\r
+ public static Color VIEW_BORDER_1 = getColor("view_border_1"); //$NON-NLS-1$\r
+ public static Color VIEW_BORDER_2 = getColor("view_border_2"); //$NON-NLS-1$\r
+ public static Color VIEW_BORDER_3 = getColor("view_border_3"); //$NON-NLS-1$\r
public static Color VIEW_BG_COLOR = getColor("view_bg_color"); //$NON-NLS-1$\r
public static Color VIEW_TITLE_FONT_COLOR = getColor("view_title_font_color");//$NON-NLS-1$\r
\r
\r
/** device and application combo specific colors start **/\r
public static Color DEVICE_APPLICATION_ENABLE = getColor("device_application_enable_font"); //$NON-NLS-1$\r
- public static Color DEVICE_APPLICATION_DISABLE = getColor("device_application_disable"); //$NON-NLS-1$\r
+ public static Color DEVICE_APPLICATION_DISABLE = getColor("device_application_disable_font"); //$NON-NLS-1$\r
public static Color DEVICE_APPLICATION_POPUP_OUTER_1 = getColor("device_application_popup_outer_1"); //$NON-NLS-1$\r
public static Color DEVICE_APPLICATION_POPUP_OUTER_2 = getColor("device_application_popup_outer_2"); //$NON-NLS-1$\r
public static Color DEVICE_APPLICATION_DROPDOWN_TEXT = getColor("device_application_enable_font"); //$NON-NLS-1$\r
public static Color TAB_HOVER_FONT_COLOR = getColor("tab_hover_font_color"); //$NON-NLS-1$\r
public static Color TAB_PUSH_FONT_COLOR = getColor("tab_push_font_color"); //$NON-NLS-1$\r
\r
+ public static Color TAB_BG_COLOR = getColor("tab_bg_color"); //$NON-NLS-1$\r
public static Color TAB_BG_COLOR_START = getColor("tab_bg_color_start"); //$NON-NLS-1$\r
public static Color TAB_BG_COLOR_END = getColor("tab_bg_color_end"); //$NON-NLS-1$\r
public static Color TAB_BG_OUTLINE_COLOR = getColor("tab_bg_outline_color"); //$NON-NLS-1$\r
public static Color SERIES_COLOR_CPU_SYSTEM = getColor("seriesColorCPUSystem"); //$NON-NLS-1$\r
public static Color SERIES_COLOR_CPU_APP = getColor("seriesColorCPUApp"); //$NON-NLS-1$\r
\r
- public final static int MAX_SERIES_COLOR_COUNT = 4;\r
public static Color SERIES_COLOR_CPUCORE_CORE0 = getColor("seriesColorCPUCoreCore0"); //$NON-NLS-1$\r
public static Color SERIES_COLOR_CPUCORE_CORE1 = getColor("seriesColorCPUCoreCore1"); //$NON-NLS-1$\r
public static Color SERIES_COLOR_CPUCORE_CORE2 = getColor("seriesColorCPUCoreCore2"); //$NON-NLS-1$\r
public static final Font TAB_BUTTON_FONT = getFont(\r
"tab_button_font", resizeDefaultFont(8, 3));//$NON-NLS-1$\r
// mac 11\r
-\r
+ \r
+ public static final Font TAB_BUTTON_LARGE_FONT = getFont(\r
+ "tab_button_large_font", resizeDefaultFont(9, 2));//$NON-NLS-1$\r
+ \r
// * Time-Line Layout\r
// Edit Chart Dlg.\r
public static final Font ADDITEM_BUTTON_FONT = getFont(\r
// * About Dlg.\r
public static final Font ABOUT_TEXT = getFont(\r
"about_text", resizeDefaultFont(9, 2));//$NON-NLS-1$\r
+ \r
+ // * License Dlg.\r
+ public static final Font LICENSE_TEXT = getFont(\r
+ "license_text", resizeDefaultFont(8, 3));//$NON-NLS-1$\r
+ \r
// mac 11\r
public static final Font DIALOG_BUTTON_FONT = getFont(\r
"dialog_button_font", resizeDefaultFont(9, 2));//$NON-NLS-1$\r
public static final Image OPEN_PUSH = getPngImage("toolbar_open_push"); //$NON-NLS-1$\r
public static final Image OPEN_HOVER = getPngImage("toolbar_open_hover"); //$NON-NLS-1$\r
public static final Image OPEN_DISABLE = getPngImage("toolbar_open_disable"); //$NON-NLS-1$\r
- \r
+\r
public static final Image REPLAY = getPngImage("toolbar_replay_nor"); //$NON-NLS-1$\r
public static final Image REPLAY_PUSH = getPngImage("toolbar_replay_push"); //$NON-NLS-1$\r
public static final Image REPLAY_HOVER = getPngImage("toolbar_replay_hover"); //$NON-NLS-1$\r
public static final Image REPLAY_DISABLE = getPngImage("toolbar_replay_disable"); //$NON-NLS-1$\r
- \r
+\r
public static final Image REPLAY_EDIT = getPngImage("toolbar_replayedit_nor"); //$NON-NLS-1$\r
public static final Image REPLAY_EDIT_PUSH = getPngImage("toolbar_replayedit_push"); //$NON-NLS-1$\r
public static final Image REPLAY_EDIT_HOVER = getPngImage("toolbar_replayedit_hover"); //$NON-NLS-1$\r
\r
// Tab\r
public static final Image TAB = getPngImage("tab_unselected"); //$NON-NLS-1$\r
+ public static final Image TAB_NORMAL = getPngImage("tab_normal"); //$NON-NLS-1$\r
public static final Image TAB_PUSH = getPngImage("tab_push"); //$NON-NLS-1$\r
public static final Image TAB_HOVER = getPngImage("tab_hover"); //$NON-NLS-1$\r
- public static final Image TAB_DISABLE = getPngImage("tab_selected"); //$NON-NLS-1$\r
+ public static final Image TAB_SELECTED = getPngImage("tab_selected"); //$NON-NLS-1$\r
+ public static final Image TAB_DRAG = getPngImage("tab_dag"); //$NON-NLS-1$\r
\r
// Trim\r
public static final Image WINDOW_TOP = getPngImage("window_top_pattern_01"); //$NON-NLS-1$\r
// Dialog icon\r
public static final Image DIALOG_WARNING_ICON = getPngImage("dialog_warning"); //$NON-NLS-1$\r
\r
+ // OpenGL\r
+ public static final Image OPENGL_SHOW_ONLY_CHANGED_SELECTED = getPngImage("show_only_changed_push"); //$NON-NLS-1$\r
+ public static final Image OPENGL_SHOW_ONLY_CHANGED_UNSELECTED = getPngImage("show_only_changed_normal"); //$NON-NLS-1$\r
+\r
// Diglog trim\r
public static final Image DIALOG_TOP = getPngImage("dialog_top_pattern"); //$NON-NLS-1$\r
public static final Image DIALOG_BOTTOM = getPngImage("dialog_bottom_pattern"); //$NON-NLS-1$\r
public static final Image COMBO_DROPDOWN_UP = getPngImage("dropdown_up"); //$NON-NLS-1$\r
public static final Image COMBO_DROPDOWN_DOWN = getPngImage("dropdown_down"); //$NON-NLS-1$\r
public static final Image REPLAY_EDIT_DROPDOWN_DOWN = getPngImage("toolbar_dropdown_normal_a"); //$NON-NLS-1$\r
- public static final Image REPLAY_EDIT_SNAPSHOT_DOWN = getPngImage("replay_edit_snapshot"); //$NON-NLS-1$\r
+ public static final Image REPLAY_EDIT_SNAPSHOT_DOWN = getPngImage("btn_touchevent_position"); //$NON-NLS-1$\r
\r
// On, Off button\r
public static final Image ON_HOVER = getPngImage("onoff_on_hover"); //$NON-NLS-1$\r
public static final Image DYNANMIC_ANALYZER_ICON = getPngImage("64_DA_icon"); //$NON-NLS-1$ \r
public static final Image ABOUT_TIZEN_SDK = getPngImage("about_Tizen_SDK");//$NON-NLS-1$\r
public static final Image LICENSE_TIZEN_SDK = getPngImage("license_banner");//$NON-NLS-1$\r
- \r
+\r
/* OpenGL */\r
public static final Image OPEN_GL_PRE_NAVI_HOVER = getPngImage("btn_nav_r_hover"); //$NON-NLS-1$ \r
public static final Image OPEN_GL_PRE_NAVI_NORMAL = getPngImage("btn_nav_r_normal"); //$NON-NLS-1$\r
public static final Image OPEN_GL_NEXT_NAVI_HOVER = getPngImage("btn_nav_f_hover"); //$NON-NLS-1$ \r
public static final Image OPEN_GL_NEXT_NAVI_NORMAL = getPngImage("btn_nav_f_normal"); //$NON-NLS-1$\r
public static final Image OPEN_GL_NEXT_NAVI_PUSH = getPngImage("btn_nav_f_push"); //$NON-NLS-1$\r
- \r
+\r
/* configuration */\r
public static final Image WELCONE_BANNER_IMAGE = getPngImage("welcome_banner"); //$NON-NLS-1$\r
public static final Image CONFIGURATION_BANNER_IMAGE = getPngImage("settings_banner"); //$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
+\r
/* graphics */\r
public static final Image CHART_FPS = getPngImage("time_line_icon_fps"); //$NON-NLS-1$\r
- public static final Image CHART_FRAME_TIME= getPngImage("time_line_icon_frame_time"); //$NON-NLS-1$\r
+ public static final Image CHART_FRAME_TIME = getPngImage("time_line_icon_frame_time"); //$NON-NLS-1$\r
public static final Image CHART_FRAME_RATE = getPngImage("time_line_icon_frame_rate"); //$NON-NLS-1$\r
\r
/* Resource */\r
public static final Image TREE_FOLD = getPngImage("tree_fold"); //$NON-NLS-1$\r
public static final Image NO_IMAGE = getPngImage("empty_snapshot"); //$NON-NLS-1$\r
public static final Image NO_IMAGE_SMALL = getPngImage("empty_snapshot_small"); //$NON-NLS-1$\r
+ \r
+ /*** context child arrow ***/\r
+ public static final Image CONTEXT_OPEN = getPngImage("context_menu_child_arrow"); //$NON-NLS-1$\r
\r
/* score */\r
public static final Image SCORE_0 = getPngImage("score_0"); //$NON-NLS-1$\r
public static final Image ICON_DEVICE = getGifImage("device"); //$NON-NLS-1$\r
public static final Image ICON_OTHER = getGifImage("file"); //$NON-NLS-1$\r
\r
- \r
/** Binary Settings page desing images */\r
public static final Image DELETE_BUTTON_NORMAL = getPngImage("btn_delete_normal"); //$NON-NLS-1$\r
public static final Image DELETE_BUTTON_PUSH = getPngImage("btn_delete_push"); //$NON-NLS-1$\r
public static final Image DELETE_BUTTON_HOVER = getPngImage("btn_delete_hover"); //$NON-NLS-1$\r
public static final Image DELETE_BUTTON_DISABLE = getPngImage("btn_delete_disable"); //$NON-NLS-1$\r
- \r
+\r
public static final Image FIND_BUTTON_NORMAL = getPngImage("btn_finder_normal"); //$NON-NLS-1$\r
public static final Image FIND_BUTTON_PUSH = getPngImage("btn_finder_push"); //$NON-NLS-1$\r
public static final Image FIND_BUTTON_HOVER = getPngImage("btn_finder_hover"); //$NON-NLS-1$\r
public static final Image FIND_BUTTON_DISABLE = getPngImage("btn_finder_disable"); //$NON-NLS-1$\r
- \r
+\r
public static final Image FILE_TYPE_DEVICE = getPngImage("file_type_device_phone"); //$NON-NLS-1$\r
public static final Image FILE_TYPE_DIR = getPngImage("file_type_dir"); //$NON-NLS-1$\r
public static final Image FILE_TYPE_DIR_LINK = getPngImage("file_type_dir_link"); //$NON-NLS-1$\r
public static final Image FILE_TYPE_ETC = getPngImage("file_type_etc"); //$NON-NLS-1$\r
public static final Image FILE_TYPE_FILE = getPngImage("file_type_file"); //$NON-NLS-1$\r
public static final Image FILE_TYPE_FILE_LINK = getPngImage("file_type_file_link"); //$NON-NLS-1$\r
- \r
+\r
public static final Image SCREEN_SHOT_NORMAL = getPngImage("toolbar_screen_shot_nor"); //$NON-NLS-1$\r
public static final Image SCREEN_SHOT_PUSH = getPngImage("toolbar_screen_shot_push"); //$NON-NLS-1$\r
public static final Image SCREEN_SHOT_HOVER = getPngImage("toolbar_screen_shot_hover"); //$NON-NLS-1$\r
public static final Image SCREEN_SHOT_DISABLE = getPngImage("toolbar_screen_shot_disable"); //$NON-NLS-1$\r
- \r
+\r
private static Image getImage(String pluginId, String folderName,\r
String imageName, String extension) {\r
if (null == imageRegistry.get(imageName)\r
}\r
\r
private static Image getImageFromWorkbench(String imageName) {\r
- return getImage(WORKBENCH_ID,\r
- ICON_WORKBENCH_FOLDER_NAME + File.separator,\r
- imageName, CommonConstants.EXTENSION_PNG_IMAGE);\r
+ return getImage(WORKBENCH_ID, ICON_WORKBENCH_FOLDER_NAME\r
+ + File.separator, imageName,\r
+ CommonConstants.EXTENSION_PNG_IMAGE);\r
}\r
\r
private static Image getPngImage(String imageName) {\r
// shell window background color
setColor("window_bg_color", new RGB(160, 160, 160)); //$NON-NLS-1$
- setColor("dialg_bg_upper", new RGB(206, 206, 206));
+ setColor("dialg_bg_upper", new RGB(232, 234, 235));
setColor("dialg_bg_lower", new RGB(240, 240, 240));
setColor("dialg_sunken_1", new RGB(160, 160, 160));
setColor("dialg_sunken_2", new RGB(255, 255, 255));
setColor("edit_chart_dialog_lower", new RGB(240, 240, 240));
setColor("view_border", new RGB(206, 206, 206)); //$NON-NLS-1$
+ setColor("view_border_1", new RGB(160, 160, 160)); //$NON-NLS-1$
+ setColor("view_border_2", new RGB(232, 234, 235)); //$NON-NLS-1$
+ setColor("view_border_3", new RGB(186, 186, 186)); //$NON-NLS-1$
setColor("view_bg_color", new RGB(230, 230, 230)); //$NON-NLS-1$
- getColor("view_title_font_color", new RGB(0, 0, 0));
+ getColor("view_title_font_color", new RGB(255, 255, 255));
setColor("coolbar_bg_color", new RGB(228, 228, 228)); //$NON-NLS-1$
setColor("default_font_color", new RGB(0, 0, 0));//$NON-NLS-1$
/** title bar colors **/
setColor("titlebar_text_color", new RGB(64, 208, 255)); //$NON-NLS-1$
setColor("titlebar_bg", new RGB(78, 79, 81)); //$NON-NLS-1$
- setColor("titlebar_start_color", new RGB(240, 240, 240)); //$NON-NLS-1$
- setColor("titlebar_end_color", new RGB(165, 165, 165)); //$NON-NLS-1$
+ setColor("titlebar_start_color", new RGB(104, 156, 166)); //$NON-NLS-1$
+ setColor("titlebar_end_color", new RGB(55, 105, 114)); //$NON-NLS-1$
setColor("titlebar_bottom_stroke_1", new RGB(115, 115, 115));
setColor("titlebar_bottom_stroke_2", new RGB(160, 160, 160));
/** device and application combo specific colors start **/
setColor("device_application_enable_font", new RGB(0, 0, 0)); //$NON-NLS-1$
- setColor("device_application_disable_font", new RGB(160, 160, 160)); //$NON-NLS-1$
- setColor("device_application_popup_outer_1", new RGB(120, 120, 120)); //$NON-NLS-1$
- setColor("device_application_popup_outer_2", new RGB(50, 185, 231)); //$NON-NLS-1$
+ setColor("device_application_disable_font", new RGB(119, 223, 238)); //$NON-NLS-1$
+ setColor("device_application_popup_outer_1", new RGB(45, 180, 200)); //$NON-NLS-1$
+ setColor("device_application_popup_outer_2", new RGB(47, 85, 92)); //$NON-NLS-1$
setColor("device_application_item_normal_top", new RGB(255, 255, 255)); //$NON-NLS-1$
- setColor("device_application_item_normal_inner", new RGB(230, 230, 230)); //$NON-NLS-1$
- setColor(
- "device_application_item_normal_bottom", new RGB(189, 189, 189)); //$NON-NLS-1$
+ setColor("device_application_item_normal_inner", new RGB(232, 234, 235)); //$NON-NLS-1$
+ setColor("device_application_item_normal_bottom", new RGB(180, 180, 180)); //$NON-NLS-1$
setColor("device_application_item_select_top", new RGB(255, 255, 255)); //$NON-NLS-1$
- setColor("device_application_item_select_inner", new RGB(50, 185, 231)); //$NON-NLS-1$
- setColor(
- "device_application_item_select_bottom", new RGB(189, 189, 189)); //$NON-NLS-1$
+ setColor("device_application_item_select_inner", new RGB(45, 180, 200)); //$NON-NLS-1$
+ setColor("device_application_item_select_bottom", new RGB(180, 180, 180)); //$NON-NLS-1$
/** device and application combo specific colors end **/
/*** combo button gradation ***/
setColor(
"device_application_button_disable_start", new RGB(157, 157, 157)); //$NON-NLS-1$
setColor("device_application_button_disable_end", new RGB(78, 79, 81)); //$NON-NLS-1$
- setColor("device_application_button_outline", new RGB(31, 31, 31));
+
+ /*** combo arrow button color ***/
+ setColor("device_application_button_normal", new RGB(206, 206, 206)); //$NON-NLS-1$
+ setColor("device_application_button_push", new RGB(24, 147, 189)); //$NON-NLS-1$
+ setColor("device_application_button_hover", new RGB(45, 180, 200)); //$NON-NLS-1$
+ setColor("device_application_button_disable", new RGB(206, 206, 206)); //$NON-NLS-1$
+ setColor("device_application_button_outline", new RGB(47, 85, 92));
/*** common button colors ***/
setColor("button_normal_color_start", new RGB(240, 240, 240));
setColor("open_trace_table2_font_color", new RGB(255, 85, 57)); //$NON-NLS-1$
/** tab widget colors **/
- setColor("tab_selected_color_start", new RGB(255, 255, 255));
- setColor("tab_selected_color_end", new RGB(178, 178, 178));
- setColor("tab_normal_color_start", new RGB(206, 206, 206));
- setColor("tab_normal_color_end", new RGB(163, 163, 163));
- setColor("tab_hover_color_start", new RGB(206, 206, 206));
- setColor("tab_hover_color_end", new RGB(163, 163, 163));
- setColor("tab_push_color_start", new RGB(163, 163, 163));
- setColor("tab_push_color_end", new RGB(206, 206, 206));
-
- setColor("tab_outline_normal_color", new RGB(115, 115, 115));
- setColor("tab_outline_push_color", new RGB(10, 113, 178));
- setColor("tab_outline_hover_color", new RGB(10, 113, 178));
- setColor("tab_outline_selected_color", new RGB(160, 160, 160));
+ setColor("tab_selected_color_start", new RGB(148, 194, 201));
+ setColor("tab_selected_color_end", new RGB(88, 167, 179));
+ setColor("tab_normal_color_start", new RGB(39, 81, 89));
+ setColor("tab_normal_color_end", new RGB(15, 45, 50));
+ setColor("tab_hover_color_start", new RGB(39, 81, 89));
+ setColor("tab_hover_color_end", new RGB(15, 45, 50));
+ setColor("tab_push_color_start", new RGB(15, 45, 50));
+ setColor("tab_push_color_end", new RGB(39, 81, 89));
+
+ setColor("tab_outline_normal_color", new RGB(0, 0, 0));
+ setColor("tab_outline_push_color", new RGB(106, 154, 163));
+ setColor("tab_outline_hover_color", new RGB(106, 154, 163));
+ setColor("tab_outline_selected_color", new RGB(232, 234, 235));
setColor("tab_selected_font_color", new RGB(0, 0, 0));
- setColor("tab_normal_font_color", new RGB(91, 91, 91));
- setColor("tab_hover_font_color", new RGB(91, 91, 91));
- setColor("tab_push_font_color", new RGB(91, 91, 91));
+ setColor("tab_normal_font_color", new RGB(184, 184, 184));
+ setColor("tab_hover_font_color", new RGB(184, 184, 184));
+ setColor("tab_push_font_color", new RGB(184, 184, 184));
+ setColor("tab_bg_color", new RGB(47, 85, 92));
setColor("tab_bg_color_start", new RGB(205, 205, 205));
setColor("tab_bg_color_end", new RGB(216, 216, 216));
setColor("tab_bg_outline_color", new RGB(160, 160, 160));
private Rectangle closeButtonRect = null;
private DACustomButtonClickEventListener closeButtonListener = null;
- public DATabButton(Composite parent, int style) {
+ public DATabButton(Composite parent, int style, boolean isImageTab) {
super(parent, ColorResources.TAB_NORMAL_COLOR_START,
ColorResources.TAB_NORMAL_COLOR_END,
ColorResources.TAB_PUSH_COLOR_START,
ColorResources.TAB_HOVER_COLOR_END,
ColorResources.TAB_SELECTED_COLOR_START,
ColorResources.TAB_SELECTED_COLOR_END);
- this.setLayout(new FormLayout());
+ if(isImageTab) {
+ this.setImages(ImageResources.TAB_NORMAL,
+ ImageResources.TAB_PUSH,
+ ImageResources.TAB_HOVER,
+ ImageResources.TAB_SELECTED);
+ }
this.addListener(SWT.MouseMove, tbMouseEventListener);
this.addListener(SWT.MouseDown, tbMouseEventListener);
if (null == closeButtonRect) {
Rectangle imgRect = button.getCloseButtonImage().getBounds();
Rectangle rect = button.getBounds();
- closeButtonRect = new Rectangle(rect.width - imgRect.width - 2,
- (rect.height - imgRect.height) / 2, imgRect.width,
+ closeButtonRect = new Rectangle(rect.width - imgRect.width - 6,
+ rect.y + 1, imgRect.width,
imgRect.height);
}
private int targetButtonIndex = -1;
private int sourceButtonIndex = -1;
private boolean drag = false;
-
+
+ private boolean isImageTab = false;
private int tabWidth = LONG_TAB_WIDTH;
{
public void paintControl(PaintEvent e) {
Composite comp = (Composite) e.widget;
Rectangle rect = comp.getClientArea();
- e.gc.setForeground(ColorResources.TAB_BG_COLOR_START);
- e.gc.setBackground(ColorResources.TAB_BG_COLOR_END);
+ e.gc.setBackground(ColorResources.TAB_BG_COLOR);
e.gc.fillGradientRectangle(rect.x, rect.y, rect.width, rect.height,
true);
- e.gc.setForeground(ColorResources.TAB_BG_OUTLINE_COLOR);
e.gc.drawRectangle(rect);
}
};
String title = child.getTitle();
- final DATabButton tabButton = new DATabButton(tabComposite, SWT.NONE);
+ final DATabButton tabButton;
+ if(isImageTab) {
+ tabButton = new DATabButton(tabComposite, SWT.NONE, true);
+ tabButton.setButtonFont(FontResources.TAB_BUTTON_FONT);
+ } else {
+ tabButton = new DATabButton(tabComposite, SWT.NONE, false);
+ tabButton.setButtonFont(FontResources.TAB_BUTTON_LARGE_FONT);
+ }
tabButton.setFontColors(ColorResources.TAB_NORMAL_FONT_COLOR,
ColorResources.TAB_PUSH_FONT_COLOR,
ColorResources.TAB_HOVER_FONT_COLOR,
ColorResources.TAB_OUTLINE_SELECTED_COLOR);
tabButton.setRenderer(new TabButtonRenderer());
tabButton.setButtonEnabled(true);
- tabButton.setButtonFont(FontResources.TAB_BUTTON_FONT);
+ tabButton.setBackground(ColorResources.TAB_BG_COLOR);
tabButton.setText(title);
tabButton.setToolTipText((String) child.getData("tooltip"));
tabButton.setClosable(closeable);
FormData data = new FormData();
- data.top = new FormAttachment(0, 0);
+ data.top = new FormAttachment(0, 1);
data.bottom = new FormAttachment(100, 0);
-
+
if (buttons.size() > 0) {
DATabButton lastbutton = buttons.get(buttons.size() - 1);
data.left = new FormAttachment(lastbutton, 0);
contentsComposite.layout();
} else {
if (r.contains(curPosition.x, 0)
- && (event.y > r.y && event.y < r.y
+ && (event.y > r.y && event.y < r.y
+ r.height)) {
btn.changeButtonState(DACustomButton.STATE_HOVER);
} else {
// positioning of the tab button
private void setLayoutTabs(int leftTabIndex, int tabIndex) {
FormData data = new FormData();
- data.top = new FormAttachment(0, 0);
+ data.top = new FormAttachment(0, 1);
data.bottom = new FormAttachment(100, 0);
data.width = tabWidth;
if (leftTabIndex != -1) {
public void setTabWidth(int size) {
tabWidth = size;
}
+
+ public void isImageTab(boolean isImageTab) {
+ this.isImageTab = isImageTab;
+ }
@Override
public DABaseComposite getView(String ID) {
final Composite composite = new Composite(this, SWT.NONE);\r
composite.setLayout(new FormLayout());\r
// Creates title bar.\r
- titleBar = new Canvas(composite, SWT.DOUBLE_BUFFERED);\r
- titleBar.addPaintListener(titlePaintListener);\r
- titleBar.addListener(SWT.MouseDoubleClick, titleMouseListener);\r
-\r
- // Creates border area.\r
- Composite borderArea = new Composite(composite, SWT.NONE);\r
- borderArea.setLayout(new FormLayout());\r
- borderArea.setBackground(ColorResources.VIEW_BORDER);\r
-\r
- // Creates content area.\r
- contentArea = new Composite(borderArea, SWT.NONE);\r
- contentArea.setLayout(new FormLayout());\r
- contentArea.setBackground(ColorResources.VIEW_BG_COLOR);\r
-\r
- // Sets layout data.\r
- FormData data = new FormData();\r
- data.left = new FormAttachment(0, 0);\r
- data.right = new FormAttachment(100, 0);\r
- if (titleVisibility) {\r
- data.height = DesignConstants.VIEW_TITLEBAR_HEIGHT;\r
- } else {\r
- data.height = 0;\r
- }\r
- titleBar.setLayoutData(data);\r
-\r
- data = new FormData();\r
- data.top = new FormAttachment(titleBar, 0);\r
- data.left = new FormAttachment(0, 0);\r
- data.right = new FormAttachment(100, 0);\r
- data.bottom = new FormAttachment(100, 0);\r
- borderArea.setLayoutData(data);\r
-\r
- data = new FormData();\r
- data.top = new FormAttachment(0, 3);\r
- data.left = new FormAttachment(0, 2);\r
- data.right = new FormAttachment(100, -2);\r
- data.bottom = new FormAttachment(100, -2);\r
- contentArea.setLayoutData(data);\r
+ titleBar = new Canvas(composite, SWT.DOUBLE_BUFFERED);\r
+ titleBar.addPaintListener(titlePaintListener);\r
+ titleBar.addListener(SWT.MouseDoubleClick, titleMouseListener);\r
+\r
+ // Creates border area.\r
+ Composite borderArea1 = new Composite(composite, SWT.NONE);\r
+ borderArea1.setLayout(new FormLayout());\r
+ borderArea1.setBackground(ColorResources.VIEW_BORDER_1);\r
+ \r
+ Composite borderArea2 = new Composite(borderArea1, SWT.NONE);\r
+ borderArea2.setLayout(new FormLayout());\r
+ borderArea2.setBackground(ColorResources.VIEW_BORDER_2);\r
+ \r
+ Composite borderArea3 = new Composite(borderArea2, SWT.NONE);\r
+ borderArea3.setLayout(new FormLayout());\r
+ borderArea3.setBackground(ColorResources.VIEW_BORDER_3);\r
+ \r
+ // Creates content area.\r
+ contentArea = new Composite(borderArea3, SWT.NONE);\r
+ contentArea.setLayout(new FormLayout());\r
+ contentArea.setBackground(ColorResources.VIEW_BG_COLOR);\r
+\r
+ // Sets layout data.\r
+ FormData data = new FormData();\r
+ data.left = new FormAttachment(0, 0);\r
+ data.right = new FormAttachment(100, 0);\r
+ if (titleVisibility) {\r
+ data.height = DesignConstants.VIEW_TITLEBAR_HEIGHT;\r
+ } else {\r
+ data.height = 0;\r
+ }\r
+ titleBar.setLayoutData(data);\r
+\r
+ data = new FormData();\r
+ data.top = new FormAttachment(titleBar, 0);\r
+ data.left = new FormAttachment(0, 0);\r
+ data.right = new FormAttachment(100, 0);\r
+ data.bottom = new FormAttachment(100, 0);\r
+ borderArea1.setLayoutData(data);\r
+ \r
+ data = new FormData();\r
+ data.top = new FormAttachment(0, 1);\r
+ data.left = new FormAttachment(0, 1);\r
+ data.right = new FormAttachment(100, -1);\r
+ data.bottom = new FormAttachment(100, -1);\r
+ borderArea2.setLayoutData(data);\r
+ \r
+ data = new FormData();\r
+ data.top = new FormAttachment(0, 4);\r
+ data.left = new FormAttachment(0, 3);\r
+ data.right = new FormAttachment(100, -3);\r
+ data.bottom = new FormAttachment(100, -3);\r
+ borderArea3.setLayoutData(data);\r
+\r
+ data = new FormData();\r
+ data.top = new FormAttachment(0, 0);\r
+ data.left = new FormAttachment(0, 0);\r
+ data.right = new FormAttachment(100, 0);\r
+ data.bottom = new FormAttachment(100, 0);\r
+ contentArea.setLayoutData(data);\r
}\r
\r
public Canvas getTitleArea(){\r
\r
Rectangle bounds = titleBar.getBounds();\r
int width = bounds.width;\r
- int height = bounds.height - 2;\r
+ int height = bounds.height;\r
\r
// Draws background.\r
gc.setForeground(ColorResources.TITLEBAR_START_COLOR);\r
gc.setBackground(ColorResources.TITLEBAR_END_COLOR);\r
gc.fillGradientRectangle(bounds.x, bounds.y, width, height, true);\r
- gc.setForeground(ColorResources.TITLEBAR_BOTTOM_STROKE_1);\r
- gc.drawLine(bounds.x, bounds.y + height + 1, bounds.x + width,\r
- bounds.y + height + 1);\r
- gc.setForeground(ColorResources.TITLEBAR_BOTTOM_STROKE_2);\r
- gc.drawLine(bounds.x, bounds.y + height + 2, bounds.x + width,\r
- bounds.y + height + 2);\r
\r
// Draws text.\r
gc.setFont(FontResources.VIEW_TITLE);\r
if (button.isClosable()) {
Image img = button.getCloseButtonImage();
Rectangle imgRect = img.getBounds();
- gc.drawImage(img, rect.width - imgRect.width, rect.y + 1);
+ gc.drawImage(img, rect.width - imgRect.width - 6, rect.y + 1);
}
}
}
Rectangle r = new Rectangle(0, 0, rect.width - 1, rect.height - 1);
- if (attr.getButtonImage() == null) {
+ if (attr.getButtonImage(state) == null) {
drawButtonText(gc, r, state, attr);
}
Color c = gc.getForeground();
}
protected void drawButtonImage(GC gc, Rectangle rect,
- DACustomButtonAttribute attr) {
- if (attr != null && attr.getButtonImage() != null) {
- Image img = attr.getButtonImage();
+ DACustomButtonAttribute attr, int state) {
+ Image img = attr.getButtonImage(state);
+ if (attr != null && img != null) {
Rectangle imgRect = img.getBounds();
int width = rect.width - imgRect.width;
int height = rect.height - imgRect.height;
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact:
+ * Heeyoung Hwang <heeyoung1008.hwang@samsung.com>
* Jooyoul Lee <jy.exe.lee@samsung.com>
* Juyoung Kim <j0.kim@samsung.com>
*
* image button means background is image. <br>
* icon button means image draws on text field or front of text
*
- * @param img
- * the icon of icon button
+ *
+ * @param state
+ * The state of the button you want to set.
+ * @param image
+ * The image of the button you want to set.
*/
- public void setButtonImage(Image img) {
- attr.setButtonImage(img);
+
+ public void setButtonImage(int state, Image image) {
+ attr.setButtonImage(state, image);
}
-
+
/**
* Sets the user render of button. <br>
* this class has default renderer : DACustomButtonRenderer
}
/**
+ * Sets the icon images of button
+ *
+ * @param normal
+ * The image of normal state
+ * @param push
+ * The image of push state
+ * @param hover
+ * The image of hover state
+ * @param disable
+ * The image of disable state
+ */
+ public void setButtonImages(Image normal, Image push, Image hover, Image disable) {
+ attr.setButtonImage(STATE_NORMAL, normal);
+ attr.setButtonImage(STATE_PUSH, push);
+ attr.setButtonImage(STATE_HOVER, hover);
+ attr.setButtonImage(STATE_DISABLE, disable);
+ }
+
+ /**
* Sets the outside outline color of button.
*
* @param normal
import org.eclipse.swt.graphics.Point;
public class DACustomButtonAttribute {
- public static final int MAX_SIZE = 12;
+ public static final int MAX_SIZE = 14;
private String text;
- private Image buttonImage = null;
private Font font;
private Point fontPoint;
private int drawType = DACustomButton.TYPE_COLOR;
-
+ private List<Image> buttonImages = new ArrayList<Image>();
+ private Point buttonImagePoint;
+
private int align = SWT.CENTER;
private Image iconImage = null;
public DACustomButtonAttribute() {
for (int i = 0; i < MAX_SIZE; i++) {
+ buttonImages.add(null);
images.add(null);
colors.add(null);
fontColors.add(null);
this.text = text;
}
- public Image getButtonImage() {
- return buttonImage;
+ public Image getButtonImage(int state) {
+ if (!buttonImages.isEmpty()) {
+ return buttonImages.get(state);
+ }
+ return null;
}
- public void setButtonImage(Image img) {
- buttonImage = img;
+ public void setButtonImage(int state, Image buttonImage) {
+ buttonImages.set(state, buttonImage);
}
+ public Point getButtonImagePoint() {
+ return buttonImagePoint;
+ }
+
+ public void setButtonImagePoint(Point buttonImagePoint) {
+ this.buttonImagePoint = buttonImagePoint;
+ }
+
public Font getFont() {
return font;
}
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact:
+ * Heeyoung Hwang <heeyoung1008.hwang@samsung.com>
* Jooyoul Lee <jy.exe.lee@samsung.com>
* Juyoung Kim <j0.kim@samsung.com>
*
|| attr.getDrawType() == DACustomButton.TYPE_GRADATION) {
drawButton(gc, rect, state, attr);
}
- drawButtonImage(gc, rect, attr);
+ drawButtonImage(gc, rect, attr, state);
drawIcon(gc, rect, attr);
}
}
Rectangle r = new Rectangle(0, 0, rect.width - 1, rect.height - 1);
- if (attr.getButtonImage() == null) {
+// if (attr.getButtonImage() == null) {
drawButtonText(gc, r, attr, state);
- }
+// }
Color c = gc.getForeground();
if (null != attr.getOutlineColor(state)) {
gc.setForeground(attr.getOutlineColor(state));
}
protected void drawButtonImage(GC gc, Rectangle rect,
- DACustomButtonAttribute attr) {
- if (attr != null && attr.getButtonImage() != null) {
- Image img = attr.getButtonImage();
+ DACustomButtonAttribute attr, int state) {
+
+ Image img = attr.getButtonImage(state);
+ if (attr != null && img != null) {
+ Point p = null;
Rectangle imgRect = img.getBounds();
- int width = rect.width - imgRect.width;
- int height = rect.height - imgRect.height;
+
int x = 0, y = 0;
- if (width > 0) {
- x = width / 2;
- }
+ if (null == (p = attr.getButtonImagePoint())) {
+ int width = rect.width - imgRect.width;
+ int height = rect.height - imgRect.height;
+ if (width > 0) {
+ x = width / 2;
+ }
- if (height > 0) {
- y = height / 2;
+ if (height > 0) {
+ y = height / 2;
+ }
+ } else {
+ x = p.x;
+ y = p.y;
}
+
gc.drawImage(img, x, y);
}
}
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
*\r
* Contact: \r
+ * Heeyoung Hwang <heeyoung1008.hwang@samsung.com>\r
* Jooyoul Lee <jy.exe.lee@samsung.com>\r
* Juyoung Kim <j0.kim@samsung.com>\r
*\r
Color normalEnd, Color pushStart, Color pushEnd, Color hoverStart,\r
Color hoverEnd, Color disableStart, Color disableEnd,\r
Color toggleStart, Color toggleEnd, Color toggleHoverStart,\r
- Color toggleHoverEnd) {\r
+ Color toggleHoverEnd, Color togglePushStart, Color togglePushEnd) {\r
this(parent, SWT.NONE);\r
attr.setColor(0, normalStart);\r
attr.setColor(1, normalEnd);\r
attr.setColor(9, toggleEnd);\r
attr.setColor(10, toggleHoverStart);\r
attr.setColor(11, toggleHoverEnd);\r
+ attr.setColor(12, togglePushStart);\r
+ attr.setColor(13, togglePushEnd);\r
attr.setDrawType(TYPE_GRADATION);\r
}\r
+ \r
+ public void setOutlineColors(Color normal, Color push, Color hover,\r
+ Color disable, Color toggle, Color toggleHover, Color togglePush) {\r
+ setOutlineColors(normal, togglePush, toggleHover, disable);\r
+ attr.setOutlineColor(STATE_TOGGLE, toggle);\r
+ attr.setOutlineColor(STATE_TOGGLE_HOVER, toggleHover);\r
+ attr.setOutlineColor(STATE_TOGGLE_PUSH, togglePush);\r
+ }\r
+\r
+ public void setOutlineInColors(Color normal, Color push, Color hover,\r
+ Color disable, Color toggle, Color toggleHover, Color togglePush) { \r
+ setOutlineInColors(normal, togglePush, toggleHover, disable);\r
+ attr.setOutlineInColor(STATE_TOGGLE, toggle);\r
+ attr.setOutlineInColor(STATE_TOGGLE_HOVER, toggleHover);\r
+ attr.setOutlineInColor(STATE_TOGGLE_PUSH, togglePush);\r
+ }\r
\r
protected void addToggleListeners() {\r
if (null != toggleButtonMouseListener) {\r
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact:
+ * Heeyoung Hwang <heeyoung1008.hwang@samsung.com>
* Jooyoul Lee <jy.exe.lee@samsung.com>
* Juyoung Kim <j0.kim@samsung.com>
*
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.tizen.dynamicanalyzer.util.DALogger;
import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonRenderer;
import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonAttribute;
public class DACustomToggleButtonRenderer extends DACustomButtonRenderer {
+ private static final DALogger DA_LOG = DALogger.getInstance();
@Override
public void draw(GC gc, Canvas canvas, int state,
} else if (attr.getDrawType() == DACustomButton.TYPE_COLOR
|| attr.getDrawType() == DACustomButton.TYPE_GRADATION) {
drawButton(gc, rect, state, attr);
+ drawButtonToggleImage(gc, rect, state, attr);
}
}
+ private void drawButtonToggleImage(GC gc, Rectangle rect,
+ int state, DACustomButtonAttribute attr) {
+ Point p = null;
+ Image img = null;
+ Rectangle imgRect = null;
+
+ if (state < DACustomToggleButton.STATE_TOGGLE) {
+ // draw normal image
+ img = attr.getButtonImage(DACustomToggleButton.STATE_NORMAL);
+ } else { // state >= DACustomToggleButton.STATE_TOGGLE
+ // draw toggle image
+ img = attr.getButtonImage(DACustomToggleButton.STATE_TOGGLE);
+ }
+
+ if (null != img) {
+ imgRect = img.getBounds();
+ int x = 0, y = 0;
+ if (null == (p = attr.getButtonImagePoint())) {
+ int width = rect.width - imgRect.width;
+ int height = rect.height - imgRect.height;
+ if (width > 0) {
+ x = width / 2;
+ } else {
+ DA_LOG.debug("width size : " + width); //$NON-NLS-1$
+ }
+
+ if (height > 0) {
+ y = height / 2;
+ } else {
+ DA_LOG.debug("height size : " + height); //$NON-NLS-1$
+ }
+ } else {
+ x = p.x;
+ y = p.y;
+ }
+ gc.drawImage(img, x, y);
+ }
+
+ }
}
gc.setAlpha(255);
}
+ /*
+ * This method is one of Chart renderer. Real chart using this method is File Analysis chart.
+ * This renderer draws Rectangle and bar in multi line and need specific seriesItem type.
+ * Type is possible SERIES_AREA_START, SERIES_AREA_END, SERIES_AREA_BAR.
+ */
private void drawStateAreaSeries(GC gc, DAChartSeries series, int seriesIndex,
int seriesSize) {
List<DAChartSeriesItem> seriesItems = series.getSeriesItemList();
pixcelWidth = plot.getXPixcelFromX(endSeriesItem.getX(), r) - pixcelStartX;
} else {
/*
- * endSeriesItem is null when end series is not exist. this case, draw it as much as visibleEndX.
+ * endSeriesItem is null when end series is not exist. this case, draw it as much as validEndX.
*/
- pixcelWidth = plot.getXPixcelFromX(plot.getVisibleEndX(), r) - pixcelStartX;
+ pixcelWidth = plot.getXPixcelFromX(plot.getValidEndX(), r) - pixcelStartX;
+ }
+ if(pixcelWidth ==0) {
+ pixcelWidth = 1;
}
gc.fillRectangle(pixcelStartX, pixcelStartY, pixcelWidth, areaHeight);
chartCell.addMouseListener(new MouseListener() {
@Override
public void mouseUp(MouseEvent e) {
+ parent.callbackSelect(true);
}
@Override
public void mouseDown(MouseEvent e) {
- parent.callbackSelect(true);
+// parent.callbackSelect(true);
}
@Override
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact:
+ * Heeyoung Hwang <heeyoung1008.hwang@samsung.com>
* Jooyoul Lee <jy.exe.lee@samsung.com>
* Juyoung Kim <j0.kim@samsung.com>
*
private static final int pageSize = 5;
+ public static final int TYPE_IMAGE = 0;
+ public static final int TYPE_COLOR = 1;
+ public static final int TYPE_GRADATION = 2;
+
Composite parent;
private Canvas combo = null;
private Canvas popup = null;
private List<String> items;
private List<Rectangle> rects = null;
+ private int arrowButtonHeight = 15;
+ private Point comboImagePoint;
+ private List<Image> comboImages = null;
+ private List<Color> colors = null;
+ private List<Color> outlineColors = null;
+ private int drawType = DACustomCombo.TYPE_COLOR; // color, gradation, image
+
private List<Image> images = null;
private Image buttonUp = null;
private Image buttonDown = null;
private int selection = 0;
private int tmpSelection = 0;
private String text = DAWidgetConstants.EMPTY_STRING;
- private boolean imgCombo = false;
private int state = STATE_NORMAL; // 0 normal 1 hover 2 push 3 disable
private DACustomComboRenderer comboRenderer = new DACustomComboDefaultRenderer();;
private DACustomComboPopupRenderer popupRenderer = new DACustomComboPopupDefaultRenderer();
private IDACustomButtonRenderer buttonRenderer = null;
private List<Color> arrowColors = null;
+ private List<Color> arrowOutlineColors = null;
private List<Image> arrowImages = null;
private int titleAlign = TEXT_ALIGN_LEFT;
private Font font;
-
+ private Point fontPoint;
+
public DACustomCombo(Composite parent, int style) {
super(parent, style);
combo = this;
addListener(SWT.MouseUp, comboMouseListener);
}
+ public Point getFontPoint() {
+ return fontPoint;
+ }
+
+ public void setFontPoint(Point fontPoint) {
+ this.fontPoint = fontPoint;
+ }
+
public String getText() {
if (selection < 0) {
return text;
return max;
}
+ public int getArrowButtonHeight() {
+ return arrowButtonHeight;
+ }
+
+ public void setArrowButtonHeight(int arrowButtonHeight) {
+ this.arrowButtonHeight = arrowButtonHeight;
+ }
+
public int getItemHeight() {
return itemHeight;
}
if (buttonUp == null) {
upArrowButton.setText(Messages.DACustomCombo_1);
} else {
- upArrowButton.setButtonImage(buttonUp);
+ upArrowButton.setButtonImages(buttonUp,
+ buttonUp, buttonUp, buttonUp);
}
FormData data = new FormData();
data.top = new FormAttachment(0, 0);
data.left = new FormAttachment(0, 0);
data.right = new FormAttachment(100, 0);
- data.height = height;
+ data.height = arrowButtonHeight;
upArrowButton.setLayoutData(data);
upArrowButton.addListener(SWT.MouseExit, upButtonMouseListener);
upArrowButton.addListener(SWT.MouseEnter, upButtonMouseListener);
upArrowButton.addListener(SWT.MouseUp, upButtonMouseListener);
upArrowButton.addListener(SWT.FocusIn, upButtonMouseListener);
upArrowButton.addListener(SWT.FocusOut, upButtonMouseListener);
- shellHeight += height;
+ shellHeight += arrowButtonHeight;
if (tmpItemIndex > 0) {
upArrowButton.setButtonEnabled(true);
} else {
if (null == buttonDown) {
downArrowButton.setText(Messages.DACustomCombo_2);
} else {
- downArrowButton.setButtonImage(buttonDown);
+ downArrowButton.setButtonImages(buttonDown,
+ buttonDown, buttonDown, buttonDown);
}
data = new FormData();
data.top = new FormAttachment(popup, 0);
data.left = new FormAttachment(0, 0);
data.right = new FormAttachment(100, 0);
- data.height = height;
+ data.height = arrowButtonHeight;
downArrowButton.setLayoutData(data);
downArrowButton.addListener(SWT.MouseExit, downButtonMouseListener);
downArrowButton
downArrowButton.addListener(SWT.MouseUp, downButtonMouseListener);
downArrowButton.addListener(SWT.FocusIn, downButtonMouseListener);
downArrowButton.addListener(SWT.FocusOut, downButtonMouseListener);
- shellHeight += height;
+ shellHeight += arrowButtonHeight;
if (tmpItemIndex + MAX_SIZE < size - 1) {
downArrowButton.setButtonEnabled(true);
} else {
this.enabled = enabled;
if (enabled) {
changeComboState(STATE_NORMAL);
- if (isImageCombo()) {
- setBackgroundImage(images.get(STATE_NORMAL));
- }
+ setBackgroundImageAndColor(STATE_NORMAL);
} else {
changeComboState(STATE_DISABLE);
- if (isImageCombo()) {
- setBackgroundImage(images.get(STATE_DISABLE));
- }
+ setBackgroundImageAndColor(STATE_DISABLE);
Display.getDefault().syncExec(new Runnable() {
@Override
}
}
+ private void setBackgroundImageAndColor(int state) {
+ if (drawType == TYPE_IMAGE) {
+ setBackgroundImage(images.get(state));
+ } else if (drawType == TYPE_COLOR) {
+ setBackground(colors.get(state));
+ } else if (drawType == TYPE_GRADATION) {
+ int index = state * 2;
+ setForeground(colors.get(index));
+ setBackground(colors.get(index + 1));
+ } else {
+ DA_LOG.debug("DACustomCombo drawType : " + state);
+ }
+ }
+
private PaintListener comboPaintListener = new PaintListener() {
@Override
- public void paintControl(PaintEvent e) {
- if (!isImageCombo()) {
- comboRenderer.draw(e.gc, combo, text, titleAlign, font, state);
- } else {
+ public void paintControl(PaintEvent e) {
+ if (drawType == TYPE_IMAGE) {
comboRenderer.drawImage(e.gc, combo, images.get(state), text,
- titleAlign, font, state);
- }
+ titleAlign, font, state);
+ } else if (drawType == TYPE_COLOR || drawType == TYPE_GRADATION) {
+ comboRenderer.draw(e.gc, combo, drawType, colors,
+ outlineColors, comboImagePoint, comboImages,
+ text, titleAlign, font, fontPoint, state);
+ } else {
+ DA_LOG.debug("DACustomCombo drawType : " + state);
+ }
}
};
}
return DAWidgetConstants.EMPTY_STRING;
}
-
+
+ private List<Color> getColors() {
+ if (null == colors) {
+ colors = new ArrayList<Color>();
+ }
+ return colors;
+ }
+
+ public void setComboColors(Color normal, Color push, Color hover, Color disable) {
+ List<Color> comboColors = getColors();
+ comboColors.add(normal);
+ comboColors.add(hover);
+ comboColors.add(push);
+ comboColors.add(disable);
+ drawType = TYPE_COLOR;
+ }
+
+ public void setComboGradation(Color normalStart, Color normalEnd,
+ Color pushStart, Color pushEnd, Color hoverStart, Color hoverEnd,
+ Color disableStart, Color disableEnd) {
+ List<Color> comboColors = getColors();
+ comboColors.add(normalStart);
+ comboColors.add(normalEnd);
+ comboColors.add(hoverStart);
+ comboColors.add(hoverEnd);
+ comboColors.add(pushStart);
+ comboColors.add(pushEnd);
+ comboColors.add(disableStart);
+ comboColors.add(disableEnd);
+ drawType = TYPE_GRADATION;
+ }
+
public void setImages(Image normal, Image hover, Image push, Image disable) {
if (null == normal || null == hover || null == push || null == disable) {
+ DA_LOG.debug("DACustomCombo setImages parameter is null");
return;
}
List<Image> imgs = getImages();
imgs.add(hover);
imgs.add(push);
imgs.add(disable);
- setImageCombo(true);
+ drawType = TYPE_IMAGE;
}
private List<Image> getImages() {
return images;
}
- private void setImageCombo(boolean b) {
- this.imgCombo = b;
+ private List<Color> getOutlineColors() {
+ if (null == outlineColors) {
+ outlineColors = new ArrayList<Color>();
+ }
+ return outlineColors;
}
-
- public boolean isImageCombo() {
- return imgCombo;
+
+ public void setOutlineColors(Color normal, Color push, Color hover,
+ Color disable) {
+ List<Color> comboOutlineColors = getOutlineColors();
+ comboOutlineColors.add(normal);
+ comboOutlineColors.add(hover);
+ comboOutlineColors.add(push);
+ comboOutlineColors.add(disable);
+ }
+
+ private List<Image> getComboImages() {
+ if (null == comboImages) {
+ comboImages = new ArrayList<Image>();
+ }
+ return comboImages;
}
+ public void setComboImages(Image normal, Image push, Image hover, Image disable) {
+ List<Image> imgs = getComboImages();
+ imgs.add(normal);
+ imgs.add(hover);
+ imgs.add(push);
+ imgs.add(disable);
+ }
+
+ public Point getComboImagePoint() {
+ return comboImagePoint;
+ }
+
+ public void setComboImagePoint(Point comboImagePoint) {
+ this.comboImagePoint = comboImagePoint;
+ }
+
private Listener upButtonMouseListener = new Listener() {
@Override
Color disable) {
arrowColors = new ArrayList<Color>();
arrowColors.add(normal);
- arrowColors.add(push);
arrowColors.add(hover);
+ arrowColors.add(push);
arrowColors.add(disable);
}
arrowColors = new ArrayList<Color>();
arrowColors.add(normalStart);
arrowColors.add(normalEnd);
- arrowColors.add(pushStart);
- arrowColors.add(pushEnd);
arrowColors.add(hoverStart);
arrowColors.add(hoverEnd);
+ arrowColors.add(pushStart);
+ arrowColors.add(pushEnd);
arrowColors.add(disableStart);
arrowColors.add(disableEnd);
}
+ private List<Color> getArrowOutlineColors() {
+ if (null == arrowOutlineColors) {
+ arrowOutlineColors = new ArrayList<Color>();
+ }
+ return arrowOutlineColors;
+ }
+
+ public void setArrowOutlineColors(Color normal, Color push, Color hover,
+ Color disable) {
+ List<Color> comboArrowOutlineColors = getArrowOutlineColors();
+ comboArrowOutlineColors.add(normal);
+ comboArrowOutlineColors.add(hover);
+ comboArrowOutlineColors.add(push);
+ comboArrowOutlineColors.add(disable);
+ }
+
private DACustomButton makeButton() {
DACustomButton button = null;
if (arrowImages != null) {
+ // image
button = new DACustomButton(childShell,
arrowImages.get(STATE_NORMAL), arrowImages.get(STATE_PUSH),
arrowImages.get(STATE_HOVER),
arrowColors.get(STATE_DISABLE * 2),
arrowColors.get(STATE_DISABLE * 2 + 1));
} else {
+ // color
button = new DACustomButton(childShell, SWT.NONE);
button.setColors(arrowColors.get(STATE_NORMAL),
arrowColors.get(STATE_PUSH),
arrowColors.get(STATE_HOVER),
arrowColors.get(STATE_DISABLE));
}
+
+ if (arrowOutlineColors != null) {
+ button.setOutlineColors(arrowOutlineColors.get(STATE_NORMAL),
+ arrowOutlineColors.get(STATE_PUSH),
+ arrowOutlineColors.get(STATE_HOVER),
+ arrowOutlineColors.get(STATE_DISABLE));
+ }
} else {
button = new DACustomButton(childShell, SWT.NONE);
}
package org.tizen.dynamicanalyzer.widgets.combo;
+import java.util.List;
+
import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
}
@Override
- public void drawPattern(GC gc, Canvas canvas, Image patternImage,
- String text, int state) {
+ public void drawImage(GC gc, Canvas canvas, Image image, String text,
+ int textAlign, Font font, int state) {
+
}
@Override
- public void drawImage(GC gc, Canvas canvas, Image image, String text,
- int textAlign, Font font, int state) {
+ public void draw(GC gc, Canvas canvas, int drawType, List<Color> colors,
+ List<Color> outlineColors, Point comboImagePoint,
+ List<Image> comboImages, String text, int textAlign, Font font,
+ Point fontPoint, int state) {
}
@Override
public void drawPattern(GC gc, Canvas canvas, Image patternImage,
int state, List<Rectangle> rects, int selection, List<String> items) {
- // TODO Auto-generated method stub
}
@Override
public void drawImage(GC gc, Canvas canvas, Image image, int state,
List<Rectangle> rects, int selection, List<String> items) {
- // TODO Auto-generated method stub
}
package org.tizen.dynamicanalyzer.widgets.combo;
+import java.util.List;
+
+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.widgets.Canvas;
public abstract class DACustomComboRenderer {
public abstract void draw(GC gc, Canvas canvas, String text, int textAlign,
Font font, int state);
- public abstract void drawPattern(GC gc, Canvas canvas, Image patternImage,
- String text, int state);
-
public abstract void drawImage(GC gc, Canvas canvas, Image image,
String text, int textAlign, Font font, int state);
+
+ public abstract void draw(GC gc, Canvas canvas, int drawType, List<Color> colors,
+ List<Color> outlineColors, Point comboImagePoint, List<Image> comboImages,
+ String text, int textAlign, Font font, Point fontPoint, int state);
}
"checkbox_disabled_font_color", new RGB(135, 135, 135)); //$NON-NLS-1$\r
\r
/*** stop progress dialog ***/\r
- public static final Color STOP_PROGRESS_LINE1_COLOR = getColor("stop_progress_line1_color", new RGB(2, 171, 208)); //$NON-NLS-1$\r
- public static final Color STOP_PROGRESS_LINE2_COLOR = getColor("stop_progress_line2_color", new RGB(86, 86, 86)); //$NON-NLS-1$\r
- public static final Color STOP_PROGRESS_BACKGROUND_COLOR = getColor("stop_progress_background_color", new RGB(230, 230, 230)); //$NON-NLS-1$\r
+ public static final Color STOP_PROGRESS_LINE1_COLOR = getColor("stop_progress_line1_color", new RGB(45, 180, 200)); //$NON-NLS-1$\r
+ public static final Color STOP_PROGRESS_LINE2_COLOR = getColor("stop_progress_line2_color", new RGB(0, 0, 0)); //$NON-NLS-1$\r
+ public static final Color STOP_PROGRESS_BACKGROUND_COLOR = getColor("stop_progress_background_color", new RGB(232, 234, 235)); //$NON-NLS-1$\r
public static final Color STOP_PROGRESS_INFO_FONT_COLOR = getColor("stop_progress_info_font_color", new RGB(70, 70, 70)); //$NON-NLS-1$\r
- public static final Color STOP_PROGRESS_BAR_START_COLOR = getColor("stop_progress_bar_start_color", new RGB(0, 181, 222)); //$NON-NLS-1$\r
- public static final Color STOP_PROGRESS_BAR_END_COLOR = getColor("stop_progress_bar_end_color", new RGB(4, 108, 143)); //$NON-NLS-1$\r
+ public static final Color STOP_PROGRESS_BAR_START_COLOR = getColor("stop_progress_bar_start_color", new RGB(45, 180, 222)); //$NON-NLS-1$\r
+ public static final Color STOP_PROGRESS_BAR_END_COLOR = getColor("stop_progress_bar_end_color", new RGB(19, 161, 183)); //$NON-NLS-1$\r
public static final Color STOP_PROGRESS_BAR_BG_START_COLOR = getColor("stop_progress_bar_bg_start_color", new RGB(204, 204, 204)); //$NON-NLS-1$\r
public static final Color STOP_PROGRESS_BAR_BG_END_COLOR = getColor("stop_progress_bar_bg_end_color", new RGB(212, 212, 212)); //$NON-NLS-1$\r
- public static final Color STOP_PROGRESS_BAR_OUTLINE_COLOR = getColor("stop_progress_bar_outline_color", new RGB(150, 150, 150)); //$NON-NLS-1$\r
+ public static final Color STOP_PROGRESS_BAR_OUTLINE_COLOR = getColor("stop_progress_bar_outline_color", new RGB(95, 95, 95)); //$NON-NLS-1$\r
\r
\r
\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
+ public static Color POPUP_MENU_ITEM_SELECTED = getColor("popup_menu_item_selected", new RGB(45, 180, 200)); //$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
public static final Font TEST_TEXT = getFont(\r
"about_text", resizeSystemFont(28));//$NON-NLS-1$\r
\r
+ public static final Font LICENSE_TEXT = getFont(\r
+ "license_text", resizeSystemFont(8));//$NON-NLS-1$\r
+ \r
/** detail info font **/\r
public static final Font DETAIL_INFO_FONT = getFont(\r
"detail_info_font", resizeSystemFont(9));//$NON-NLS-1$\r
"additem_button_font", resizeSystemFont(8));//$NON-NLS-1$\r
public static final Font TAB_BUTTON_FONT = getFont(\r
"tab_button_font", resizeSystemFont(10));//$NON-NLS-1$\r
+ public static final Font TAB_BUTTON__LARGE_FONT = getFont(\r
+ "tab_button_large_font", resizeSystemFont(10));//$NON-NLS-1$\r
\r
public static final Font CURRENT_TABLE_HEADER_FONT = getFont(\r
"current_table_header_font", resizeSystemFont(8));//$NON-NLS-1$\r
public static final Font STOP_PROGRESS_FONT = getFont(\r
"stop_progress_font", resizeSystemFont(8));//$NON-NLS-1$\r
public static final Font PROGRESS_FONT = getFont(\r
- "progress_font", resizeSystemFont(9));//$NON-NLS-1$\r
+ "progress_font", resizeSystemFont(8));//$NON-NLS-1$\r
\r
public static final Font CONTEXT_MENU_ITEM_FONT = getFont(\r
"context_menu_item_font", resizeSystemFont(9));//$NON-NLS-1$\r
/*** tree fold ***/
public static final Image TREE_FOLD = getPngImage("tree_fold"); //$NON-NLS-1$
public static final Image TREE_OPEN = getPngImage("tree_open"); //$NON-NLS-1$
+
+ /*** context child arrow ***/
+ public static final Image CONTEXT_OPEN = getPngImage("context_menu_child_arrow"); //$NON-NLS-1$
// check box
public static final Image CHECKBOX_SELECTED = getPngImage("checkbox_selected"); //$NON-NLS-1$
@Override
public void mouseDown(MouseEvent event) {
- // TODO Auto-generated method stub
switch (event.button) {
case MOUSE_LEFT: {
closeParent();
newItem.setButtonEnabled(false);
}
} else {
- newItem.setButtonImage(ImageResources.TREE_FOLD);
+ newItem.setButtonImages(ImageResources.CONTEXT_OPEN,
+ ImageResources.CONTEXT_OPEN,
+ ImageResources.CONTEXT_OPEN,
+ ImageResources.CONTEXT_OPEN);
newItem.addListener(SWT.MouseHover, mouseListener);
}
Image icon = child.getIcon();
}
shell.layout();
int popupWidth = itemWidth + DAPopupMenuItemButtonRenderer.MARGIN * 2
+ + DAPopupMenuItemButtonRenderer.ICON_MARGIN
+ DAPopupMenuItemButtonRenderer.TEXT_MARGIN
+ DAPopupMenuItemButtonRenderer.DEFAULT_ICON_SIZE * 2;
int popupHeight = itemHeight + DAPopupMenuItemButtonRenderer.MARGIN * 2;
@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);
* Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact:
+ * Heeyoung Hwang <heeyoung1008.hwang@samsung.com>
* yeongtaik byeon <yeongtaik.byeon@samsung.com>
* Juyoung Kim <j0.kim@samsung.com>
*
protected static final int DEFAULT_ITEM_HEIGHT = 24;
protected static final int DEFAULT_ICON_SIZE = 16;
protected static final int DEFAULT_FONT_SIZE = 9;
+ protected static final int ICON_MARGIN = 3;
@Override
public void draw(GC gc, Canvas canvas, int state,
Rectangle rect = canvas.getClientArea();
drawButton(gc, rect, state, attr);
drawIcon(gc, rect, state, attr);
- drawButtonImage(gc, rect, attr);
+ drawButtonImage(gc, rect, attr, state);
}
protected void drawButton(GC gc, Rectangle rect, int state,
Font font = null;
Point p = null;
- Rectangle textRect = new Rectangle(rect.x + DEFAULT_ICON_SIZE, rect.y,
+ Rectangle textRect = new Rectangle(rect.x + ICON_MARGIN + DEFAULT_ICON_SIZE, rect.y,
rect.width, rect.height);
if (null != (text = attr.getText())) {
}
protected void drawButtonImage(GC gc, Rectangle rect,
- DACustomButtonAttribute attr) {
- if (attr != null && attr.getButtonImage() != null) {
- Image img = attr.getButtonImage();
+ DACustomButtonAttribute attr, int state) {
+ Image img = attr.getButtonImage(state);
+ if (attr != null && img != null) {
gc.drawImage(img, rect.width - img.getBounds().width - MARGIN,
rect.height / 2 - img.getBounds().height / 2);
}
public final static String DAEMONLOG_PREFIX = "da_daemon_log_";//$NON-NLS-1$
public final static int DAEMONLOG_COUNT = 3;
+
+ public final static String DOWNLOAD_FILE_FOLDER = "download_file";//$NON-NLS-1$
+ public final static String TMP_FOLDER = "tmp";//$NON-NLS-1$
+ public static final String CHECK_DOWNLOAD_FILE_STRING = "SkWek2n3_File:";//$NON-NLS-1$
+
+
/*** version 3.0 */
public final static int MSG_KEEP_ALIVE = 0x0001;
--- /dev/null
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * 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.common;
+
+public class DALimit {
+
+ /*
+ * limit of each information size
+ * if the size is over, read/write/send/receive in file or cut it down.
+ */
+ // common
+ public static final int FUNCTION_NAME_LENGTH = 1024;
+ public static final int FILEPATH_LENGTH = 1024;
+ public static final int FUNCTION_ARGUMENTS_FORMAT_LENGTH = 100;
+ public static final int FUNCTION_ARGUMENTS_VALUE_LENGTH = 1024;
+ // OpenGL Analysis
+ public static final int SHADER_SOURCE_LENGTH = 4096;
+ public static final int SHADER_VARIABLE_LENGTH = 1024;
+ // Network Analysis
+ public static final int HTML_SCRIPT_LENGTH = 4096;
+
+
+ /*
+ * maximum limit of the tool can manager
+ * if one of the value is over, stop the trace.
+ */
+ // common
+ public static final int MAX_TRACE_TIME_INSECOND = 24*60*60; // 1 day
+ public static final long MAX_SEQUENCE_NUMBER = Long.MAX_VALUE; //2^63-1, 4G*2G-1
+ public static final int MAX_PROCESS_COUNT = 2^16; // 65535
+ public static final int MAX_BINARY_COUNT = 2^16; // 65535
+ public static final int MAX_FUNCTION_COUNT = 2^20; // 1,048,576
+ public static final int MAX_FUNCTION_ARGUMENTS_COUNT = FUNCTION_ARGUMENTS_FORMAT_LENGTH; // Because "MAX_FUNCTION_ARGUMENTS_COUNT < FUNCTION_ARGUMENTS_FORMAT_LENGTH" is always true
+
+ // Leak
+ public static final int MAX_LEAK_CHECK_BUFFER_SIZE = 2^20; // 1,048,576
+
+ // File Analysis
+ public static final int MAX_FILE_COUNT = 2^10; // 1024
+ public static final int MAX_FILE_STATUS_COUNT = 2^10*100; // 102400
+ public static final int MAX_FILE_ACCESS_COUNT = 2^10*100; // 102400
+ public static final int MAX_FILE_ACCESSOR_COUNT = 2^10*100; // 102400
+ public static final int MAX_STRING_LENGTH = 12;
+
+}
|| appInfo.getInfo(AppInfo.APPTYPE_INDEX)
.contains(AppInfo.APPTYPE_WEB) || appInfo
.getInfo(AppInfo.APPTYPE_INDEX).contains(
- AppInfo.APPTYPE_CAPP))
- && appInfo.getInfo(AppInfo.MULTIPLE_INDEX).equals(
- AppInfo.FLAG_ZERO)
- && appInfo.getInfo(AppInfo.NODISPLAY_INDEX).equals(
- AppInfo.FLAG_ZERO)) {
+ AppInfo.APPTYPE_CAPP))) {
+// && appInfo.getInfo(AppInfo.MULTIPLE_INDEX).equals(
+// AppInfo.FLAG_ZERO)
+// && appInfo.getInfo(AppInfo.NODISPLAY_INDEX).equals(
+// AppInfo.FLAG_ZERO)) {
String pkgId = appInfo.getInfo(AppInfo.PACKAGE_INDEX);
String appId = appInfo.getInfo(AppInfo.APPID_INDEX);
public static final String COMMON_COLUMN_PID = "PID";//$NON-NLS-1$
public static final String COMMON_COLUMN_TID = "TID";//$NON-NLS-1$
public static final String COMMON_COLUMN_ARG = "ARG";//$NON-NLS-1$
+ public static final String COMMON_COLUMN_RET = "RET";//$NON-NLS-1$
public static final String COMMON_COLUMN_ERROR = "ERROR";//$NON-NLS-1$
public static final String COMMON_COLUMN_CALLER_PC_ADDRESS = "CALLER_PC_ADDRESS";//$NON-NLS-1$
public static final String COMMON_COLUMN_CALLER_LIB_NAME = "LIB_NAME";//$NON-NLS-1$
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.LinkedBlockingQueue;
import org.tizen.dynamicanalyzer.util.CommonUtil;
import org.tizen.dynamicanalyzer.util.DALogger;
public class SqlConnectionManager {
private static final DALogger DA_LOG = DALogger.getInstance();
- private static Connection connection = null;
+ // apply multi connection of DB
+ private static final int CONNECTION_COUNT_UPDATE = 8;
+ private static final int CONNECTION_COUNT_QUERY = 8;
+ private static BlockingQueue<Connection> updateConnections = null;
+ private static BlockingQueue<Connection> queryConnections = null;
+ private static int realUpdateConnCount = 0;
+ private static int realQueryConnCount = 0;
+
+ // DATABASE state
+ private enum State {
+ NOT_CONNECTED,
+ CONNECTED,
+ TO_BE_CLOSED
+ }
+
+ private static State state = State.NOT_CONNECTED;
public static boolean establishConnection(String dbFilePath) {
boolean result = true;
try {
synchronized (SqlConnectionManager.class) {
- if (connection == null) {
+ if (updateConnections == null && queryConnections == null) {
+ updateConnections = new LinkedBlockingQueue<Connection>();
+ queryConnections = new LinkedBlockingQueue<Connection>();
+ realUpdateConnCount = 0;
+ realQueryConnCount = 0;
+
Class.forName("org.hsqldb.jdbcDriver");
String dbUrl = "jdbc:hsqldb:"
+ dbFilePath
- + ";shutdown=false;hsqldb.default_table_type=cached;hsqldb.large_data=true;hdqldb.log_data=false"; //$NON-NLS-1$
- connection = DriverManager.getConnection(dbUrl, "SA", "");
- SQLWarning warning = connection.getWarnings();
- while (warning != null) {
- DA_LOG.debug("[DB] Message: " + warning.getMessage());
- DA_LOG.debug("[DB] SQL state: " + warning.getSQLState());
- DA_LOG.debug("[DB] Vendor code: "
- + warning.getErrorCode());
- warning = warning.getNextWarning();
+ + ";shutdown=false;hsqldb.default_table_type=cached"
+ + ";hsqldb.tx=mvcc;hsqldb.large_data=true;hdqldb.log_data=false"; //$NON-NLS-1$
+
+ Connection conn;
+ // establish update connection pool
+ for (int i = 0; i < CONNECTION_COUNT_UPDATE; i++) {
+ conn = DriverManager.getConnection(dbUrl, "SA", "");
+ updateConnections.offer(conn);
+ realUpdateConnCount++;
+
+ SQLWarning warning = conn.getWarnings();
+ while (warning != null) {
+ DA_LOG.debug("[DB][" + i + "] Message: "
+ + warning.getMessage());
+ DA_LOG.debug("[DB][" + i + "] SQL state: "
+ + warning.getSQLState());
+ DA_LOG.debug("[DB][" + i + "] Vendor code: "
+ + warning.getErrorCode());
+ warning = warning.getNextWarning();
+ }
+ }
+
+ // establish query connection pool
+ for (int i = 0; i < CONNECTION_COUNT_QUERY; i++) {
+ conn = DriverManager.getConnection(dbUrl, "SA", "");
+ queryConnections.offer(conn);
+ realQueryConnCount++;
+
+ SQLWarning warning = conn.getWarnings();
+ while (warning != null) {
+ DA_LOG.debug("[DB][" + i + "] Message: "
+ + warning.getMessage());
+ DA_LOG.debug("[DB][" + i + "] SQL state: "
+ + warning.getSQLState());
+ DA_LOG.debug("[DB][" + i + "] Vendor code: "
+ + warning.getErrorCode());
+ warning = warning.getNextWarning();
+ }
}
+
+ state = State.CONNECTED;
}
}
} catch (ClassNotFoundException e) {
} catch (SQLException e) {
e.printStackTrace();
} finally {
- if (connection == null)
+ if (updateConnections == null || queryConnections == null)
result = false;
else
result = true;
public static void closeConnection() {
synchronized (SqlConnectionManager.class) {
- if (connection != null) {
- try {
- Statement st = connection.createStatement();
- st.execute("SHUTDOWN");
- CommonUtil.tryClose(st);
- connection.close();
- } catch (SQLException se) {
- if (!se.getSQLState().equals("XJ015")) {
- DA_LOG.debug("DB did not shutdown normally");
+ // set close state
+ // this value prevent other thread from getting connection
+ state = State.TO_BE_CLOSED;
+
+ // close update connection
+ if (updateConnections != null) {
+ synchronized (updateConnections) {
+ while (updateConnections.size() != realUpdateConnCount) {
+ // wait until other execution is finished
+ try {
+ updateConnections.wait();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ // close all connection
+ Connection conn;
+ while ((conn = updateConnections.poll()) != null) {
+ try {
+ conn.close();
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ // close query connection
+ if (queryConnections != null) {
+ synchronized (queryConnections) {
+ while (queryConnections.size() != realQueryConnCount) {
+ // wait until other execution is finished
+ try {
+ queryConnections.wait();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ // close all connection
+ Connection conn;
+ while ((conn = queryConnections.poll()) != null) {
+ // if it is last connection of database
+ if (queryConnections.size() == 0) {
+ Statement st = null;
+ try {
+ st = conn.createStatement();
+ st.execute("SHUTDOWN");
+ } catch (SQLException se) {
+ if (!se.getSQLState().equals("XJ015")) {
+ DA_LOG.debug("DB did not shutdown normally");
+ }
+ } finally {
+ CommonUtil.tryClose(st);
+ }
+ }
+
+ try {
+ conn.close();
+ } catch (SQLException e) {
+ e.printStackTrace();
}
}
- connection = null;
}
+
+ updateConnections = null;
+ queryConnections = null;
+
+ state = State.NOT_CONNECTED;
}
}
- public static boolean isConnected() {
- return (connection != null);
- }
+ private static Connection getUpdateConnection() {
+ Connection retConn = null;
+ if (state == State.CONNECTED) {
+ try {
+ retConn = updateConnections.take();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
- private static void semaphoreAcquire() {
+ return retConn;
+ }
+ private static void putUpdateConnection(Connection conn) {
+ if (conn != null) {
+ try {
+ updateConnections.put(conn);
+ synchronized (updateConnections) {
+ updateConnections.notifyAll();
+ }
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
}
- private static void semaphoreRelease() {
+ private static Connection getQueryConnection() {
+ Connection retConn = null;
+ if (state == State.CONNECTED) {
+ try {
+ retConn = queryConnections.take();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ return retConn;
+ }
+
+ private static void putQueryConnection(Connection conn) {
+ if (conn != null) {
+ try {
+ queryConnections.put(conn);
+ synchronized (queryConnections) {
+ queryConnections.notifyAll();
+ }
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
}
public static void executeUpdate(String statement) {
+ Connection conn = null;
Statement sm = null;
try {
- if (connection != null) {
- semaphoreAcquire();
- sm = connection.createStatement();
+ conn = getUpdateConnection();
+ if (conn != null) {
+ sm = conn.createStatement();
sm.executeUpdate(statement);
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
CommonUtil.tryClose(sm);
- semaphoreRelease();
+ if (conn != null)
+ putUpdateConnection(conn);
}
}
public static void executePreparedWithType(String query,
List<List<Object>> data, List<String> columnType) {
+ Connection conn = null;
PreparedStatement prep = null;
if (data.size() == 0)
return;
try {
- if (connection != null) {
+ conn = getUpdateConnection();
+ if (conn != null) {
int batchCount = 0;
- prep = connection.prepareStatement(query);
+ prep = conn.prepareStatement(query);
// count ? in query
int questionCount = 0;
return;
}
- connection.setAutoCommit(false);
+ conn.setAutoCommit(false);
for (int k = 0; k < datasize; k++) {
List<Object> row = data.get(k);
if (batchCount > 0)
prep.executeBatch();
- connection.commit();
- connection.setAutoCommit(true);
+ conn.commit();
+ conn.setAutoCommit(true);
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
CommonUtil.tryClose(prep);
+ if (conn != null)
+ putUpdateConnection(conn);
}
}
// (no need to check the type of each column)
public static void executePreparedWithInterface(String query,
List<List<Object>> data, IPreparedStatement ip) {
+ Connection conn = null;
PreparedStatement prep = null;
if (data.size() == 0)
return;
try {
- if (connection != null) {
+ conn = getUpdateConnection();
+ if (conn != null) {
int batchCount = 0;
- prep = connection.prepareStatement(query);
+ prep = conn.prepareStatement(query);
// count ? in query
int questionCount = 0;
// set data into prepared statement
int datasize = data.size();
- connection.setAutoCommit(false);
+ conn.setAutoCommit(false);
for (int k = 0; k < datasize; k++) {
List<Object> row = data.get(k);
if (batchCount > 0)
prep.executeBatch();
- connection.commit();
- connection.setAutoCommit(true);
+ conn.commit();
+ conn.setAutoCommit(true);
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
CommonUtil.tryClose(prep);
+ if (conn != null)
+ putUpdateConnection(conn);
}
}
public static List<List<Object>> executeQuery(String query) {
+ Connection conn = null;
Statement sm = null;
ResultSet rs = null;
List<List<Object>> result = null;
+
try {
- if (connection != null) {
- semaphoreAcquire();
- sm = connection.createStatement();
+ conn = getQueryConnection();
+ if (conn != null) {
+ sm = conn.createStatement();
rs = sm.executeQuery(query);
if (rs != null) {
result = new ArrayList<List<Object>>();
e.printStackTrace();
} finally {
CommonUtil.tryClose(sm);
- semaphoreRelease();
+ if (conn != null)
+ putQueryConnection(conn);
}
return result;
-/*\r
- * Dynamic Analyzer\r
- *\r
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
- *\r
- * Contact: \r
- * Jooyoul Lee <jy.exe.lee@samsung.com>\r
- * Juyoung Kim <j0.kim@samsung.com>\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * \r
- * Contributors:\r
- * - S-Core Co., Ltd\r
- * \r
- */\r
-\r
-package org.tizen.dynamicanalyzer.handlers;\r
-\r
-import java.util.ArrayList;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-\r
-import org.eclipse.core.commands.AbstractHandler;\r
-import org.eclipse.core.commands.ExecutionEvent;\r
-import org.eclipse.core.commands.ExecutionException;\r
-import org.eclipse.swt.SWT;\r
-import org.eclipse.swt.widgets.Display;\r
-import org.eclipse.swt.widgets.Shell;\r
-import org.tizen.dynamicanalyzer.common.AnalyzerManager;\r
-import org.tizen.dynamicanalyzer.common.GlobalInformation;\r
-import org.tizen.dynamicanalyzer.communicator.DACommunicator;\r
-import org.tizen.dynamicanalyzer.constant.CommonConstants;\r
-import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;\r
-import org.tizen.dynamicanalyzer.model.ImageInfo;\r
-import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;\r
-import org.tizen.dynamicanalyzer.project.Project;\r
-import org.tizen.dynamicanalyzer.resources.ImageResources;\r
-import org.tizen.dynamicanalyzer.sql.SqlManager;\r
-import org.tizen.dynamicanalyzer.swap.callstack.BaseCallstackManager;\r
-import org.tizen.dynamicanalyzer.swap.channel.control.TargetInfo;\r
-import org.tizen.dynamicanalyzer.swap.channel.data.ApiNameManager;\r
-import org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants;\r
-import org.tizen.dynamicanalyzer.swap.channel.data.LibraryObject;\r
-import org.tizen.dynamicanalyzer.swap.channel.data.ProcessInfo;\r
-import org.tizen.dynamicanalyzer.swap.channel.data.ProcessInfoPackage;\r
-import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackData;\r
-import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackUnit;\r
-import org.tizen.dynamicanalyzer.ui.network.data.NetworkDataManager;\r
-import org.tizen.dynamicanalyzer.ui.opengl.data.GLDataManager;\r
-import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;\r
-import org.tizen.dynamicanalyzer.ui.range.RangePage;\r
-import org.tizen.dynamicanalyzer.ui.summary.failed.FailedChecker;\r
-import org.tizen.dynamicanalyzer.ui.summary.failed.FailedData;\r
-import org.tizen.dynamicanalyzer.ui.summary.leaks.LeakData;\r
-import org.tizen.dynamicanalyzer.ui.summary.leaks.LeakDetector;\r
-import org.tizen.dynamicanalyzer.ui.summary.profiling.FunctionUsageProfiler;\r
-import org.tizen.dynamicanalyzer.ui.summary.profiling.ProfileDataMaker;\r
-import org.tizen.dynamicanalyzer.ui.summary.profiling.ProfilingChildData;\r
-import org.tizen.dynamicanalyzer.ui.summary.profiling.ProfilingData;\r
-import org.tizen.dynamicanalyzer.ui.timeline.TimelinePage;\r
-import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;\r
-import org.tizen.dynamicanalyzer.ui.toolbar.opentrace.OpenTraceProgressManager;\r
-import org.tizen.dynamicanalyzer.ui.userinterface.UIDataManager;\r
-import org.tizen.dynamicanalyzer.util.DALogger;\r
-import org.tizen.dynamicanalyzer.util.WorkbenchUtil;\r
-import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;\r
-import org.tizen.dynamicanalyzer.widgets.combo.DACustomCombo;\r
-import org.tizen.dynamicanalyzer.widgets.da.base.DADialog;\r
-import org.tizen.dynamicanalyzer.widgets.da.view.DAPageComposite;\r
-\r
-public class OpenTraceHandler extends AbstractHandler {\r
- private static final DALogger DA_LOG = DALogger.getInstance();\r
-\r
- public static final String ID = OpenTraceHandler.class.getName();\r
- Project project = null;\r
-\r
- @Override\r
- public Object execute(ExecutionEvent event) throws ExecutionException {\r
-\r
- project = AnalyzerManager.getProject();\r
-\r
- List<String> pInfo = SqlManager.getInstance().getDetailsInfo(\r
- project.getSavePath());\r
-\r
- if (null == pInfo || pInfo.isEmpty()) {\r
- DA_LOG.debug("The trace file is invalid."); //$NON-NLS-1$\r
- createWarningDialog(AnalyzerLabels.OPEN_TRACE_PROGRESS_VERSION_INVALID_REMOVE);\r
- AnalyzerUtil.executeCommand(ClearHandler.ID);\r
- return null;\r
- }\r
- project.loadSaveFormat(pInfo);\r
-\r
-// OpenTraceProgressManager.getInstance().openTracePrgressStart(\r
-// AnalyzerLabels.OPEN_TRACE_PROGRESS_LOADING);\r
-\r
- if (!DACommunicator.isDeviceConnected()) {\r
- Display.getDefault().syncExec(new Runnable() {\r
- @Override\r
- public void run() {\r
- DACustomCombo deviceCombo = ToolbarArea.getInstance()\r
- .getDeviceCombo();\r
- DACustomCombo appCombo = ToolbarArea.getInstance()\r
- .getAppCombo();\r
- deviceCombo.setText(AnalyzerManager.getProject()\r
- .getDevice());\r
- appCombo.setText(AnalyzerManager.getProject().getAppName());\r
- deviceCombo.setEnabled(true);\r
- appCombo.setEnabled(true);\r
- }\r
- });\r
- }\r
-\r
- int percent = OpenTraceProgressManager.getInstance().getPercent();\r
- if (loadInfos() && loadCallStackData() && loadCallStackApis()\r
- && loadProfilingData() && loadProfilingChildData() &&\r
- // loadLeakData() &&\r
- // loadFailedData() &&\r
- loadImageSet()) {\r
-\r
- OpenTraceProgressManager.getInstance().setProgressPercent(\r
- AnalyzerLabels.OPEN_TRACE_PROGRESS_LOADING, percent += 60);\r
-\r
- } else {\r
- OpenTraceProgressManager.getInstance().closeOpenTraceDialog(\r
- AnalyzerLabels.OPEN_TRACE_PROGRESS_LOADING_FAILED);\r
- createWarningDialog(AnalyzerLabels.OPEN_TRACE_PROGRESS_INVALID_REMOVE);\r
- AnalyzerUtil.executeCommand(ClearHandler.ID);\r
- return null;\r
- }\r
-\r
- ToolbarArea.getInstance().setTime(project.getLastTime());\r
- ToolbarArea.getInstance().setDeviceComboText(project.getDevice());\r
- ToolbarArea.getInstance().setAppComboText(project.getAppName());\r
- ToolbarArea.getInstance().checkStartButtonAndAppListEnablement();\r
- ToolbarArea.getInstance().setRepalyButtonEnable(true);\r
- if (AnalyzerManager.getProject().getProcessInfoPackHash().isEmpty()) {\r
- ToolbarArea.getInstance().setSourceViewEnable(false);\r
- ToolbarArea.getInstance().setSourceViewTooltip(\r
- AnalyzerLabels.MESSAGE_PROCESS_PG_WARNING);\r
- } else {\r
- ToolbarArea.getInstance().setSourceViewEnable(true);\r
- ToolbarArea.getInstance().setSourceViewTooltip(\r
- AnalyzerLabels.MESSAGE_PROCESS_VIEW_SOURCE);\r
- }\r
- OpenTraceProgressManager.getInstance().setProgressPercent(\r
- AnalyzerLabels.OPEN_TRACE_PROGRESS_LOADING, percent += 3);\r
- /* add each part action.. close... open...etc... */\r
-\r
- /* resource log view action start */\r
- // List<LogCenter> logCenters = AnalyzerManager.getLogCenters();\r
- // List<Integer> ids = LogDataFactory.getLogList();\r
- // size = ids.size();\r
- // for (int i = 0; i < size; i++) {\r
- // LogCenter center = logCenters.get(i);\r
- // int dataSize = SqlManager.getInstance().selectCount(center);\r
- // center.setDataSize(dataSize);\r
- // }\r
-\r
- if (RangeDataManager.getInstance().isBeingAnalyzed()) {\r
- DAPageComposite page = AnalyzerManager.getCurrentPage();\r
- if (page instanceof RangePage) {\r
- AnalyzerUtil.changePage(TimelinePage.pageID);\r
- }\r
- }\r
-\r
- OpenTraceProgressManager.getInstance().runThreads();\r
- OpenTraceProgressManager.getInstance().openTraceComplete();\r
- SqlManager.getInstance().closeConnection();\r
-\r
- NetworkDataManager.getInstance().openProcess();\r
- GLDataManager.getInstance().openProcess();\r
- return null;\r
- }\r
-\r
- private void invalidProgress() {\r
- OpenTraceProgressManager.getInstance().closeOpenTraceDialog(\r
- AnalyzerLabels.OPEN_TRACE_PROGRESS_INVALID);\r
- createWarningDialog(AnalyzerLabels.OPEN_TRACE_PROGRESS_INVALID_REMOVE);\r
- AnalyzerUtil.executeCommand(ClearHandler.ID);\r
- }\r
-\r
- private boolean loadCallStackData() {\r
- boolean isSuccess = true;\r
- List<List<String>> dbInfo = SqlManager.getInstance()\r
- .getCallStackDataFromTable();\r
- if (null == dbInfo) {\r
- DA_LOG.debug("failed - loadCallStackData");\r
- isSuccess = false;\r
- } else {\r
- for (int i = 0; i < dbInfo.size(); i++) {\r
- List<String> pInfo = dbInfo.get(i);\r
- int seq = Integer.parseInt(pInfo.get(0));\r
- String addrs = pInfo.get(1);\r
- if (null == addrs) {\r
- continue;\r
- }\r
- String[] splitAddrs = addrs.split(CommonConstants.SLASH);\r
- CallStackData csd = new CallStackData(seq);\r
- List<Long> addrList = csd.getAddrs();\r
- int size = splitAddrs.length;\r
- for (int j = 0; j < size; j++) {\r
- long addr = Long.parseLong(splitAddrs[j]);\r
- addrList.add(addr);\r
- }\r
- AnalyzerManager.getCallstackManager()\r
- .getCallStackDataBySeqMap().put(seq, csd);\r
- }\r
- }\r
- return isSuccess;\r
- }\r
-\r
- private boolean loadCallStackApis() {\r
- boolean isSuccess = true;\r
- List<List<String>> dbInfo = SqlManager.getInstance()\r
- .setloadCallStackApis();\r
- if (null == dbInfo) {\r
- DA_LOG.debug("failed - loadCallStackApis");\r
- isSuccess = false;\r
- } else {\r
- BaseCallstackManager callstackManager = AnalyzerManager\r
- .getCallstackManager();\r
- for (int i = 0; i < dbInfo.size(); i++) {\r
- List<String> pInfo = dbInfo.get(i);\r
- long addr = Long.parseLong(pInfo.get(0));\r
- String api = pInfo.get(1);\r
- int pid = Integer.parseInt(pInfo.get(2));\r
- long time = Long.parseLong(pInfo.get(3));\r
- CallStackUnit csa = new CallStackUnit(addr, api, pid, time);\r
- callstackManager.getCallStackApiAddrByPidMap(pid)\r
- .put(addr, csa);\r
-\r
- }\r
- }\r
- return isSuccess;\r
- }\r
-\r
- private boolean loadInfos() {\r
- boolean isSuccess = true;\r
- List<List<String>> dbInfo = SqlManager.getInstance().loadTargetInfo();\r
- if (null == dbInfo) {\r
- DA_LOG.debug("failed - loadTargetInfo");\r
- isSuccess = false;\r
- } else {\r
- List<String> info = dbInfo.get(0);\r
- TargetInfo targetInfo = new TargetInfo();\r
- targetInfo.loadSaveFormat(info);\r
- GlobalInformation.getCurrentDeviceInfo().setTargetInfo(targetInfo);\r
- }\r
-\r
- List<String> pids = SqlManager.getInstance().getPids();\r
- int pidCount = pids.size();\r
-\r
- HashMap<Integer, ProcessInfoPackage> processPkgMap = AnalyzerManager\r
- .getProject().getProcessInfoPackHash();\r
- for (int h = 0; h < pidCount; h++) {\r
- ProcessInfoPackage pip = new ProcessInfoPackage();\r
- String option = " where pid = " + pids.get(h);\r
- dbInfo = SqlManager.getInstance().loadProcessInfo(option);\r
- if (null == dbInfo) {\r
- DA_LOG.debug("failed - load Process Info");\r
- isSuccess = false;\r
- continue;\r
- } else {\r
- List<ProcessInfo> pInfos = pip.getProcessSnapshots();\r
- for (int i = 0; i < dbInfo.size(); i++) {\r
- List<String> info = dbInfo.get(i);\r
- ProcessInfo process = new ProcessInfo();\r
- process.loadSaveFormat(info.get(1));\r
- pInfos.add(process);\r
- if (i == 0) {\r
- pip.setPid(process.getPid());\r
- pip.setPpid(process.getPpid());\r
- pip.setTargetBinaryPath(process\r
- .getMainTargetBinaryPath());\r
- }\r
- String subOption = "where pid = " + process.getPid()\r
- + " and time = \'"\r
- + process.getStartTime().toString() + "\'";\r
- List<List<String>> objInfo = SqlManager.getInstance()\r
- .loadLibObj(subOption);\r
- if (null == objInfo) {\r
- DA_LOG.debug("failed - load Lib Object");\r
- isSuccess = false;\r
- continue;\r
- } else {\r
- for (List<String> libInfo : objInfo) {\r
- LibraryObject libObj = new LibraryObject();\r
- libObj.setPid(Integer.parseInt(libInfo.get(0)));\r
- // 1 : time\r
- libObj.setLowestAddress(Long.parseLong(libInfo\r
- .get(2)));\r
- libObj.setHighestAddress(Long.parseLong(libInfo\r
- .get(3)));\r
- libObj.setLibPath(libInfo.get(4));\r
- process.getLibObjs().add(libObj);\r
- process.getLibObjHash().put(libObj.getLibPath(),\r
- libObj);\r
- }\r
- }\r
- }\r
- }\r
- processPkgMap.put(pip.getPid(), pip);\r
- }\r
- dbInfo = SqlManager.getInstance().loadApiNames();\r
- if (null == dbInfo) {\r
- DA_LOG.debug("failed - load Api names");\r
- isSuccess = false;\r
- } else {\r
- List<String> apiList = ApiNameManager.getApiList();\r
- for (List<String> info : dbInfo) {\r
- apiList.add(info.get(0));\r
- }\r
- }\r
- return isSuccess;\r
- }\r
-\r
- private boolean loadImageSet() {\r
- List<List<String>> input = SqlManager.getInstance().getloadImageSet(3);\r
- if (null == input) {\r
- return false;\r
- }\r
-\r
- int size = input.size();\r
-\r
- for (int i = 0; i < size; i++) {\r
- List<String> imgLog = input.get(i);\r
- String seq = imgLog.get(0);\r
- String time = imgLog.get(1);\r
- ImageInfo imgInfo = new ImageInfo();\r
- imgInfo.setSeq(seq);\r
- imgInfo.setTime(time);\r
-\r
- String[] path = imgLog.get(2).split(CommonConstants.SLASH);\r
- imgInfo.setFileName(new String(path[path.length - 1]));\r
-\r
- AnalyzerManager.getImageSet().put(seq, imgInfo);\r
- }\r
- return true;\r
- }\r
-\r
- private boolean loadLeakData() {\r
- boolean isSuccess = true;\r
- List<List<String>> dbInfo = SqlManager.getInstance().setloadLeakData();\r
- if (null == dbInfo) {\r
- DA_LOG.debug("leak data loading failed..");\r
- isSuccess = false;\r
- } else {\r
- LeakDetector leakDectector = AnalyzerManager.getLeakDetector();\r
- for (int i = 0; i < dbInfo.size(); i++) {\r
- List<String> info = dbInfo.get(i);\r
- LeakData leakData = new LeakData(info);\r
- if (-1 != leakData.getParentKey()) {\r
- LeakData parent = leakDectector.getLeakHash().get(\r
- leakData.getParentKey());\r
- if (null == parent) {\r
- continue;\r
- } else {\r
- parent.getChildren().add(leakData);\r
- }\r
- } else {\r
- leakDectector.getLeakHash().put((long) leakData.getKey(),\r
- leakData);\r
- }\r
- }\r
- }\r
- return isSuccess;\r
- }\r
-\r
- private boolean loadFailedData() {\r
- boolean isSuccess = true;\r
- List<List<String>> dbInfo = SqlManager.getInstance()\r
- .setloadFailedData();\r
- if (null == dbInfo) {\r
- DA_LOG.debug("failed - loadFailedData");\r
- isSuccess = false;\r
- } else {\r
- FailedChecker failedChecker = AnalyzerManager.getFailedChecker();\r
- for (int i = 0; i < dbInfo.size(); i++) {\r
- List<String> pInfo = dbInfo.get(i);\r
- // possibility of extensions - network, efl, db, etc...\r
- int id = Integer.parseInt(pInfo\r
- .get(LogCenterConstants.ID_INDEX));\r
- if (id == DataChannelConstants.MSG_PROBE_FILE) {\r
- // if file failed api data is skip - file chart make it!\r
- int type = Integer.parseInt(pInfo\r
- .get(LogCenterConstants.RESOURCE_FDTYPE_INDEX));\r
- if (type == LogCenterConstants.FD_TYPE_FILE) {\r
- continue;\r
- }\r
- }\r
- FailedData failedData = new FailedData(pInfo);\r
- failedChecker.getFailedList().add(failedData);\r
- }\r
- }\r
- return isSuccess;\r
- }\r
-\r
- private boolean loadProfilingData() {\r
- boolean isSuccess = true;\r
- List<List<String>> dbInfo = SqlManager.getInstance()\r
- .setloadProfilingData();\r
- if (null == dbInfo) {\r
- DA_LOG.debug("failed - loadProfilingData");\r
- isSuccess = false;\r
- } else {\r
- for (int i = 0; i < dbInfo.size(); i++) {\r
- List<String> pInfo = dbInfo.get(i);\r
- int pid = Integer.parseInt(pInfo.get(ProfilingData.PID_INDEX));\r
- // possibility of extensions - network, efl, db, etc...\r
- ProfileDataMaker profiler = FunctionUsageProfiler.getInstance()\r
- .getProfileDataMakerByPid(pid);\r
- ProfilingData fupData = new ProfilingData(pInfo, profiler);\r
- String seq = pInfo.get(ProfilingData.SEQUENCE_INDEX);\r
- profiler.getProfilingDataMap().put(Integer.parseInt(seq),\r
- fupData);\r
- String symbol = pInfo.get(ProfilingData.KEY_INDEX);\r
- profiler.getSymbolSeqHash().put(symbol, seq);\r
- UIDataManager.getInstance().getfunctionProfilingDataChecker()\r
- .addProfilingData(fupData);\r
- // restore total sample count\r
- profiler.setTotalSampleCount(profiler.getTotalSampleCount()\r
- + fupData.getExCount());\r
- }\r
-\r
- List<Integer> pids = FunctionUsageProfiler.getInstance()\r
- .getPidsOfProfileDataMakerMap();\r
- for (int i = 0; i < pids.size(); i++) {\r
- ProfileDataMaker profiler = FunctionUsageProfiler.getInstance()\r
- .getProfileDataMakerByPid(pids.get(i));\r
- ProfilingData ab = profiler\r
- .getProfilingDataByKey(FunctionUsageProfiler.APPLICATION_KEY);\r
- profiler.setAppBin(ab);\r
- ProfilingData dl = profiler\r
- .getProfilingDataByKey(FunctionUsageProfiler.DEPENDENT_LIB_KEY);\r
- profiler.setDependentLib(dl);\r
- }\r
- }\r
- return isSuccess;\r
- }\r
-\r
- private boolean loadProfilingChildData() {\r
- boolean isSuccess = true;\r
- List<List<String>> dbInfo = SqlManager.getInstance()\r
- .setloadProfilingChildData();\r
- if (null == dbInfo) {\r
- DA_LOG.debug("failed - loadProfilingChildData");\r
- isSuccess = false;\r
- } else {\r
- for (int i = 0; i < dbInfo.size(); i++) {\r
- List<String> data = dbInfo.get(i);\r
- if (data.size() < 2) { // why?\r
- continue;\r
- }\r
- int pid = Integer.parseInt(data.get(1)); // 1 == PID_INDEX\r
- String seqs = data.get(2); // 2 == CHILDLIST_INDEX\r
- String[] splitSeqs = seqs.split(CommonConstants.SLASH);\r
- List<Integer> childData = new ArrayList<Integer>();\r
- for (int ii = 0; ii < splitSeqs.length; ii++) {\r
- childData.add(Integer.parseInt(splitSeqs[ii]));\r
- }\r
- int key = Integer.parseInt(data.get(0));\r
- ProfileDataMaker profiler = FunctionUsageProfiler.getInstance()\r
- .getProfileDataMakerByPid(pid);\r
- ProfilingData parent = profiler.getProfilingDataMap().get(key);\r
- ProfilingChildData child = parent.getChildData();\r
- child.getChildren().addAll(childData);\r
- profiler.getChildListMap().put(data.get(0), child);\r
- }\r
- }\r
- return isSuccess;\r
- }\r
-\r
- private void createWarningDialog(String message) {\r
- final Shell shell = WorkbenchUtil.getWorkbenchWindow().getShell();\r
- final DADialog dialog = new DADialog(shell, SWT.NONE);\r
- dialog.setIcon(ImageResources.DIALOG_WARNING_ICON);\r
- dialog.setMessage(message);\r
- Display.getDefault().syncExec(new Runnable() {\r
- @Override\r
- public void run() {\r
- dialog.open();\r
- }\r
- });\r
- }\r
-}\r
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * 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.handlers;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.tizen.dynamicanalyzer.common.AnalyzerManager;
+import org.tizen.dynamicanalyzer.common.GlobalInformation;
+import org.tizen.dynamicanalyzer.communicator.DACommunicator;
+import org.tizen.dynamicanalyzer.constant.CommonConstants;
+import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
+import org.tizen.dynamicanalyzer.model.ImageInfo;
+import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
+import org.tizen.dynamicanalyzer.project.Project;
+import org.tizen.dynamicanalyzer.resources.ImageResources;
+import org.tizen.dynamicanalyzer.sql.SqlManager;
+import org.tizen.dynamicanalyzer.swap.callstack.BaseCallstackManager;
+import org.tizen.dynamicanalyzer.swap.channel.control.TargetInfo;
+import org.tizen.dynamicanalyzer.swap.channel.data.ApiNameManager;
+import org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants;
+import org.tizen.dynamicanalyzer.swap.channel.data.LibraryObject;
+import org.tizen.dynamicanalyzer.swap.channel.data.ProcessInfo;
+import org.tizen.dynamicanalyzer.swap.channel.data.ProcessInfoPackage;
+import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackData;
+import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackUnit;
+import org.tizen.dynamicanalyzer.ui.network.data.NetworkDataManager;
+import org.tizen.dynamicanalyzer.ui.opengl.data.GLDataManager;
+import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
+import org.tizen.dynamicanalyzer.ui.range.RangePage;
+import org.tizen.dynamicanalyzer.ui.summary.failed.FailedChecker;
+import org.tizen.dynamicanalyzer.ui.summary.failed.FailedData;
+import org.tizen.dynamicanalyzer.ui.summary.leaks.LeakData;
+import org.tizen.dynamicanalyzer.ui.summary.leaks.LeakDetector;
+import org.tizen.dynamicanalyzer.ui.summary.profiling.FunctionUsageProfiler;
+import org.tizen.dynamicanalyzer.ui.summary.profiling.ProfileDataMaker;
+import org.tizen.dynamicanalyzer.ui.summary.profiling.ProfilingChildData;
+import org.tizen.dynamicanalyzer.ui.summary.profiling.ProfilingData;
+import org.tizen.dynamicanalyzer.ui.timeline.TimelinePage;
+import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
+import org.tizen.dynamicanalyzer.ui.toolbar.opentrace.OpenTraceProgressManager;
+import org.tizen.dynamicanalyzer.ui.userinterface.UIDataManager;
+import org.tizen.dynamicanalyzer.util.DALogger;
+import org.tizen.dynamicanalyzer.util.WorkbenchUtil;
+import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
+import org.tizen.dynamicanalyzer.widgets.combo.DACustomCombo;
+import org.tizen.dynamicanalyzer.widgets.da.base.DADialog;
+import org.tizen.dynamicanalyzer.widgets.da.view.DAPageComposite;
+
+public class OpenTraceHandler extends AbstractHandler {
+ private static final DALogger DA_LOG = DALogger.getInstance();
+
+ public static final String ID = OpenTraceHandler.class.getName();
+ Project project = null;
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+
+ project = AnalyzerManager.getProject();
+
+ List<String> pInfo = SqlManager.getInstance().getDetailsInfo(
+ project.getSavePath());
+
+ if (null == pInfo || pInfo.isEmpty()) {
+ DA_LOG.debug("The trace file is invalid."); //$NON-NLS-1$
+ createWarningDialog(AnalyzerLabels.OPEN_TRACE_PROGRESS_VERSION_INVALID_REMOVE);
+ AnalyzerUtil.executeCommand(ClearHandler.ID);
+ return null;
+ }
+ project.loadSaveFormat(pInfo);
+
+ OpenTraceProgressManager.getInstance().openTracePrgressStart(
+ AnalyzerLabels.OPEN_TRACE_PROGRESS_LOADING);
+
+ if (!DACommunicator.isDeviceConnected()) {
+ Display.getDefault().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ DACustomCombo deviceCombo = ToolbarArea.getInstance()
+ .getDeviceCombo();
+ DACustomCombo appCombo = ToolbarArea.getInstance()
+ .getAppCombo();
+ deviceCombo.setText(AnalyzerManager.getProject()
+ .getDevice());
+ appCombo.setText(AnalyzerManager.getProject().getAppName());
+ deviceCombo.setEnabled(true);
+ appCombo.setEnabled(true);
+ }
+ });
+ }
+
+ int percent = OpenTraceProgressManager.getInstance().getPercent();
+ if (loadInfos() && loadCallStackData() && loadCallStackApis()
+ && loadProfilingData() && loadProfilingChildData() &&
+ // loadLeakData() &&
+ // loadFailedData() &&
+ loadImageSet()) {
+
+ OpenTraceProgressManager.getInstance().setProgressPercent(
+ AnalyzerLabels.OPEN_TRACE_PROGRESS_LOADING, percent += 60);
+
+ } else {
+ OpenTraceProgressManager.getInstance().closeOpenTraceDialog(
+ AnalyzerLabels.OPEN_TRACE_PROGRESS_LOADING_FAILED);
+ createWarningDialog(AnalyzerLabels.OPEN_TRACE_PROGRESS_INVALID_REMOVE);
+ AnalyzerUtil.executeCommand(ClearHandler.ID);
+ return null;
+ }
+
+ ToolbarArea.getInstance().setTime(project.getLastTime());
+ ToolbarArea.getInstance().setDeviceComboText(project.getDevice());
+ ToolbarArea.getInstance().setAppComboText(project.getAppName());
+ ToolbarArea.getInstance().checkStartButtonAndAppListEnablement();
+ ToolbarArea.getInstance().setRepalyButtonEnable(true);
+ if (AnalyzerManager.getProject().getProcessInfoPackHash().isEmpty()) {
+ ToolbarArea.getInstance().setSourceViewEnable(false);
+ ToolbarArea.getInstance().setSourceViewTooltip(
+ AnalyzerLabels.MESSAGE_PROCESS_PG_WARNING);
+ } else {
+ ToolbarArea.getInstance().setSourceViewEnable(true);
+ ToolbarArea.getInstance().setSourceViewTooltip(
+ AnalyzerLabels.MESSAGE_PROCESS_VIEW_SOURCE);
+ }
+ OpenTraceProgressManager.getInstance().setProgressPercent(
+ AnalyzerLabels.OPEN_TRACE_PROGRESS_LOADING, percent += 3);
+ /* add each part action.. close... open...etc... */
+
+ /* resource log view action start */
+ // List<LogCenter> logCenters = AnalyzerManager.getLogCenters();
+ // List<Integer> ids = LogDataFactory.getLogList();
+ // size = ids.size();
+ // for (int i = 0; i < size; i++) {
+ // LogCenter center = logCenters.get(i);
+ // int dataSize = SqlManager.getInstance().selectCount(center);
+ // center.setDataSize(dataSize);
+ // }
+
+ if (RangeDataManager.getInstance().isBeingAnalyzed()) {
+ DAPageComposite page = AnalyzerManager.getCurrentPage();
+ if (page instanceof RangePage) {
+ AnalyzerUtil.changePage(TimelinePage.pageID);
+ }
+ }
+
+ OpenTraceProgressManager.getInstance().runThreads();
+ OpenTraceProgressManager.getInstance().openTraceComplete();
+ SqlManager.getInstance().closeConnection();
+
+ NetworkDataManager.getInstance().openProcess();
+ GLDataManager.getInstance().openProcess();
+ return null;
+ }
+
+ private void invalidProgress() {
+ OpenTraceProgressManager.getInstance().closeOpenTraceDialog(
+ AnalyzerLabels.OPEN_TRACE_PROGRESS_INVALID);
+ createWarningDialog(AnalyzerLabels.OPEN_TRACE_PROGRESS_INVALID_REMOVE);
+ AnalyzerUtil.executeCommand(ClearHandler.ID);
+ }
+
+ private boolean loadCallStackData() {
+ boolean isSuccess = true;
+ List<List<String>> dbInfo = SqlManager.getInstance()
+ .getCallStackDataFromTable();
+ if (null == dbInfo) {
+ DA_LOG.debug("failed - loadCallStackData");
+ isSuccess = false;
+ } else {
+ for (int i = 0; i < dbInfo.size(); i++) {
+ List<String> pInfo = dbInfo.get(i);
+ int seq = Integer.parseInt(pInfo.get(0));
+ String addrs = pInfo.get(1);
+ if (null == addrs) {
+ continue;
+ }
+ String[] splitAddrs = addrs.split(CommonConstants.SLASH);
+ CallStackData csd = new CallStackData(seq);
+ List<Long> addrList = csd.getAddrs();
+ int size = splitAddrs.length;
+ for (int j = 0; j < size; j++) {
+ long addr = Long.parseLong(splitAddrs[j]);
+ addrList.add(addr);
+ }
+ AnalyzerManager.getCallstackManager()
+ .getCallStackDataBySeqMap().put(seq, csd);
+ }
+ }
+ return isSuccess;
+ }
+
+ private boolean loadCallStackApis() {
+ boolean isSuccess = true;
+ List<List<String>> dbInfo = SqlManager.getInstance()
+ .setloadCallStackApis();
+ if (null == dbInfo) {
+ DA_LOG.debug("failed - loadCallStackApis");
+ isSuccess = false;
+ } else {
+ BaseCallstackManager callstackManager = AnalyzerManager
+ .getCallstackManager();
+ for (int i = 0; i < dbInfo.size(); i++) {
+ List<String> pInfo = dbInfo.get(i);
+ long addr = Long.parseLong(pInfo.get(0));
+ String api = pInfo.get(1);
+ int pid = Integer.parseInt(pInfo.get(2));
+ long time = Long.parseLong(pInfo.get(3));
+ CallStackUnit csa = new CallStackUnit(addr, api, pid, time);
+ callstackManager.getCallStackApiAddrByPidMap(pid)
+ .put(addr, csa);
+
+ }
+ }
+ return isSuccess;
+ }
+
+ private boolean loadInfos() {
+ boolean isSuccess = true;
+ List<List<String>> dbInfo = SqlManager.getInstance().loadTargetInfo();
+ if (null == dbInfo) {
+ DA_LOG.debug("failed - loadTargetInfo");
+ isSuccess = false;
+ } else {
+ List<String> info = dbInfo.get(0);
+ TargetInfo targetInfo = new TargetInfo();
+ targetInfo.loadSaveFormat(info);
+ GlobalInformation.getCurrentDeviceInfo().setTargetInfo(targetInfo);
+ }
+
+ List<String> pids = SqlManager.getInstance().getPids();
+ int pidCount = pids.size();
+
+ HashMap<Integer, ProcessInfoPackage> processPkgMap = AnalyzerManager
+ .getProject().getProcessInfoPackHash();
+ for (int h = 0; h < pidCount; h++) {
+ ProcessInfoPackage pip = new ProcessInfoPackage();
+ String option = " where pid = " + pids.get(h);
+ dbInfo = SqlManager.getInstance().loadProcessInfo(option);
+ if (null == dbInfo) {
+ DA_LOG.debug("failed - load Process Info");
+ isSuccess = false;
+ continue;
+ } else {
+ List<ProcessInfo> pInfos = pip.getProcessSnapshots();
+ for (int i = 0; i < dbInfo.size(); i++) {
+ List<String> info = dbInfo.get(i);
+ ProcessInfo process = new ProcessInfo();
+ process.loadSaveFormat(info.get(1));
+ pInfos.add(process);
+ if (i == 0) {
+ pip.setPid(process.getPid());
+ pip.setPpid(process.getPpid());
+ pip.setTargetBinaryPath(process
+ .getMainTargetBinaryPath());
+ }
+ String subOption = "where pid = " + process.getPid()
+ + " and time = \'"
+ + process.getStartTime().toString() + "\'";
+ List<List<String>> objInfo = SqlManager.getInstance()
+ .loadLibObj(subOption);
+ if (null == objInfo) {
+ DA_LOG.debug("failed - load Lib Object");
+ isSuccess = false;
+ continue;
+ } else {
+ for (List<String> libInfo : objInfo) {
+ LibraryObject libObj = new LibraryObject();
+ libObj.setPid(Integer.parseInt(libInfo.get(0)));
+ // 1 : time
+ libObj.setLowestAddress(Long.parseLong(libInfo
+ .get(2)));
+ libObj.setHighestAddress(Long.parseLong(libInfo
+ .get(3)));
+ libObj.setLibPath(libInfo.get(4));
+ process.getLibObjs().add(libObj);
+ process.getLibObjHash().put(libObj.getLibPath(),
+ libObj);
+ }
+ }
+ }
+ }
+ processPkgMap.put(pip.getPid(), pip);
+ }
+ dbInfo = SqlManager.getInstance().loadApiNames();
+ if (null == dbInfo) {
+ DA_LOG.debug("failed - load Api names");
+ isSuccess = false;
+ } else {
+ List<String> apiList = ApiNameManager.getApiList();
+ for (List<String> info : dbInfo) {
+ apiList.add(info.get(0));
+ }
+ }
+ return isSuccess;
+ }
+
+ private boolean loadImageSet() {
+ List<List<String>> input = SqlManager.getInstance().getloadImageSet(3);
+ if (null == input) {
+ return false;
+ }
+
+ int size = input.size();
+
+ for (int i = 0; i < size; i++) {
+ List<String> imgLog = input.get(i);
+ String seq = imgLog.get(0);
+ String time = imgLog.get(1);
+ ImageInfo imgInfo = new ImageInfo();
+ imgInfo.setSeq(seq);
+ imgInfo.setTime(time);
+
+ String[] path = imgLog.get(2).split(CommonConstants.SLASH);
+ imgInfo.setFileName(new String(path[path.length - 1]));
+
+ AnalyzerManager.getImageSet().put(seq, imgInfo);
+ }
+ return true;
+ }
+
+ private boolean loadLeakData() {
+ boolean isSuccess = true;
+ List<List<String>> dbInfo = SqlManager.getInstance().setloadLeakData();
+ if (null == dbInfo) {
+ DA_LOG.debug("leak data loading failed..");
+ isSuccess = false;
+ } else {
+ LeakDetector leakDectector = AnalyzerManager.getLeakDetector();
+ for (int i = 0; i < dbInfo.size(); i++) {
+ List<String> info = dbInfo.get(i);
+ LeakData leakData = new LeakData(info);
+ if (-1 != leakData.getParentKey()) {
+ LeakData parent = leakDectector.getLeakHash().get(
+ leakData.getParentKey());
+ if (null == parent) {
+ continue;
+ } else {
+ parent.getChildren().add(leakData);
+ }
+ } else {
+ leakDectector.getLeakHash().put((long) leakData.getKey(),
+ leakData);
+ }
+ }
+ }
+ return isSuccess;
+ }
+
+ private boolean loadFailedData() {
+ boolean isSuccess = true;
+ List<List<String>> dbInfo = SqlManager.getInstance()
+ .setloadFailedData();
+ if (null == dbInfo) {
+ DA_LOG.debug("failed - loadFailedData");
+ isSuccess = false;
+ } else {
+ FailedChecker failedChecker = AnalyzerManager.getFailedChecker();
+ for (int i = 0; i < dbInfo.size(); i++) {
+ List<String> pInfo = dbInfo.get(i);
+ // possibility of extensions - network, efl, db, etc...
+ int id = Integer.parseInt(pInfo
+ .get(LogCenterConstants.ID_INDEX));
+ if (id == DataChannelConstants.MSG_PROBE_FILE) {
+ // if file failed api data is skip - file chart make it!
+ int type = Integer.parseInt(pInfo
+ .get(LogCenterConstants.RESOURCE_FDTYPE_INDEX));
+ if (type == LogCenterConstants.FD_TYPE_FILE) {
+ continue;
+ }
+ }
+ FailedData failedData = new FailedData(pInfo);
+ failedChecker.getFailedList().add(failedData);
+ }
+ }
+ return isSuccess;
+ }
+
+ private boolean loadProfilingData() {
+ boolean isSuccess = true;
+ List<List<String>> dbInfo = SqlManager.getInstance()
+ .setloadProfilingData();
+ if (null == dbInfo) {
+ DA_LOG.debug("failed - loadProfilingData");
+ isSuccess = false;
+ } else {
+ for (int i = 0; i < dbInfo.size(); i++) {
+ List<String> pInfo = dbInfo.get(i);
+ int pid = Integer.parseInt(pInfo.get(ProfilingData.PID_INDEX));
+ // possibility of extensions - network, efl, db, etc...
+ ProfileDataMaker profiler = FunctionUsageProfiler.getInstance()
+ .getProfileDataMakerByPid(pid);
+ ProfilingData fupData = new ProfilingData(pInfo, profiler);
+ String seq = pInfo.get(ProfilingData.SEQUENCE_INDEX);
+ profiler.getProfilingDataMap().put(Integer.parseInt(seq),
+ fupData);
+ String symbol = pInfo.get(ProfilingData.KEY_INDEX);
+ profiler.getSymbolSeqHash().put(symbol, seq);
+ UIDataManager.getInstance().getfunctionProfilingDataChecker()
+ .addProfilingData(fupData);
+ // restore total sample count
+ profiler.setTotalSampleCount(profiler.getTotalSampleCount()
+ + fupData.getExCount());
+ }
+
+ List<Integer> pids = FunctionUsageProfiler.getInstance()
+ .getPidsOfProfileDataMakerMap();
+ for (int i = 0; i < pids.size(); i++) {
+ ProfileDataMaker profiler = FunctionUsageProfiler.getInstance()
+ .getProfileDataMakerByPid(pids.get(i));
+ ProfilingData ab = profiler
+ .getProfilingDataByKey(FunctionUsageProfiler.APPLICATION_KEY);
+ profiler.setAppBin(ab);
+ ProfilingData dl = profiler
+ .getProfilingDataByKey(FunctionUsageProfiler.DEPENDENT_LIB_KEY);
+ profiler.setDependentLib(dl);
+ }
+ }
+ return isSuccess;
+ }
+
+ private boolean loadProfilingChildData() {
+ boolean isSuccess = true;
+ List<List<String>> dbInfo = SqlManager.getInstance()
+ .setloadProfilingChildData();
+ if (null == dbInfo) {
+ DA_LOG.debug("failed - loadProfilingChildData");
+ isSuccess = false;
+ } else {
+ for (int i = 0; i < dbInfo.size(); i++) {
+ List<String> data = dbInfo.get(i);
+ if (data.size() < 2) { // why?
+ continue;
+ }
+ int pid = Integer.parseInt(data.get(1)); // 1 == PID_INDEX
+ String seqs = data.get(2); // 2 == CHILDLIST_INDEX
+ String[] splitSeqs = seqs.split(CommonConstants.SLASH);
+ List<Integer> childData = new ArrayList<Integer>();
+ for (int ii = 0; ii < splitSeqs.length; ii++) {
+ childData.add(Integer.parseInt(splitSeqs[ii]));
+ }
+ int key = Integer.parseInt(data.get(0));
+ ProfileDataMaker profiler = FunctionUsageProfiler.getInstance()
+ .getProfileDataMakerByPid(pid);
+ ProfilingData parent = profiler.getProfilingDataMap().get(key);
+ ProfilingChildData child = parent.getChildData();
+ child.getChildren().addAll(childData);
+ profiler.getChildListMap().put(data.get(0), child);
+ }
+ }
+ return isSuccess;
+ }
+
+ private void createWarningDialog(String message) {
+ final Shell shell = WorkbenchUtil.getWorkbenchWindow().getShell();
+ final DADialog dialog = new DADialog(shell, SWT.NONE);
+ dialog.setIcon(ImageResources.DIALOG_WARNING_ICON);
+ dialog.setMessage(message);
+ Display.getDefault().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ dialog.open();
+ }
+ });
+ }
+}
int logId = logIds.get(i);
Logs logs = logPack.getLogs(logId);
if (null != logs
- && (logId == DataChannelConstants.MSG_DATA_RECORD || logId == DataChannelConstants.MSG_PROBE_GLES20)) {
+ && (logId == DataChannelConstants.MSG_DATA_RECORD
+ || logId == DataChannelConstants.MSG_PROBE_GLES20 || logId == DataChannelConstants.MSG_PROBE_NETWORK)) {
continue;
}
if (null != logs) {
--- /dev/null
+package org.tizen.dynamicanalyzer.model;
+
+// this class is parent class of data class which is element of blocking queue.
+// this class has methods to confirm that is end of stream or not
+public abstract class Streamable {
+ private boolean endOfStream = false;
+
+ public final boolean isEndOfStream() {
+ return endOfStream;
+ }
+
+ public final void setEndOfStream() {
+ endOfStream = true;
+ }
+}
public static String HEAP_MEMORY_WARNING_PRE;
public static String HEAP_MEMORY_WARNING_POST;
+ public static String TIME_MS;
+
static {
NLS.initializeMessages(BUNDLE_NAME, AnalyzerLabels.class);
}
HEAP_MEMORY_WARNING_PRE=The trace has been stoped automatically for out of heap memory.\nIf you want to more, please edit the\n
HEAP_MEMORY_WARNING_POST=/dynamic-analyzer.ini.
+
+TIME_MS = ms
public static String FILE_API_LIST_VIEW_API;
public static String FILE_API_LIST_VIEW_PARAMETER;
public static String FILE_API_LIST_VIEW_THREAD_ID;
+ public static String FILE_API_LIST_VIEW_FD;
public static String FILE_API_LIST_VIEW_RETURN;
public static String FILE_API_LIST_VIEW_ERRNO;
FILE_API_LIST_VIEW_API=API Name
FILE_API_LIST_VIEW_PARAMETER=Parameter
FILE_API_LIST_VIEW_THREAD_ID=TID
+FILE_API_LIST_VIEW_FD=FD
FILE_API_LIST_VIEW_RETURN=Return
FILE_API_LIST_VIEW_ERRNO=Error code
public static String NETWORK_CHART_SESSION_NAME;
public static String NETWORK_CHART_TRANSACTION_NAME;
- public static String NETWORK_DB_RID;
- public static String NETWORK_DB_DESTINATION_ADDRESS;
- public static String NETWORK_DB_FD_VALUE;
- public static String NETWORK_DB_API_ID;
-
- public static String NETWORK_API_DB_TABLENAME;
- public static String NETWORK_API_DB_API_TIME;
-
- public static String NETWORK_API_DB_ERRNO;
- public static String NETWORK_API_DB_ARGUMENT;
- public static String NETWORK_API_DB_RETURN;
- public static String NETWORK_API_DB_BYTE_SIZE;
- public static String NETWORK_API_DB_PAYLOAD;
- public static String NETWORK_API_DB_API_TYPE;
- public static String NETWORK_API_DB_CALLER_PC_ADDRESS;
- public static String NETWORK_API_DB_LIB_NAME;
-
- public static String NETWORK_SERIES_DB_TABLENAME;
- public static String NETWORK_SERIES_DB_START_TIME;
- public static String NETWORK_SERIES_DB_END_TIME;
- public static String NETWORK_SERIES_DB_STATUS_TYPE;
-
-
-
- public static String TIME_MS;
-
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, NetworkPageLabels.class);
NETWORK_CHART_SESSION_NAME=Session
NETWORK_CHART_TRANSACTION_NAME=Transaction
-TIME_MS = ms
-
-NETWORK_DB_RID = "RID"
-NETWORK_DB_DESTINATION_ADDRESS = DESTINATION_ADDRESS
-NETWORK_DB_FD_VALUE = FD_VALUE
-NETWORK_DB_API_ID = API_ID
-
-NETWORK_API_DB_TABLENAME = NETWORK_API
-NETWORK_API_DB_API_TIME = API_TIME
-NETWORK_API_DB_ERRNO = ERRNO
-NETWORK_API_DB_ARGUMENT = ARGUMENT
-NETWORK_API_DB_RETURN = RETURN
-NETWORK_API_DB_BYTE_SIZE = BYTE_SIZE
-NETWORK_API_DB_PAYLOAD = PAYLOAD
-NETWORK_API_DB_API_TYPE = API_TYPE
-NETWORK_API_DB_CALLER_PC_ADDRESS = CALLER_PC_ADDRESS
-NETWORK_API_DB_LIB_NAME = LIB_NAME
-
-NETWORK_SERIES_DB_TABLENAME = NETWORK_SERIES
-NETWORK_SERIES_DB_START_TIME = START_TIME
-NETWORK_SERIES_DB_END_TIME = END_TIME
-NETWORK_SERIES_DB_STATUS_TYPE = STATUS_TYPE
\ No newline at end of file
ProcessInfoPackage processInfoPkg = AnalyzerManager
.getProject().getProcessInfoPackage(
logData.getPid());
+ if (null != processInfoPkg) {
processInfoPkg.addFunctionEntryInsertLogCount();
+ }
}
prep.addBatch();
probeCallstack.set(size - 1, new CallStackItem(
callerCallstackUnit));
} else {
- // DA_LOG.debug("probe caller is not the same as top of user callstack"); //$NON-NLS-1$
+ DA_LOG.debug("probe caller is not the same as top of user callstack"); //$NON-NLS-1$
}
}
String path = processInfo.getMainTargetBinaryPath();
String key = AnalyzerUtil.getTargetPathKey(path);
- BinaryInfo binInfo = GlobalInformation.getCurrentApplication().getBinaryInfo(key);
+ BinaryInfo binInfo = GlobalInformation.getCurrentApplication()
+ .getBinaryInfo(key);
if (null == binInfo) {
return false;
}
public final static int MSG_CONTEXT_SWITCH_EXIT = 0x0011;
public final static int MSG_PROCESS_MAP = 0x0012;
public final static int MSG_PROCESS_UNMAP = 0x0013;
+ public final static int MSG_PROCESS_COMM = 0x0014;
public static final int LOG_USER_FUNCTION = 0x002C; //44
public static final int LOG_CONTEXT_SWITCH = 0x002D; //45
private String targetBinaryPath = null;
private int functionEntryInsertLogCount = 0;
private boolean dropLog = false;
+ private String cmdLineName = null;
private List<ProcessInfo> processSnapshots = new ArrayList<ProcessInfo>();
this.targetBinaryPath = localBinaryPath;
}
+ public String getCmdLineName() {
+ return cmdLineName;
+ }
+
+ public void setCmdLineName(String cmdLineName) {
+ this.cmdLineName = cmdLineName;
+ }
+
public List<ProcessInfo> getProcessSnapshots() {
return processSnapshots;
}
import java.util.HashMap;
import java.util.List;
+import org.tizen.dynamicanalyzer.model.Streamable;
import org.tizen.dynamicanalyzer.swap.model.data.LogData;
-public class LogPackage {
+public class LogPackage extends Streamable {
private HashMap<Integer, Logs> logMap;
public void clear() {
long highAddr = 0;
String targetBinaryPath = null;
int dependantLibCount = 0;
+ String commandLineName = null;
int index = MSG_HEADER_SIZE;
pid = ByteUtils.toInt(data, index);
index += INT_SIZE;
+ commandLineName = ByteUtils.getString(data, index);
+ index += ByteUtils.getStringLength(data, index);
ppid = ByteUtils.toInt(data, index);
index += INT_SIZE;
int sec = ByteUtils.toInt(data, index);
pInfoPack.setPid(pid);
pInfoPack.setPpid(ppid);
pInfoPack.setTargetBinaryPath(targetBinaryPath);
+ pInfoPack.setCmdLineName(commandLineName);
if (processPkgMap.isEmpty()) {
AnalyzerManager.getProject().setMainPid(pid);
}
}
}
break;
+ case DataChannelConstants.MSG_PROCESS_COMM:
+ {
+ // process command line name is changed (/proc/<pid>/cmdline)
+ int index = MSG_HEADER_SIZE;
+ int pid = ByteUtils.toInt(data, index);
+ index += INT_SIZE;
+ String name = ByteUtils.getString(data, index);
+ index += ByteUtils.getStringLength(data, index);
+
+ HashMap<Integer, ProcessInfoPackage> processPkgMap = AnalyzerManager
+ .getProject().getProcessInfoPackHash();
+
+ ProcessInfoPackage pInfoPack = processPkgMap.get(pid);
+ if (null != pInfoPack) {
+ pInfoPack.setCmdLineName(name);
+ }
+ }
+ break;
default: // MSG_PROBE
if (AnalyzerManager.isProcessInfoArrived() && id > 0x0100
&& id < 0x0200) {
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.LinkedBlockingQueue;
import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
+import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.database.DBTable;
import org.tizen.dynamicanalyzer.util.DALogger;
public abstract class PageDataManager implements Runnable {
private static final DALogger DA_LOG = DALogger.getInstance();
-
+
private String name = null;
private Thread thread = null;
- private ReadBlockingQueue<LogPackage> logPackQueue = new ReadBlockingQueue<LogPackage>();
+ private BlockingQueue<LogPackage> logPackQueue = new LinkedBlockingQueue<LogPackage>();
private List<DBTable> dbTableList = new ArrayList<DBTable>();
+ private enum State {
+ NOT_RUNNING,
+ RUNNING,
+ TO_BE_STOPED
+ }
+
+ private State state = State.NOT_RUNNING;
+
public final String getName() {
if (name == null) {
name = getClass().getName();
}
return name;
}
-
+
public final void updateLog(LogPackage logPack) {
- logPackQueue.offer(logPack);
+ try {
+ logPackQueue.put(logPack);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
}
- protected final LogPackage pollPack() {
- return logPackQueue.poll();
+ private final LogPackage pollPack() {
+ LogPackage pack = null;
+ try {
+ if (state == State.RUNNING)
+ pack = logPackQueue.take(); // wait if empty
+ else if (state == State.TO_BE_STOPED)
+ pack = logPackQueue.poll(); // return null if empty
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+
+ return pack;
}
-
+
protected final void addDBTable(DBTable table) {
dbTableList.add(table);
}
-
+
public final List<DBTable> getDBTableList() {
return dbTableList;
}
-
- public final void startThread() {
+
+ public synchronized final void startThread() {
if (thread == null || !thread.isAlive()) {
thread = new Thread(null, this, getName());
+ state = State.RUNNING;
thread.start();
}
}
- public final void stopThread() {
+ // "called stopThread" means that there is no more data
+ // coming in this page data manager
+ // It means that this function should be called only in data offerer
+ // when all data offer is finished.
+ public synchronized final void stopThread() {
if (thread != null && thread.isAlive()) {
try {
- onThreadStop();
+ state = State.TO_BE_STOPED;
sendNotify();
thread.join(AnalyzerConstants.THREAD_JOIN_WAIT_TIME);
+ state = State.NOT_RUNNING;
thread = null;
+ logPackQueue.clear();
DA_LOG.debug(getName() + " thread joined!"); //$NON-NLS-1$
} catch (InterruptedException e) {
e.printStackTrace();
return true;
}
- protected void sendNotify() {
- logPackQueue.wake();
+ private void sendNotify() {
+ LogPackage endOfStream = new LogPackage();
+ endOfStream.setEndOfStream();
+
+ try {
+ logPackQueue.put(endOfStream);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
}
-
+
+ @Override
+ public final void run() {
+ while (!AnalyzerManager.isExit()) {
+ LogPackage pack = pollPack();
+ if (null == pack || pack.isEndOfStream()) // stop thread
+ break;
+
+ makeData(pack);
+ }
+
+ onThreadStop();
+
+ /* log for debug */
+ DA_LOG.debug(getName() + " thread end!!"); //$NON-NLS-1$
+ }
+
+ protected abstract void makeData(LogPackage pack);
+
protected void onThreadStop() {
}
-
- protected void saveData(Map<String, String> dataMap) {
+
+ public void saveData(Map<String, String> dataMap) {
}
-
- protected void openData(Map<String, String> dataMap) {
+
+ public void openData(Map<String, String> dataMap) {
}
-
+
}
ProfileData pData = (ProfileData) log;
long pcAddr = pData.getPcAddr();
+
+
+
ProcessInfoPackage processInfoPkg = AnalyzerManager
.getProject().getProcessInfoPackage(pData.getPid());
- String apiName = pData.getApiName();
- if (null == apiName || apiName.isEmpty()
- || apiName.equals("_end")) { //$NON-NLS-1$
- apiName = getFuncName(pData);
- if (apiName == null
- || apiName.equals("<unknown function>")) {
- continue;
- } else {
- pData.setApiName(apiName);
- }
+ if (pData.getProbeType() == 4) {
+ //System.out.println("log ====>" + pData.getProbeType() + ":" + pData.getProbeSubType());
+ //System.out.println("log ====> args:" + pData.getArgs());
}
-
- if (processInfoPkg.isDropLog()) {
- apiName = pData.getApiName();
- if (apiName.contains(OSP_MAIN)) {
- processInfoPkg.setDropLog(false);
- } else {
- continue;
+ if (pData.getProbeType() == 1) {
+
+ String apiName = pData.getApiName();
+ if (null == apiName || apiName.isEmpty()
+ || apiName.equals("_end")) { //$NON-NLS-1$
+ apiName = getFuncName(pData);
+ if (apiName == null
+ || apiName.equals("<unknown function>")) {
+ continue;
+ } else {
+ pData.setApiName(apiName);
+ }
}
- }
- // irregular call check still necessary?
- // if (AnalyzerManager.getCallstackManager()
- // .isIrregularUserCall(pData)) {
- // continue;
- // }
-
- ProcessInfo processInfo = processInfoPkg
- .getProcessInfo(pData.getTime());
-
- // for debug
- // System.out.println(" PROFILE LOG DEBUG = ID: "
- // + pData.getId()
- // + " PC : "
- // + AnalyzerUtil.toHexdecimal(pData.getPcAddr())
- // + " Api : "
- // + pData.getApiName()
- // + " caller : "
- // + AnalyzerUtil.toHexdecimal(pData.getCallerPcAddr())
- // + " base addr : "
- // + AnalyzerUtil.toHexdecimal(processInfo
- // .getLowestAddress()));
+ //System.out.println("====>" + apiName);
- pushLog(log, logPack);
- if (pcAddr >= processInfo.getLowestAddress()
- && pcAddr <= processInfo.getHighestAddress()) {
- /* user callstack create by entry and exit */
- AnalyzerManager.getCallstackManager()
- .makeUserCallstack(
- pData,
- FunctionUsageProfiler.getInstance()
- .getProfileDataMakerByPid(
- pData.getPid()));
- } else {
- AnalyzerManager.getCallstackManager()
- .makeCallstackWithoutBacktrace(pData);
+ if (processInfoPkg.isDropLog()) {
+ apiName = pData.getApiName();
+ if (apiName.contains(OSP_MAIN)) {
+ processInfoPkg.setDropLog(false);
+ } else {
+ continue;
+ }
+ }
+
+ // irregular call check still necessary?
+ // if (AnalyzerManager.getCallstackManager()
+ // .isIrregularUserCall(pData)) {
+ // continue;
+ // }
+
+ ProcessInfo processInfo = processInfoPkg
+ .getProcessInfo(pData.getTime());
+
+ // for debug
+ // System.out.println(" PROFILE LOG DEBUG = ID: "
+ // + pData.getId()
+ // + " PC : "
+ // + AnalyzerUtil.toHexdecimal(pData.getPcAddr())
+ // + " Api : "
+ // + pData.getApiName()
+ // + " caller : "
+ // + AnalyzerUtil.toHexdecimal(pData.getCallerPcAddr())
+ // + " base addr : "
+ // + AnalyzerUtil.toHexdecimal(processInfo
+ // .getLowestAddress()));
+
+ pushLog(log, logPack);
+ if (pcAddr >= processInfo.getLowestAddress()
+ && pcAddr <= processInfo.getHighestAddress()) {
+ /* user callstack create by entry and exit */
+ AnalyzerManager.getCallstackManager()
+ .makeUserCallstack(
+ pData,
+ FunctionUsageProfiler.getInstance()
+ .getProfileDataMakerByPid(
+ pData.getPid()));
+ } else {
+ AnalyzerManager.getCallstackManager()
+ .makeCallstackWithoutBacktrace(pData);
+ }
+ // for file
+ } else if(pData.getProbeType() == 4) {
+ pushLog(log, logPack);
}
} else {
pushLog(log, logPack);
public class FileData extends ProbeCommonData {
- long size = 0;
- long fdValue = 0;
- int fdApiType = 0; // TODO: short
- long fileSize = 0;
- String filePath = null;
+ protected long size = 0;
+ protected long fdValue = 0;
+ protected int fdApiType = 0; // TODO: short
+ protected long fileSize = 0;
+ protected String filePath = null;
public long getSize() {
return size;
prep.setInt(index++, apiType);
prep.setLong(index++, elapsedTime);
prep.setString(index++, contextValue);
+
}
@Override
contextValue = rs.getString(index++);
}
}
-
-
-
import org.tizen.dynamicanalyzer.swap.model.format.MemoryLogFormat;
import org.tizen.dynamicanalyzer.swap.model.format.NetworkLogFormat;
import org.tizen.dynamicanalyzer.swap.model.format.ProfilingLogFormat;
-import org.tizen.dynamicanalyzer.swap.model.format.ReplayLogFormat;
import org.tizen.dynamicanalyzer.swap.model.format.SceneLogFormat;
import org.tizen.dynamicanalyzer.swap.model.format.ScreenShotLogFormat;
import org.tizen.dynamicanalyzer.swap.model.format.SyncLogFormat;
logList.add(MSG_PROBE_UICONTROL);
logList.add(MSG_PROBE_UIEVENT);
logList.add(MSG_PROBE_FILE);
- logList.add(MSG_PROBE_NETWORK);
- logList.add(MSG_PROBE_GLES20);
+// logList.add(MSG_PROBE_NETWORK);
+// logList.add(MSG_PROBE_GLES20);
logList.add(MSG_PROBE_LIFECYCLE);
logList.add(MSG_PROBE_SCREENSHOT);
logList.add(MSG_PROBE_SCENE);
logList.add(MSG_DATA_SAMPLE);
logList.add(MSG_DATA_SYSTEM);
logList.add(LogCenterConstants.LOG_USER_FUNCTION);
- logList.add(MSG_DATA_RECORD);
+// logList.add(MSG_DATA_RECORD);
logList.add(MSG_FUNCTION_ENTRY);
logList.add(MSG_FUNCTION_EXIT);
logList.add(MSG_CONTEXT_SWITCH_ENTRY);
--- /dev/null
+package org.tizen.dynamicanalyzer.swap.model.data;
+
+import java.util.Comparator;
+
+public class LogDataSeqNoComparator implements Comparator<LogData> {
+
+ @Override
+ public int compare(LogData arg0, LogData arg1) {
+ int seq0 = arg0.getSeq();
+ int seq1 = arg1.getSeq();
+
+ if (seq0 < seq1)
+ return -1;
+ else if (seq0 > seq1)
+ return 1;
+ else
+ return 0;
+ }
+
+}
\ No newline at end of file
public void makeData(byte[] data) {
super.makeData(data);
+ byte[] temp = new byte[4];
switch (id) {
case MSG_FUNCTION_ENTRY:
logCount++;
- pcAddr = ByteUtils.toLong(data, index);
- index += LONG_SIZE;
- callerPcAddr = ByteUtils.toLong(data, index);
- index += LONG_SIZE;
+ pid = ByteUtils.toInt(data, index);
+ index += INT_SIZE;
+ tid = ByteUtils.toInt(data, index);
+ index += INT_SIZE;
- byte[] temp = new byte[4];
System.arraycopy(data, index, temp, 0, 2);
probeType = ByteUtils.toInt(temp, 0);
index += 2;
probeSubType = ByteUtils.toInt(temp, 0);
index += 2;
- pid = ByteUtils.toInt(data, index);
- index += INT_SIZE;
- tid = ByteUtils.toInt(data, index);
- index += INT_SIZE;
+ pcAddr = ByteUtils.toLong(data, index);
+ index += LONG_SIZE;
+ callerPcAddr = ByteUtils.toLong(data, index);
+ index += LONG_SIZE;
cpuNum = ByteUtils.toInt(data, index);
index += INT_SIZE;
ArgsInfo info = LogDataUtils.parseArgs(data, index);
index += INT_SIZE;
tid = ByteUtils.toInt(data, index);
index += INT_SIZE;
+
+ System.arraycopy(data, index, temp, 0, 2);
+ probeType = ByteUtils.toInt(temp, 0);
+ index += 2;
+
+ System.arraycopy(data, index, temp, 0, 2);
+ probeSubType = ByteUtils.toInt(temp, 0);
+ index += 2;
+
pcAddr = ByteUtils.toLong(data, index);
index += LONG_SIZE;
callerPcAddr = ByteUtils.toLong(data, index);
ProcessInfoPackage processInfoPkg = AnalyzerManager.getProject()
.getProcessInfoPackage(pid);
if (time > 0) {
- ProcessInfo processInfo = processInfoPkg.getProcessInfo(time);
- BinaryInfo binInfo = processInfo.getTargetBinary(pcAddr);
- if (null == binInfo) {
+ if (null == processInfoPkg) {
libName = "unknown";
} else {
- libName = binInfo.getTargetBinaryPath();
+ ProcessInfo processInfo = processInfoPkg.getProcessInfo(time);
+ if (null == processInfo) {
+ libName = "unknown";
+ } else {
+ BinaryInfo binInfo = processInfo.getTargetBinary(pcAddr);
+ if (null == binInfo) {
+ libName = "unknown";
+ } else {
+ libName = binInfo.getTargetBinaryPath();
+ }
+ // System.out.println("plib name : " + libName);
+ }
}
- // System.out.println("plib name : " + libName);
}
}
import java.sql.SQLException;
import org.tizen.dynamicanalyzer.common.GlobalInformation;
-import org.tizen.dynamicanalyzer.communicator.DACommunicator;
import org.tizen.dynamicanalyzer.constant.CommonConstants;
import org.tizen.dynamicanalyzer.swap.model.ByteUtils;
String deviceEnergyUsage = null;
String applicationEnergyUsage = null;
- int callAlpha = 0;
- int rssiAlpha = 0;
+// int callAlpha = 0;
+// int rssiAlpha = 0;
public SystemData() {
}
this.diskWrittenSectorCount = diskWrittenSectorCount;
}
- public int getCallAlpha() {
- return callAlpha;
- }
-
- public void setCallAlpha(int callAlpha) {
- this.callAlpha = callAlpha;
- }
-
- public int getRssiAlpha() {
- return rssiAlpha;
- }
-
- public void setRssiAlpha(int rssiAlpha) {
- this.rssiAlpha = rssiAlpha;
- }
+// public int getCallAlpha() {
+// return callAlpha;
+// }
+//
+// public void setCallAlpha(int callAlpha) {
+// this.callAlpha = callAlpha;
+// }
+//
+// public int getRssiAlpha() {
+// return rssiAlpha;
+// }
+//
+// public void setRssiAlpha(int rssiAlpha) {
+// this.rssiAlpha = rssiAlpha;
+// }
public int getEnergyUsage() {
return energyUsage;
prep.setInt(index++, call);
prep.setInt(index++, dnet);
prep.setInt(index++, energyUsage);
-
- prep.setInt(index++, callAlpha);
- prep.setInt(index++, rssiAlpha);
+ prep.setString(index++, deviceEnergyUsage);
+ prep.setString(index++, applicationEnergyUsage);
+// prep.setInt(index++, callAlpha);
+// prep.setInt(index++, rssiAlpha);
}
@Override
call = rs.getInt(index++);
dnet = rs.getInt(index++);
energyUsage = rs.getInt(index++);
-
- callAlpha = rs.getInt(index++);
- rssiAlpha = rs.getInt(index++);
+ deviceEnergyUsage = rs.getString(index++);
+ applicationEnergyUsage = rs.getString(index++);
+// callAlpha = rs.getInt(index++);
+// rssiAlpha = rs.getInt(index++);
}
@Override
logFormats.add(ControlLogFormat.getInstance());
logFormats.add(CustomChartLogFormat.getInstance());
logFormats.add(FileLogFormat.getInstance());
- logFormats.add(NetworkLogFormat.getInstance());
+ // logFormats.add(NetworkLogFormat.getInstance());
logFormats.add(LifeCycleLogFormat.getInstance());
logFormats.add(MemoryLogFormat.getInstance());
logFormats.add(ProfilingLogFormat.getInstance());
"NetworkReceiveSize","WiFi", "BlueTooth", "GPS", "Brightness",
"Camera", "Sound","Audio", "Vibration", "Voltage",
"Rssi", "Video", "CallValue","Dnet", "Energy",
- "CallAlpha", "RssiAlpha"};
+ "EnergyPerDevice", "AppEnergyPerDevice"};
dbColumnNames = new ArrayList<String>();
dbColumnNames.addAll(HeaderColumns.getDBColumnNames());
dbColumnNames.addAll(Arrays.asList(dcn));
I, I, I, I, I,
I, I, I, I, I,
I, I, I,
- I, I, I};
+ I, T, T};
dbColumnTypes = new ArrayList<Integer>();
dbColumnTypes.addAll(HeaderColumns.getDBColumntypes());
dbColumnTypes.addAll(Arrays.asList(dct));
"Disk Sectors Written", "Network Send Size,", "Network Receive Size",
"WiFi", "BlueTooth", "GPS", "Brightness", "Camera", "Sound",
"Audio", "Vibration", "Voltage", "Rssi", "Video", "Call",
- "Dnet", "Energy", "CallAlpha", "RssiAlpha" };
+ "Dnet", "Energy", "Energy Usage Per Devices", "Application Energy Usage" };
tableColumnNames = new ArrayList<String>();
tableColumnNames.addAll(HeaderColumns.getTableColumnNames());
tableColumnNames.addAll(Arrays.asList(tcn));
I, I, I, I, I,
I, I, I, I, I,
I, I, I,
- I, I, I};
+ I, S, S};
logColumnTypes = new ArrayList<Integer>();
logColumnTypes.addAll(HeaderColumns.getLogColumnTypes());
logColumnTypes.addAll(Arrays.asList(types));
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact:
- * Hyunjong Park <phjwithyou.park@samsung.com>
- * yeongtaik byeon <yeongtaik.byeon@samsung.com>
+ * Hyeran kim <hyearn74.kim@samsung.com>
* Juyoung Kim <j0.kim@samsung.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
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.ui.file.FilePage;
+import org.tizen.dynamicanalyzer.ui.file.manager.FileDataManager;
+import org.tizen.dynamicanalyzer.ui.file.model.FileEvent;
+
public class FileApiListTable extends DAApiListTableComposite {
public FileApiListTable(Composite parent, int compStyle, int tableStyle) {
endTime = itemTime;
}
}
-
DASelectionData selData = new DASelectionData(
FilePage.apilistViewID, startTime, endTime, items,
table);
+
AnalyzerManager.getCurrentPage().updateView(selData);
}
FileApiListView view = (FileApiListView) AnalyzerManager
.getCurrentPage().getView(FilePage.apilistViewID);
- FileChartData data = view.getPageData();
- if (null == data) {
- return null;
- }
-
long rangeStartTime = view.getRangeStartTime();
long rangeEndTime = view.getRangeEndTime();
-
- List<TableInput> input = new ArrayList<TableInput>();
- List<FileChartDataEvent> contents = data.getContents();
+
HashMap<String, Integer> findStartAPITableIndexHashMap = new HashMap<String, Integer>();
List<Integer> removeTableIndex = new ArrayList<Integer>();
- FileChartDataEvent content;
+ List<TableInput> input = new ArrayList<TableInput>();
+
+ List<FileEvent> contents = FileDataManager.getInstance().getSelectedTableAPIList();
+ if(contents == null) {
+ return null;
+ }
for (int i = 0; i < contents.size(); i++) {
- content = contents.get(i);
- FileData contentTemp = content.getContents();
+ FileEvent contentTemp = contents.get(i);
int selectedPid = ToolbarArea.getInstance().getSelectedPid();
if (selectedPid != 0) {
if (selectedPid != contentTemp.getPid()) {
contentData.add(input.get(startLogIndex.intValue())
.getText().get(1));
- long startTime = contents.get(startLogIndex.intValue())
- .getContents().getTime();
+ long startTime = contents.get(startLogIndex.intValue()).getTime();
String timeFormat = Formatter
.toTimeFormat(time - startTime);
String removeTimeFormat = timeFormat.replace(
contentText.add(Integer.toString(contentTemp.getTid()));
contentData.add(Integer.toString(contentTemp.getTid()));
+
+ contentText.add(Long.toString(contentTemp.getFdValue()));
+ contentData.add(Long.toString(contentTemp.getFdValue()));
contentText.add(contentTemp.getApiName());
contentData.add(contentTemp.getApiName());
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact:
- * Hyunjong Park <phjwithyou.park@samsung.com>
- * yeongtaik byeon <yeongtaik.byeon@samsung.com>
+ * Hyeran kim <hyearn74.kim@samsung.com>
* Juyoung Kim <j0.kim@samsung.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
package org.tizen.dynamicanalyzer.ui.file;
-import org.eclipse.nebula.widgets.grid.Grid;
+import java.util.List;
+
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.nl.FilePageLabels;
import org.tizen.dynamicanalyzer.resources.ColorResources;
-import org.tizen.dynamicanalyzer.swap.model.data.LogData;
+import org.tizen.dynamicanalyzer.ui.file.model.FileEvent;
+import org.tizen.dynamicanalyzer.ui.file.model.FileSelectedData;
import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
import org.tizen.dynamicanalyzer.ui.widgets.table.TableColumnSizePackListener;
import org.tizen.dynamicanalyzer.widgets.da.view.DAViewComposite;
import org.tizen.dynamicanalyzer.widgets.da.view.DAViewData;
+import org.tizen.dynamicanalyzer.ui.file.manager.FileDataManager;
public class FileApiListView extends DAViewComposite {
- private FileChartData data;
private long analysisStartTime = 0;
private long analysisEndTime = 0;
- private long selectionStartTime = 0;
- private long selectionEndTime = 0;
private int preSelectionPId = 1;
+ private long preAnalysisStartTime = 0;
+ private long preAnalysisEndTime = 0;
+ private FileSelectedData selectedData = null;
private String[] columnNames = { FilePageLabels.FILE_API_LIST_VIEW_INDEX,
FilePageLabels.FILE_API_LIST_VIEW_START_TIME,
FilePageLabels.FILE_API_LIST_VIEW_ELAPSED_TIME,
FilePageLabels.FILE_API_LIST_VIEW_PID,
FilePageLabels.FILE_API_LIST_VIEW_THREAD_ID,
+ FilePageLabels.FILE_API_LIST_VIEW_FD,
FilePageLabels.FILE_API_LIST_VIEW_API,
FilePageLabels.FILE_API_LIST_VIEW_PARAMETER,
FilePageLabels.FILE_API_LIST_VIEW_RETURN,
FilePageLabels.FILE_API_LIST_VIEW_ERRNO };
- private int[] columnSizes = { 40, 70, 100, 40, 40, 120, 250, 70, 100 };
+ private int[] columnSizes = { 40, 70, 100, 40, 40, 40, 120, 250, 70, 100 };
private int[] columnAlignment = { SWT.RIGHT, SWT.RIGHT, SWT.RIGHT,
- SWT.RIGHT, SWT.RIGHT, SWT.LEFT, SWT.LEFT, SWT.LEFT, SWT.LEFT };
+ SWT.RIGHT, SWT.RIGHT, SWT.RIGHT, SWT.LEFT, SWT.LEFT, SWT.LEFT, SWT.LEFT };
int[] sortTypes = { AnalyzerConstants.SORT_TYPE_NUM,
AnalyzerConstants.SORT_TYPE_STRING,
AnalyzerConstants.SORT_TYPE_STRING,
- AnalyzerConstants.SORT_TYPE_NUM, AnalyzerConstants.SORT_TYPE_NUM,
+ 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_STRING };
FileApiListTable tableComp = null;
+ FileDataManager manager = FileDataManager.getInstance();
public FileApiListView(Composite parent, int style) {
super(parent, style, true);
@Override
public void updateView() {
- if (null == data) {
+ if (null == tableComp || selectedData == null) {
return;
}
+ if (isUpdateTable()) {
+ tableComp.updateTable();
+ }
+ }
+
+ private boolean isUpdateTable() {
+ boolean isUpdate = false;
+
+ // if preSelected PID is different with current selected PID, update
+ // table
+ int selectedPid = ToolbarArea.getInstance().getSelectedPid();
+ if (preSelectionPId != -1 && preSelectionPId != selectedPid) {
+ isUpdate = true;
+ }
+ preSelectionPId = selectedPid;
+
+ // if analyzer is changed, set the start and end time with changed
+ // analyzer and update table
long newAnalysisStartTime = 0;
long newAnalysisEndTime = 0;
-
if (RangeDataManager.getInstance().isBeingAnalyzed()) {
newAnalysisStartTime = RangeDataManager.getInstance()
.getAnalysisStartTime();
newAnalysisStartTime = 0;
newAnalysisEndTime = 0;
}
-
- if (newAnalysisStartTime != analysisStartTime
- || newAnalysisEndTime != analysisEndTime) {
- analysisStartTime = newAnalysisStartTime;
- analysisEndTime = newAnalysisEndTime;
- tableComp.updateTable();
- return;
- }
-
- int selectedPid = ToolbarArea.getInstance().getSelectedPid();
- if (preSelectionPId != -1 && preSelectionPId != selectedPid) {
- tableComp.updateTable();
- }
- preSelectionPId = selectedPid;
-
- if (tableComp.getTable().getItemCount() > 0
- && data.getContents().size() != tableComp.getTable()
- .getItemCount()) {
- tableComp.updateTable();
+ if (newAnalysisStartTime != preAnalysisStartTime
+ || newAnalysisEndTime != preAnalysisEndTime) {
+ preAnalysisStartTime = newAnalysisStartTime;
+ preAnalysisEndTime = newAnalysisEndTime;
+ isUpdate = true;
}
-
- }
-
- @Override
- public void updateView(DAViewData data) {
- if (!(data instanceof DASelectionData))
- return;
- DASelectionData seldata = (DASelectionData) data;
-
- if(seldata.isLogData()) {
- Object odata = seldata.getData();
- if(!(odata instanceof LogData) || odata == null)
- return;
-
- LogData ldata = (LogData) odata;
-
- int seq = ldata.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();
- }
+ // if new event is put from swap, update table
+ List<FileEvent> events = manager.getApiDB().selectAPITable(
+ selectedData.getDentry(), selectedData.getPid(),
+ selectedData.getTid(), selectedData.isParentChart());
+ if(events != null) {
+ if (tableComp.getTable().getItemCount() > 0
+ && events.size() != tableComp.getTable().getItemCount()) {
+ manager.setSelectedTableAPIList(events);
+ isUpdate = true;
}
- long selectedTime = ldata.getTime();
- DASelectionData selection = new DASelectionData(FilePage.apilistViewID,
- selectedTime, selectedTime,
- tableComp.getTable().getSelection(), tableComp.getTable());
- AnalyzerManager.getCurrentPage().updateView(selection);
- } else {
- if (!(seldata.getData() instanceof FileChartData)) {
- selectionStartTime = seldata.getStartTime();
- selectionEndTime = seldata.getEndTime();
- } else {
- this.data = (FileChartData) seldata.getData();
- }
- tableComp.getTable().removeAll();
- tableComp.updateTable();
- tableComp.setSelectionByTime(selectionStartTime, selectionEndTime);
}
- }
-
- private int getScrollSelectionIndex(Grid table, int selection) {
- int size = table.getVerticalBar().getThumb() / 2;
- int output = selection - size;
- output = (output < 0) ? 0 : output;
- return output;
+
+ return isUpdate;
}
@Override
@Override
public void clear() {
tableComp.getTable().removeAll();
- data = null;
+ }
+
+ @Override
+ public void updateView(DAViewData data) {
+ DASelectionData selData = (DASelectionData) data;
+ long selectionStartTime = selData.getStartTime();
+ long selectionEndTime = selData.getEndTime();
+ if (selData.getData() instanceof FileSelectedData) {
+ selectedData = (FileSelectedData) selData.getData();
+ if (null == selectedData) {
+ return;
+ }
+ manager.setSelectedTableAPIList(
+ manager.getApiDB().
+ selectAPITable(selectedData.getDentry(),
+ selectedData.getPid(),
+ selectedData.getTid(),
+ selectedData.isParentChart()));
+
+ tableComp.updateTable();
+ tableComp.setSelectionByTime(selectionStartTime,
+ selectionEndTime);
+ }
}
- public FileChartData getPageData() {
- return data;
+ public FileSelectedData getSelectedData() {
+ return selectedData;
}
public long getRangeStartTime() {
*
*/
-package org.tizen.dynamicanalyzer.ui.file.view;
+package org.tizen.dynamicanalyzer.ui.file;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.swt.graphics.Color;
-import org.tizen.dynamicanalyzer.constant.CommonConstants;
import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
import org.tizen.dynamicanalyzer.nl.FilePageLabels;
-import org.tizen.dynamicanalyzer.nl.NetworkPageLabels;
import org.tizen.dynamicanalyzer.resources.ColorResources;
-import org.tizen.dynamicanalyzer.swap.channel.data.ApiNameManager;
-import org.tizen.dynamicanalyzer.ui.file.FileChartData;
import org.tizen.dynamicanalyzer.ui.file.model.FileAccess;
import org.tizen.dynamicanalyzer.ui.file.model.FileEvent;
import org.tizen.dynamicanalyzer.ui.file.model.FileStatus;
-import org.tizen.dynamicanalyzer.ui.network.data.type.NetworkAPIType;
-import org.tizen.dynamicanalyzer.ui.network.data.type.NetworkSeriesType;
import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
-import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
+import org.tizen.dynamicanalyzer.utils.Formatter;
import org.tizen.dynamicanalyzer.widgets.chart.DAChart;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeries;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeriesItem;
private String filePath = null;
private int pid = -1;
private int tid = -1;
+ private long fd = -1;
private long fileSize = 0;
private List<FileEvent> statusList = new ArrayList<FileEvent>(); // only open, close event
private boolean isReading = false;
private double fileOpenedTime = 0;
- private long fileClosedTime = 0;
- private long fileLastUsedTime = 0;
- private long fileTotalUsedTime = 0;
public FileChart(String filePath) {
this.filePath = filePath;
this.dentry = dentry;
}
- public FileChart(String filePath, int pid, int tid) {
+ public FileChart(String filePath, int pid, int tid, long fd) {
this.filePath = filePath;
this.pid = pid;
this.tid = tid;
+ this.fd = fd;
}
- public FileChart(long dentry, int pid, int tid, String filePath, long fileSize) {
+ public FileChart(long dentry, int pid, int tid, long fd, String filePath, long fileSize) {
this.dentry = dentry;
this.filePath = filePath;
this.pid = pid;
this.tid = tid;
+ this.fd = fd;
this.fileSize = fileSize;
}
}
}
- // TODO check
+ /**
+ * update api series chart
+ * @param apiList
+ */
public void updateApiSeries(List<FileEvent> apiList){
for(FileEvent event : apiList) {
if(event.getDentry() != this.dentry ||
event.getTid() != this.tid) {
continue;
}
- double time = event.getEventTime() / TimelineConstants.MEGA_DOUBLE;
+ double time = event.getTime() / TimelineConstants.MEGA_DOUBLE;
String apiName = event.getApiName();
Color color = ColorResources.FILE_OTHER_OPERATION;
- if (event.getErrNo() != 0) {
+ if (event.getErrno() != 0) {
color = ColorResources.FILE_API_FAILED;
} else {
- int id = event.getApiType();
+ int id = event.getFdApiType();
if( id == LogCenterConstants.FD_API_TYPE_READ_START
|| id == LogCenterConstants.FD_API_TYPE_READ_END
|| id == LogCenterConstants.FD_API_TYPE_WRITE_START
chart.redraw();
}
- // TODO check
+ /**
+ * update access series chart - read/write/lock event
+ * @param accessList
+ */
public void updateAccessSeries(List<FileAccess> accessList) {
for(FileAccess data : accessList) {
if(data.getDentry() != this.dentry ||
switch(data.getApiType()){
case LogCenterConstants.FD_API_TYPE_READ_START:
+ // if a file is already read by other thread or process(concurrent read)
if(data.isAlreadyReading()) {
accessSeries.addSeriesItem(new DAChartSeriesItem(
startTime, DAChartSeriesItem.SERIES_AREA_START,
FilePageLabels.FILE_CHART_TOOLTIP_READ));
if(endTime > 0) { // if endTime <= 0, still accessing
accessSeries.addSeriesItem(new DAChartSeriesItem(
- startTime, DAChartSeriesItem.SERIES_AREA_END,
+ endTime, DAChartSeriesItem.SERIES_AREA_END,
ColorResources.FILE_ACCESS_READ,
ColorResources.FILE_ACCESS_READ, true,
FilePageLabels.FILE_CHART_TOOLTIP_READ));
FilePageLabels.FILE_CHART_TOOLTIP_READ));
if(endTime > 0) {
accessSeries.addSeriesItem(new DAChartSeriesItem(
- startTime, DAChartSeriesItem.SERIES_AREA_END,
+ endTime, DAChartSeriesItem.SERIES_AREA_END,
ColorResources.FILE_ACCESS_READ,
ColorResources.FILE_ACCESS_READ, false,
FilePageLabels.FILE_CHART_TOOLTIP_READ));
}
break;
case LogCenterConstants.FD_API_TYPE_WRITE_START:
+ // if a file is already wrote by other thread or process(concurrent write)
if(data.isAlreadyWriting()) {
accessSeries.addSeriesItem(new DAChartSeriesItem(
startTime, DAChartSeriesItem.SERIES_AREA_START,
FilePageLabels.FILE_CHART_TOOLTIP_WRITE));
if(endTime > 0) { // if endTime <= 0, still accessing
accessSeries.addSeriesItem(new DAChartSeriesItem(
- startTime, DAChartSeriesItem.SERIES_AREA_END,
+ endTime, DAChartSeriesItem.SERIES_AREA_END,
ColorResources.FILE_ACCESS_WRITE,
ColorResources.FILE_ACCESS_WRITE, true,
FilePageLabels.FILE_CHART_TOOLTIP_WRITE));
FilePageLabels.FILE_CHART_TOOLTIP_WRITE));
if(endTime > 0) {
accessSeries.addSeriesItem(new DAChartSeriesItem(
- startTime, DAChartSeriesItem.SERIES_AREA_END,
+ endTime, DAChartSeriesItem.SERIES_AREA_END,
ColorResources.FILE_ACCESS_WRITE,
ColorResources.FILE_ACCESS_WRITE, false,
FilePageLabels.FILE_CHART_TOOLTIP_WRITE));
FilePageLabels.FILE_CHART_TOOLTIP_LOCK));
if(endTime > 0){
lockSeries.addSeriesItem(new DAChartSeriesItem(
- startTime, DAChartSeriesItem.SERIES_AREA_START,
- ColorResources.FILE_LOCK_ACQUIRED,
+ endTime, DAChartSeriesItem.SERIES_AREA_END,
+ ColorResources.FILE_LOCK_ACQUIRED,
ColorResources.FILE_LOCK_ACQUIRED, false,
FilePageLabels.FILE_CHART_TOOLTIP_LOCK));
}
chart.redraw();
}
- // TODO only parent, open/close, duplicated open/close
+ /**
+ * update status series chart - open/close event
+ * @param statusList
+ */
public void updateStatusSeries(List<FileStatus> statusList) {
int openNum = 0;
int closeNum = 0;
|| data.getErrNo() != 0) {
continue;
}
- double time = data.getEventTime() / TimelineConstants.MEGA_DOUBLE;
+ double time = Formatter.toLongTimeForDoubleTime(data.getEventTime());
switch(data.getApiType()){
case LogCenterConstants.FD_API_TYPE_OPEN:
if(openNum > 0){ // duplicated open
ColorResources.FILE_OPENED,
ColorResources.FILE_OPENED,
FilePageLabels.FILE_CHART_TOOLTIP_CLOSED));
-
- }else if((openNum-closeNum) == 1){ // duplicated close
+ openNum = 0;
+ closeNum = 0;
+ } else { // duplicated close
statusSeries.addSeriesItem(new DAChartSeriesItem(
time, DAChartSeriesItem.SERIES_AREA_END,
ColorResources.FILE_DUPLICATE_OPENED,
public void getFileSize(long fileSize) {
this.fileSize = fileSize;
}
+
+ public long getFd() {
+ return fd;
+ }
+
+ public void setFd(long fd) {
+ this.fd = fd;
+ }
+
}
\ No newline at end of file
*
*/
-package org.tizen.dynamicanalyzer.ui.file.view;
+package org.tizen.dynamicanalyzer.ui.file;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.swt.widgets.Composite;
+import org.tizen.dynamicanalyzer.common.DALimit;
import org.tizen.dynamicanalyzer.constant.CommonConstants;
import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
import org.tizen.dynamicanalyzer.nl.FilePageLabels;
-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.ui.common.PopupStartMenuItemClickListener;
import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseEventListener;
import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseTrackAdapter;
-import org.tizen.dynamicanalyzer.ui.file.FileChartData;
import org.tizen.dynamicanalyzer.ui.file.data.FileApiDB;
-import org.tizen.dynamicanalyzer.ui.file.manager.FileChartDataMaker;
-import org.tizen.dynamicanalyzer.ui.file.manager.FileChartManager;
+import org.tizen.dynamicanalyzer.ui.file.manager.FileDataMaker;
+import org.tizen.dynamicanalyzer.ui.file.manager.FileDataManager;
import org.tizen.dynamicanalyzer.ui.file.model.FileAccess;
import org.tizen.dynamicanalyzer.ui.file.model.FileEvent;
import org.tizen.dynamicanalyzer.ui.file.model.FileSelectedData;
import org.tizen.dynamicanalyzer.ui.file.model.FileStatus;
-import org.tizen.dynamicanalyzer.ui.network.NetworkChart;
-import org.tizen.dynamicanalyzer.ui.network.data.NetworkDataManager;
-import org.tizen.dynamicanalyzer.ui.network.data.type.NetworkAPIType;
-import org.tizen.dynamicanalyzer.ui.network.data.type.NetworkSelectionType;
-import org.tizen.dynamicanalyzer.ui.network.data.type.NetworkSeriesType;
-import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
-import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
+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.DAChartPlotIntervalMarker;
import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenu;
import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenuItem;
-public class FileChartBoard extends DAChartBoard{
+public class FileChartBoard extends DAChartBoard {
private List<FileChart> chartList = new ArrayList<FileChart>();
- private FileChartManager fileChartManager = FileChartManager.getInstance();
+ private FileDataManager fileChartManager = FileDataManager.getInstance();
private Map<String, Long> fileAccessorMap = new HashMap<String, Long>();
- private FileChartDataMaker dataMaker;
+ private FileDataMaker dataMaker;
private FileApiDB apiDB;
-
+
public FileChartBoard(Composite parent, String title) {
super(parent, title);
dataMaker = fileChartManager.getFileChartDataMaker();
- //TODO
- //apiDB = dataMaker.getApiDB();
apiDB = fileChartManager.getApiDB();
initIntervalMarkers();
}
-
+
@Override
protected void callBackScaleChanged() {
super.callBackScaleChanged();
layout(true, true);
super.callBackSizeChanged();
}
-
+
+ /**
+ * starting point of processing file information for file chart 1.
+ * FileChartView->updateView : periodic, message received 2.
+ * callBackScaleChanged 3. callBackScrollChanged
+ */
public void updateChart() {
clearSeries();
createChartList();
updateAccessSeries();
updateApiSeries();
}
-
+
public void clear() {
super.clear();
chartList.clear();
initIntervalMarkers();
}
-
+
public void clearSeries() {
if (null == chartList) {
return;
chart.clearSeries();
}
}
-
- // create chart rows
+
+ /**
+ * create chart rows
+ */
private void createChartList() {
FileChart parent = null;
FileChart child = null;
- long dentry = -1;
+ long dentry = 0;
String key = null;
- List<FileEvent> eventList = dataMaker.getFileEventList();
- if(eventList == null){
+ List<FileEvent> eventList = dataMaker.getFileEventList();
+ if (eventList == null) {
+ // no file event at all.
return;
}
- for(FileEvent event : eventList) {
+
+ for (FileEvent event : eventList) {
+ // TODO need to think about what value could be a key
key = createKey(event.getPid(), event.getTid());
- if(event.getApiType() == LogCenterConstants.FD_API_TYPE_OPEN){
- if(fileAccessorMap.get(key) == null) {
+ if (event.getFdApiType() == LogCenterConstants.FD_API_TYPE_OPEN) {
+ if (fileAccessorMap.get(key) == null) {
fileAccessorMap.put(key, event.getDentry());
}
}
parent = getParentChart(dentry);
if (parent == null) {
parent = new FileChart(dentry);
- //TODO target process'file name only
+ // TODO change to origin file path
parent.setFilePath(event.getFilePath());
- child = new FileChart(dentry, event.getPid(), event.getTid(), event.getFilePath(),
- event.getFileSize());
+ child = new FileChart(dentry, event.getPid(), event.getTid(),
+ event.getFdValue(), event.getFilePath(), event.getFileSize());
parent.addChild(child);
createChartItem(null, parent);
createChartItem(parent, child);
chartList.add(child);
} else {
child = parent.getChildChart(event);
- if(child == null){
- child = new FileChart(dentry, event.getPid(), event.getTid(), event.getFilePath(),
+ if (child == null) {
+ child = new FileChart(dentry, event.getPid(),
+ event.getTid(), event.getFdValue(), event.getFilePath(),
event.getFileSize());
parent.addChild(child);
createChartItem(parent, child);
}
}
}
-
+
+ /**
+ * Drawing the chart title 1. parent: file name: max 2line, last: ... 2.
+ * child: "pid(PID) \n tid(TID)"
+ *
+ * @param parent
+ * @param fileChart
+ */
private void createChartItem(FileChart parent, FileChart fileChart) {
DAChartBoardItem item;
DAChart chart;
-
- if(parent != null){ // child chart row
+
+ if (parent != null) { // child chart row
DAChartBoardItem parentItem = parent.getItem();
- item = new DAChartBoardItem (parentItem, "0x"//$NON-NLS-1$
- + Long.toHexString(fileChart.getPid()) + "(PID)"
+ item = new DAChartBoardItem(parentItem, "0x"//$NON-NLS-1$
+ + Long.toHexString(fileChart.getPid())
+ + "(PID)"
+ CommonConstants.NEW_LINE
- + Long.toHexString(fileChart.getTid()) + "(TID)"
- );
+ + Long.toHexString(fileChart.getTid()) + "(TID)");
chart = item.getChart();
+ // TODO change dentry to origin file path
item.setData(new FileSelectedData(fileChart.getDentry(), fileChart
- .getPid(), fileChart.getTid(), false));
+ .getPid(), fileChart.getTid(), fileChart.getFd(), false));
initFileChart(chart, false);
} else { // parent chart row
String fileName = fileChart.getFileName();
String title = fileName;
- if (fileName.length() > 12) {
- title = fileName.substring(0, 12)
- + CommonConstants.NEW_LINE
- + fileName.substring(12, fileName.length());
+ int maxLen = DALimit.MAX_STRING_LENGTH;
+ if (fileName.length() > maxLen && fileName.length() < maxLen * 2) {
+ title = fileName.substring(0, maxLen) + CommonConstants.NEW_LINE
+ + fileName.substring(maxLen, fileName.length());
+ } else if (fileName.length() >= maxLen *2) {
+ title = fileName.substring(0, maxLen) + CommonConstants.NEW_LINE
+ + fileName.substring(maxLen, maxLen*2 - 1) + "...";
}
item = new DAChartBoardItem(this, title);
item.setData(new FileSelectedData(fileChart.getDentry(), fileChart
- .getPid(), fileChart.getTid(), true, fileChart
- .getFilePath(), fileChart.getFileSize()));
+ .getPid(), fileChart.getTid(), fileChart.getFd(), true,
+ fileChart.getFilePath(), fileChart.getFileSize()));
chart = item.getChart();
initFileChart(chart, true);
}
fileChart.setItem(item);
chart.redraw();
}
-
- // update file open status
+
+ /**
+ * update file open status
+ */
private void updateStatusSeries() {
- if(chartList.size() > 0) {
- List<FileStatus> statusList = getVisibleSatausList();
+ if (chartList.size() > 0) {
+ List<FileStatus> statusList = getVisibleStatusList();
for (FileChart chart : chartList) {
- if(!chart.isParentChart()) {
+ if (!chart.isParentChart()) {
continue;
}
chart.updateStatusSeries(statusList);
}
}
}
-
- // update file access status
+
+ /**
+ * update file access status
+ */
private void updateAccessSeries() {
- if(chartList.size() >0) {
+ if (chartList.size() > 0) {
List<FileAccess> accessList = getVisibleAccessList();
for (FileChart chart : chartList) {
chart.updateAccessSeries(accessList);
}
}
}
-
- // update file api
+
+ /**
+ * update file api
+ */
private void updateApiSeries() {
- if(chartList.size() >0) {
- List<FileEvent> apiList = apiDB.selectAPISeries(getVisibleStartTime(),
- getVisibleEndTime());
+ if (chartList.size() > 0) {
+ List<FileEvent> apiList = apiDB.selectAPISeries(
+ getVisibleStartTime(), getVisibleEndTime());
if (null == apiList) {
+ // no file event within the selected time range.
return;
}
for (FileChart chart : chartList) {
- if(chart.isParentChart()){
+ if (chart.isParentChart()) {
continue;
}
chart.updateApiSeries(apiList);
}
+ } else { // chartList.size() <= 0
+ // no data at all
}
}
-
+
private FileChart getParentChart(long dentry) {
for (FileChart chart : chartList) {
- if (chart.getDentry() == dentry
- && chart.isParentChart()) {
+ if (chart.getDentry() == dentry && chart.isParentChart()) {
return chart;
}
}
return null;
}
-
+
private String createKey(int pid, int tid) {
StringBuffer key = new StringBuffer(pid);
key.append(":");
key.append(tid);
return key.toString();
}
-
- private List<FileStatus> getVisibleSatausList() {
+
+ private List<FileStatus> getVisibleStatusList() {
return dataMaker.getFileStatusList();
}
-
+
private List<FileAccess> getVisibleAccessList() {
List<FileAccess> data = new ArrayList<FileAccess>();
- for(FileAccess access : dataMaker.getFileAccessList()){
- double startTime = access.getStartTime() / TimelineConstants.MEGA_DOUBLE;
- double endTime = access.getEndTime() / TimelineConstants.MEGA_DOUBLE;
- if ( startTime >= getVisibleStartTime()
+ for (FileAccess access : dataMaker.getFileAccessList()) {
+ double startTime = Formatter.toLongTimeForDoubleTime(access
+ .getStartTime());
+ double endTime = Formatter.toLongTimeForDoubleTime(access
+ .getEndTime());
+ if (startTime >= getVisibleStartTime()
&& startTime <= getVisibleEndTime()) {
data.add(access);
} else if (endTime >= getVisibleStartTime()
&& endTime <= getVisibleEndTime()) {
data.add(access);
- } else if (endTime <= 0) { // ing
+ } else if (endTime <= 0) { // not finished
data.add(access);
}
}
return data;
}
-
+
+ // TODO change dentry to origin file path
public int[] getChartIndex(FileEvent event) {
FileChart data = null;
for (int i = 0; i < chartList.size(); i++) {
data = chartList.get(i);
- if (data.isParentChart()
- && data.getDentry() == event.getDentry()) {
- for(int j = 0; j < data.getChild().size(); j++) {
+ if (data.isParentChart() && data.getDentry() == event.getDentry()) {
+ for (int j = 0; j < data.getChild().size(); j++) {
FileChart child = data.getChild().get(i);
- if(child.getPid() == event.getPid()
- && child.getTid() == event.getTid()){
- return new int[] {i, j};
+ if (child.getPid() == event.getPid()
+ && child.getTid() == event.getTid()) {
+ return new int[] { i, j };
}
}
}
return;
}
DAChartPlot plot = chart.getPlot();
- if (null == plot) {
- return;
- }
+
if (isParent) {
DAChartSeries statusSeries = new DAChartSeries(
FilePageLabels.FILE_CHART_SERIES,
} else {
DAChartSeries lockSeries = new DAChartSeries(
FilePageLabels.FILE_CHART_API,
- DAChartSeries.SERIES_STYLE_STATE_AREA, ColorResources.YELLOW);
+ DAChartSeries.SERIES_STYLE_STATE_AREA,
+ ColorResources.YELLOW);
chart.addSeries(lockSeries);
-
+
DAChartSeries accessSeries = new DAChartSeries(
FilePageLabels.FILE_CHART_ACCESS,
- DAChartSeries.SERIES_STYLE_EVENT_AREA, ColorResources.WHITE);
+ DAChartSeries.SERIES_STYLE_STATE_AREA, ColorResources.WHITE);
chart.addSeries(accessSeries);
plot.setBackgroundImage(ImageResources.BG_CHILD_GRADIENT);
}
-
+
plot.setAutoHeightRange(AutoRangeType.MANUAL);
plot.setAxisFont(FontResources.CHART_AXIS_FONT);
plot.setAxisRangeY(0, 101);
plot.setAxisRangeX(getVisibleStartTime(), getVisibleEndTime());
-
+
DAChartPlotTooltip tooltip = new DAChartPlotTooltip(-1);
tooltip.setFont(FontResources.CHART_TOOLTIP_FONT);
plot.setTooltip(tooltip);
clearItem.setText(TimelineChartLabels.RANGE_CONTEXT_CLEAR);
clearItem.addListener(new PopupClearMenuItemClickListener());
- TimelineChartMouseEventListener timelineChartMouseEventListener = new TimelineChartMouseEventListener(
+ TimelineChartMouseEventListener timelineChartMouseEventListener =
+ new TimelineChartMouseEventListener(
popupMenu, getTimeline());
chart.addMouseListener(timelineChartMouseEventListener);
chart.addMouseMoveListener(timelineChartMouseEventListener);
getTimeline()));
plot.setMarkers(getMarkers());
}
-
+
private void initIntervalMarkers() {
// selection marker
DAChartPlotIntervalMarker selectionMarker = new DAChartPlotIntervalMarker(
addIntervalMarker(rangeMarker);
}
- public int getChartSize(){
+ public int getChartSize() {
return chartList.size();
}
}
+++ /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.file;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.tizen.dynamicanalyzer.common.AnalyzerManager;
-import org.tizen.dynamicanalyzer.constant.CommonConstants;
-import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
-import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
-import org.tizen.dynamicanalyzer.nl.FilePageLabels;
-import org.tizen.dynamicanalyzer.resources.ColorResources;
-import org.tizen.dynamicanalyzer.ui.summary.failed.FailedData;
-import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
-import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
-import org.tizen.dynamicanalyzer.util.DALogger;
-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 FileChartData {
- private static final DALogger DA_LOG = DALogger.getInstance();
-
- private List<FileChartData> children = new ArrayList<FileChartData>();
- private DAChartSeries apiSeries;
- private DAChartSeries accessSeries;
- private DAChartSeries statueSeries;
-
- private long fd = -1;
- private String filePath = AnalyzerLabels.EMPTY_STRING;
- private boolean isClosedFile = true;
- private boolean isFailedAPI = false;
- // for Detail View Data
- private List<FailedData> failedData = null;
- private long fileSize = 0;
- private long readSize = 0;
- private long writeSize = 0;
- private double fileOpendTime = 0;
- private double fileClosedTime = 0;
- private double fileLastUsedTime = 0;
- private double fileTotalUsedTime = 0;
-
- protected DAChartBoardItem item;
- protected List<FileChartDataEvent> contents = new ArrayList<FileChartDataEvent>();
- protected List<FileChartDataEvent> contentsQueue = new ArrayList<FileChartDataEvent>();
-
- protected DAChart chart;
- protected boolean hasUpdate = false;
-
- // private int lastAccessIndexForParent = 0;
-
- public FileChartData(String filePath, long Fd, boolean isRoot) {
- setFilePath(filePath);
- setFd(Fd);
- }
-
- public void pushChild(FileChartData 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(FileChartDataEvent event) {
- contentsQueue.add(event);
- makeDetailViewData(event);
- hasUpdate = true;
- }
-
- public void makeDetailViewData(FileChartDataEvent event) {
- setFileSize(event.getFileSize());
- setReadSize(event.getReadSize());
- setWriteSize(event.getWriteSize());
- if (event.getFailedData() != null) {
- getFailedData().add(event.getFailedData());
- }
- }
-
- public List<FailedData> getFailedData() {
- if (null == failedData) {
- failedData = new ArrayList<FailedData>();
- }
- return failedData;
- }
-
- public List<Integer> getFailedRelations() {
- List<Integer> output = new ArrayList<Integer>();
- int size = getFailedData().size();
- for (int i = 0; i < size; i++) {
- FailedData ffd = failedData.get(i);
- int seq = ffd.getSeq();
- output.add(seq);
- }
- return output;
- }
-
- public void setHasUpdate() {
- hasUpdate = true;
- }
-
- public List<FileChartDataEvent> getContents() {
- return contents;
- }
-
- public int getChildCount() {
- return children.size();
- }
-
- public List<FileChartData> getChild() {
- return children;
- }
-
- public long getFD() {
- return fd;
- }
-
- public void setFd(long data) {
- this.fd = data;
- }
-
- public void setClosed(boolean data) {
- this.isClosedFile = data;
- }
-
- public boolean isClosed(FileChartDataEvent event) {
- if (event == null) {
- return this.isClosedFile;
- }
- if (isParent()) {
- this.isClosedFile = true;
- for (int i = 0; i < children.size(); i++) {
-
- double fileOpendTime = children.get(i).getFileOpendTime();
- double fileClosedTime = children.get(i).getFileClosedTime();
- if (event.getApiChartTime() == fileOpendTime) {
- this.isClosedFile = true;
- break;
- }
- if (event.getApiChartTime() < fileOpendTime) {
- continue;
- }
- if ((event.getApiChartTime() > fileClosedTime)
- && (fileClosedTime != 0)) {
- continue;
- }
- if (fileClosedTime == 0) {
- if (!children.get(i).isClosed(null)) {
- this.isClosedFile = false;
- break;
- }
- }
- if (fileOpendTime < event.getApiChartTime()
- && event.getApiChartTime() < fileClosedTime) {
- this.isClosedFile = false;
- break;
- }
- }
- return this.isClosedFile;
- }
- return this.isClosedFile;
- }
-
- public boolean isFileOpenFailed() {
- if (isParent()) {
- this.isClosedFile = true;
- for (int i = 0; i < children.size(); i++) {
- if (!children.get(i).isFileOpenFailed()) {
- return false;
- }
- }
- return true;
- } else {
- return isFailedAPI;
- }
- }
-
- public void setFileOpenFailed(boolean data) {
- this.isFailedAPI = data;
- }
-
- public void setFilePath(String name) {
- this.filePath = name;
- }
-
- public String getFilePath() {
- return filePath;
- }
-
- public String getFileName() {
- String[] splitPath = this.filePath.split("\\/"); //$NON-NLS-1$
- String fileName = new String(splitPath[splitPath.length - 1]);
- return fileName;
- }
-
- public int getFailedApiCount() {
- return getFailedData().size();
- }
-
- public int getApiCount() {
- return getContents().size();
- }
-
- public void setFileSize(long data) {
- if (data > 0) {
- this.fileSize = data;
- }
- }
-
- public long getFileSize() {
- return this.fileSize;
- }
-
- public void setReadSize(long data) {
- this.readSize += data;
- }
-
- public long getReadSize() {
- return this.readSize;
- }
-
- public void setWriteSize(long data) {
- this.writeSize += data;
- }
-
- public long getWriteSize() {
- return this.writeSize;
- }
-
- private boolean isParent() {
- boolean isParent = false;
- if (children.size() > 0) {
- isParent = true;
- } else {
- isParent = false;
- }
- return isParent;
- }
-
- public FileChartData findChildData(FileChartDataEvent event) {
- int size = children.size();
- FileChartData ret;
- for (int i = 0; i < size; i++) {
- ret = children.get(i);
- if ((ret.getFD() == event.getFd())
- && (ret.isClosed(event) == false)) {
- return ret;
- }
- }
- return null;
- }
-
- public void setItem(DAChartBoardItem item) {
- this.item = item;
- setChart(item.getChart());
- apiSeries = chart.getSeries(FilePageLabels.FILE_CHART_API);
- accessSeries = chart.getSeries(FilePageLabels.FILE_CHART_ACCESS);
- statueSeries = chart.getSeries(FilePageLabels.FILE_CHART_SERIES);
-
- }
-
- public void checkUpdate() {
- if (false == hasUpdate && AnalyzerManager.isRunning()) {
- return;
- } else {
- hasUpdate = false;
- }
-
- int size = contentsQueue.size();
- FileChartDataEvent 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) {
- FileChartData 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() != -1)) {
- setNotClosedFileStatus();
- break;
- }
- }
- } else {
- if (!isClosed(event)) {
- setNotClosedFileStatus();
- }
- }
- }
- }
-
- private void setStatusColor(FileChartDataEvent event) {
- if ((isFileOpenFailed()) == true || (event.isFailedAPI() == true)) {
- return;
- }
- if (event.getApiType() == LogCenterConstants.FD_API_TYPE_OPEN) {
- if (isParent()) {
- if (isClosed(event)) {
- setOpendFileStatus(event);
- }
- } else {
- setOpendFileStatus(event);
- }
- } else if (event.getApiType() == LogCenterConstants.FD_API_TYPE_CLOSE) {
- if (isParent()) {
- if (isClosed(event)) {
- setClosedFileStatus(event);
- }
- } else {
- setClosedFileStatus(event);
- }
- }
- }
-
- private void setOpendFileStatus(FileChartDataEvent event) {
- DAChartSeriesItem seriesItem = new DAChartSeriesItem(
- event.getApiChartTime(),
- DAChartSeriesItem.SERIES_STATE_CONTINUE,
- ColorResources.FILE_AREA_USED_END,
- ColorResources.FILE_AREA_USED_START,
- FilePageLabels.FILE_CHART_TOOLTIP_OPEND);
- statueSeries.addSeriesItem(seriesItem);
- }
-
- private void setClosedFileStatus(FileChartDataEvent event) {
- int nStatusLastIndex = statueSeries.getSeriesItemList().size() - 1;
- if (nStatusLastIndex > -1) {
- statueSeries.getSeriesItemList().get(nStatusLastIndex)
- .setColor(ColorResources.FILE_AREA_CLOSED_END);
- statueSeries
- .getSeriesItemList()
- .get(nStatusLastIndex)
- .setGradationForegroundColor(
- ColorResources.FILE_AREA_CLOSED_START);
- DAChartSeriesItem seriesItem = new DAChartSeriesItem(
- event.getApiChartTime(),
- DAChartSeriesItem.SERIES_STATE_BAR,
- ColorResources.FILE_AREA_CLOSED_END,
- ColorResources.FILE_AREA_CLOSED_START,
- FilePageLabels.FILE_CHART_TOOLTIP_CLOSED);
- seriesItem.setBarWidth(0);
- statueSeries.addSeriesItem(seriesItem);
- statueSeries.getSeriesItemList().get(nStatusLastIndex)
- .setTooltipText(FilePageLabels.FILE_CHART_TOOLTIP_CLOSED);
- }
- }
-
- private void setNotClosedFileStatus() {
- int nStatusLastIndex = statueSeries.getSeriesItemList().size() - 1;
- if (nStatusLastIndex > -1) {
- statueSeries.getSeriesItemList().get(nStatusLastIndex)
- .setColor(ColorResources.FILE_AREA_NOT_ACCESS_END);
- statueSeries
- .getSeriesItemList()
- .get(nStatusLastIndex)
- .setGradationForegroundColor(
- ColorResources.FILE_AREA_NOT_ACCESS_START);
- statueSeries.getSeriesItemList().get(nStatusLastIndex)
- .setTooltipText(FilePageLabels.FILE_CHART_TOOLTIP_OPEND);
- }
- }
-
- protected int createChartItem(FileChartDataEvent 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.FILE_API_FAILED, event.getTooltipContent());
- apiSeries.addSeriesItem(seriesItem);
- return apiType;
- }
- switch (apiType) {
- case LogCenterConstants.FD_API_TYPE_OPEN:
- seriesItem = new DAChartSeriesItem(event.getApiChartTime(),
- DAChartSeriesItem.SERIES_STATE_BAR,
- ColorResources.FILE_API_USED, event.getTooltipContent());
- break;
- case LogCenterConstants.FD_API_TYPE_CLOSE:
- seriesItem = new DAChartSeriesItem(event.getApiChartTime(),
- DAChartSeriesItem.SERIES_STATE_BAR,
- ColorResources.FILE_API_USED, event.getTooltipContent());
- break;
- case LogCenterConstants.FD_API_TYPE_READ_START:
- seriesItem = new DAChartSeriesItem(event.getApiChartTime(),
- DAChartSeriesItem.SERIES_STATE_BAR,
- ColorResources.FILE_API_USED, event.getTooltipContent());
- accessItem = new DAChartSeriesItem(event.getApiChartTime(),
- event.getApiChartTime(), ColorResources.FILE_ACCESS_READ,
- event.getTooltipContent());
- break;
- case LogCenterConstants.FD_API_TYPE_READ_END:
- setAccessSeriesEnd(accessSeries.getSeriesItemList().size() - 1,
- event.getApiChartTime());
- break;
- case LogCenterConstants.FD_API_TYPE_WRITE_START:
- seriesItem = new DAChartSeriesItem(event.getApiChartTime(),
- DAChartSeriesItem.SERIES_STATE_BAR,
- ColorResources.FILE_API_USED, event.getTooltipContent());
- accessItem = new DAChartSeriesItem(event.getApiChartTime(),
- event.getApiChartTime(), ColorResources.FILE_ACCESS_WRITE,
- event.getTooltipContent());
- break;
- case LogCenterConstants.FD_API_TYPE_WRITE_END:
- setAccessSeriesEnd(accessSeries.getSeriesItemList().size() - 1,
- event.getApiChartTime());
- break;
-
- case LogCenterConstants.FD_API_TYPE_OTHERS:
- seriesItem = new DAChartSeriesItem(event.getApiChartTime(),
- DAChartSeriesItem.SERIES_STATE_BAR,
- ColorResources.FILE_API_USED, event.getTooltipContent());
- break;
- default:
- DA_LOG.debug("createChartItem : no case FileChartDataEvent");
- return -1;
- }
- if (seriesItem != null) {
- apiSeries.addSeriesItem(seriesItem);
- }
- if (accessItem != null) {
- accessSeries.addSeriesItem(accessItem);
- }
-
- return apiType;
- }
-
- public void setAccessSeriesEnd(int lastIndex, double endTime) {
- if (lastIndex < 0) {
- return;
- }
- accessSeries.getSeriesItemList().get(lastIndex).setY(endTime);
- }
-
- public void setFileOpendTime(double data) {
- this.fileOpendTime = data;
- }
-
- public double getFileOpendTime() {
- return this.fileOpendTime / TimelineConstants.MEGA_DOUBLE;
- }
-
- public void setFileClosedTime(double data) {
- fileClosedTime = data;
- }
-
- public double getFileClosedTime() {
- return this.fileClosedTime / TimelineConstants.MEGA_DOUBLE;
- }
-
- public void setFileLastUsedTime(double data) {
- fileLastUsedTime = data;
- }
-
- public double getFileLastUsedTime() {
- return this.fileLastUsedTime / TimelineConstants.MEGA_DOUBLE;
- }
-
- public void setFileUsedTime(double data) {
- if (this.fileOpendTime == 0) {
- this.setFileTotalUsedTime(0);
- } else {
- this.setFileTotalUsedTime(data - this.fileOpendTime);
- }
- setFileLastUsedTime(data);
- }
-
- private double parentTotalUsedTime() {
- List<String> totalUsedTimeList = new ArrayList<String>();
- boolean firstInputData = false;
- double fileTotalUsedTime = 0;
- FileChartData fileData;
- double firstUsedTime = 0;
- double lastUsedTime = 0;
- for (int i = 0; i < children.size(); i++) {
- fileData = children.get(i);
- firstUsedTime = fileData.getFileOpendTime()
- * TimelineConstants.MEGA_DOUBLE;
- lastUsedTime = fileData.getFileLastUsedTime()
- * TimelineConstants.MEGA_DOUBLE;
- if (lastUsedTime == 0) {
- continue;
- } else if (!fileData.isFileOpenFailed() && 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]);
- fileTotalUsedTime += (savedLastUsedTime - savedFirstUsedTime);
- }
- return fileTotalUsedTime;
- }
-
- public double getFileTotalUseTime() {
-
- if (isParent()) {
- double fistOpenTime = 1000000;
- FileChartData fileData;
- boolean isAllClosed = true;
- for (int i = 0; i < children.size(); i++) {
- fileData = children.get(i);
- if (fileData.getFileOpendTime() < fistOpenTime) {
- fistOpenTime = fileData.getFileOpendTime();
- }
- if (fileData.isClosed(null) != true) {
- if (isAllClosed) {
- isAllClosed = false;
- }
- }
- }
- if (isAllClosed) {
- return parentTotalUsedTime();
- } else {
- return ToolbarArea.getInstance().getTime() - fistOpenTime;
- }
- }
- if (isClosed(null) == true) {
- return this.fileLastUsedTime - this.fileOpendTime;
- } else {
- return ToolbarArea.getInstance().getTime() - this.fileOpendTime;
- }
- }
-
- public double getFileTotalUsedTime() {
- return fileTotalUsedTime;
- }
-
- public void setFileTotalUsedTime(double fileTotalUsedTime) {
- this.fileTotalUsedTime = fileTotalUsedTime;
- }
-
-}
\ 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.file;
-
-import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
-import org.tizen.dynamicanalyzer.swap.model.data.FileData;
-import org.tizen.dynamicanalyzer.ui.summary.failed.FailedData;
-import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
-
-public class FileChartDataEvent {
-
- private FileData contents;
- private FailedData failedData = null;
-
- private long fd = -1;
- private String filePath = AnalyzerLabels.EMPTY_STRING;
-
- private int apiType = -1;
- private double logTime = -1;
-
- private long fileSize = 0;
- private long readSize = 0;
- private long writeSize = 0;
-
- private boolean isFailedAPI = false;
-
- private String tooltip = null;
-
- public FileChartDataEvent(String filePath, long fd, long time,
- String tooltip, FileData contents) {
- setFilePath(filePath);
- setFd(fd);
- setLogTime(time);
- setContents(contents);
- setTooltipContent(tooltip);
- }
-
- public FileChartDataEvent(FileData contents) {
- setContents(contents);
- }
-
- public FileData getContents() {
- return contents;
- }
-
- public void setContents(FileData contents) {
- this.contents = contents;
- }
-
- public long getFd() {
- return fd;
- }
-
- public void setFd(long 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_DOUBLE;
- }
-
- public void setFilePath(String data) {
- this.filePath = data;
- }
-
- public String getFilePath() {
- return filePath;
- }
-
- public void setFileSize(long data) {
- this.fileSize = data;
- this.writeSize = data;
- }
-
- public long getFileSize() {
- return this.fileSize;
- }
-
- public void setReadSize(long data) {
- this.readSize = data;
- }
-
- public long getReadSize() {
- return this.readSize;
- }
-
- public void setWriteSize(long data) {
- this.writeSize = data;
- }
-
- public long getWriteSize() {
- return this.writeSize;
- }
-
- public void setFailedData(FailedData data) {
- failedData = data;
- }
-
- public FailedData getFailedData() {
- return failedData;
- }
-
- public String getTooltipContent() {
- return tooltip;
- }
-
- public void setTooltipContent(String tooltip) {
- this.tooltip = tooltip;
- }
-}
+++ /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.file;
-
-import java.util.List;
-
-import org.tizen.dynamicanalyzer.common.AnalyzerManager;
-import org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants;
-import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
-import org.tizen.dynamicanalyzer.swap.logparser.Logs;
-import org.tizen.dynamicanalyzer.swap.logparser.PageDataManager;
-import org.tizen.dynamicanalyzer.swap.model.data.LogData;
-import org.tizen.dynamicanalyzer.util.DALogger;
-
-public class FileChartManager extends PageDataManager {
- private static final DALogger DA_LOG = DALogger.getInstance();
-
- private FileDataMaker fileDataMaker = null;
- private static FileChartManager instance = null;
-
- private FileChartManager() {
- fileDataMaker = new FileDataMaker(AnalyzerManager.getFailedChecker(),
- AnalyzerManager.getLeakDetector(),
- AnalyzerManager.getWarningChecker());
- }
-
- public synchronized static FileChartManager getInstance() {
- if (null == instance) {
- instance = new FileChartManager();
- }
- return instance;
- }
-
- public FileDataMaker getFileDataMaker() {
- return fileDataMaker;
- }
-
- @Override
- public void run() {
- while (!AnalyzerManager.isExit()) {
- LogPackage pack = pollPack();
- if(pack == null) // end of thread
- break;
-
- Logs logs = pack.getLogs(DataChannelConstants.MSG_PROBE_FILE);
- if (null != logs && (logs.getRawLogs().size() != 0)) {
- List<LogData> inputs = logs.getLogs();
- getFileDataMaker().makeData(inputs);
- }
- }
-
- /* log for debug */
- DA_LOG.debug(getName() + " thread end!!"); //$NON-NLS-1$
- }
-
- public void clear() {
- instance = null;
- fileDataMaker.clear();
- }
-
- public int[] getParentChartIndex(int seq) {
- int parentChartIndex = -1;
- FileChartData chartData = null;
- List<FileChartData> fileChartDataLow = getFileDataMaker().getFileChartLow();
- for (int i = 0; i < fileChartDataLow.size(); i++) {
- chartData = fileChartDataLow.get(i);
- if (chartData.getChildCount() != 0) {
- parentChartIndex++;
- if (isEqualsSeq(chartData, seq)) {
- return new int[] { parentChartIndex, i };
- }
- }
- }
- return new int[] { 0, 0 };
- }
-
- public int getChildChartIndex(int parentChartIndex, int seq) {
- List<FileChartData> fileChartDataLow = getFileDataMaker().getFileChartLow();
- List<FileChartData> childData = fileChartDataLow.get(parentChartIndex)
- .getChild();
- FileChartData childChartData = null;
- for (int i = 0; i < childData.size(); i++) {
- childChartData = childData.get(i);
- if (isEqualsSeq(childChartData, seq)) {
- return i;
- }
- }
- return 0;
- }
-
- public boolean isEqualsSeq(FileChartData chartData, int seq) {
- for (int j = 0; j < chartData.getContents().size(); j++) {
- if (chartData.getContents().get(j).getContents()
- .getSeq() == seq) {
- return true;
- }
- }
- return false;
- }
-}
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact:
- * Hyunjong Park <phjwithyou.park@samsung.com>
- * yeongtaik byeon <yeongtaik.byeon@samsung.com>
+ * Hyeran kim <hyearn74.kim@samsung.com>
* Juyoung Kim <j0.kim@samsung.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
package org.tizen.dynamicanalyzer.ui.file;
+import java.util.List;
+
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StackLayout;
import org.eclipse.swt.events.PaintEvent;
import org.tizen.dynamicanalyzer.swap.model.data.LogData;
import org.tizen.dynamicanalyzer.ui.common.SetRangeMarkerMouseMoveListener;
import org.tizen.dynamicanalyzer.ui.common.UICommonConstants;
+import org.tizen.dynamicanalyzer.ui.file.FilePage;
+import org.tizen.dynamicanalyzer.ui.file.model.FileEvent;
+import org.tizen.dynamicanalyzer.ui.file.manager.FileDataManager;
import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
import org.tizen.dynamicanalyzer.ui.timeline.logparser.LifecycleLogParser;
public final static int FILE_CHART_HEIGHT = 40;
private final Composite contents;
- private DAChartBoard fileChart;
+ private FileChartBoard fileChartBoard;
private final StackLayout stackLayout;
+ private DAChartBoardItem lastSelectedItemForSummary = null;
private final RangeDataManager rangeDataManager = RangeDataManager
.getInstance();
+ private FileDataManager chartManager = FileDataManager.getInstance();
public FileChartView(Composite parent, int style) {
super(parent, style, false);
contents.setBackground(ColorResources.WINDOW_BG_COLOR);
stackLayout = new StackLayout();
contents.setLayout(stackLayout);
- fileChart = new DAChartBoard(contents, FilePageLabels.FILE_CHART_FILE);
- fileChart.setNameFont(FontResources.CHART_NAME_FONT);
- fileChart.addSelectionListener(new DAChartBoardSelectionListener() {
-
+ fileChartBoard = new FileChartBoard(contents, FilePageLabels.FILE_CHART_FILE);
+ fileChartBoard.setNameFont(FontResources.CHART_NAME_FONT);
+ fileChartBoard.addSelectionListener(new DAChartBoardSelectionListener() {
@Override
public void handleSelectionEvent(DAChartBoardItem item) {
+ lastSelectedItemForSummary = item;
AnalyzerManager
- .getCurrentPage()
- .updateView(
+ .getCurrentPage().updateView(
new DASelectionData(
FilePage.chartViewID,
- (long) (((DAChartPlotIntervalMarker) fileChart
+ (long) (((DAChartPlotIntervalMarker) fileChartBoard
.getMarkers()
.get(UICommonConstants.SELECTION_MARKER_INDEX))
.getStartVal() * TimelineConstants.MEGA_DOUBLE),
- (long) (((DAChartPlotIntervalMarker) fileChart
+ (long) (((DAChartPlotIntervalMarker) fileChartBoard
.getMarkers()
.get(UICommonConstants.SELECTION_MARKER_INDEX))
.getEndVal() * TimelineConstants.MEGA_DOUBLE),
}
});
- initIntervalMarkers(fileChart);
+ initIntervalMarkers(fileChartBoard);
- stackLayout.topControl = fileChart;
- Composite textBoxLabel = new Composite(fileChart.getTitleComp(),
+ stackLayout.topControl = fileChartBoard;
+
+ // draw title what page on the top of the file chart board
+ Composite textBoxLabel = new Composite(fileChartBoard.getTitleComp(),
SWT.NONE);
textBoxLabel.addPaintListener(new PaintListener() {
@Override
}
});
- DATimeline timeline = fileChart.getTimeline();
+ DATimeline timeline = fileChartBoard.getTimeline();
timeline.setTimeTickFont(FontResources.TIMELINE_TICK_FONT);
timeline.setTimeBalloonFont(FontResources.TIMELINE_BALLOON_FONT);
LifecycleLogParser.getInstance().registerLifecycleBar(
- fileChart.getLifecycleBar());
+ fileChartBoard.getLifecycleBar());
LifecycleLogParser.getInstance().registerTimeline(timeline);
timeline.addMouseMoveListener(new SetRangeMarkerMouseMoveListener(
- rangeDataManager, fileChart, timeline));
+ rangeDataManager, fileChartBoard, timeline));
}
@Override
public void updateView() {
- FileChartManager.getInstance().getFileDataMaker().checkUpdate();
- fileChart.setTotalEndTime(ToolbarArea.getInstance().getTime());
+ fileChartBoard.updateChart();
+
+ fileChartBoard.setTotalEndTime(ToolbarArea.getInstance().getTime());
- fileChart.setTimelineMarkerStartTime(rangeDataManager
+ fileChartBoard.setTimelineMarkerStartTime(rangeDataManager
.getMarkerStartTime() / TimelineConstants.MEGA_DOUBLE);
- fileChart.setTimelineMarkerEndTime(rangeDataManager.getMarkerEndTime()
+ fileChartBoard.setTimelineMarkerEndTime(rangeDataManager.getMarkerEndTime()
/ TimelineConstants.MEGA_DOUBLE);
if (RangeDataManager.getInstance().isBeingAnalyzed()) {
- ((DAChartPlotIntervalMarker) fileChart.getMarkers().get(
+ ((DAChartPlotIntervalMarker) fileChartBoard.getMarkers().get(
UICommonConstants.RANGE_ANALYSIS_MARKER_INDEX))
.setInterval(rangeDataManager.getAnalysisStartTime()
/ TimelineConstants.MEGA_DOUBLE,
rangeDataManager.getAnalysisEndTime()
/ TimelineConstants.MEGA_DOUBLE);
} else {
- ((DAChartPlotIntervalMarker) fileChart.getMarkers().get(
+ ((DAChartPlotIntervalMarker) fileChartBoard.getMarkers().get(
UICommonConstants.RANGE_ANALYSIS_MARKER_INDEX))
.setInterval(-1, -1);
}
- ((DAChartPlotIntervalMarker) fileChart.getMarkers().get(
+ ((DAChartPlotIntervalMarker) fileChartBoard.getMarkers().get(
UICommonConstants.RANGE_MARKER_INDEX)).setInterval(
rangeDataManager.getMarkerStartTime()
/ TimelineConstants.MEGA_DOUBLE,
@Override
public void updateView(DAViewData data) {
- if (!(data instanceof DASelectionData))
- return;
-
- DASelectionData selData = (DASelectionData) data;
-
- if(selData.isLogData()) {
- Object odata = selData.getData();
- if(!(odata instanceof LogData) || odata == null)
- return;
-
- LogData ldata = (LogData) odata;
- int seq = ldata.getSeq();
- int selectedIndex[] = FileChartManager.getInstance()
- .getParentChartIndex(seq);
- fileChart.selectItem(selectedIndex[0], FileChartManager.getInstance()
- .getChildChartIndex(selectedIndex[1], seq));
- } else {
- long start = selData.getStartTime();
- long end = selData.getEndTime();
-
- double startTime = (double) start / TimelineConstants.MEGA_DOUBLE;
- double endTime = (double) end / TimelineConstants.MEGA_DOUBLE;
- // double middleTime = (startTime + endTime) / 2.0;
- // if (start == end) {
- // middleTime = startTime;
- // }
-
- DAChartBoard chartBoard = (DAChartBoard) stackLayout.topControl;
+ fileChartBoard.updateChart();
+ if (data instanceof DASelectionData) {
+ DASelectionData selData = (DASelectionData) data;
+ long dataTime = -1;
+
+ if (selData.isLogData()) {
+ Object obData = selData.getData();
+ if (null != obData && (obData instanceof LogData)) { // summary
+ LogData ldata = (LogData) obData;
+ dataTime = ldata.getTime();
+ int seq = ldata.getSeq();
+ List<FileEvent> event = chartManager.getApiDB().selectFileEventBySeq(seq);
+ if(event != null) {
+ int selectedIndex[] = fileChartBoard.getChartIndex(event.get(0));
+ fileChartBoard.selectItem(selectedIndex[0], selectedIndex[1]);
+ if (null != lastSelectedItemForSummary) {
+ AnalyzerManager.getCurrentPage().updateView(
+ new DASelectionData(FilePage.chartViewID,
+ dataTime, dataTime,
+ lastSelectedItemForSummary.getData(),
+ null));
+ }
+ } // else, no need to update
+ }
+ } else {
+ dataTime = selData.getStartTime();
+ }
+ double startTime = dataTime / TimelineConstants.MEGA_DOUBLE;
+ double endTime = selData.getEndTime() / TimelineConstants.MEGA_DOUBLE;
- // chartBoard.setVisibleMiddleTime(middleTime);
- DAChartPlotIntervalMarker intervalMarker = (DAChartPlotIntervalMarker) chartBoard
+ DAChartPlotIntervalMarker intervalMarker = (DAChartPlotIntervalMarker)fileChartBoard
.getMarkers().get(UICommonConstants.SELECTION_MARKER_INDEX);
intervalMarker.setInterval(startTime, endTime);
+
}
}
@Override
public void clear() {
- fileChart.clear();
- initIntervalMarkers(fileChart);
- FileChartManager.getInstance().getFileDataMaker().clear();
- FileChartManager.getInstance().getFileDataMaker().setBoard(fileChart);
+ fileChartBoard.clear();
+ initIntervalMarkers(fileChartBoard);
+ chartManager.getFileChartDataMaker().clear();
}
@Override
public Control getControl() {
- return fileChart;
+ return fileChartBoard;
}
private void initIntervalMarkers(DAChartBoard board) {
}
public void setRangeMarker(double starttime, double endtime) {
- fileChart.setTimelineMarkerStartTime(starttime);
- fileChart.setTimelineMarkerEndTime(endtime);
+ fileChartBoard.setTimelineMarkerStartTime(starttime);
+ fileChartBoard.setTimelineMarkerEndTime(endtime);
- ((DAChartPlotIntervalMarker) fileChart.getMarkers().get(
+ ((DAChartPlotIntervalMarker) fileChartBoard.getMarkers().get(
UICommonConstants.RANGE_MARKER_INDEX)).setInterval(
starttime, endtime);
}
+++ /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.file;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-import org.tizen.dynamicanalyzer.common.AnalyzerManager;
-import org.tizen.dynamicanalyzer.constant.CommonConstants;
-import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
-import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
-import org.tizen.dynamicanalyzer.nl.ConfigureLabels;
-import org.tizen.dynamicanalyzer.nl.FilePageLabels;
-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.data.FileData;
-import org.tizen.dynamicanalyzer.swap.model.data.LogData;
-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.common.TimelineChartMouseEventListener;
-import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseTrackAdapter;
-import org.tizen.dynamicanalyzer.ui.summary.failed.FailedChecker;
-import org.tizen.dynamicanalyzer.ui.summary.failed.FailedData;
-import org.tizen.dynamicanalyzer.ui.summary.leaks.LeakDetector;
-import org.tizen.dynamicanalyzer.ui.summary.warning.WarningCase;
-import org.tizen.dynamicanalyzer.ui.summary.warning.WarningChecker;
-import org.tizen.dynamicanalyzer.ui.summary.warning.WarningData;
-import org.tizen.dynamicanalyzer.ui.timeline.chart.FileChart;
-import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
-import org.tizen.dynamicanalyzer.ui.toolbar.configuration.ConfigurationDialogDataManager;
-import org.tizen.dynamicanalyzer.util.DALogger;
-import org.tizen.dynamicanalyzer.widgets.chart.DAChart;
-import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot;
-import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot.AutoRangeType;
-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 FileDataMaker {
- private static final DALogger DA_LOG = DALogger.getInstance();
-
- private DAChartBoard board;
- private List<FileChartData> rows = new ArrayList<FileChartData>();
- private List<FileChartDataEvent> fileEventQueue = new ArrayList<FileChartDataEvent>();
- private List<FileChartDataEvent> fileEventWarningQueue = new ArrayList<FileChartDataEvent>();
- private HashMap<Long, String> findPathHashMap = new HashMap<Long, String>();
- private int timeLineFileChartFDCount = 0;
- private FailedChecker failedChecker = null;
- private WarningChecker warningChecker = null;
- private int preSelectionPId = -1;
-
- public FileDataMaker(FailedChecker failedChecker,
- LeakDetector leakDetector, WarningChecker warningChecker) {
- this.failedChecker = failedChecker;
- this.warningChecker = warningChecker;
- }
-
- public void setBoard(DAChartBoard board) {
- this.board = board;
- }
-
- public void clear() {
- rows.clear();
- fileEventQueue.clear();
- fileEventWarningQueue.clear();
- findPathHashMap.clear();
- timeLineFileChartFDCount = 0;
- }
-
- public List<FileChartData> getFileChartLow() {
- return rows;
- }
-
- private boolean isOpenMainLog(FileData input) {
- String filePath = input.getFilePath();
- if (filePath.contains(CommonConstants.SLASH)) {
- String[] splitApiFilePath = filePath.split(CommonConstants.SLASH);
- String strApiFilePath = new String(
- splitApiFilePath[splitApiFilePath.length - 1].trim());
- if (AnalyzerManager.getProject().getPkgId().equals(strApiFilePath)) {
- return true;
- }
- }
- return false;
- }
-
- private boolean isPrintLog(FileData input) {
- String apiName = input.getApiName();
- if (apiName.contains("print")) {//$NON-NLS-1$
- return true;
- }
- return false;
- }
-
- public void makeData(List<LogData> inputs) {
- int size = inputs.size();
- for (int i = 0; i < size; i++) {
- FileData input = (FileData) inputs.get(i);
-
- if (ConfigurationDialogDataManager.getInstance()
- .getfeatureValue(
- ConfigureLabels.INCLUDE_INSIDE_CALL_FILE) == 0) {
- if (input.isInternal()) {
- continue;
- }
- }
-
- if (isPrintLog(input)) {
- continue;
- }
-
- if (isOpenMainLog(input)) {
- continue;
- }
-
- int fdApiType = input.getFdApiType();
- String path = input.getFilePath();
- long fd = input.getFdValue();
-
- long errno = input.getErrno();
-
- String name = input.getApiName();
- long time = input.getTime();
-
- if (fdApiType != LogCenterConstants.FD_API_TYPE_OPEN) {
- path = AnalyzerLabels.EMPTY_STRING;
- }
- FileChartDataEvent event = new FileChartDataEvent(path, fd, time,
- name, input);
-
- // error check
- if (errno != 0) {
- FailedData ffd = new FailedData(input);
- event.setFailedData(ffd);
- this.failedChecker.getFailedList().add(ffd);
- event.setFailedAPI();
- } else if (name.equals("fdopen")) { //$NON-NLS-1$
- DA_LOG.debug("fdopen");
- continue;
- }
-
- if (fdApiType == LogCenterConstants.FD_API_TYPE_OPEN) {
- event.setApiType(LogCenterConstants.FD_API_TYPE_OPEN);
- checkDuplicateOpen(event);
- if (errno == 0) {
- timeLineFileChartFDCount++;
- FileChart.getInstance().setFDCount(1, time);
- }
- } else if (fdApiType == LogCenterConstants.FD_API_TYPE_CLOSE) {
- event.setApiType(LogCenterConstants.FD_API_TYPE_CLOSE);
- if (errno == 0) {
- timeLineFileChartFDCount--;
- if (timeLineFileChartFDCount >= 0) {
- FileChart.getInstance().setFDCount(-1, time);
- } else {
- timeLineFileChartFDCount = 0;
- }
- }
- } else if (fdApiType == LogCenterConstants.FD_API_TYPE_READ_END
- || fdApiType == LogCenterConstants.FD_API_TYPE_WRITE_END) {
- long fileSize = input.getFileSize();
- if (fileSize < 0) {
- fileSize = 0;
- }
- if (fdApiType == LogCenterConstants.FD_API_TYPE_READ_END) {
- event.setReadSize(fileSize);
- event.setApiType(LogCenterConstants.FD_API_TYPE_READ_END);
- FileChart.getInstance().setReadByte((int) fileSize, time);
- } else if (fdApiType == LogCenterConstants.FD_API_TYPE_WRITE_END) {
- event.setFileSize(fileSize);
- event.setWriteSize(fileSize);
- event.setApiType(LogCenterConstants.FD_API_TYPE_WRITE_END);
- FileChart.getInstance().setWriteByte((int) fileSize, time);
- }
- }
- event.setApiType(fdApiType);
- fileEventQueue.add(event);
- fileEventWarningQueue.add(event);
- if (fdApiType == LogCenterConstants.FD_API_TYPE_CLOSE) {
- checkWithoutUsing(event);
- }
- }
- }
-
- private void checkDuplicateOpen(FileChartDataEvent data) {
- if (data.isFailedAPI()) {
- return;
- }
- for (int i = 0; i < fileEventWarningQueue.size(); i++) {
- FileChartDataEvent event = fileEventWarningQueue.get(i);
- if ((event.getFilePath().equals(data.getFilePath()))
- && (event.getApiType() == LogCenterConstants.FD_API_TYPE_OPEN)) {
- if (!warningChecker.isChecked(data.getFilePath(),
- WarningCase.DUPLICATE_OPEN.getType())) {
- WarningData wData = new WarningData(
- WarningCase.DUPLICATE_OPEN.getType(),
- data.getContents(), data.getFilePath());
- warningChecker.getWarningData().add(wData);
- }
- }
- }
- }
-
- private void checkWithoutUsing(FileChartDataEvent data) {
- int nAPICount = 0;
- for (int i = 0; i < fileEventWarningQueue.size(); i++) {
- FileChartDataEvent event = fileEventWarningQueue.get(i);
- if ((event.getFd() == data.getFd())) {
- nAPICount++;
- if (event.getApiType() == LogCenterConstants.FD_API_TYPE_OPEN) {
- data.setFilePath(event.getFilePath());
- }
- fileEventWarningQueue.remove(i--);
- }
- }
-
- if ((nAPICount < 3)
- && (data.getFilePath().equals(AnalyzerLabels.EMPTY_STRING) == false)) { // open-close
- if (!warningChecker.isChecked(data.getFilePath(),
- WarningCase.WITHOUT_USING.getType())) {
- WarningData wData = new WarningData(
- WarningCase.WITHOUT_USING.getType(),
- data.getContents(), data.getFilePath());
- warningChecker.getWarningData().add(wData);
- }
- }
- }
-
- private void initFileChart(DAChart chart, boolean isParent) {
- if (null == chart) {
- return;
- }
-
- DAChartSeries apiSeries = new DAChartSeries(
- FilePageLabels.FILE_CHART_API,
- DAChartSeries.SERIES_STYLE_EVENT, ColorResources.YELLOW);
-
- DAChartSeries stateSeries = new DAChartSeries(
- FilePageLabels.FILE_CHART_SERIES,
- DAChartSeries.SERIES_STYLE_STATE, ColorResources.WHITE);
-
- DAChartSeries accessSeries = new DAChartSeries(
- FilePageLabels.FILE_CHART_ACCESS,
- DAChartSeries.SERIES_STYLE_EVENT_AREA, ColorResources.WHITE);
-
- apiSeries.setSummarizeTooltipText(ThreadPageLabels.THREAD_TOOLTIP_APIS);
-
- chart.addSeries(stateSeries);
- chart.addSeries(apiSeries);
- chart.addSeries(accessSeries);
-
- 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);
-
- 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()));
- plot.setMarkers(board.getMarkers());
- }
-
- private boolean createFileBoardItem(FileChartData parent,
- FileChartData sync, FileChartDataEvent event) {
- DAChartBoardItem item;
- DAChart chart;
- if (null == parent) {
- String fileName = sync.getFileName();
- if (sync.getFileName().length() > 12) {
- fileName = sync.getFileName().substring(0, 12);
- fileName += CommonConstants.NEW_LINE
- + sync.getFileName().substring(12,
- sync.getFileName().length());
- }
- item = new DAChartBoardItem(board, fileName);
- chart = item.getChart();
- initFileChart(chart, true);
- } else {
- DAChartBoardItem parentItem = parent.getItem();
- if (sync.getFD() > 0x10000000) {
- item = new DAChartBoardItem(parentItem, "0x"//$NON-NLS-1$
- + Long.toHexString(sync.getFD()));
- } else {
- item = new DAChartBoardItem(parentItem, Long.toString(sync
- .getFD()));
- }
-
- chart = item.getChart();
- initFileChart(chart, false);
- }
-
- sync.setItem(item);
- item.setData(sync);
- chart.setData(sync);
- chart.redraw();
- return true;
- }
-
- private FileChartData findParent(String filePath, long fd) {
- filePath = findPathHashMap.get(fd);
- int size = rows.size();
- FileChartData returnData = null;
- for (int i = 0; i < size; i++) {
- returnData = rows.get(i);
- if (returnData.getFilePath().equals(filePath) == true) {
- return returnData;
- } else if ((returnData.getFilePath()
- .equals(FilePageLabels.FILE_CHART_UNKNOWN_FILE))
- && (filePath == null)) {
- return returnData;
- }
- }
- return null;
- }
-
- private void chartFilteringByPId() {
- if (null == board || null == board.getItemList()) {
- return;
- }
- int selectedPid = ToolbarArea.getInstance().getSelectedPid();
- boolean isCheck = false;
-
- if (fileEventQueue.size() > 0) {
- isCheck = true;
- }
-
- if (preSelectionPId != -1 && preSelectionPId != selectedPid) {
- isCheck = true;
- }
-
- if (isCheck) {
- int parentSize = board.getItemList().getItemSize();
- for (int i = 0; i < parentSize; i++) {
- DAChartBoardItem parentItem = board.getItemList().get(i);
- int childSize = parentItem.getChildItemList().getItemSize();
- int hidedCount = 0;
- for (int j = 0; j < childSize; j++) {
- DAChartBoardItem childItem = parentItem.getChildItemList()
- .get(j);
- int itemPid = getItemPid(childItem);
- if (itemPid == selectedPid) {
- parentItem.getChildItemList().showItem(j);
- board.showItem(i);
- } else if (selectedPid == 0) {
- parentItem.getChildItemList().showItem(j);
- board.showItem(i);
- } else if (itemPid == -1) {
- board.showItem(i);
- } else {
- parentItem.getChildItemList().hideItem(j);
- hidedCount++;
- }
- }
- if (childSize == 0) {
- int itemPid = getItemPid(parentItem);
- if (itemPid == selectedPid) {
- board.showItem(i);
- } else if (selectedPid == 0) {
- board.showItem(i);
- } else if (itemPid == -1) {
- board.showItem(i);
- } else {
- board.hideItem(i);
- hidedCount++;
- }
- } else {
- if (childSize == hidedCount) {
- board.hideItem(i);
- }
- }
- }
- }
- preSelectionPId = selectedPid;
- }
-
- private int getItemPid(DAChartBoardItem item) {
- int pid = -1;
- if (item.getData() instanceof FileChartData) {
- FileChartData chartData = (FileChartData) item.getData();
- if (chartData.getContents().size() > 0) {
- pid = chartData.getContents().get(0).getContents().getPid();
- }
- }
- return pid;
- }
-
- public void checkUpdate() {
- if (!AnalyzerManager.isRunning()) {
- int size = rows.size();
- FileChartData data;
- for (int i = 0; i < size; i++) {
- data = rows.get(i);
- data.checkUpdate();
- }
- }
- chartFilteringByPId();
- int size = fileEventQueue.size();
- if (size > 0) {
- FileChartData parentChart;
- FileChartData childChart;
- FileChartDataEvent event;
- for (int i = 0; i < size; i++) {
- event = fileEventQueue.get(0);
- int apiType = event.getApiType();
- String filePath = AnalyzerLabels.EMPTY_STRING;
- if (event.getFilePath().trim()
- .equals(AnalyzerLabels.EMPTY_STRING)) {
- filePath = FilePageLabels.FILE_CHART_UNKNOWN_FILE;
- } else {
- filePath = event.getFilePath();
- }
- if (apiType == LogCenterConstants.FD_API_TYPE_OPEN) {
- findPathHashMap.put(event.getFd(), filePath);
- }
- parentChart = findParent(event.getFilePath(), event.getFd());
- if (null == parentChart) {
- findPathHashMap.put(event.getFd(), filePath);
- parentChart = new FileChartData(filePath, event.getFd(),
- true);
- childChart = new FileChartData(filePath, event.getFd(),
- false);
- if (!event.isFailedAPI()) {
- parentChart.setClosed(false);
- childChart.setClosed(false);
- }
-
- if (event.isFailedAPI()) {
- childChart.setFileOpenFailed(true);
- parentChart.setFileOpenFailed(true);
- } else if (filePath
- .equals(FilePageLabels.FILE_CHART_UNKNOWN_FILE)) {
- childChart.setFileOpenFailed(true);
- parentChart.setFileOpenFailed(true);
- } else {
- childChart.setFileOpenFailed(false);
- parentChart.setFileOpenFailed(false);
- }
-
- parentChart.pushChild(childChart);
- createFileBoardItem(null, parentChart, event);
- createFileBoardItem(parentChart, childChart, event);
- if (!event.isFailedAPI()) {
- parentChart.setFileOpendTime((long) event.getLogTime());
- childChart.setFileOpendTime((long) event.getLogTime());
- } else {
- childChart.setFileOpenFailed(true);
- parentChart.setFileOpenFailed(true);
- }
- parentChart.pushEvent(event);
- childChart.pushEvent(event);
- rows.add(parentChart);
- rows.add(childChart);
- } else if (null != parentChart) {
- childChart = parentChart.findChildData(event);
- if (null == childChart) {
- childChart = new FileChartData(filePath, event.getFd(),
- false);
- if (!event.isFailedAPI()) {
- childChart.setClosed(false);
- }
- if (event.isFailedAPI()) {
- childChart.setFileOpenFailed(true);
- parentChart.setFileOpenFailed(true);
- } else if (filePath
- .equals(FilePageLabels.FILE_CHART_UNKNOWN_FILE)) {
- childChart.setFileOpenFailed(true);
- parentChart.setFileOpenFailed(true);
- } else {
- childChart.setFileOpenFailed(false);
- parentChart.setFileOpenFailed(false);
- }
- rows.add(childChart);
- parentChart.pushChild(childChart);
- createFileBoardItem(parentChart, childChart, event);
- if (!event.isFailedAPI()) {
- childChart.setFileOpendTime((long) event
- .getLogTime());
- } else {
- childChart.setFileOpenFailed(true);
- }
- childChart.pushEvent(event);
- } else if (null != childChart) {
- if (apiType == LogCenterConstants.FD_API_TYPE_CLOSE) {
- if (!event.isFailedAPI()) {
- childChart.setClosed(true);
- childChart.setFileClosedTime((long) event
- .getLogTime());
- } else {
- childChart.setFileOpenFailed(true);
- }
-
- childChart.pushEvent(event);
- findPathHashMap.remove(event.getFd());
- } else {
- childChart.pushEvent(event);
- }
- }
- parentChart.pushEvent(event);
- parentChart.setFileUsedTime(event.getLogTime());
- childChart.setFileUsedTime(event.getLogTime());
- }
- fileEventQueue.remove(0);
- }
- }
- size = rows.size();
- if (size > 0) {
- FileChartData data;
- for (int i = 0; i < size; i++) {
- data = rows.get(i);
- data.checkUpdate();
- }
- }
- }
-}
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact:
- * Hyunjong Park <phjwithyou.park@samsung.com>
- * yeongtaik byeon <yeongtaik.byeon@samsung.com>
+ * Hyeran kim <hyearn74.kim@samsung.com>
* Juyoung Kim <j0.kim@samsung.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
package org.tizen.dynamicanalyzer.ui.file;
+import java.util.List;
+
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.tizen.dynamicanalyzer.nl.FilePageLabels;
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.resources.FontResources;
+import org.tizen.dynamicanalyzer.ui.file.FilePage;
+import org.tizen.dynamicanalyzer.ui.file.manager.FileDataManager;
+import org.tizen.dynamicanalyzer.ui.file.model.FileEvent;
+import org.tizen.dynamicanalyzer.ui.file.model.FileSelectedData;
import org.tizen.dynamicanalyzer.utils.Formatter;
import org.tizen.dynamicanalyzer.widgets.da.view.DAViewComposite;
import org.tizen.dynamicanalyzer.widgets.da.view.DAViewData;
private long writeSize = 0;
private long totalUseTime = 0;
private int apiCount = 0;
- private int failedApiCount = 0;
-
+ private int failedApiCount = 0;
+
+ private FileDataManager fileChartManager = FileDataManager.getInstance();
+
private void init() {
fileName = AnalyzerLabels.EMPTY_STRING;
filePath = AnalyzerLabels.EMPTY_STRING;
private void updateData() {
FileApiListView view = (FileApiListView) AnalyzerManager
.getCurrentPage().getView(FilePage.apilistViewID);
- FileChartData selectData = view.getPageData();
+ FileSelectedData selectData = view.getSelectedData();
if (null == selectData) {
return;
}
-
- fileName = selectData.getFileName();
- filePath = selectData.getFilePath();
- fileSize = selectData.getFileSize();
- readSize = selectData.getReadSize();
- writeSize = selectData.getWriteSize();
- totalUseTime = (long) selectData.getFileTotalUseTime();
- apiCount = selectData.getApiCount();
- failedApiCount = selectData.getFailedApiCount();
+ List<FileEvent> events = null;
+ events = fileChartManager.getApiDB()
+ .selectAPITable(selectData.getDentry(),
+ selectData.getPid(), selectData.getTid(), selectData.isParentChart());
+ if(events != null) {
+ filePath = events.get(0).getFilePath();
+ fileName = events.get(0).getFileName();
+ fileSize = events.get(0).getFileSize();
+ apiCount = events.size();
+ }
+ events = fileChartManager.getApiDB()
+ .selectFailedAPI(selectData.getDentry(),
+ selectData.getPid(), selectData.getTid(), selectData.isParentChart());
+ if(events != null) {
+ failedApiCount = events.size();
+ }
+ // TODO define What totalUseTime
+ // totalUseTime = (long) selectData.getFileTotalUseTime();
+ // readSize = selectData.getReadSize();
+ // writeSize = selectData.getWriteSize();
+
canvas.redraw();
}
import org.tizen.dynamicanalyzer.swap.logparser.DataManagerRegistry;
import org.tizen.dynamicanalyzer.ui.page.ScreenshotTabComposite;
import org.tizen.dynamicanalyzer.widgets.da.view.DAPageComposite;
+import org.tizen.dynamicanalyzer.ui.file.manager.FileDataManager;
public class FilePage extends DAPageComposite {
// page and view IDs
leftForm.setSashWidth(AnalyzerConstants.SASH_WIDTH);
rightForm.setSashWidth(AnalyzerConstants.SASH_WIDTH);
- DataManagerRegistry.registerPageDataManager(FileChartManager.getInstance());
+ DataManagerRegistry.registerPageDataManager(FileDataManager.getInstance());
}
@Override
+++ /dev/null
-/*
- * Dynamic Analyzer
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Hyeran Lim <hyeran74.kim@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.file.manager;
-
-
-import java.util.ArrayList;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Queue;
-import java.util.concurrent.ConcurrentLinkedQueue;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.tizen.dynamicanalyzer.common.AnalyzerManager;
-import org.tizen.dynamicanalyzer.common.path.PathManager;
-import org.tizen.dynamicanalyzer.constant.CommonConstants;
-import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
-import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
-import org.tizen.dynamicanalyzer.nl.ConfigureLabels;
-import org.tizen.dynamicanalyzer.resources.ImageResources;
-import org.tizen.dynamicanalyzer.swap.model.data.FileData;
-import org.tizen.dynamicanalyzer.swap.model.data.LogData;
-import org.tizen.dynamicanalyzer.ui.file.data.FileAccessDB;
-import org.tizen.dynamicanalyzer.ui.file.data.FileApiDB;
-import org.tizen.dynamicanalyzer.ui.file.data.FileStatusDB;
-import org.tizen.dynamicanalyzer.ui.file.model.FileAccess;
-import org.tizen.dynamicanalyzer.ui.file.model.FileEvent;
-import org.tizen.dynamicanalyzer.ui.file.model.FileStatus;
-import org.tizen.dynamicanalyzer.ui.network.data.NetworkDataManager;
-import org.tizen.dynamicanalyzer.ui.network.data.type.NetworkAPIType;
-import org.tizen.dynamicanalyzer.ui.network.data.type.NetworkSeriesType;
-import org.tizen.dynamicanalyzer.ui.summary.failed.FailedChecker;
-import org.tizen.dynamicanalyzer.ui.summary.failed.FailedData;
-import org.tizen.dynamicanalyzer.ui.summary.leaks.LeakDetector;
-import org.tizen.dynamicanalyzer.ui.summary.warning.WarningChecker;
-import org.tizen.dynamicanalyzer.ui.timeline.chart.FileChart;
-import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
-import org.tizen.dynamicanalyzer.ui.toolbar.configuration.ConfigurationDialogDataManager;
-import org.tizen.dynamicanalyzer.util.DALogger;
-import org.tizen.dynamicanalyzer.util.WorkbenchUtil;
-import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
-import org.tizen.dynamicanalyzer.widgets.da.base.DADialog;
-
-public class FileChartDataMaker {
- private static final DALogger DA_LOG = DALogger.getInstance();
-
- private FailedChecker failedChecker = null;
- private WarningChecker warningChecker = null;
- private int timeLineFileChartFDCount = 0;
-
- private List<FileStatus> fileStatusList = new ArrayList<FileStatus>();
- private List<FileAccess> fileAccessList = new ArrayList<FileAccess>();
- private Map<String, Long> fileAccessorMap = new HashMap<String, Long>();
-
- private Map<Long, Integer> fileReadingCount = new HashMap<Long, Integer>();
- private Map<Long, Integer> fileWritingCount = new HashMap<Long, Integer>();
- private Map<Long, Boolean> isFileLocking = new HashMap<Long, Boolean>();
-
- private Queue<List<FileEvent>> queue = new ConcurrentLinkedQueue<List<FileEvent>>();
-
- public FileChartDataMaker(FailedChecker failedChecker,
- LeakDetector leakDetector, WarningChecker warningChecker) {
- this.failedChecker = failedChecker;
- this.warningChecker = warningChecker;
- }
-
- public void clear(){
- fileStatusList.clear();
- fileAccessList.clear();
- fileAccessorMap.clear();
- fileReadingCount.clear();
- fileWritingCount.clear();
- isFileLocking.clear();
- }
-
- public void makeData(List<LogData> inputs) {
- if (!AnalyzerManager.isRunning()) {
- return;
- }
-
- List<FileEvent> fileEventQueue = new ArrayList<FileEvent>();
-
- FileChart timeLineFileChart = FileChart.getInstance();
- int size = inputs.size();
- FileEvent event = null;
- String key = null;
-
- ArrayList<List<Object>> fileApiList = new ArrayList<List<Object>>();
- for (int i = 0; i < size; i++) {
- FileData input = (FileData) inputs.get(i);
- if (ConfigurationDialogDataManager.getInstance()
- .getfeatureValue(
- ConfigureLabels.INCLUDE_INSIDE_CALL_FILE) == 0) {
- if (input.isInternal()) {
- continue;
- }
- }
- if (isPrintLog(input) || isOpenMainLog(input)) {
- continue;
- }
- int seqNum = input.getSeq();
- // TODO get dentry
- long dentry = 50000;
- int pid = input.getPid();
- int tid = input.getTid();
- String filePath = input.getFilePath();
- long fd = input.getFdValue();
- int apiType = input.getFdApiType();
- long eventTime = input.getTime(); ;
- String apiName = input.getApiName();
- long errNo = input.getErrno();
- long fileSize = input.getFileSize();
- String arg = input.getArgs();
- String returnVal = input.getReturn();
-
- DA_LOG.info("seqNum:" + seqNum);
- DA_LOG.info("apiName:" + apiName);
- DA_LOG.info("errNo:" + errNo);
-
- // check error
- if (errNo != 0) {
- FailedData failedData = new FailedData(input);
- this.failedChecker.getFailedList().add(failedData);
- } else if (apiName.equals("fdopen")) { //$NON-NLS-1$
- DA_LOG.debug("fdopen");
- continue;
- }
-
- event = new FileEvent(seqNum, dentry, filePath, pid, tid, fd,
- apiType, apiName, eventTime, fileSize, arg, returnVal, errNo, true);
- key = createKey(pid, tid);
-
- // check fileAccessList, fileStatusList, fileAccessorMap size
- checkHeapMemory();
-
- switch(apiType){
- case LogCenterConstants.FD_API_TYPE_OPEN:
- if (errNo == 0) {
- timeLineFileChartFDCount++;
- timeLineFileChart.setFDCount(1, eventTime);
- addFileAccessor(key, event.getDentry());
- addStatusData(new FileStatus(dentry, pid, tid, filePath, apiType, eventTime, errNo));
- }
- break;
- case LogCenterConstants.FD_API_TYPE_CLOSE:
- if (errNo == 0) {
- timeLineFileChartFDCount--;
- if (timeLineFileChartFDCount >= 0) {
- timeLineFileChart.setFDCount(-1, eventTime);
- } else {
- timeLineFileChartFDCount = 0;
- }
- addStatusData(new FileStatus(dentry, pid, tid, filePath, apiType, eventTime, errNo));
- }
- break;
- case LogCenterConstants.FD_API_TYPE_READ_START:
- FileAccess readAccess = new FileAccess(dentry, filePath, pid, tid, apiType, eventTime);
- addReadingCount(dentry, readAccess);
- addStartAccessData(readAccess);
- break;
- case LogCenterConstants.FD_API_TYPE_READ_END:
- timeLineFileChart.setReadByte((int) fileSize, eventTime);
- deleteReadingCount(dentry);
- addEndAccessData(dentry, pid, tid, filePath, eventTime, fileSize,
- LogCenterConstants.FD_API_TYPE_READ_START);
- break;
- case LogCenterConstants.FD_API_TYPE_WRITE_START:
- FileAccess writeAccess = new FileAccess(dentry, filePath, pid, tid, apiType, eventTime);
- addWritingCount(dentry, writeAccess);
- addStartAccessData(writeAccess);
- break;
- case LogCenterConstants.FD_API_TYPE_WRITE_END:
- timeLineFileChart.setWriteByte((int) fileSize, eventTime);
- deleteWritingCount(dentry);
- addEndAccessData(dentry, pid, tid, filePath, eventTime, fileSize,
- LogCenterConstants.FD_API_TYPE_WRITE_START);
- break;
- case LogCenterConstants.FD_API_TYPE_LOCK_START:
- isFileLocking.put(dentry, true);
- addStartAccessData(new FileAccess(dentry, filePath, pid, tid, apiType, eventTime));
- break;
- case LogCenterConstants.FD_API_TYPE_LOCK_END:
- isFileLocking.put(dentry, false);
- addEndAccessData(dentry, pid, tid, filePath, eventTime, fileSize,
- LogCenterConstants.FD_API_TYPE_WRITE_START);
- break;
- }
- fileEventQueue.add(event);
-
- }
- if(fileEventQueue.size() > 0) {
- queue.add(fileEventQueue);
- for(FileEvent data : fileEventQueue) {
- fileApiList.add(data.getDBData());
- }
- FileChartManager.getInstance().getApiDB().insert((List<List<Object>>)fileApiList);
- }
- }
-
- public void addStatusData(FileStatus data) {
- fileStatusList.add(data);
- FileChartManager.getInstance().getStatusDB().insert(data);
- }
-
- public void addStartAccessData(FileAccess data) {
- fileAccessList.add(data);
- }
-
- public void addEndAccessData(long dentry, int pid, int tid, String filePath,
- long endTime, long fileSize, int apiType) {
- for (int i = 0; i < fileAccessList.size(); i++) {
- FileAccess data = fileAccessList.get(i);
- if (data.getDentry() == dentry
- && data.getFilePath().equalsIgnoreCase(filePath)
- && data.getPid() == pid
- && data.getTid() == tid
- && data.getApiType() == apiType
- && data.getEndTime() <= 0){
- data.setEndTime(endTime);
- data.setFileSize(fileSize);
- FileChartManager.getInstance().getAccessDB().insert(data);
- break;
- }
- }
- }
-
- private String createKey(int pid, int tid) {
- StringBuffer key = new StringBuffer();
- key.append(pid);
- key.append(":");
- key.append(tid);
-
- return key.toString();
- }
-
- private void addFileAccessor(String key, long value) {
- if(fileAccessorMap.get(key) == null) {
- fileAccessorMap.put(key, value);
- }
- }
-
- private void addReadingCount(long key, FileAccess readAccess) {
- if(fileReadingCount.get(key) != null ) {
- if(fileReadingCount.get(key) > 0) {
- int count = fileReadingCount.get(key);
- fileReadingCount.put(key, count++);
- readAccess.setAlreadyReading(true);
- }
- } else {
- fileReadingCount.put(key, 1);
- }
- }
-
- private void deleteReadingCount(long key) {
- int count = fileReadingCount.get(key);
- if(count > 0) {
- fileReadingCount.put(key, count--);
- }
- }
-
- private void addWritingCount(long key, FileAccess writeAccess) {
- if(fileWritingCount.get(key) != null ) {
- if(fileWritingCount.get(key) > 0) {
- int count = fileWritingCount.get(key);
- fileWritingCount.put(key, count++);
- }
- } else {
- fileWritingCount.put(key, 1);
- }
- }
-
- private void deleteWritingCount(long key) {
- int count = fileWritingCount.get(key);
- if(count > 0) {
- fileWritingCount.put(key, count--);
- }
- }
-
- public List<FileEvent> getFileEventList() {
- return queue.poll();
- }
-
- public List<FileAccess> getFileAccessList() {
- return fileAccessList;
- }
-
- public List<FileStatus> getFileStatusList() {
- return fileStatusList;
- }
-
- private void checkHeapMemory() {
- if ( (fileAccessList.size() > 10000
- || fileStatusList.size() > 100000)
- || fileAccessorMap.size() > 100000) {
- ToolbarArea.getInstance().stopTrace();
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- final Shell shell = WorkbenchUtil.getWorkbenchWindow()
- .getShell();
- DADialog dialog = new DADialog(shell, SWT.NONE, 550, 153);
- dialog.setIcon(ImageResources.DIALOG_WARNING_ICON);
- dialog.setMessage(AnalyzerLabels.HEAP_MEMORY_WARNING_PRE
- + PathManager.DA_INSTALL_PATH
- + AnalyzerLabels.HEAP_MEMORY_WARNING_POST);
- dialog.open();
- }
- });
- }
- }
-
- private boolean isPrintLog(FileData input) {
- String apiName = input.getApiName();
- if (apiName.contains("print")) {//$NON-NLS-1$
- return true;
- }
- return false;
- }
-
- private boolean isOpenMainLog(FileData input) {
- String filePath = input.getFilePath();
- if (filePath.contains(CommonConstants.SLASH)) {
- String[] splitApiFilePath = filePath.split(CommonConstants.SLASH);
- String strApiFilePath = new String(
- splitApiFilePath[splitApiFilePath.length - 1].trim());
- if (AnalyzerManager.getProject().getPkgId().equals(strApiFilePath)) {
- return true;
- }
- }
- return false;
- }
-
- public void setFileAccessList(List<FileAccess> fileAccessList) {
- this.fileAccessList = fileAccessList;
- }
-
- public void setFileStatusList(List<FileStatus> fileStatusList) {
- this.fileStatusList = fileStatusList;
- }
-
-}
+++ /dev/null
-/*
- * Dynamic Analyzer
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Hyeran Lim <hyeran74.kim@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.file.manager;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.tizen.dynamicanalyzer.common.AnalyzerManager;
-import org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants;
-import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
-import org.tizen.dynamicanalyzer.swap.logparser.Logs;
-import org.tizen.dynamicanalyzer.swap.logparser.PageDataManager;
-import org.tizen.dynamicanalyzer.swap.model.data.LogData;
-import org.tizen.dynamicanalyzer.swap.model.data.ProfileData;
-import org.tizen.dynamicanalyzer.ui.file.FileChartData;
-import org.tizen.dynamicanalyzer.ui.file.data.FileAccessDB;
-import org.tizen.dynamicanalyzer.ui.file.data.FileApiDB;
-import org.tizen.dynamicanalyzer.ui.file.data.FileStatusDB;
-import org.tizen.dynamicanalyzer.ui.file.manager.FileChartDataMaker;
-import org.tizen.dynamicanalyzer.ui.file.model.FileAccess;
-import org.tizen.dynamicanalyzer.ui.file.model.FileEvent;
-import org.tizen.dynamicanalyzer.ui.file.model.FileStatus;
-import org.tizen.dynamicanalyzer.ui.network.data.type.NetworkSeriesType;
-import org.tizen.dynamicanalyzer.util.DALogger;
-
-
-public class FileChartManager extends PageDataManager {
- private static final DALogger DA_LOG = DALogger.getInstance();
-
- private static FileChartManager instance = null;
- private static FileChartDataMaker dataMaker = null;
-
- private FileAccessDB accessDB = null;
- private FileApiDB apiDB = null;
- private FileStatusDB statusDB = null;
-
- private List<FileEvent> eventList = new ArrayList<FileEvent>();
- private List<FileEvent> selectedTableAPIList = new ArrayList<FileEvent>();
-
- private FileChartManager() {
- dataMaker = new FileChartDataMaker(
- AnalyzerManager.getFailedChecker(),
- AnalyzerManager.getLeakDetector(),
- AnalyzerManager.getWarningChecker());
-
- initDB();
- }
-
- public synchronized static FileChartManager getInstance() {
- if (null == instance) {
- instance = new FileChartManager();
- }
- return instance;
- }
-
- public void initDB() {
- accessDB = new FileAccessDB();
- addDBTable(accessDB);
- apiDB = new FileApiDB();
- addDBTable(apiDB);
- statusDB = new FileStatusDB();
- addDBTable(statusDB);
- }
-
- public void clear() {
- accessDB = null;
- apiDB = null;
- statusDB = null;
- eventList = new ArrayList<FileEvent>();
- selectedTableAPIList = new ArrayList<FileEvent>();
- }
-
- public FileAccessDB getAccessDB(){
- return accessDB;
- }
-
- public FileApiDB getApiDB() {
- return apiDB;
- }
-
- public FileStatusDB getStatusDB() {
- return statusDB;
- }
-
- /*** make network data thread ***/
- @Override
- public void run() {
- while (!AnalyzerManager.isExit()) {
- LogPackage pack = pollPack();
- if (pack == null) // stop thread
- break;
-
- // TODO Change to get data from syscalls message and probe message
- Logs logs = pack.getLogs(DataChannelConstants.MSG_PROBE_FILE);
- if (null != logs && logs.getRawLogs().size() != 0) {
- List<LogData> inputs = logs.getLogs();
- dataMaker.makeData(inputs);
- }
-
- }
- DA_LOG.info(getName() + " thread end!!");
- }
-
- public void openProcess() {
- // TODO
- }
-
- @Override
- protected void onThreadStop() {
- // TODO
- }
-
- public FileChartDataMaker getFileChartDataMaker() {
- return dataMaker;
- }
-
- public void addFileEventQueue(FileEvent data){
- eventList.add(data);
- }
-
- public List<FileEvent> getFileEventQueue() {
- return eventList;
- }
-
- public List<FileEvent> getSelectedTableAPIList() {
- return selectedTableAPIList;
- }
-
- public void setSelectedTableAPIList(
- List<FileEvent> selectedTableAPIList) {
- this.selectedTableAPIList = selectedTableAPIList;
- }
-
-}
--- /dev/null
+package org.tizen.dynamicanalyzer.ui.file.manager;
+
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Hyeran Lim <hyeran74.kim@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
+ *
+ */
+
+
+import java.util.ArrayList;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Queue;
+import java.util.concurrent.ConcurrentLinkedQueue;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.tizen.dynamicanalyzer.common.AnalyzerManager;
+import org.tizen.dynamicanalyzer.common.DALimit;
+import org.tizen.dynamicanalyzer.common.path.PathManager;
+import org.tizen.dynamicanalyzer.constant.CommonConstants;
+import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
+import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
+import org.tizen.dynamicanalyzer.nl.ConfigureLabels;
+import org.tizen.dynamicanalyzer.resources.ImageResources;
+import org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants;
+import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
+import org.tizen.dynamicanalyzer.swap.logparser.Logs;
+import org.tizen.dynamicanalyzer.swap.model.data.FileData;
+import org.tizen.dynamicanalyzer.swap.model.data.LogData;
+import org.tizen.dynamicanalyzer.ui.file.model.FileAccess;
+import org.tizen.dynamicanalyzer.ui.file.model.FileEvent;
+import org.tizen.dynamicanalyzer.ui.file.model.FileStatus;
+import org.tizen.dynamicanalyzer.ui.summary.failed.FailedChecker;
+import org.tizen.dynamicanalyzer.ui.summary.failed.FailedData;
+import org.tizen.dynamicanalyzer.ui.summary.leaks.LeakDetector;
+import org.tizen.dynamicanalyzer.ui.summary.warning.WarningChecker;
+import org.tizen.dynamicanalyzer.ui.timeline.chart.FileChart;
+import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
+import org.tizen.dynamicanalyzer.ui.toolbar.configuration.ConfigurationDialogDataManager;
+import org.tizen.dynamicanalyzer.util.DALogger;
+import org.tizen.dynamicanalyzer.util.WorkbenchUtil;
+import org.tizen.dynamicanalyzer.widgets.da.base.DADialog;
+
+public class FileDataMaker {
+ private static final DALogger DA_LOG = DALogger.getInstance();
+
+ private FailedChecker failedChecker = null;
+ private int timeLineFileChartFDCount = 0;
+
+ private List<FileStatus> fileStatusList = new ArrayList<FileStatus>();
+ private List<FileAccess> fileAccessList = new ArrayList<FileAccess>();
+ private Map<String, String> fileAccessorMap = new HashMap<String, String>();
+
+ private Map<Long, Boolean> isFileLocking = new HashMap<Long, Boolean>();
+
+ private Queue<List<FileEvent>> fileLogsQueue = new ConcurrentLinkedQueue<List<FileEvent>>();
+ List<FileEvent> fileEventList = new ArrayList<FileEvent>();
+
+ public FileDataMaker(FailedChecker failedChecker,
+ LeakDetector leakDetector, WarningChecker warningChecker) {
+ this.failedChecker = failedChecker;
+ }
+
+ public void clear(){
+ fileStatusList.clear();
+ fileAccessList.clear();
+ fileAccessorMap.clear();
+ isFileLocking.clear();
+ timeLineFileChartFDCount = 0;
+ }
+
+ public void makeData(LogPackage pack) {
+ if (!AnalyzerManager.isRunning()) {
+ return;
+ }
+
+ List<FileEvent> eventList = new ArrayList<FileEvent>();
+
+ // 1. In case of target process that the user is interested to analyze
+ ArrayList<List<Object>> fileApiList = new ArrayList<List<Object>>();
+ Logs logs = pack.getLogs(DataChannelConstants.MSG_PROBE_FILE);
+
+ if (null == logs) {
+ return;
+ } else if(logs.getRawLogs().size() == 0) {
+ return;
+ } else {
+ List<LogData> inputs = logs.getLogs();
+ FileEvent event = null;
+ String key = null;
+
+ for (int i = 0; i < inputs.size(); i++) {
+ FileData input = (FileData) inputs.get(i);
+
+ // filtering out internal call
+ if (ConfigurationDialogDataManager.getInstance()
+ .getfeatureValue(
+ ConfigureLabels.INCLUDE_INSIDE_CALL_FILE) == 0) {
+ if (input.isInternal()) {
+ continue;
+ }
+ }
+ // filtering out print log and main func log
+ if (checkInvalidApiName(input) || isOpenMainLog(input)) {
+ continue;
+ }
+
+ int seqNum = input.getSeq();
+ // TODO change dentry to origin file path
+ long dentry = 50000;
+ int pid = input.getPid();
+ int tid = input.getTid();
+ String filePath = input.getFilePath();
+ long fd = input.getFdValue();
+ int apiType = input.getFdApiType();
+ long eventTime = input.getTime(); ;
+ String apiName = input.getApiName();
+ long errNo = input.getErrno();
+ long fileSize = input.getFileSize();
+ String arg = input.getArgs();
+ String returnVal = input.getReturn();
+
+ DA_LOG.info("apiName:" + apiName + ", apiType:" + apiType);
+
+ // check error
+ if (errNo != 0) {
+ switch (input.getFdApiType()) {
+ case LogCenterConstants.SOCKET_API_ACCEPT_END:
+ case LogCenterConstants.SOCKET_API_SEND_END:
+ case LogCenterConstants.SOCKET_API_RECV_END:
+ case LogCenterConstants.SOCKET_API_EVENT_END: {
+ FailedData ffd = new FailedData(input);
+ this.failedChecker.getFailedList().add(ffd);
+ }
+ }
+ }
+
+ event = new FileEvent(seqNum, dentry, filePath, pid, tid, fd,
+ apiType, apiName, eventTime, fileSize, arg, returnVal, errNo, true);
+
+ addFileEvent(eventList, event);
+
+ }
+ }
+
+ // 2. In case of non-target process that the user is not interested, but access the target files
+ //TODO filtering out non-target process from syscall messages
+ //TODO filtering out non-target file from syscall messages and addFileEvent
+
+ if(eventList.size() > 0) {
+ for(FileEvent data : eventList) {
+ fileApiList.add(data.getDBData());
+ }
+ fileLogsQueue.add(eventList);
+ FileDataManager.getInstance().getApiDB().insert((List<List<Object>>)fileApiList);
+ }
+ }
+
+ public void addFileEvent(List<FileEvent> list, FileEvent event) {
+ // check heap memory
+ checkHeapMemory();
+
+ // TODO change dentry to origin file path
+ long dentry = event.getDentry();
+ int pid = event.getPid();
+ int tid = event.getTid();
+ long fd = event.getFdValue();
+ String filePath = event.getFilePath();
+ int apiType = event.getFdApiType();
+ long eventTime = event.getTime();
+ long fileSize = event.getFileSize();
+ long errNo = event.getErrno();
+ boolean isTarget = event.isTarget();
+ String key = createKey(pid, tid, fd);
+
+ switch (apiType) {
+ case LogCenterConstants.FD_API_TYPE_OPEN:
+ // update FD count on timeLine chart
+ if (isTarget && errNo == 0) {
+ timeLineFileChartFDCount++;
+ FileChart.getInstance().setFDCount(1, eventTime);
+ }// else, in case of non-target process or failed api,
+ // no need to update FD count on timeLine chart
+
+ if(fileAccessorMap.get(key) == null) {
+ fileAccessorMap.put(key, event.getOriginFilePath());
+ }
+ addStatusData(new FileStatus(dentry, pid, tid, fd, filePath,
+ apiType, eventTime, errNo));
+ break;
+ case LogCenterConstants.FD_API_TYPE_CLOSE:
+ // update FD count on timeLine chart
+ if (isTarget && errNo == 0) {
+ timeLineFileChartFDCount--;
+ if (timeLineFileChartFDCount >= 0) {
+ FileChart.getInstance().setFDCount(-1, eventTime);
+ } else {
+ timeLineFileChartFDCount = 0;
+ }
+ }// else, no need to update FD count on timeLine chart
+ addStatusData(new FileStatus(dentry, pid, tid, fd, filePath,
+ apiType, eventTime, errNo));
+ break;
+ case LogCenterConstants.FD_API_TYPE_READ_START:
+ FileAccess readAccess = new FileAccess(dentry, filePath, pid,
+ tid, fd, apiType, eventTime);
+ addStartAccessData(readAccess);
+ break;
+ case LogCenterConstants.FD_API_TYPE_READ_END:
+ addEndAccessData(dentry, pid, tid, fd, filePath, eventTime,
+ fileSize, LogCenterConstants.FD_API_TYPE_READ_START);
+ break;
+ case LogCenterConstants.FD_API_TYPE_WRITE_START:
+ FileAccess writeAccess = new FileAccess(dentry, filePath, pid,
+ tid, fd, apiType, eventTime);
+ addStartAccessData(writeAccess);
+ break;
+ case LogCenterConstants.FD_API_TYPE_WRITE_END:
+ addEndAccessData(dentry, pid, tid, fd, filePath, eventTime,
+ fileSize, LogCenterConstants.FD_API_TYPE_WRITE_START);
+ break;
+ case LogCenterConstants.FD_API_TYPE_LOCK_START:
+ isFileLocking.put(dentry, true);
+ addStartAccessData(new FileAccess(dentry, filePath, pid, tid, fd,
+ apiType, eventTime));
+ break;
+ case LogCenterConstants.FD_API_TYPE_LOCK_END:
+ isFileLocking.put(dentry, false);
+ addEndAccessData(dentry, pid, tid, fd, filePath, eventTime,
+ fileSize, LogCenterConstants.FD_API_TYPE_LOCK_START);
+ break;
+ default:
+ break;
+ }
+ list.add(event);
+ }
+
+ public void addStatusData(FileStatus data) {
+ fileStatusList.add(data);
+ FileDataManager.getInstance().getStatusDB().insert(data);
+ }
+
+ public void addStartAccessData(FileAccess data) {
+ fileAccessList.add(data);
+ }
+
+ public void addEndAccessData(long dentry, int pid, int tid, long fd, String filePath,
+ long endTime, long fileSize, int apiType) {
+ for (int i = 0; i < fileAccessList.size(); i++) {
+ FileAccess data = fileAccessList.get(i);
+ if (data.getPid() == pid
+ && data.getTid() == tid
+ && data.getFd() == fd
+ && data.getApiType() == apiType
+ && data.getEndTime() <= 0){
+ data.setEndTime(endTime);
+ data.setFileSize(fileSize);
+ FileDataManager.getInstance().getAccessDB().insert(data);
+ break;
+ }
+ }
+ // when failed search start time, dump endEvent.
+ }
+
+ private String createKey(int pid, int tid, long fd) {
+ StringBuffer key = new StringBuffer(pid);
+ key.append(":");
+ key.append(tid);
+ key.append(":");
+ key.append(fd);
+ return key.toString();
+ }
+
+ public List<FileEvent> getFileEventList() {
+ return fileLogsQueue.poll();
+ }
+
+ public List<FileAccess> getFileAccessList() {
+ return fileAccessList;
+ }
+
+ public List<FileStatus> getFileStatusList() {
+ return fileStatusList;
+ }
+
+ private void checkHeapMemory() {
+ if ( (fileAccessList.size() > DALimit.MAX_FILE_ACCESS_COUNT
+ || fileStatusList.size() > DALimit.MAX_FILE_STATUS_COUNT)
+ || fileAccessorMap.size() > DALimit.MAX_FILE_ACCESSOR_COUNT) {
+ ToolbarArea.getInstance().stopTrace();
+ Display.getDefault().asyncExec(new Runnable() {
+ @Override
+ // display a dialog to alert heap memory warning
+ public void run() {
+ final Shell shell = WorkbenchUtil.getWorkbenchWindow()
+ .getShell();
+ DADialog dialog = new DADialog(shell, SWT.NONE, 550, 153);
+ dialog.setIcon(ImageResources.DIALOG_WARNING_ICON);
+ dialog.setMessage(AnalyzerLabels.HEAP_MEMORY_WARNING_PRE
+ + PathManager.DA_INSTALL_PATH
+ + AnalyzerLabels.HEAP_MEMORY_WARNING_POST);
+ dialog.open();
+ }
+ });
+ }
+ }
+
+
+ /**
+ * filtering out "print" and "fdopen" api name
+ * @param input
+ * @return
+ */
+ private boolean checkInvalidApiName(FileData input) {
+ String apiName = input.getApiName();
+ if (apiName.contains("print")
+ || apiName.contains("fdopen")) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * filtering out main function call when it's OSP api
+ * @param input
+ * @return
+ */
+ private boolean isOpenMainLog(FileData input) {
+ String filePath = input.getFilePath();
+ if (filePath.contains(CommonConstants.SLASH)) {
+ String[] splitApiFilePath = filePath.split(CommonConstants.SLASH);
+ String strApiFilePath = new String(
+ splitApiFilePath[splitApiFilePath.length - 1].trim());
+ if (AnalyzerManager.getProject().getPkgId().equals(strApiFilePath)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public void setFileAccessList(List<FileAccess> fileAccessList) {
+ this.fileAccessList = fileAccessList;
+ }
+
+ public void setFileStatusList(List<FileStatus> fileStatusList) {
+ this.fileStatusList = fileStatusList;
+ }
+
+}
--- /dev/null
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Hyeran Lim <hyeran74.kim@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.file.manager;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.PriorityQueue;
+import java.util.TreeSet;
+
+import org.tizen.dynamicanalyzer.common.AnalyzerManager;
+import org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants;
+import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
+import org.tizen.dynamicanalyzer.swap.logparser.Logs;
+import org.tizen.dynamicanalyzer.swap.logparser.PageDataManager;
+import org.tizen.dynamicanalyzer.swap.model.data.FileData;
+import org.tizen.dynamicanalyzer.swap.model.data.LogData;
+import org.tizen.dynamicanalyzer.swap.model.data.LogDataSeqNoComparator;
+import org.tizen.dynamicanalyzer.swap.model.data.LogDataTimeComparator;
+import org.tizen.dynamicanalyzer.swap.model.data.ProfileData;
+import org.tizen.dynamicanalyzer.ui.file.data.FileAccessDB;
+import org.tizen.dynamicanalyzer.ui.file.data.FileApiDB;
+import org.tizen.dynamicanalyzer.ui.file.data.FileStatusDB;
+import org.tizen.dynamicanalyzer.ui.file.model.FileEvent;
+
+
+public class FileDataManager extends PageDataManager {
+ private static FileDataManager instance = null;
+ private static FileDataMaker dataMaker = null;
+
+ private FileAccessDB accessDB = null;
+ private FileApiDB apiDB = null;
+ private FileStatusDB statusDB = null;
+
+ // TODO: comment or rename eventList
+ private List<FileEvent> eventList = new ArrayList<FileEvent>();
+ private List<FileEvent> selectedTableAPIList = new ArrayList<FileEvent>();
+
+ private FileDataManager() {
+ dataMaker = new FileDataMaker(
+ AnalyzerManager.getFailedChecker(),
+ AnalyzerManager.getLeakDetector(),
+ AnalyzerManager.getWarningChecker());
+
+ initDB();
+ }
+
+ public synchronized static FileDataManager getInstance() {
+ if (null == instance) {
+ instance = new FileDataManager();
+ }
+ return instance;
+ }
+
+ public void initDB() {
+ accessDB = new FileAccessDB();
+ addDBTable(accessDB);
+ apiDB = new FileApiDB();
+ addDBTable(apiDB);
+ statusDB = new FileStatusDB();
+ addDBTable(statusDB);
+ }
+
+ public void clear() {
+ accessDB = null;
+ apiDB = null;
+ statusDB = null;
+ eventList = new ArrayList<FileEvent>();
+ selectedTableAPIList = new ArrayList<FileEvent>();
+ }
+
+ public FileAccessDB getAccessDB(){
+ return accessDB;
+ }
+
+ public FileApiDB getApiDB() {
+ return apiDB;
+ }
+
+ public FileStatusDB getStatusDB() {
+ return statusDB;
+ }
+
+ public void openProcess() {
+ // TODO
+ }
+
+ @Override
+ protected void onThreadStop() {
+ // TODO
+ }
+
+ public FileDataMaker getFileChartDataMaker() {
+ return dataMaker;
+ }
+
+ public void addFileEventQueue(FileEvent data){
+ eventList.add(data);
+ }
+
+ public List<FileEvent> getFileEventQueue() {
+ return eventList;
+ }
+
+ public List<FileEvent> getSelectedTableAPIList() {
+ return selectedTableAPIList;
+ }
+
+ public void setSelectedTableAPIList(
+ List<FileEvent> selectedTableAPIList) {
+ this.selectedTableAPIList = selectedTableAPIList;
+ }
+
+ /**
+ * get syscalls message and probe message about file
+ * @param logPack
+ * @return
+ */
+ private List<LogData> getLogsFromLogPackage(LogPackage logPack) {
+ Logs probeLogs = logPack
+ .getLogs(DataChannelConstants.MSG_PROBE_FILE);
+ Logs functionEntryLogs = logPack
+ .getLogs(DataChannelConstants.MSG_FUNCTION_ENTRY);
+ Logs functionExitLogs = logPack
+ .getLogs(DataChannelConstants.MSG_FUNCTION_EXIT);
+
+
+
+ PriorityQueue<LogData> sysQueue = new PriorityQueue<LogData>(100000, new LogDataSeqNoComparator());
+ PriorityQueue<LogData> pQueue = new PriorityQueue<LogData>(100000,
+ new LogDataSeqNoComparator());
+
+ //List<LogData> remainProbeLogs = dataMaker.getRemainProbeLogs();
+ //List<LogData> remainSysLogs = dataMaker.getRemainSysLogs();
+
+ /* // probe message
+ if (probeLogs != null) {
+ List<LogData> probeLogList = probeLogs.getLogs();
+ Iterator<LogData> probeIterator = probeLogList.iterator();
+ while (probeIterator.hasNext()) {
+ pQueue.offer(probeIterator.next());
+ }
+ } else
+
+ if(remainProbeLogs != null) {
+ Iterator<LogData> iterator = remainProbeLogs.iterator();
+ while (iterator.hasNext()) {
+ pQueue.offer(iterator.next());
+ }
+ }
+
+ // function entry message
+ if (functionEntryLogs != null) {
+ List<LogData> functionEntryLogList = functionEntryLogs.getLogs();
+ Iterator<LogData> fEntryiterator = functionEntryLogList.iterator();
+ ProfileData fndata = null;
+ while (fEntryiterator.hasNext()) {
+ fndata = (ProfileData) fEntryiterator.next();
+ if (fndata.getProbeType() == 4) {
+ sysQueue.offer(fndata);
+ }
+ }
+ }
+ // function exit message
+ if (functionExitLogs != null) {
+ ProfileData fndata = null;
+ List<LogData> functionExitLogList = functionExitLogs.getLogs();
+ Iterator<LogData> fExitIterator = functionExitLogList.iterator();
+ while (fExitIterator.hasNext()) {
+ fndata = (ProfileData) fExitIterator.next();
+ if (fndata.getProbeType() == 4) {
+ sysQueue.offer(fndata);
+ }
+ }
+ }
+
+ if(remainSysLogs != null) {
+ Iterator<LogData> iterator = remainSysLogs.iterator();
+ while (iterator.hasNext()) {
+ sysQueue.offer(iterator.next());
+ }
+ }
+
+ List<LogData> fileProbeLogs = new ArrayList<LogData>();
+ do {
+ LogData probeTop = pQueue.poll();
+ if(probeTop !=null) {
+ fileProbeLogs.add(probeTop);
+ }else {
+ break;
+ }
+
+ } while (true);
+
+ // save syscall messages separated by pid in Map
+ Map<Integer, List<LogData>> sysLogsMap = new HashMap<Integer, List<LogData>>();
+ List<LogData> fileSysLogs = new ArrayList<LogData>();
+ do {
+ LogData sysTop = sysQueue.poll();
+ if(sysTop != null) {
+ int pid = sysTop.getPid();
+ if(sysLogsMap.get(pid) != null) {
+ fileSysLogs = sysLogsMap.get(pid);
+ fileSysLogs.add(sysTop);
+ } else {
+ fileSysLogs = new ArrayList<LogData>();
+ fileSysLogs.add(sysTop);
+ sysLogsMap.put(pid, fileSysLogs);
+ }
+ }else{
+ break;
+ }
+
+ } while (true);
+
+
+ dataMaker.addSysLogsMap(sysLogsMap);
+ return fileProbeLogs;*/
+
+
+
+
+ // probe message
+ ArrayList<LogData> fileLogs = new ArrayList<LogData>();
+
+ // probe message
+ if (probeLogs != null) {
+ List<LogData> probeLogList = probeLogs.getLogs();
+ Iterator<LogData> probeIterator = probeLogList.iterator();
+ while (probeIterator.hasNext()) {
+ pQueue.offer(probeIterator.next());
+ }
+ }
+
+ // function entry message
+ if (functionEntryLogs != null) {
+ List<LogData> functionEntryLogList = functionEntryLogs.getLogs();
+ Iterator<LogData> fEntryiterator = functionEntryLogList.iterator();
+ ProfileData fndata = null;
+ while (fEntryiterator.hasNext()) {
+ fndata = (ProfileData) fEntryiterator.next();
+ if (fndata.getProbeType() == 4) {
+ pQueue.offer(fndata);
+ }
+ }
+ }
+ // function exit message
+ if (functionExitLogs != null) {
+ ProfileData fndata = null;
+ List<LogData> functionExitLogList = functionExitLogs.getLogs();
+ Iterator<LogData> fExitIterator = functionExitLogList.iterator();
+ while (fExitIterator.hasNext()) {
+ fndata = (ProfileData) fExitIterator.next();
+ if (fndata.getProbeType() == 4) {
+ pQueue.offer(fndata);
+ }
+ }
+ }
+
+ do {
+ LogData top = pQueue.poll();
+ if (top == null)
+ break;
+
+ fileLogs.add(top);
+ } while (true);
+
+ return fileLogs;
+
+ }
+
+ /**
+ * make log data about file into chart data for drawing chart
+ */
+ @Override
+ protected void makeData(LogPackage pack) {
+ // TODO change when the issue with SRR is resolved
+ /*List<LogData> logs = getLogsFromLogPackage(pack);
+ if (!logs.isEmpty()) {
+ dataMaker.makeData(logs);
+ }*/
+ dataMaker.makeData(pack);
+ }
+
+
+}
private boolean isAlreadyWriting = false;
private boolean isAlreadyLocking = false;
- public FileAccess(long dentry, String filePath, int pid, int tid,
- int apiType, long startTime) {
+ public FileAccess(long dentry, String filePath, int pid, int tid, int apiType, long startTime) {
this.dentry = dentry;
this.filePath = filePath;
this.pid = pid;
this.apiType = apiType;
this.startTime = startTime;
}
-
- public FileAccess(long dentry, String filePath, int pid, int tid, long fd,
- int apiType, long startTime) {
+
+ public FileAccess(long dentry, String filePath, int pid, int tid, long fd, int apiType, long startTime) {
this.dentry = dentry;
this.filePath = filePath;
this.pid = pid;
import org.tizen.dynamicanalyzer.ui.file.data.FileApiDB;
import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
-// file log data
public class FileEvent extends FileData{
- private int seqNo = -1;
- private long dentry = -1;
- private String filePath = null;
- private int pid = -1;
- private int tid = -1;
- private long fd = -1;
- private int apiType = -1;
- private long eventTime = -1;
+ protected long dentry = -1;
+ private String originFilePath = null;
+ // TODO considering apiId
private String apiName = null;
- private long errNo = -1;
private long ioSize =-1;
- private long fileSize = -1;
- private String returnVal = null;
- private String args = null;
- private boolean target = true;
+ private boolean target = false;
- private long readSize = -1;
- private long writeSize = -1;
+ public FileEvent() { }
- public FileEvent(int seqNo, String filePath, int pid, int tid,
+ public FileEvent(int seq, long dentry, int pid, int tid, String filePath) {
+ this.seq = seq;
+ this.dentry = dentry;
+ this.pid = pid;
+ this.tid = tid;
+ this.filePath = filePath;
+ }
+
+
+ public FileEvent(int seq, long dentry, int pid, int tid, long fd, String filePath, String originFilePath) {
+ this.seq = seq;
+ this.dentry = dentry;
+ this.pid = pid;
+ this.tid = tid;
+ this.fdValue = fd;
+ this.filePath = filePath;
+ this.originFilePath = originFilePath;
+ }
+
+ // for non-target process
+ public FileEvent(int seq, long dentry, int pid, int tid, long fd, String originFilePath, int apiType, long eventTime) {
+ this.seq = seq;
+ this.dentry = dentry;
+ this.pid = pid;
+ this.tid = tid;
+ this.fdValue = fd;
+ this.originFilePath = originFilePath;
+ this.fdApiType = apiType;
+ this.time = eventTime;
+
+ }
+
+ public FileEvent(int seq, String filePath, int pid, int tid,
long fd, int apiType, long eventTime, long fileSize) {
+ this.seq = seq;
this.filePath = filePath;
this.pid = pid;
this.tid = tid;
- this.fd = fd;
- this.apiType = apiType;
- this.eventTime = eventTime;
+ this.fdValue = fd;
+ this.fdApiType = apiType;
+ this.time = eventTime;
this.fileSize = fileSize;
}
- public FileEvent(int seqNo, long dentry, String filePath, int pid, int tid,
+ public FileEvent(int seq, long dentry, String filePath, int pid, int tid,
long fd, int apiType, String apiName, long eventTime, long fileSize,
String args, String returnVal, long errNo, boolean target){
- this.seqNo = seqNo;
+ this.seq = seq;
this.dentry = dentry;
this.filePath = filePath;
this.pid = pid;
this.tid = tid;
- this.fd = fd;
- this.apiType = apiType;
+ this.fdValue = fd;
+ this.fdApiType = apiType;
this.apiName = apiName;
- this.eventTime = eventTime;
+ this.time = eventTime;
this.fileSize = fileSize;
this.args = args;
- this.returnVal = returnVal;
- this.errNo = errNo;
+ this.ret = returnVal;
+ this.errno = errNo;
this.target = target;
}
public FileEvent(List<Object> data) {
- this.seqNo = (Integer)data.get(FileApiDB.COLUMN.SEQ.getValue());
+ this.seq = (Integer)data.get(FileApiDB.COLUMN.SEQ.getValue());
this.dentry = (Long)data.get(FileApiDB.COLUMN.DENTRY.getValue());
this.filePath = (String)data.get(FileApiDB.COLUMN.FILE_PATH.getValue());
this.pid = (Integer)data.get(FileApiDB.COLUMN.PID.getValue());
this.tid = (Integer)data.get(FileApiDB.COLUMN.TID.getValue());
- this.fd = (Long)data.get(FileApiDB.COLUMN.FD.getValue());
- this.apiType = (Integer)data.get(FileApiDB.COLUMN.API_TYPE.getValue());
+ this.fdValue = (Long)data.get(FileApiDB.COLUMN.FD.getValue());
+ this.fdApiType = (Integer)data.get(FileApiDB.COLUMN.API_TYPE.getValue());
this.apiName = (String)data.get(FileApiDB.COLUMN.API_NAME.getValue());
- this.eventTime = (Long)data.get(FileApiDB.COLUMN.EVENT_TIME.getValue());
+ this.time = (Long)data.get(FileApiDB.COLUMN.EVENT_TIME.getValue());
this.fileSize = (Long)data.get(FileApiDB.COLUMN.FILE_SIZE.getValue());
- this.returnVal = (String)data.get(FileApiDB.COLUMN.RETURN_VALUE.getValue());
+ this.ret = (String)data.get(FileApiDB.COLUMN.RETURN_VALUE.getValue());
this.args = (String)data.get(FileApiDB.COLUMN.ARGS.getValue());
- this.errNo = (Long)data.get(FileApiDB.COLUMN.ERRNO.getValue());
+ this.errno = (Long)data.get(FileApiDB.COLUMN.ERRNO.getValue());
this.target = (Boolean)data.get(FileApiDB.COLUMN.TARGET.getValue());
}
public List<Object> getDBData() {
List<Object> data = new ArrayList<Object>();
- data.add(this.seqNo);
+ data.add(this.seq);
data.add(this.dentry);
data.add(this.filePath);
data.add(this.pid);
data.add(this.tid);
- data.add(this.fd);
- data.add(this.apiType);
- data.add(this.eventTime);
+ data.add(this.fdValue);
+ data.add(this.fdApiType);
+ data.add(this.time);
data.add(this.apiName);
- data.add(this.errNo);
+ data.add(this.errno);
data.add(this.ioSize);
data.add(this.fileSize);
- data.add(this.returnVal);
+ data.add(this.ret);
data.add(this.args);
data.add(this.target);
return data;
this.filePath = filePath;
}
+ public String getOriginFilePath() {
+ return originFilePath;
+ }
+
+ public void setOriginFilePath(String originFilePath) {
+ this.originFilePath = originFilePath;
+ }
+
+ public String getOriginFileName() {
+ String[] splitPath = originFilePath.split("\\/"); //$NON-NLS-1$
+ String fileName = new String(splitPath[splitPath.length - 1]);
+ return fileName;
+ }
+
public String getFileName() {
- String[] splitPath = this.filePath.split("\\/"); //$NON-NLS-1$
+ String[] splitPath = filePath.split("\\/"); //$NON-NLS-1$
String fileName = new String(splitPath[splitPath.length - 1]);
return fileName;
}
this.tid = tid;
}
- public long getFd() {
- return fd;
- }
-
- public void setFd(long fd) {
- this.fd = fd;
- }
-
- public int getApiType() {
- return apiType;
- }
-
- public void setApiType(int apiType) {
- this.apiType = apiType;
- }
-
- public long getEventTime() {
- return Math.round(eventTime);
- }
-
- public void setEventTime(long eventTime) {
- this.eventTime = eventTime;
- }
-
- public long getTime() {
- return Math.round(eventTime);
- }
-
- public void setTime(long eventTime) {
- this.eventTime = eventTime;
- }
-
- public long getErrNo() {
- return errNo;
- }
-
- public void setErrNo(long errNo) {
- this.errNo = errNo;
+ public int getSeq() {
+ return seq;
}
- public int getSeqNo() {
- return seqNo;
- }
-
- public void setSeqNo(int seqNo) {
- this.seqNo = seqNo;
+ public void setSeq(int seqNo) {
+ this.seq = seqNo;
}
public long getIoSize() {
this.fileSize = fileSize;
}
- public String getReturnVal() {
- return returnVal;
- }
-
- public void setReturnVal(String returnVal) {
- this.returnVal = returnVal;
- }
-
public String getArgs() {
return args;
}
this.args = args;
}
- public long getReadSize() {
- return readSize;
- }
-
- public void setReadSize(long readSize) {
- this.readSize = readSize;
- }
-
- public long getWriteSize() {
- return writeSize;
- }
-
- public void setWriteSize(long writeSize) {
- this.writeSize = writeSize;
- }
-
public String getApiName() {
return apiName;
}
package org.tizen.dynamicanalyzer.ui.file.model;
-import org.tizen.dynamicanalyzer.swap.model.data.FileData;
-
-public class FileSelectedData {
- private long dentry = -1;
- private int pid = -1;
- private int tid = -1;
+public class FileSelectedData extends FileEvent{
private boolean isParentChart = false;
- private String filePath = null;
- private long fileSize = 0;
- public FileSelectedData(long dentry, int pid, int tid, boolean isParentChart) {
+ public FileSelectedData(long dentry, int pid, int tid,long fd, boolean isParentChart) {
this.dentry = dentry;
this.pid = pid;
this.tid = tid;
+ this.fdValue = fd;
this.isParentChart = isParentChart;
}
- public FileSelectedData(long dentry, int pid, int tid,
+ public FileSelectedData(long dentry, int pid, int tid, long fd,
boolean isParentChart, String filePath, long fileSize) {
this.dentry = dentry;
this.pid = pid;
this.tid = tid;
+ this.fdValue = fd;
this.isParentChart = isParentChart;
this.filePath = filePath;
this.fileSize = fileSize;
public void getFileSize(long fileSize) {
this.fileSize = fileSize;
}
+
}
private long eventTime = -1;
private long errNo = 0;
- public FileStatus(long dentry, int pid, int tid, String filePath,
+ public FileStatus(long dentry, int pid, int tid, long fd, String filePath,
int apiType, long eventTime, long errNo) {
this.dentry = dentry;
this.filePath = filePath;
this.pid = pid;
this.tid = tid;
+ this.fd = fd;
this.apiType = apiType;
this.eventTime = eventTime;
this.errNo = errNo;
+++ /dev/null
-/*
- * Dynamic Analyzer
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Hyeran kim <hyearn74.kim@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.file.view;
-
-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.DASelectionData;
-import org.tizen.dynamicanalyzer.constant.CommonConstants;
-import org.tizen.dynamicanalyzer.error.ErrorCodeManager;
-import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
-import org.tizen.dynamicanalyzer.model.TableInput;
-import org.tizen.dynamicanalyzer.swap.model.data.FileData;
-import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
-import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
-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.ui.file.FilePage;
-import org.tizen.dynamicanalyzer.ui.file.manager.FileChartManager;
-import org.tizen.dynamicanalyzer.ui.file.model.FileEvent;
-
-public class FileApiListTable extends DAApiListTableComposite {
- public FileApiListTable(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(
- FilePage.apilistViewID, startTime, endTime, items,
- table);
- AnalyzerManager.getCurrentPage().updateView(selData);
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- });
- }
-
- @Override
- protected List<TableInput> makeTableInput() {
- FileApiListView view = (FileApiListView) AnalyzerManager
- .getCurrentPage().getView(FilePage.apilistViewID);
-
- long rangeStartTime = view.getRangeStartTime();
- long rangeEndTime = view.getRangeEndTime();
-
- HashMap<String, Integer> findStartAPITableIndexHashMap = new HashMap<String, Integer>();
- List<Integer> removeTableIndex = new ArrayList<Integer>();
- List<TableInput> input = new ArrayList<TableInput>();
-
- List<FileEvent> contents = FileChartManager.getInstance().getSelectedTableAPIList();
- if(contents == null) {
- return null;
- }
- for (int i = 0; i < contents.size(); i++) {
- FileEvent contentTemp = contents.get(i);
- int selectedPid = ToolbarArea.getInstance().getSelectedPid();
- if (selectedPid != 0) {
- if (selectedPid != contentTemp.getPid()) {
- continue;
- }
- }
- List<String> contentText = new ArrayList<String>();
- List<String> contentData = new ArrayList<String>();
-
- Integer startLogIndex = 0;
- int fdApiType = contentTemp.getApiType();
-
- int seq = contentTemp.getSeqNo();
- contentText.add(0, Integer.toString(seq));
- contentData.add(Integer.toString(seq));
- long time = contentTemp.getEventTime();
-
- boolean isExistStartTimeLog = false;
- if (fdApiType == LogCenterConstants.FD_API_TYPE_READ_START
- || fdApiType == LogCenterConstants.FD_API_TYPE_WRITE_START) {
- String keString = contentTemp.getApiName()
- + contentTemp.getPid() + contentTemp.getTid();
- findStartAPITableIndexHashMap.put(keString, i);
-
- } else if (fdApiType == LogCenterConstants.FD_API_TYPE_READ_END
- || fdApiType == LogCenterConstants.FD_API_TYPE_WRITE_END) {
- String keString = contentTemp.getApiName()
- + contentTemp.getPid() + contentTemp.getTid();
- startLogIndex = findStartAPITableIndexHashMap.get(keString);
- if (null != startLogIndex) {
- contentText.add(input.get(startLogIndex.intValue())
- .getText().get(1)); // start time
- contentData.add(input.get(startLogIndex.intValue())
- .getText().get(1));
-
- long startTime = contents.get(startLogIndex.intValue()).getEventTime();
- String timeFormat = Formatter
- .toTimeFormat(time - startTime);
- String removeTimeFormat = timeFormat.replace(
- "00:", CommonConstants.EMPTY);//$NON-NLS-1$
-
- contentText.add(removeTimeFormat); // elapsed time
- contentData.add(Long.toString(time - startTime));
-
- isExistStartTimeLog = true;
- removeTableIndex.add(startLogIndex.intValue());
- } else {
- contentText.add(Formatter.toTimeFormat(contentTemp
- .getEventTime())); // start//
- contentData.add(Long.toString(contentTemp.getEventTime()));
- contentText.add("00.000");//$NON-NLS-1$
- contentData.add("00.000");//$NON-NLS-1$
- }
- }
-
- if (!isExistStartTimeLog) {
- contentText.add(Formatter.toTimeFormat(time)); // start time
- contentData.add(Long.toString(time));
- contentText.add("00.000");//$NON-NLS-1$ //elapsed time
- contentData.add("00.000");//$NON-NLS-1$
- }
-
- contentText.add(Integer.toString(contentTemp.getPid()));
- contentData.add(Integer.toString(contentTemp.getPid()));
-
- contentText.add(Integer.toString(contentTemp.getTid()));
- contentData.add(Integer.toString(contentTemp.getTid()));
-
- contentText.add(contentTemp.getApiName());
- contentData.add(contentTemp.getApiName());
-
- contentText.add(contentTemp.getArgs());
- contentData.add(contentTemp.getArgs());
-
- contentText.add(contentTemp.getReturnVal());
- contentData.add(contentTemp.getReturnVal());
-
- String errMsg = ErrorCodeManager.getInatance()
- .getErrorCode(contentTemp.getErrNo()).name();
- if (null == errMsg) {
- errMsg = "undefined error code"; //$NON-NLS-1$
- }
- contentText.add(errMsg);
- contentData.add(errMsg);
- contentText.add(Long.toString(contentTemp.getFileSize()));
- contentData.add(Long.toString(contentTemp.getFileSize()));
-
- DATableDataFormat tableData = new DATableDataFormat(
- contentTemp.getSeqNo());
- tableData.setLogData(contentTemp);
- tableData.getData().addAll(contentData);
- TableInput tableInput = new TableInput();
- tableInput.setText(contentText);
- tableInput.setData(tableData);
- if (!errMsg.contains("SUCCESS")) {//$NON-NLS-1$
- tableInput.setFailed(true);
- }
- input.add(tableInput);
-
- if (time >= rangeStartTime && time <= rangeEndTime) {
- tableInput.setInRange(true);
- }
- }
- int removeCount = 0;
- for (int index : removeTableIndex) {
- int removeIndex = index - removeCount;
- if (removeIndex > 0) {
- input.remove(removeIndex);
- removeCount++;
- }
- }
- return input;
- }
-
- protected void actionSetStartEnd(int type) {
- GridItem item = table.getItem(mousePoint);
- if (null != item) {
- FileData data = (FileData) ((DATableDataFormat) item.getData())
- .getLogData();
- long time = data.getTime();
- double startTime = -1;
- double endTime = -1;
-
- if (type == START_TIME) {
- rangeDataManager.setMarkerStartTime(time);
- startTime = time / TimelineConstants.MEGA_DOUBLE;
- endTime = rangeDataManager.getMarkerEndTime()
- / TimelineConstants.MEGA_DOUBLE;
-
- } else if (type == END_TIME) {
- rangeDataManager.setMarkerEndTime(time);
- endTime = time / TimelineConstants.MEGA_DOUBLE;
- startTime = rangeDataManager.getMarkerStartTime()
- / TimelineConstants.MEGA_DOUBLE;
- }
-
- FileChartView chartview = (FileChartView) (AnalyzerManager
- .getCurrentPage().getView(FilePage.chartViewID));
-
- chartview.setRangeMarker(startTime, endTime);
- }
- }
-}
+++ /dev/null
-/*
- * Dynamic Analyzer
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Hyeran kim <hyearn74.kim@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.file.view;
-
-import java.util.List;
-
-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.nl.FilePageLabels;
-import org.tizen.dynamicanalyzer.resources.ColorResources;
-import org.tizen.dynamicanalyzer.swap.model.data.LogData;
-import org.tizen.dynamicanalyzer.ui.file.FileChartData;
-import org.tizen.dynamicanalyzer.ui.file.FilePage;
-import org.tizen.dynamicanalyzer.ui.file.model.FileEvent;
-import org.tizen.dynamicanalyzer.ui.file.model.FileSelectedData;
-import org.tizen.dynamicanalyzer.ui.network.data.NetworkDataManager;
-import org.tizen.dynamicanalyzer.ui.network.data.type.NetworkSelectionType;
-import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
-import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
-import org.tizen.dynamicanalyzer.ui.widgets.table.TableColumnSizePackListener;
-import org.tizen.dynamicanalyzer.widgets.da.view.DAViewComposite;
-import org.tizen.dynamicanalyzer.widgets.da.view.DAViewData;
-import org.tizen.dynamicanalyzer.ui.file.manager.FileChartManager;
-
-public class FileApiListView extends DAViewComposite {
- private long analysisStartTime = 0;
- private long analysisEndTime = 0;
- private int preSelectionPId = 1;
- private long preAnalysisStartTime = 0;
- private long preAnalysisEndTime = 0;
- private boolean isChangedSelected = true;
- private FileSelectedData selectedData = null;
-
- private String[] columnNames = { FilePageLabels.FILE_API_LIST_VIEW_INDEX,
- FilePageLabels.FILE_API_LIST_VIEW_START_TIME,
- FilePageLabels.FILE_API_LIST_VIEW_ELAPSED_TIME,
- FilePageLabels.FILE_API_LIST_VIEW_PID,
- FilePageLabels.FILE_API_LIST_VIEW_THREAD_ID,
- FilePageLabels.FILE_API_LIST_VIEW_API,
- FilePageLabels.FILE_API_LIST_VIEW_PARAMETER,
- FilePageLabels.FILE_API_LIST_VIEW_RETURN,
- FilePageLabels.FILE_API_LIST_VIEW_ERRNO };
-
- private int[] columnSizes = { 40, 70, 100, 40, 40, 120, 250, 70, 100 };
- private int[] columnAlignment = { SWT.RIGHT, SWT.RIGHT, SWT.RIGHT,
- SWT.RIGHT, SWT.RIGHT, SWT.LEFT, SWT.LEFT, SWT.LEFT, SWT.LEFT };
-
- int[] sortTypes = { AnalyzerConstants.SORT_TYPE_NUM,
- AnalyzerConstants.SORT_TYPE_STRING,
- AnalyzerConstants.SORT_TYPE_STRING,
- AnalyzerConstants.SORT_TYPE_NUM, AnalyzerConstants.SORT_TYPE_NUM,
- AnalyzerConstants.SORT_TYPE_STRING,
- AnalyzerConstants.SORT_TYPE_STRING,
- AnalyzerConstants.SORT_TYPE_STRING,
- AnalyzerConstants.SORT_TYPE_STRING };
-
- FileApiListTable tableComp = null;
- FileChartManager manager = FileChartManager.getInstance();
-
- public FileApiListView(Composite parent, int style) {
- super(parent, style, true);
- this.setLayout(new FillLayout());
-
- setTitle(FilePageLabels.FILE_API_LIST_VIEW_TITLE);
-
- Composite contents = getContentArea();
- contents.setBackground(ColorResources.WINDOW_BG_COLOR);
- contents.setLayout(new FillLayout());
- tableComp = new FileApiListTable(contents, SWT.NONE, SWT.MULTI
- | SWT.BORDER | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL);
- tableComp.setSortTypes(sortTypes);
- tableComp.setColumnAlignment(columnAlignment);
- tableComp.setColumns(columnNames);
- tableComp.setColumnSize(columnSizes);
- tableComp.setTableName(FilePageLabels.FILE_API_LIST_VIEW_TITLE);
- contents.addControlListener(new TableColumnSizePackListener(tableComp,
- columnSizes));
- }
-
- @Override
- public void updateView() {
- if (null == tableComp || selectedData == null) {
- 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;
- }
-
- int selectedPid = ToolbarArea.getInstance().getSelectedPid();
- if (preSelectionPId != -1 && preSelectionPId != selectedPid) {
- tableComp.updateTable();
- }
- preSelectionPId = selectedPid;
-
- List<FileEvent> events = manager.getApiDB().selectAPITable(
- selectedData.getDentry(), selectedData.getPid(),
- selectedData.getTid(), selectedData.isParentChart());
- if (tableComp.getTable().getItemCount() > 0
- && events.size() != tableComp.getTable().getItemCount()) {
- manager.setSelectedTableAPIList(events);
- tableComp.updateTable();
- }
- }
-
- @Override
- public Control getControl() {
- return tableComp;
- }
-
- @Override
- public void clear() {
- tableComp.getTable().removeAll();
- }
-
- @Override
- public void updateView(DAViewData data) {
- DASelectionData selData = (DASelectionData) data;
- long selectionStartTime = selData.getStartTime();
- long selectionEndTime = selData.getEndTime();
- if (selData.getData() instanceof FileSelectedData) {
- selectedData = (FileSelectedData) selData.getData();
- if (null == selectedData) {
- return;
- }
- manager.setSelectedTableAPIList(
- manager.getApiDB().
- selectAPITable(selectedData.getDentry(),
- selectedData.getPid(),
- selectedData.getTid(),
- selectedData.isParentChart()));
-
- tableComp.updateTable();
- tableComp.setSelectionByTime(selectionStartTime,
- selectionEndTime);
- isChangedSelected = true;
- }
- }
-
-
- public FileSelectedData getSelectedData() {
- return selectedData;
- }
-
- 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:
- * Hyeran kim <hyearn74.kim@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.file.view;
-
-import java.util.List;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.StackLayout;
-import org.eclipse.swt.events.PaintEvent;
-import org.eclipse.swt.events.PaintListener;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.tizen.dynamicanalyzer.common.AnalyzerManager;
-import org.tizen.dynamicanalyzer.common.DASelectionData;
-import org.tizen.dynamicanalyzer.nl.FilePageLabels;
-import org.tizen.dynamicanalyzer.resources.ColorResources;
-import org.tizen.dynamicanalyzer.resources.FontResources;
-import org.tizen.dynamicanalyzer.resources.ImageResources;
-import org.tizen.dynamicanalyzer.swap.model.data.LogData;
-import org.tizen.dynamicanalyzer.ui.common.SetRangeMarkerMouseMoveListener;
-import org.tizen.dynamicanalyzer.ui.common.UICommonConstants;
-import org.tizen.dynamicanalyzer.ui.file.FilePage;
-import org.tizen.dynamicanalyzer.ui.file.model.FileEvent;
-import org.tizen.dynamicanalyzer.ui.file.manager.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.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.da.view.DAViewComposite;
-import org.tizen.dynamicanalyzer.widgets.da.view.DAViewData;
-import org.tizen.dynamicanalyzer.widgets.timeline.DATimeline;
-
-public class FileChartView extends DAViewComposite {
- public final static int FILE_CHART_HEIGHT = 40;
-
- private final Composite contents;
- private FileChartBoard fileChartBoard;
- private final StackLayout stackLayout;
- private DAChartBoardItem lastSelectedItemForSummary = null;
-
- private final RangeDataManager rangeDataManager = RangeDataManager
- .getInstance();
- private FileChartManager chartManager = FileChartManager.getInstance();
-
- public FileChartView(Composite parent, int style) {
- super(parent, style, false);
- this.setLayout(new FillLayout());
-
- setTitle(FilePageLabels.FILE_CHART_FILE);
-
- contents = getContentArea();
- contents.setBackground(ColorResources.WINDOW_BG_COLOR);
- stackLayout = new StackLayout();
- contents.setLayout(stackLayout);
- fileChartBoard = new FileChartBoard(contents, FilePageLabels.FILE_CHART_FILE);
- fileChartBoard.setNameFont(FontResources.CHART_NAME_FONT);
- fileChartBoard.addSelectionListener(new DAChartBoardSelectionListener() {
- @Override
- public void handleSelectionEvent(DAChartBoardItem item) {
- lastSelectedItemForSummary = item;
- AnalyzerManager
- .getCurrentPage().updateView(
- new DASelectionData(
- FilePage.chartViewID,
- (long) (((DAChartPlotIntervalMarker) fileChartBoard
- .getMarkers()
- .get(UICommonConstants.SELECTION_MARKER_INDEX))
- .getStartVal() * TimelineConstants.MEGA_DOUBLE),
- (long) (((DAChartPlotIntervalMarker) fileChartBoard
- .getMarkers()
- .get(UICommonConstants.SELECTION_MARKER_INDEX))
- .getEndVal() * TimelineConstants.MEGA_DOUBLE),
- item.getData(), null));
- }
- });
-
- initIntervalMarkers(fileChartBoard);
-
- stackLayout.topControl = fileChartBoard;
- Composite textBoxLabel = new Composite(fileChartBoard.getTitleComp(),
- SWT.NONE);
- textBoxLabel.addPaintListener(new PaintListener() {
- @Override
- public void paintControl(PaintEvent e) {
- Composite composite = (Composite) e.widget;
- Rectangle rect = composite.getClientArea();
-
- e.gc.drawImage(ImageResources.TIMELINE_DROPDOWN_NORMAL, rect.x,
- rect.y);
- e.gc.setFont(FontResources.COMBO);
- e.gc.setForeground(ColorResources.BLACK);
- e.gc.drawString(FilePageLabels.FILE_CHART_FILE, rect.x + 30,
- rect.y + 2, true);
- }
- });
-
- DATimeline timeline = fileChartBoard.getTimeline();
-
- timeline.setTimeTickFont(FontResources.TIMELINE_TICK_FONT);
- timeline.setTimeBalloonFont(FontResources.TIMELINE_BALLOON_FONT);
-
- LifecycleLogParser.getInstance().registerLifecycleBar(
- fileChartBoard.getLifecycleBar());
- LifecycleLogParser.getInstance().registerTimeline(timeline);
-
- timeline.addMouseMoveListener(new SetRangeMarkerMouseMoveListener(
- rangeDataManager, fileChartBoard, timeline));
- }
-
- @Override
- public void updateView() {
- fileChartBoard.updateChart();
-
- fileChartBoard.setTotalEndTime(ToolbarArea.getInstance().getTime());
-
- fileChartBoard.setTimelineMarkerStartTime(rangeDataManager
- .getMarkerStartTime() / TimelineConstants.MEGA_DOUBLE);
- fileChartBoard.setTimelineMarkerEndTime(rangeDataManager.getMarkerEndTime()
- / TimelineConstants.MEGA_DOUBLE);
-
- if (RangeDataManager.getInstance().isBeingAnalyzed()) {
- ((DAChartPlotIntervalMarker) fileChartBoard.getMarkers().get(
- UICommonConstants.RANGE_ANALYSIS_MARKER_INDEX))
- .setInterval(rangeDataManager.getAnalysisStartTime()
- / TimelineConstants.MEGA_DOUBLE,
- rangeDataManager.getAnalysisEndTime()
- / TimelineConstants.MEGA_DOUBLE);
- } else {
- ((DAChartPlotIntervalMarker) fileChartBoard.getMarkers().get(
- UICommonConstants.RANGE_ANALYSIS_MARKER_INDEX))
- .setInterval(-1, -1);
- }
-
- ((DAChartPlotIntervalMarker) fileChartBoard.getMarkers().get(
- UICommonConstants.RANGE_MARKER_INDEX)).setInterval(
- rangeDataManager.getMarkerStartTime()
- / TimelineConstants.MEGA_DOUBLE,
- rangeDataManager.getMarkerEndTime()
- / TimelineConstants.MEGA_DOUBLE);
-
- }
-
- @Override
- public void updateView(DAViewData data) {
- fileChartBoard.updateChart();
- if (data instanceof DASelectionData) {
- DASelectionData selData = (DASelectionData) data;
- long dataTime = -1;
-
- if (selData.isLogData()) {
- Object obData = selData.getData();
- if (null != obData && (obData instanceof LogData)) { // summary
- LogData ldata = (LogData) obData;
- dataTime = ldata.getTime();
-
- int seq = ldata.getSeq();
- List<FileEvent> event = chartManager.getApiDB().selectFileEventBySeq(seq);
- int selectedIndex[] = fileChartBoard.getChartIndex(event.get(0));
- fileChartBoard.selectItem(selectedIndex[0], selectedIndex[1]);
-
- if (null != lastSelectedItemForSummary) {
- AnalyzerManager.getCurrentPage().updateView(
- new DASelectionData(FilePage.chartViewID,
- dataTime, dataTime,
- lastSelectedItemForSummary.getData(),
- null));
- }
- }
- } else {
- dataTime = selData.getStartTime();
- }
- double startTime = dataTime / TimelineConstants.MEGA_DOUBLE;
- double endTime = selData.getEndTime() / TimelineConstants.MEGA_DOUBLE;
-
- DAChartPlotIntervalMarker intervalMarker = (DAChartPlotIntervalMarker)fileChartBoard
- .getMarkers().get(UICommonConstants.SELECTION_MARKER_INDEX);
- intervalMarker.setInterval(startTime, endTime);
-
- }
- }
-
- @Override
- public void clear() {
- fileChartBoard.clear();
- initIntervalMarkers(fileChartBoard);
- chartManager.getFileChartDataMaker().clear();
- }
-
- @Override
- public Control getControl() {
- return fileChartBoard;
- }
-
- 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);
- }
-
- public void setRangeMarker(double starttime, double endtime) {
- fileChartBoard.setTimelineMarkerStartTime(starttime);
- fileChartBoard.setTimelineMarkerEndTime(endtime);
-
- ((DAChartPlotIntervalMarker) fileChartBoard.getMarkers().get(
- UICommonConstants.RANGE_MARKER_INDEX)).setInterval(
- starttime, endtime);
- }
-
-}
+++ /dev/null
-/*
- * Dynamic Analyzer
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Hyeran kim <hyearn74.kim@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.file.view;
-
-import java.util.List;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.PaintEvent;
-import org.eclipse.swt.events.PaintListener;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.widgets.Canvas;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.tizen.dynamicanalyzer.common.AnalyzerManager;
-import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
-import org.tizen.dynamicanalyzer.nl.FilePageLabels;
-import org.tizen.dynamicanalyzer.resources.ColorResources;
-import org.tizen.dynamicanalyzer.resources.FontResources;
-import org.tizen.dynamicanalyzer.ui.file.FilePage;
-import org.tizen.dynamicanalyzer.ui.file.manager.FileChartManager;
-import org.tizen.dynamicanalyzer.ui.file.model.FileEvent;
-import org.tizen.dynamicanalyzer.ui.file.model.FileSelectedData;
-import org.tizen.dynamicanalyzer.utils.Formatter;
-import org.tizen.dynamicanalyzer.widgets.da.view.DAViewComposite;
-import org.tizen.dynamicanalyzer.widgets.da.view.DAViewData;
-
-public class FileDetailInfoView extends DAViewComposite {
- private Canvas canvas = null;
- private String fileName = AnalyzerLabels.EMPTY_STRING;
- private String filePath = AnalyzerLabels.EMPTY_STRING;
- private long fileSize = 0;
- private long readSize = 0;
- private long writeSize = 0;
- private long totalUseTime = 0;
- private int apiCount = 0;
- private int failedApiCount = 0;
-
- private FileChartManager fileChartManager = FileChartManager.getInstance();
-
- private void init() {
- fileName = AnalyzerLabels.EMPTY_STRING;
- filePath = AnalyzerLabels.EMPTY_STRING;
- fileSize = 0;
- readSize = 0;
- writeSize = 0;
- totalUseTime = 0;
- apiCount = 0;
- failedApiCount = 0;
- }
-
- public FileDetailInfoView(Composite parent, int style) {
- super(parent, style, true);
- this.setLayout(new FillLayout());
-
- setTitle(FilePageLabels.FILE_DETAILS_TITLE);
-
- Composite contents = getContentArea();
- contents.setBackground(ColorResources.VIEW_BG_COLOR);
- contents.setLayout(new FillLayout());
- canvas = new Canvas(contents, SWT.TRANSPARENT);
- canvas.addPaintListener(new PaintListener() {
-
- @Override
- public void paintControl(PaintEvent e) {
- int x = 0;
- int y = 0;
- Rectangle rect = canvas.getBounds();
- e.gc.setBackground(ColorResources.VIEW_BG_COLOR);
- e.gc.fillRectangle(rect.x, rect.y, rect.width, rect.height);
- e.gc.setForeground(ColorResources.TABLE_CONTENTS_FONT_COLOR);
- e.gc.setFont(FontResources.DETAIL_INFO_FONT);
-
- String fName = FilePageLabels.FILE_DETAILS_FILE_NAME + fileName;
- Point textSize = e.gc.textExtent(fName, SWT.DRAW_MNEMONIC);
- if (textSize.x > rect.width) {
- fName = FilePageLabels.FILE_DETAILS_FILE_NAME_NEWLINE
- + fileName;
- }
- int fontHeight = textSize.y + 5;
- e.gc.drawString(fName, x += 10, y += fontHeight);
-
- // file path bolck
- {
- String pathLabel = FilePageLabels.FILE_DETAILS_FILE_PATH;
- e.gc.drawString(pathLabel, x, y + fontHeight);
- Point pathSize = e.gc.textExtent(pathLabel,
- SWT.DRAW_MNEMONIC);
- int xPos = x + pathSize.x;
- int width = rect.width - xPos;
- String text = filePath;
- if (text.length() > 0) {
- while (text.length() > 0) {
- Point tSize = e.gc.textExtent(text,
- SWT.DRAW_MNEMONIC);
- String inputText = AnalyzerLabels.EMPTY_STRING;
- if (tSize.x > width) {
- int strLen = (width * text.length()) / tSize.x;
- inputText += text.substring(0, strLen - 1);
- text = text.substring(strLen - 1, text.length());
- } else {
- inputText += text;
- text = AnalyzerLabels.EMPTY_STRING;
- }
- e.gc.drawString(inputText, xPos, y += fontHeight);
- }
- } else {
- y += fontHeight;
- }
- }
-
- e.gc.drawString(
- FilePageLabels.FILE_DETAILS_TOTAL_SIZE
- + Long.toString(fileSize), x, y += fontHeight);
- e.gc.drawString(
- FilePageLabels.FILE_DETAILS_READ_SIZE
- + Long.toString(readSize), x, y += fontHeight);
- e.gc.drawString(
- FilePageLabels.FILE_DETAILS_WRITE_SIZE
- + Long.toString(writeSize), x, y += fontHeight);
- e.gc.drawString(FilePageLabels.FILE_DETAILS_TOTAL_USE_TIME
- + Formatter.toTimeFormat(totalUseTime)
- + FilePageLabels.TIME_MS, x, y += fontHeight);
- e.gc.drawString(
- FilePageLabels.FILE_DETAILS_API_COUNT
- + Integer.toString(apiCount), x,
- y += fontHeight);
- e.gc.drawString(FilePageLabels.FILE_DETAILS_FAILED_API_COUNT
- + Integer.toString(failedApiCount), x, y += fontHeight);
- }
- });
- }
-
- @Override
- public void updateView(DAViewData data) {
- updateData();
- }
-
- @Override
- public void updateView() {
- updateData();
- }
-
- private void updateData() {
- FileApiListView view = (FileApiListView) AnalyzerManager
- .getCurrentPage().getView(FilePage.apilistViewID);
- FileSelectedData selectData = view.getSelectedData();
-
- if (null == selectData) {
- return;
- }
- List<FileEvent> events = null;
- events = fileChartManager.getApiDB()
- .selectAPITable(selectData.getDentry(),
- selectData.getPid(), selectData.getTid(), selectData.isParentChart());
- if(events != null) {
- filePath = events.get(0).getFilePath();
- fileName = events.get(0).getFileName();
- fileSize = events.get(0).getFileSize();
- apiCount = events.size();
- }
- events = fileChartManager.getApiDB()
- .selectFailedAPI(selectData.getDentry(),
- selectData.getPid(), selectData.getTid(), selectData.isParentChart());
- if(events != null) {
- failedApiCount = events.size();
- }
- // TODO define What totalUseTime
- // totalUseTime = (long) selectData.getFileTotalUseTime();
- // readSize = selectData.getReadSize();
- // writeSize = selectData.getWriteSize();
-
- canvas.redraw();
- }
-
- @Override
- public Control getControl() {
- return canvas;
- }
-
- @Override
- public void clear() {
- init();
- canvas.redraw();
- }
-}
import java.util.ArrayList;
import java.util.List;
-import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.constant.CommonConstants;
import org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants;
import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
import org.tizen.dynamicanalyzer.swap.logparser.PageDataManager;
import org.tizen.dynamicanalyzer.swap.model.data.LogData;
import org.tizen.dynamicanalyzer.swap.model.data.SystemData;
-import org.tizen.dynamicanalyzer.util.DALogger;
public class ScreenshotDataManager extends PageDataManager {
- private static final DALogger DA_LOG = DALogger.getInstance();
-
private static ScreenshotDataManager instance = null;
private List<Long> lastCpuRate = null;
private int lastProcessMemory = 0;
return instance;
}
- @Override
- public void run() {
- while (!AnalyzerManager.isExit()) {
- LogPackage pack = pollPack();
- if(pack == null) // stop thread
- break;
-
- Logs logs = pack.getLogs(DataChannelConstants.MSG_DATA_SYSTEM);
- if (null != logs && null != logs.getRawLogs() && !logs.getRawLogs().isEmpty()) {
- List<LogData> inputs = logs.getRawLogs();
- int lastIndex = inputs.size() - 1;
- SystemData input = (SystemData) inputs.get(lastIndex);
-
- String[] cpuRates = input.getCpuLoad().split(CommonConstants.COMMA);
- for (int i = 0; i < cpuRates.length - 1; i++) {
- String cpu = cpuRates[i].trim();
- lastCpuRate.add(new Long((long)Float.parseFloat(cpu)));
- }
-
- lastProcessMemory = input.getResidentMemory();
- lastStartTime = input.getTime();
- }
- }
-
- /* log for debug */
- DA_LOG.debug(getName() + " thread end!!"); //$NON-NLS-1$
- }
-
public List<Long> getLastCpuRate() {
return lastCpuRate;
}
public long getLastStartTime() {
return lastStartTime;
}
+
+ @Override
+ protected void makeData(LogPackage pack) {
+ Logs logs = pack.getLogs(DataChannelConstants.MSG_DATA_SYSTEM);
+ if (null != logs && null != logs.getRawLogs() && !logs.getRawLogs().isEmpty()) {
+ List<LogData> inputs = logs.getRawLogs();
+ int lastIndex = inputs.size() - 1;
+ SystemData input = (SystemData) inputs.get(lastIndex);
+
+ String[] cpuRates = input.getCpuLoad().split(CommonConstants.COMMA);
+ for (int i = 0; i < cpuRates.length - 1; i++) {
+ String cpu = cpuRates[i].trim();
+ lastCpuRate.add(new Long((long)Float.parseFloat(cpu)));
+ }
+
+ lastProcessMemory = input.getResidentMemory();
+ lastStartTime = input.getTime();
+ }
+ }
}
import java.util.Iterator;
import java.util.List;
import java.util.PriorityQueue;
-import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.database.DBTable;
import org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants;
import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
import org.tizen.dynamicanalyzer.swap.logparser.PageDataManager;
import org.tizen.dynamicanalyzer.swap.model.data.LogData;
import org.tizen.dynamicanalyzer.swap.model.data.LogDataTimeComparator;
-import org.tizen.dynamicanalyzer.util.DALogger;
public class KernelDataManager extends PageDataManager {
- private static final DALogger DA_LOG = DALogger.getInstance();
-
private static KernelDataManager instance = null;
private KernelDataMaker kdataMaker = null;
return instance;
}
- @Override
- public void run() {
- while (!AnalyzerManager.isExit()) {
- LogPackage pack = pollPack();
- if (null == pack) { // stop thread
- break;
- }
-
- ArrayList<LogData> logs = getLogsFromLogPackage(pack);
- if (!logs.isEmpty())
- kdataMaker.makeData(logs);
- }
-
- /* log for debug */
- DA_LOG.debug(getName() + " thread end!!"); //$NON-NLS-1$
- }
-
public void clear() {
kdataMaker.clear();
}
return kernelLogs;
}
+
+ @Override
+ protected void makeData(LogPackage pack) {
+ ArrayList<LogData> logs = getLogsFromLogPackage(pack);
+ if (!logs.isEmpty())
+ kdataMaker.makeData(logs);
+ }
}
import org.tizen.dynamicanalyzer.nl.NetworkPageLabels;
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.swap.channel.data.ApiNameManager;
+import org.tizen.dynamicanalyzer.ui.network.data.NetworkDataManager;
import org.tizen.dynamicanalyzer.ui.network.data.StatusSeriesListSortComparator;
import org.tizen.dynamicanalyzer.ui.network.data.type.NetworkAPIType;
import org.tizen.dynamicanalyzer.ui.network.data.type.NetworkSeriesType;
protected DAChartBoardItem item;
protected DAChart chart;
private List<NetworkChart> children = new ArrayList<NetworkChart>();
-
private DAChartSeries statueSeries;
private DAChartSeries apiSeries;
private DAChartSeries accessSeries;
private String destinationAddress = CommonConstants.EMPTY;
private String fdValue = CommonConstants.EMPTY;
+ private int parentChartIndex = -1;
+ private int childChartIndex = -1;
+ private int pId = -1;
+
public NetworkChart(String chartName, String destinationAddress,
- String fdValue, DAChartBoardItem item, DAChart chart) {
+ String fdValue, DAChartBoardItem item, DAChart chart,
+ int parentChartIndex, int childChartIndex) {
setChartName(chartName);
setDestinationAddress(destinationAddress);
setFdValue(fdValue);
setItem(item);
setChart(chart);
+ setParentChartIndex(parentChartIndex);
+ setChildChartIndex(childChartIndex);
}
public String getChartName() {
}
NetworkAPIType data = apiList.get(i);
DAChartSeriesItem seriesItem = null;
- double time = data.getTime() / TimelineConstants.MEGA_DOUBLE;
+ double time = getConvertTime(data.getTime());
Color color = ColorResources.NETWORK_API_USED;
String apiName = ApiNameManager.getApiName(data.getApiNameID());
if (data.getErrno() != 0) {
seriesItem = new DAChartSeriesItem(time,
DAChartSeriesItem.SERIES_STATE_BAR, color, apiName);
apiSeries.addSeriesItem(seriesItem);
+ if (!isParentChartRow() && data.getErrno() != 0) {
+ setChartIndexOfSeq(data.getSeq());
+ }
}
}
chart.redraw();
}
+ private void setChartIndexOfSeq(int seq) {
+ NetworkDataManager.getInstance().setParentIndexOfSeq(seq,
+ getParentChartIndex());
+ NetworkDataManager.getInstance().setChildIndexOfSeq(seq,
+ getChildChartIndex());
+ }
+
private void sortStatusSeriesByStartTime(List<NetworkSeriesType> statusList) {
Collections.sort(statusList, new StatusSeriesListSortComparator());
}
double startTime = -1;
double endTime = -1;
- double openTimeOfNotClosed = 999999999;
+ double openTimeOfNotClosed = NetworkDataManager.MAX_CHART_TIME;
for (int i = 0; i < statusList.size(); i++) {
if (getDestinationAddress().equals(
continue;
}
- startTime = data.getStartTime() / TimelineConstants.MEGA_DOUBLE;
- endTime = data.getEndTime() / TimelineConstants.MEGA_DOUBLE;
+ startTime = getConvertTime(data.getStartTime());
+ endTime = getConvertTime(data.getEndTime());
if (endTime > 0 && openTimeOfNotClosed > startTime) { // closed
DAChartSeriesItem seriesItem = new DAChartSeriesItem(
NetworkSeriesType data = null;
double startTime = -1;
double endTime = -1;
-
for (int i = 0; i < statusList.size(); i++) {
if (getDestinationAddress().equals(
statusList.get(i).getDestinationAddress())
if (isAccessEvnet(data.getAPIType())) {
continue;
}
- startTime = data.getStartTime() / TimelineConstants.MEGA_DOUBLE;
- endTime = data.getEndTime() / TimelineConstants.MEGA_DOUBLE;
-
+ startTime = getConvertTime(data.getStartTime());
+ endTime = getConvertTime(data.getEndTime());
}
}
if (null == data) {
if (!isAccessEvnet(data.getAPIType())) {
continue;
}
- startTime = data.getStartTime() / TimelineConstants.MEGA_DOUBLE;
- endTime = data.getEndTime() / TimelineConstants.MEGA_DOUBLE;
+ startTime = getConvertTime(data.getStartTime());
+ endTime = getConvertTime(data.getEndTime());
int status = data.getAPIType();
Color waitiColor = null;
chart.redraw();
}
+ private double getConvertTime(double logTime) {
+ return logTime / TimelineConstants.MEGA_DOUBLE;
+ }
+
private boolean isAccessEvnet(int apiType) {
{
if (apiType == NetworkSeriesType.ACCESS_TYPE_WAIT
}
}
+
+ public int getParentChartIndex() {
+ return parentChartIndex;
+ }
+
+ public void setParentChartIndex(int parentChartIndex) {
+ this.parentChartIndex = parentChartIndex;
+ }
+
+ public int getChildChartIndex() {
+ return childChartIndex;
+ }
+
+ public void setChildChartIndex(int childChartIndex) {
+ this.childChartIndex = childChartIndex;
+ }
+
+ public int getpId() {
+ return pId;
+ }
+
+ public void setpId(int pId) {
+ this.pId = pId;
+ }
}
\ No newline at end of file
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact:
- * Jooyoul Lee <jy.exe.lee@samsung.com>
+ * Hyunjong Park <phjwithyou.park@samsung.com>
* Juyoung Kim <j0.kim@samsung.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
package org.tizen.dynamicanalyzer.ui.network;
import java.util.ArrayList;
+import java.util.LinkedHashMap;
import java.util.List;
import org.eclipse.swt.widgets.Composite;
import org.tizen.dynamicanalyzer.ui.network.data.type.NetworkSelectionType;
import org.tizen.dynamicanalyzer.ui.network.data.type.NetworkSeriesType;
import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
+import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
import org.tizen.dynamicanalyzer.widgets.chart.DAChart;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot.AutoRangeType;
private int statusSeriesListCount = -1;
private boolean isFirstMakeChart = true;
+ private int parentChartIndex = -1;
+ private LinkedHashMap<Integer, Integer> lastChildChartIndexOfEachParent = new LinkedHashMap<Integer, Integer>();
+
+ private int preSelectionPId = -1;
+
public NetworkChartBoard(Composite parent, String title) {
super(parent, title);
initIntervalMarkers();
clearSeries();
updateSeries();
updateApiSeries();
+ chartFilteringByPId();
+ }
+
+ private void chartFilteringByPId() {
+ if (null == getItemList()) {
+ return;
+ }
+ int selectedPid = ToolbarArea.getInstance().getSelectedPid();
+ boolean isCheck = false;
+
+ if (preSelectionPId != -1 && preSelectionPId != selectedPid) {
+ isCheck = true;
+ }
+
+ if (isCheck) {
+ int parentIndex = 0;
+ for (NetworkChart chart : chartItemList) {
+ if (chart.isParentChartRow()) {
+ if (selectedPid == 0) {
+ showItem(parentIndex);
+ } else if (selectedPid == chart.getpId()) {
+ showItem(parentIndex);
+ } else {
+ hideItem(parentIndex);
+ }
+ parentIndex++;
+ }
+ }
+ }
+ preSelectionPId = selectedPid;
}
public void clear() {
statusSeriesListCount = -1;
isFirstMakeChart = true;
initIntervalMarkers();
+ parentChartIndex = -1;
+ lastChildChartIndexOfEachParent = new LinkedHashMap<Integer, Integer>();
+ preSelectionPId = -1;
}
public void initIntervalMarkers() {
NetworkChart parent = getParentChartData(destinationAddress, fd);
if (null == parent) {
+ parentChartIndex++;
+ lastChildChartIndexOfEachParent.put(parentChartIndex, 1);
StringBuffer chartName = new StringBuffer(
destinationAddress);
if (chartName.length() > 10) {
addSeries(parentDAChart);
NetworkChart parentChartData = new NetworkChart(
chartName.toString(), destinationAddress, fd,
- parentItem, parentDAChart);
+ parentItem, parentDAChart, parentChartIndex, 0);
chartItemList.add(parentChartData);
String childChartName = NetworkPageLabels.NETWORK_CHILD_CHART_NAME
addSeries(childDAChart);
NetworkChart childChartData = new NetworkChart(
childChartName, destinationAddress, fd, childItem,
- childDAChart);
+ childDAChart, parentChartIndex, 0);
parentChartData.pushChild(childChartData);
chartItemList.add(childChartData);
} else {
+ int childChartIndex = lastChildChartIndexOfEachParent
+ .get(parent.getParentChartIndex());
+
String childChartName = NetworkPageLabels.NETWORK_CHILD_CHART_NAME
+ fd;
DAChartBoardItem parentItem = parent.getItem();
+
DAChartBoardItem childItem = new DAChartBoardItem(
parentItem, childChartName);
childItem.setData(new NetworkSelectionType(
DAChart childDAChart = childItem.getChart();
initNetworkChart(childDAChart, false);
addSeries(childDAChart);
+
NetworkChart childChartData = new NetworkChart(
childChartName, destinationAddress, fd, childItem,
- childDAChart);
+ childDAChart, parent.getParentChartIndex(),
+ childChartIndex);
parent.pushChild(childChartData);
chartItemList.add(childChartData);
+ lastChildChartIndexOfEachParent.put(
+ parent.getParentChartIndex(), ++childChartIndex);
}
}
statusSeriesListCount = NetworkDataManager.getInstance()
List<NetworkSeriesType> seriesList = filetirngSeriresList();
for (NetworkChart chart : chartItemList) {
chart.updateStatusSeries(seriesList);
+ for (int i = 0; i < seriesList.size(); i++) {
+ if (chart.getDestinationAddress().equals(
+ seriesList.get(i).getDestinationAddress())
+ && chart.getFdValue().equals(
+ seriesList.get(i).getFdValue())) {
+ chart.setpId(seriesList.get(i).getpId());
+ }
+ }
}
for (NetworkChart chart : chartItemList) {
chart.updateAccessSeries(seriesList);
networkChartBoard.updateChart();
if (data instanceof DASelectionData) {
DASelectionData selData = (DASelectionData) data;
- long dataTime = -1;
- if (selData.isLogData()) {
+ String id = data.getViewID();
+ long dataTime = -1;
+ if (id.equals(NetworkPage.listViewID)) {
+ dataTime = selData.getStartTime();
+ moveChartPosition(dataTime, -1);
+ } else if (id.equals(NetworkPage.chartViewID)
+ || id.equals(NetworkPage.detailViewID)) {
+ return;
+ } else {
Object obData = selData.getData();
if (null != obData && (obData instanceof LogData)) { // summary
LogData ldata = (LogData) obData;
lastSelectedItemForSummary.getData(),
null));
}
+ moveChartPosition(dataTime, ldata.getSeq());
}
- } else {
- dataTime = selData.getStartTime();
}
- double selectionTime = dataTime / TimelineConstants.MEGA_DOUBLE;
-
- DAChartPlotIntervalMarker intervalMarker = (DAChartPlotIntervalMarker) networkChartBoard
- .getMarkers().get(UICommonConstants.SELECTION_MARKER_INDEX);
- intervalMarker.setInterval(selectionTime, selectionTime);
+ }
+ }
+ private void moveChartPosition(long dataTime, int seq) {
+ double selectionTime = dataTime / TimelineConstants.MEGA_DOUBLE;
+ networkChartBoard.setVisibleMiddleTime(selectionTime);
+ DAChartPlotIntervalMarker intervalMarker = (DAChartPlotIntervalMarker) networkChartBoard
+ .getMarkers().get(UICommonConstants.SELECTION_MARKER_INDEX);
+ intervalMarker.setInterval(selectionTime, selectionTime);
+ if (seq > 0) {
+ int parentChartIndex = NetworkDataManager.getInstance()
+ .getParentIndexOfSeq(seq);
+ int childChartIndex = NetworkDataManager.getInstance()
+ .getChildIndexOfSeq(seq);
+
+ networkChartBoard.selectItem(parentChartIndex, childChartIndex);
}
+
}
@Override
import org.tizen.dynamicanalyzer.common.DASelectionData;
import org.tizen.dynamicanalyzer.constant.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.resources.FontResources;
import org.tizen.dynamicanalyzer.ui.network.data.NetworkDataManager;
import org.tizen.dynamicanalyzer.ui.network.data.type.NetworkAPIType;
import org.tizen.dynamicanalyzer.ui.widgets.table.DATableDataFormat;
+import org.tizen.dynamicanalyzer.utils.DownloadContentfileManager;
import org.tizen.dynamicanalyzer.utils.Formatter;
import org.tizen.dynamicanalyzer.widgets.da.view.DAViewComposite;
import org.tizen.dynamicanalyzer.widgets.da.view.DAViewData;
if (!sendAckTime.equals(CommonConstants.EMPTY)) {
strDetailView.append(leftFormAttachment
+ NetworkPageLabels.NETWORK_DETAILS_SEND_ACK_TIME
- + sendAckTime + NetworkPageLabels.TIME_MS
+ + sendAckTime + AnalyzerLabels.TIME_MS
+ heightFormAttachment);
}
if (!payload.equals(CommonConstants.EMPTY)) {
detailText.getVerticalBar().setVisible(true);
detailText.getHorizontalBar().setVisible(true);
- strDetailView.append(setPacketMessage(payload));
+ strDetailView.append(getPacketMessage(DownloadContentfileManager
+ .getFileContents(payload)));
} else {
detailText.getVerticalBar().setVisible(true);
detailText.getHorizontalBar().setVisible(true);
}
- public String setPacketMessage(String packetMessage) {
+ public String getPacketMessage(String packetMessage) {
StringBuffer out = new StringBuffer();
StringBuffer strHex = new StringBuffer();
StringBuffer strAscii = new StringBuffer();
long startTime = 0;
long endTime = 0;
- DATableDataFormat dataFormat;
+ DATableDataFormat dataFormat = null;
long itemTime;
for (int i = 0; i < items.length; i++) {
dataFormat = (DATableDataFormat) items[i].getData();
}
DASelectionData selData = new DASelectionData(
NetworkTableView.ID, startTime, endTime, items, table);
+
AnalyzerManager.getCurrentPage().updateView(selData);
}
+/*
+ * 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.data;
import java.sql.PreparedStatement;
+import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import org.tizen.dynamicanalyzer.database.DBConstants;
import org.tizen.dynamicanalyzer.database.DBTable;
import org.tizen.dynamicanalyzer.database.SqlConnectionManager;
-import org.tizen.dynamicanalyzer.nl.NetworkPageLabels;
import org.tizen.dynamicanalyzer.ui.network.data.type.NetworkAPIType;
import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
public class NetworkAPIDBManager extends DBTable {
- private static final String TABLENAME = NetworkPageLabels.NETWORK_API_DB_TABLENAME;
+ private static final String TABLENAME = "NETWORK_API"; //$NON-NLS-1$
public static final String SEQ = DBConstants.COMMON_COLUMN_SEQ;
- public static final String DESTINATION_ADDRESS = NetworkPageLabels.NETWORK_DB_DESTINATION_ADDRESS;
- public static final String FD_VALUE = NetworkPageLabels.NETWORK_DB_FD_VALUE;
- public static final String API_TIME = NetworkPageLabels.NETWORK_API_DB_API_TIME;
- public static final String API_NAME_ID = NetworkPageLabels.NETWORK_DB_API_ID;
- public static final String ERRNO = NetworkPageLabels.NETWORK_API_DB_ERRNO;
+ public static final String DESTINATION_ADDRESS = "DESTINATION_ADDRESS"; //$NON-NLS-1$
+ public static final String FD_VALUE = "FD_VALUE"; //$NON-NLS-1$
+ public static final String API_TIME = DBConstants.COMMON_COLUMN_TIME;
+ public static final String API_NAME_ID = DBConstants.COMMON_COLUMN_ID;
+ public static final String ERRNO = DBConstants.COMMON_COLUMN_ERROR;
public static final String PID = DBConstants.COMMON_COLUMN_PID;
public static final String TID = DBConstants.COMMON_COLUMN_TID;
- public static final String ARGUMENT = NetworkPageLabels.NETWORK_API_DB_ARGUMENT;
- public static final String RETURN = NetworkPageLabels.NETWORK_API_DB_RETURN;
- public static final String BYTE_SIZE = NetworkPageLabels.NETWORK_API_DB_BYTE_SIZE;
- public static final String PAYLOAD = NetworkPageLabels.NETWORK_API_DB_PAYLOAD;
- public static final String API_TYPE = NetworkPageLabels.NETWORK_API_DB_API_TYPE;
- public static final String CALLER_PC_ADDRESS = NetworkPageLabels.NETWORK_API_DB_CALLER_PC_ADDRESS;
- public static final String LIB_NAME = NetworkPageLabels.NETWORK_API_DB_LIB_NAME;
-
- private static final String SELECT_API_SERIES_QUERY = "select " + SEQ //$NON-NLS-1$
- + CommonConstants.COMMA + CommonConstants.SPACE
- + DESTINATION_ADDRESS + CommonConstants.COMMA
- + CommonConstants.SPACE + FD_VALUE + CommonConstants.COMMA
- + CommonConstants.SPACE + API_TIME + CommonConstants.COMMA
- + CommonConstants.SPACE + API_NAME_ID + CommonConstants.COMMA
- + CommonConstants.SPACE + ERRNO
+ public static final String ARGUMENT = DBConstants.COMMON_COLUMN_ARG;
+ public static final String RETURN = DBConstants.COMMON_COLUMN_RET;
+ public static final String BYTE_SIZE = "BYTE_SIZE"; //$NON-NLS-1$
+ public static final String PAYLOAD = "PAYLOAD"; //$NON-NLS-1$
+ public static final String API_TYPE = "API_TYPE"; //$NON-NLS-1$
+ public static final String CALLER_PC_ADDRESS = DBConstants.COMMON_COLUMN_CALLER_PC_ADDRESS;
+ public static final String LIB_NAME = DBConstants.COMMON_COLUMN_CALLER_LIB_NAME;
+
+ public static final int DB_SEQ_INDEX = 0;
+ public static final int DB_DESTINATION_ADDRESS_INDEX = 1;
+ public static final int DB_FD_VALUE_INDEX = 2;
+ public static final int DB_API_TIME_INDEX = 3;
+ public static final int DB_API_NAME_ID_INDEX = 4;
+ public static final int DB_ERRNO_INDEX = 5;
+ public static final int DB_PID_INDEX = 6;
+ public static final int DB_TID_INDEX = 7;
+ public static final int DB_ARGUMENT_INDEX = 8;
+ public static final int DB_RETURN_INDEX = 9;
+ public static final int DB_BYTE_SIZE_INDEX = 10;
+ public static final int DB_PAYLOAD_INDEX = 11;
+ public static final int DB_API_TYPE_INDEX = 12;
+ public static final int DB_CALLER_PC_ADDRESS_INDEX = 13;
+ public static final int DB_LIB_NAME_INDEX = 14;
+
+ private static final String SELECT_API_SERIES_QUERY = "select " //$NON-NLS-1$
+ + SEQ + CommonConstants.COMMA
+ + DESTINATION_ADDRESS
+ + CommonConstants.COMMA + FD_VALUE
+ + CommonConstants.COMMA
+ + API_TIME + CommonConstants.COMMA
+ + API_NAME_ID
+ + CommonConstants.COMMA + ERRNO
+ " from " //$NON-NLS-1$
- + TABLENAME + " where %s <= " + API_TIME + " and " + API_TIME
+ + TABLENAME + " where %s <= " + API_TIME + " and "
+ + API_TIME
+ " <= %s";//$NON-NLS-1$
- private static final String SELECT_API_TABLE_CHILD_QUERY = "select * from "//$NON-NLS-1$
+ private static final String SELECT_API_TABLE_CHILD_QUERY = "select " + SEQ//$NON-NLS-1$
+ + CommonConstants.COMMA + DESTINATION_ADDRESS
+ + CommonConstants.COMMA + FD_VALUE + CommonConstants.COMMA
+ + API_TIME + CommonConstants.COMMA + API_NAME_ID
+ + CommonConstants.COMMA + ERRNO + CommonConstants.COMMA + PID
+ + CommonConstants.COMMA + TID + CommonConstants.COMMA + ARGUMENT
+ + CommonConstants.COMMA + RETURN + CommonConstants.COMMA
+ + BYTE_SIZE + CommonConstants.COMMA + PAYLOAD
+ + CommonConstants.COMMA + API_TYPE + CommonConstants.COMMA
+ + CALLER_PC_ADDRESS + CommonConstants.COMMA + LIB_NAME + " from "//$NON-NLS-1$
+ TABLENAME + " where " + DESTINATION_ADDRESS + " = '%s' and "//$NON-NLS-1$
+ FD_VALUE + " = '%s'";//$NON-NLS-1$
- private static final String SELECT_API_TABLE_PARENT_QUERY = "select * from "//$NON-NLS-1$
+ private static final String SELECT_API_TABLE_PARENT_QUERY = "select " + SEQ//$NON-NLS-1$
+ + CommonConstants.COMMA + DESTINATION_ADDRESS
+ + CommonConstants.COMMA + FD_VALUE + CommonConstants.COMMA
+ + API_TIME + CommonConstants.COMMA + API_NAME_ID
+ + CommonConstants.COMMA + ERRNO + CommonConstants.COMMA + PID
+ + CommonConstants.COMMA + TID + CommonConstants.COMMA + ARGUMENT
+ + CommonConstants.COMMA + RETURN + CommonConstants.COMMA
+ + BYTE_SIZE + CommonConstants.COMMA + PAYLOAD
+ + CommonConstants.COMMA + API_TYPE + CommonConstants.COMMA
+ + CALLER_PC_ADDRESS + CommonConstants.COMMA + LIB_NAME + " from "//$NON-NLS-1$
+ TABLENAME + " where " + DESTINATION_ADDRESS + " = '%s'";//$NON-NLS-1$ //$NON-NLS-2$
@Override
@Override
public boolean prepare(PreparedStatement prep, List<Object> rowData) {
- // TODO Auto-generated method stub
- return false;
+ boolean isPrepared = true;
+ int columnsize = getColumnSize();
+ if (columnsize != rowData.size()) {
+ isPrepared = false;
+ } else {
+ try {
+ prep.setInt(DB_SEQ_INDEX + 1,
+ (Integer) (rowData.get(DB_SEQ_INDEX)));
+ prep.setString(DB_DESTINATION_ADDRESS_INDEX + 1,
+ (String) (rowData.get(DB_DESTINATION_ADDRESS_INDEX)));
+ prep.setString(DB_FD_VALUE_INDEX + 1,
+ (String) (rowData.get(DB_FD_VALUE_INDEX)));
+ prep.setLong(DB_API_TIME_INDEX + 1,
+ (Long) (rowData.get(DB_API_TIME_INDEX)));
+ prep.setInt(DB_API_NAME_ID_INDEX + 1,
+ (Integer) (rowData.get(DB_API_NAME_ID_INDEX)));
+ prep.setLong(DB_ERRNO_INDEX + 1,
+ (Long) (rowData.get(DB_ERRNO_INDEX)));
+ prep.setInt(DB_PID_INDEX + 1,
+ (Integer) (rowData.get(DB_PID_INDEX)));
+ prep.setInt(DB_TID_INDEX + 1,
+ (Integer) (rowData.get(DB_TID_INDEX)));
+ prep.setString(DB_ARGUMENT_INDEX + 1,
+ (String) (rowData.get(DB_ARGUMENT_INDEX)));
+ prep.setString(DB_RETURN_INDEX + 1,
+ (String) (rowData.get(DB_RETURN_INDEX)));
+ prep.setInt(DB_BYTE_SIZE_INDEX + 1,
+ (Integer) (rowData.get(DB_BYTE_SIZE_INDEX)));
+ prep.setString(DB_PAYLOAD_INDEX + 1,
+ (String) (rowData.get(DB_PAYLOAD_INDEX)));
+ prep.setInt(DB_API_TYPE_INDEX + 1,
+ (Integer) (rowData.get(DB_API_TYPE_INDEX)));
+ prep.setLong(DB_CALLER_PC_ADDRESS_INDEX + 1,
+ (Long) (rowData.get(DB_CALLER_PC_ADDRESS_INDEX)));
+ prep.setString(DB_LIB_NAME_INDEX + 1,
+ (String) (rowData.get(DB_LIB_NAME_INDEX)));
+
+ } catch (SQLException e) {
+ e.printStackTrace();
+ isPrepared = false;
+ }
+ }
+ return isPrepared;
}
}
import org.tizen.dynamicanalyzer.ui.network.data.type.NetworkAPIType;
import org.tizen.dynamicanalyzer.ui.network.data.type.NetworkSeriesType;
import org.tizen.dynamicanalyzer.ui.summary.failed.FailedChecker;
-import org.tizen.dynamicanalyzer.ui.summary.failed.FailedData;
import org.tizen.dynamicanalyzer.ui.summary.leaks.LeakDetector;
import org.tizen.dynamicanalyzer.ui.summary.warning.WarningChecker;
import org.tizen.dynamicanalyzer.ui.toolbar.configuration.ConfigurationDialogDataManager;
import org.tizen.dynamicanalyzer.util.DALogger;
import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
+import org.tizen.dynamicanalyzer.utils.DownloadContentfileManager;
public class NetworkDataMaker {
private HashMap<String, String> addressByFdHashMap = new HashMap<String, String>();
private HashMap<String, String> parentFDByFdHashMap = new HashMap<String, String>();
- private FailedChecker failedChecker = null;
-
List<NetworkAPIType> noDestinationApiSeriesList = new ArrayList<NetworkAPIType>();
List<NetworkAPIType> destinationApiSeriesList = new ArrayList<NetworkAPIType>();
public NetworkDataMaker(FailedChecker failedChecker,
LeakDetector leakDetector, WarningChecker warningChecker) {
- this.failedChecker = failedChecker;
}
public void clear() {
}
makeEventData(input);
-
- long errno = input.getErrno();
-
- if (errno != 0) {
- FailedData ffd = new FailedData(input);
- this.failedChecker.getFailedList().add(ffd);
- }
}
if (destinationApiSeriesList.size() > 0) {
String apiFD = Long.toString(input.getFdValue()).trim();
apiFD = getHexString(apiFD);
int apiId = input.getApiId();
-
int apiType = input.getFdApiType();
long time = input.getTime();
long errno = input.getErrno();
case LogCenterConstants.SOCKET_API_CONNECT: {
String[] strInput = parameter.split(CommonConstants.COMMA);
if (strInput.length <= 0) {
+ DALogger.getInstance().error(
+ "argument length is wrong : " + input.getApiName());
return;
}
apiAddress = strInput[1].trim();
}
case LogCenterConstants.SOCKET_API_ACCEPT_START:
setStartSeries(apiAddress, apiFD, time, -1,
- NetworkSeriesType.ACCESS_TYPE_WAIT, apiId);
+ NetworkSeriesType.ACCESS_TYPE_WAIT, apiId, pId);
break;
case LogCenterConstants.SOCKET_API_ACCEPT_END: {
String clientFD = returnValue;
}
case LogCenterConstants.SOCKET_API_RECV_START:
setStartSeries(apiAddress, apiFD, time, -1,
- NetworkSeriesType.ACCESS_TYPE_READ, apiId);
+ NetworkSeriesType.ACCESS_TYPE_READ, apiId, pId);
break;
case LogCenterConstants.SOCKET_API_RECV_END:
setEndSeries(apiAddress, apiFD, time,
NetworkSeriesType.ACCESS_TYPE_READ);
+ payloadInfo = DownloadContentfileManager
+ .getDowonloadFilePath(payloadInfo);
break;
case LogCenterConstants.SOCKET_API_SEND_START:
setStartSeries(apiAddress, apiFD, time, -1,
- NetworkSeriesType.ACCESS_TYPE_WRITE, apiId);
+ NetworkSeriesType.ACCESS_TYPE_WRITE, apiId, pId);
break;
case LogCenterConstants.SOCKET_API_SEND_END:
setEndSeries(apiAddress, apiFD, time,
NetworkSeriesType.ACCESS_TYPE_WRITE);
+ payloadInfo = DownloadContentfileManager
+ .getDowonloadFilePath(payloadInfo);
break;
case LogCenterConstants.SOCKET_API_EVENT_START:
setStartSeries(apiAddress, apiFD, time, -1,
- NetworkSeriesType.ACCESS_TYPE_WAIT, apiId);
+ NetworkSeriesType.ACCESS_TYPE_WAIT, apiId, pId);
break;
case LogCenterConstants.SOCKET_API_EVENT_END:
setEndSeries(apiAddress, apiFD, time,
case LogCenterConstants.SOCKET_API_BIND: {
String[] strInput = parameter.split(CommonConstants.COMMA);
if (strInput.length <= 0) {
+ DALogger.getInstance().error(
+ "argument length is wrong : " + input.getApiName());
return;
}
apiAddress = strInput[1].trim();
if (apiName.contains("epoll_ctl")) { //$NON-NLS-1$
String[] strInput = parameter.split(CommonConstants.COMMA);
if (strInput.length <= 0) {
+ DALogger.getInstance().error(
+ "argument length is wrong : " + input.getApiName());
return;
}
String clientFD = strInput[0].trim();
NetworkDataManager.getInstance().getCheckStatusSeries()
.put(apiFD.trim(), apiAddress.trim());
setStartSeries(apiAddress, apiFD, time, -1,
- NetworkSeriesType.STATUS_TYPE_OPEN, apiId);
+ NetworkSeriesType.STATUS_TYPE_OPEN, apiId, pId);
}
}
}
}
private void setStartSeries(String apiAddress, String apiFD, long time,
- int eventType, int apiType, int apiId) {
+ int eventType, int apiType, int apiId, int pId) {
NetworkSeriesType statusType = new NetworkSeriesType(apiAddress, apiFD,
- time, -1, apiType, apiId);
+ time, -1, apiType, apiId, pId);
NetworkDataManager.getInstance().setStartSeriesData(statusType);
}
}
return retStr;
}
+
+ // private String getDowonloadPayloadFilePath(String payload) {
+ // if (payload.contains(AnalyzerConstants.CHECK_DOWNLOAD_FILE_STRING)) {
+ // String[] strFile = payload
+ // .split(AnalyzerConstants.CHECK_DOWNLOAD_FILE_STRING);
+ // if (strFile.length < 1) {
+ // return payload;
+ // }
+ // String downloadFilePath = strFile[1];
+ //
+ // String[] copyFilePathSplit = downloadFilePath.split(File.separator
+ // + AnalyzerConstants.TMP_FOLDER + File.separator);
+ // if (copyFilePathSplit.length < 1) {
+ // return payload;
+ // }
+ // String downloadFolderPath = File.separator
+ // + AnalyzerConstants.DOWNLOAD_FILE_FOLDER;
+ //
+ // File toDir = new File(AnalyzerManager.getProject().getSavePath()
+ // + downloadFolderPath);
+ // if (!toDir.exists() || !toDir.isDirectory()) {
+ // toDir.mkdirs();
+ // }
+ //
+ // String saveFilePath = downloadFolderPath + File.separator
+ // + copyFilePathSplit[1];
+ //
+ // if (pullPayloadFile(downloadFilePath, AnalyzerManager.getProject()
+ // .getSavePath() + saveFilePath)) {
+ // return saveFilePath;
+ // } else {
+ // return payload;
+ // }
+ // }
+ // return payload;
+ // }
+ //
+ // private boolean pullPayloadFile(String from, String to) {
+ // SyncResult res = CommunicatorUtils.pull(from, to);
+ // if (null != res && res.isOk()) {
+ // DALogger.getInstance().debug(from + "file copying success!!");//$NON-NLS-1$
+ // } else {
+ // DALogger.getInstance().debug("Failed to get " + from); //$NON-NLS-1$
+ // return false;
+ // }
+ // CommunicatorUtils.removeCommand(from);
+ // return true;
+ // }
}
import org.tizen.dynamicanalyzer.ui.network.data.type.NetworkAPIType;
import org.tizen.dynamicanalyzer.ui.network.data.type.NetworkSeriesType;
import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
-import org.tizen.dynamicanalyzer.util.DALogger;
import org.tizen.dynamicanalyzer.util.WorkbenchUtil;
import org.tizen.dynamicanalyzer.widgets.da.base.DADialog;
public class NetworkDataManager extends PageDataManager {
+ public final static int MAX_CHART_TIME = 999999999;
+
+ public final static double NETWORK_SERIES_TYPE_HEAP_MEMORY_KB = 0.3;
+ public final static double CHART_TYPE_HEAP_MEMORY_KB = 4.6 * 5;
+ public final static double MAX_NETWORK_HEAP_MEMORY_KB = 5000; // possible to make approximately 200 chart
+ public final static double ONE_CHART_HEAP_MEMORY_KB = NETWORK_SERIES_TYPE_HEAP_MEMORY_KB;
+ public final static double ONE_ACCESS_SERIES_HEAP_MEMORY_KB = NETWORK_SERIES_TYPE_HEAP_MEMORY_KB;
+
private static NetworkDataManager instance = null;
private NetworkDataMaker networkDataMaker = null;
private List<NetworkAPIType> selectedTableAPIList = null;
private LinkedHashMap<String, String> checkStatusSeries = new LinkedHashMap<String, String>();
private List<NetworkSeriesType> seriesList = new ArrayList<NetworkSeriesType>();
+ private LinkedHashMap<Integer, Integer> parentChartIndexOfSeq = new LinkedHashMap<Integer, Integer>();
+ private LinkedHashMap<Integer, Integer> childChartIndexOfSeq = new LinkedHashMap<Integer, Integer>();
- private int statusSeriesSize = 0;
+ private int chartCount = 0;
private int accessSeriesSize = 0;
+
private boolean isStopTrace = false;
public NetworkDataManager() {
return instance;
}
- /*** make network data thread ***/
- @Override
- public void run() {
- while (!AnalyzerManager.isExit()) {
- LogPackage pack = pollPack();
- if (pack == null) // stop thread
- break;
-
- Logs logs = pack.getLogs(DataChannelConstants.MSG_PROBE_NETWORK);
- if (null != logs && logs.getRawLogs().size() != 0) {
- List<LogData> inputs = logs.getLogs();
-
- networkDataMaker.makeData(inputs);
- }
- }
-
- /* log for debug */
- DALogger.getInstance().info(getName() + " thread end!!");
- }
-
private void initDB() {
networkDataMaker = new NetworkDataMaker(
AnalyzerManager.getFailedChecker(),
selectedTableAPIList = null;
seriesList = new ArrayList<NetworkSeriesType>();
checkStatusSeries = new LinkedHashMap<String, String>();
- statusSeriesSize = 0;
+ parentChartIndexOfSeq = new LinkedHashMap<Integer, Integer>();
+ childChartIndexOfSeq = new LinkedHashMap<Integer, Integer>();
+ chartCount = 0;
accessSeriesSize = 0;
isStopTrace = false;
}
public void setStartSeriesData(NetworkSeriesType seriesType) {
if (seriesType.getAPIType() == NetworkSeriesType.STATUS_TYPE_OPEN) {
- statusSeriesSize++;
+ chartCount++;
} else {
accessSeriesSize++;
}
public void openProcess() {
// set series list from DB
if (seriesList.size() == 0) {
- seriesList = seriesDBManager.select(0, 999999999);
+ seriesList = seriesDBManager.select(0, MAX_CHART_TIME);
}
}
}
private void checkHeapMemory() {
- if (isStopTrace == false
- && (statusSeriesSize > 1000 || accessSeriesSize > 10000)) {
+ double useHeapMemory = (chartCount * ONE_CHART_HEAP_MEMORY_KB)
+ + (accessSeriesSize * ONE_ACCESS_SERIES_HEAP_MEMORY_KB);
+ if (!isStopTrace && (MAX_NETWORK_HEAP_MEMORY_KB < useHeapMemory)) {
isStopTrace = true;
ToolbarArea.getInstance().stopTrace();
Display.getDefault().asyncExec(new Runnable() {
}
}
+ public int getParentIndexOfSeq(int seq) {
+ Integer chartIndex = this.parentChartIndexOfSeq.get(seq);
+ if (null != chartIndex) {
+ return chartIndex;
+ } else {
+ return 0;
+ }
+ }
+
+ public void setParentIndexOfSeq(int seq, int paretnChartIndex) {
+ Integer chartIndex = this.parentChartIndexOfSeq.get(seq);
+ if (null == chartIndex) {
+ this.parentChartIndexOfSeq.put(seq, paretnChartIndex);
+ }
+
+ }
+
+ public int getChildIndexOfSeq(int seq) {
+ Integer chartIndex = this.childChartIndexOfSeq.get(seq);
+ if (null != chartIndex) {
+ return chartIndex;
+ } else {
+ return 0;
+ }
+ }
+
+ public void setChildIndexOfSeq(int seq, int childChartIndex) {
+ Integer chartIndex = this.childChartIndexOfSeq.get(seq);
+ if (null == chartIndex) {
+ this.childChartIndexOfSeq.put(seq, childChartIndex);
+ }
+
+ }
+
+ /*** make network data thread ***/
+ @Override
+ protected void makeData(LogPackage pack) {
+ Logs logs = pack.getLogs(DataChannelConstants.MSG_PROBE_NETWORK);
+ if (null != logs && logs.getRawLogs().size() != 0) {
+ List<LogData> inputs = logs.getLogs();
+
+ networkDataMaker.makeData(inputs);
+ }
+ }
}
+/*
+ * 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.data;
import java.sql.PreparedStatement;
+import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
+import org.tizen.dynamicanalyzer.constant.CommonConstants;
import org.tizen.dynamicanalyzer.database.DBColumn;
import org.tizen.dynamicanalyzer.database.DBConstants;
import org.tizen.dynamicanalyzer.database.DBTable;
import org.tizen.dynamicanalyzer.database.SqlConnectionManager;
-import org.tizen.dynamicanalyzer.nl.NetworkPageLabels;
import org.tizen.dynamicanalyzer.ui.network.data.type.NetworkSeriesType;
import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
+import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
public class NetworkSeriesDBManager extends DBTable {
+ private static final String TABLENAME = " NETWORK_SERIES"; //$NON-NLS-1$
+ public static final String RID = "RID";
+ public static final String DESTINATION_ADDRESS = "DESTINATION_ADDRESS"; //$NON-NLS-1$
+ public static final String FD_VALUE = "FD_VALUE"; //$NON-NLS-1$
+ public static final String START_TIME = "START_TIME"; //$NON-NLS-1$
+ public static final String END_TIME = "END_TIME"; //$NON-NLS-1$
+ public static final String STATUS_TYPE = "STATUS_TYPE"; //$NON-NLS-1$
+ public static final String API_ID = DBConstants.COMMON_COLUMN_ID;
+ public static final String PID = DBConstants.COMMON_COLUMN_PID;
- private static final String TABLENAME = NetworkPageLabels.NETWORK_SERIES_DB_TABLENAME;
- public static final String RID = NetworkPageLabels.NETWORK_DB_RID;
- public static final String DESTINATION_ADDRESS = NetworkPageLabels.NETWORK_DB_DESTINATION_ADDRESS;
- public static final String FD_VALUE = NetworkPageLabels.NETWORK_DB_FD_VALUE;
- public static final String START_TIME = NetworkPageLabels.NETWORK_SERIES_DB_START_TIME;
- public static final String END_TIME = NetworkPageLabels.NETWORK_SERIES_DB_END_TIME;
- public static final String STATUS_TYPE = NetworkPageLabels.NETWORK_SERIES_DB_STATUS_TYPE;
- public static final String API_ID = NetworkPageLabels.NETWORK_DB_API_ID;
+ public final static int DB_RID_INDEX = 0;
+ public final static int DB_DESTINATION_ADDRESSINDEX = 1;
+ public final static int DB_FD_VALUE_INDEX = 2;
+ public final static int DB_START_TIME_INDEX = 3;
+ public final static int DB_END_TIME_INDEX = 4;
+ public final static int DB_STATUS_TYPE_INDEX = 5;
+ public final static int DB_API_ID_INDEX = 6;
+ public final static int DB_PID_INDEX = 7;
- private static final String SELECT_QUERY = "select * from " + TABLENAME; //$NON-NLS-1$
+ private static final String SELECT_QUERY = "select " + RID
+ + CommonConstants.COMMA + DESTINATION_ADDRESS
+ + CommonConstants.COMMA + FD_VALUE + CommonConstants.COMMA
+ + START_TIME + CommonConstants.COMMA + END_TIME
+ + CommonConstants.COMMA + STATUS_TYPE + CommonConstants.COMMA
+ + API_ID + CommonConstants.COMMA + PID + " from " + TABLENAME; //$NON-NLS-1$
+
+ private static final String SELECT_PID_QUERY = "select " + RID
+ + CommonConstants.COMMA + DESTINATION_ADDRESS
+ + CommonConstants.COMMA + FD_VALUE + CommonConstants.COMMA
+ + START_TIME + CommonConstants.COMMA + END_TIME
+ + CommonConstants.COMMA + STATUS_TYPE + CommonConstants.COMMA
+ + API_ID + CommonConstants.COMMA + PID
+ + " from " + TABLENAME + " where pid = '%s'"; //$NON-NLS-1$
private static int rid = 0;
DBConstants.INTEGER));
addColumn(new DBColumn(API_ID, DBConstants.NOT_NULL,
DBConstants.INTEGER));
+ addColumn(new DBColumn(PID, DBConstants.NOT_NULL, DBConstants.INTEGER));
rid = 0;
}
public List<NetworkSeriesType> select(double visibleStartTime,
double visibleEndTime) {
+ String selectQuery = SELECT_QUERY;
+ int selectedPid = ToolbarArea.getInstance().getSelectedPid();
+ if (selectedPid != 0) {
+ selectQuery = String.format(SELECT_PID_QUERY, selectedPid);
+ }
+
double selectStartTime = visibleStartTime
* TimelineConstants.MEGA_DOUBLE;
double selectEndTime = visibleEndTime * TimelineConstants.MEGA_DOUBLE;
- String query = String.format(SELECT_QUERY, selectStartTime,
+ String query = String.format(selectQuery, selectStartTime,
selectEndTime);
List<List<Object>> result = SqlConnectionManager.executeQuery(query);
if (null == result || result.size() == 0 || result.get(0).size() == 0) {
@Override
public boolean prepare(PreparedStatement prep, List<Object> rowData) {
- // TODO Auto-generated method stub
- return false;
+ boolean isPrepared = true;
+ int columnsize = getColumnSize();
+ if (columnsize != rowData.size()) {
+ isPrepared = false;
+ } else {
+ try {
+ prep.setInt(DB_RID_INDEX + 1,
+ (Integer) (rowData.get(DB_RID_INDEX)));
+ prep.setString(DB_DESTINATION_ADDRESSINDEX + 1,
+ (String) (rowData.get(DB_DESTINATION_ADDRESSINDEX)));
+ prep.setString(DB_FD_VALUE_INDEX + 1,
+ (String) (rowData.get(DB_FD_VALUE_INDEX)));
+ prep.setLong(DB_START_TIME_INDEX + 1,
+ (Long) (rowData.get(DB_START_TIME_INDEX)));
+ prep.setLong(DB_END_TIME_INDEX + 1,
+ (Long) (rowData.get(DB_END_TIME_INDEX)));
+ prep.setInt(DB_STATUS_TYPE_INDEX + 1,
+ (Integer) (rowData.get(DB_STATUS_TYPE_INDEX)));
+ prep.setInt(DB_API_ID_INDEX + 1,
+ (Integer) (rowData.get(DB_API_ID_INDEX)));
+ prep.setInt(DB_PID_INDEX + 1,
+ (Integer) (rowData.get(DB_PID_INDEX)));
+
+ } catch (SQLException e) {
+ e.printStackTrace();
+ isPrepared = false;
+ }
+ }
+ return isPrepared;
}
}
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact:
- * Jooyoul Lee <jy.exe.lee@samsung.com>
+ * Hyunjong Park <phjwithyou.park@samsung.com>
* Juyoung Kim <j0.kim@samsung.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
import org.tizen.dynamicanalyzer.constant.CommonConstants;
import org.tizen.dynamicanalyzer.swap.model.data.NetworkData;
+import org.tizen.dynamicanalyzer.ui.network.data.NetworkAPIDBManager;
public class NetworkAPIType extends NetworkData {
private final int apiSeriesColumnSize = 6;
}
public NetworkAPIType(List<Object> data) {
- setSeq((Integer) data.get(0));
- setDestinationAddress((String) data.get(1));
- setFdStr((String) data.get(2));
- setTime((Long) data.get(3));
- setApiNameID((Integer) data.get(4));
- setErrno((Long) data.get(5));
+ setSeq((Integer) data.get(NetworkAPIDBManager.DB_SEQ_INDEX));
+ setDestinationAddress((String) data
+ .get(NetworkAPIDBManager.DB_DESTINATION_ADDRESS_INDEX));
+ setFdStr((String) data.get(NetworkAPIDBManager.DB_FD_VALUE_INDEX));
+ setTime((Long) data.get(NetworkAPIDBManager.DB_API_TIME_INDEX));
+ setApiNameID((Integer) data
+ .get(NetworkAPIDBManager.DB_API_NAME_ID_INDEX));
+ setErrno((Long) data.get(NetworkAPIDBManager.DB_ERRNO_INDEX));
if (data.size() <= apiSeriesColumnSize) {
return;
}
- setPid((Integer) data.get(6));
- setTid((Integer) data.get(7));
- setArgs((String) data.get(8));
- setReturn((String) data.get(9));
- setPacketMessageSize((Integer) data.get(10));
- setPacketMessage((String) data.get(11));
- setFdApiType((Integer) data.get(12));
- setCallerAddress((Long) data.get(13));
- setLibName((String) data.get(14));
+ setPid((Integer) data.get(NetworkAPIDBManager.DB_PID_INDEX));
+ setTid((Integer) data.get(NetworkAPIDBManager.DB_PID_INDEX));
+ setArgs((String) data.get(NetworkAPIDBManager.DB_ARGUMENT_INDEX));
+ setReturn((String) data.get(NetworkAPIDBManager.DB_RETURN_INDEX));
+ setPacketMessageSize((Integer) data
+ .get(NetworkAPIDBManager.DB_BYTE_SIZE_INDEX));
+ setPacketMessage((String) data
+ .get(NetworkAPIDBManager.DB_PAYLOAD_INDEX));
+ setFdApiType((Integer) data.get(NetworkAPIDBManager.DB_API_TYPE_INDEX));
+ setCallerAddress((Long) data
+ .get(NetworkAPIDBManager.DB_CALLER_PC_ADDRESS_INDEX));
+ setLibName((String) data.get(NetworkAPIDBManager.DB_LIB_NAME_INDEX));
}
public int getSeq() {
import java.util.List;
import org.tizen.dynamicanalyzer.constant.CommonConstants;
+import org.tizen.dynamicanalyzer.ui.network.data.NetworkSeriesDBManager;
public class NetworkSeriesType {
- public static final int HEAP_MEMORY = 128;
- public static int STATUS_TYPE_OPEN = 0;
- public static int ACCESS_TYPE_WAIT = 1;
- public static int ACCESS_TYPE_READ = 2;
- public static int ACCESS_TYPE_WRITE = 3;
+ public final static int STATUS_TYPE_OPEN = 0;
+ public final static int STATUS_TYPE_CONNECTED = 1;
+ public final static int ACCESS_TYPE_WAIT = 2;
+ public final static int ACCESS_TYPE_READ = 3;
+ public final static int ACCESS_TYPE_WRITE = 4;
private int rid = 0;
private String destinationAddress = CommonConstants.EMPTY;
private int apiType = -1;
private int apiID = -1;
+ private int pId = -1;
public NetworkSeriesType(String destinationAddress, String fdValue,
- long startTime, long endTime, int statusType, int apiId) {
+ long startTime, long endTime, int statusType, int apiId, int pId) {
setRid(0);
setDestinationAddress(destinationAddress);
setFdValue(fdValue);
setEndTime(endTime);
setAPIType(statusType);
setApiID(apiId);
+ setpId(pId);
}
public NetworkSeriesType(List<Object> data) {
- setRid((Integer) data.get(0));
- setDestinationAddress((String) data.get(1));
- setFdValue((String) data.get(2));
- setStartTime((Long) data.get(3));
- setEndTime((Long) data.get(4));
- setAPIType((Integer) data.get(5));
- setApiID((Integer) data.get(6));
+ setRid((Integer) data.get(NetworkSeriesDBManager.DB_RID_INDEX));
+ setDestinationAddress((String) data
+ .get(NetworkSeriesDBManager.DB_DESTINATION_ADDRESSINDEX));
+ setFdValue((String) data.get(NetworkSeriesDBManager.DB_FD_VALUE_INDEX));
+ setStartTime((Long) data
+ .get(NetworkSeriesDBManager.DB_START_TIME_INDEX));
+ setEndTime((Long) data.get(NetworkSeriesDBManager.DB_END_TIME_INDEX));
+ setAPIType((Integer) data
+ .get(NetworkSeriesDBManager.DB_STATUS_TYPE_INDEX));
+ setApiID((Integer) data.get(NetworkSeriesDBManager.DB_API_ID_INDEX));
+ setpId((Integer) data.get(NetworkSeriesDBManager.DB_API_ID_INDEX));
}
public int getRid() {
this.apiID = apiID;
}
+ public int getpId() {
+ return pId;
+ }
+
+ public void setpId(int pId) {
+ this.pId = pId;
+ }
+
public List<Object> getDBInsertData() {
List<Object> data = new ArrayList<Object>();
data.add(getRid());
data.add(getEndTime());
data.add(getAPIType());
data.add(getApiID());
+ data.add(getpId());
return data;
}
-
}
\ No newline at end of file
import org.tizen.dynamicanalyzer.ui.opengl.data.type.GLSelectionData;
import org.tizen.dynamicanalyzer.ui.opengl.data.type.GLStateShaderType;
import org.tizen.dynamicanalyzer.ui.widgets.table.DATableDataFormat;
+import org.tizen.dynamicanalyzer.utils.DownloadContentfileManager;
import org.tizen.dynamicanalyzer.widgets.da.view.DAViewComposite;
import org.tizen.dynamicanalyzer.widgets.da.view.DAViewData;
@Override
public void updateView(DAViewData vdata) {
-
if (vdata instanceof GLSelectionData) {
GLSelectionData data = (GLSelectionData) vdata;
String id = vdata.getViewID();
updateProgramTableInfo(data);
}
}
-
}
@Override
return;
}
+ String contextId = items[0].getText(0);
+ if (contextId.contains(GLPageLabels.GL_CONTEXT)) {
+ contextId = contextId.replace(GLPageLabels.GL_CONTEXT,
+ CommonConstants.EMPTY);
+ }
String vertexShaderID = items[0].getText(2)
.replace(GLPageLabels.GL_SHADER, CommonConstants.EMPTY).trim();
String fragmentID = items[0].getText(3)
String fragmentSrc = CommonConstants.EMPTY;
List<GLStateShaderType> shaderList = GLDataManager.getInstance()
- .getStateDataMagerInstance().getShaderList();
+ .getStateDataMake().getShaderList();
for (int i = 0; i < shaderList.size(); i++) {
- if (shaderList.get(i).getId() == Integer.parseInt(vertexShaderID)) {
- vertexSrc = shaderList.get(i).getShaderSrc();
+ if (shaderList.get(i).getContextId() == Long.parseLong(contextId)
+ && shaderList.get(i).getId() == Integer
+ .parseInt(vertexShaderID)) {
+ vertexSrc = DownloadContentfileManager
+ .getFileContents(shaderList.get(i).getShaderSrc());
} else if (shaderList.get(i).getId() == Integer
.parseInt(fragmentID)) {
- fragmentSrc = shaderList.get(i).getShaderSrc();
+ fragmentSrc = DownloadContentfileManager
+ .getFileContents(shaderList.get(i).getShaderSrc());
}
}
import org.eclipse.swt.custom.StackLayout;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
+import org.tizen.dynamicanalyzer.common.DASelectionData;
import org.tizen.dynamicanalyzer.nl.GLPageLabels;
import org.tizen.dynamicanalyzer.nl.ThreadPageLabels;
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.resources.FontResources;
import org.tizen.dynamicanalyzer.resources.ImageResources;
+import org.tizen.dynamicanalyzer.swap.model.data.LogData;
import org.tizen.dynamicanalyzer.ui.common.SetRangeMarkerMouseMoveListener;
import org.tizen.dynamicanalyzer.ui.common.UICommonConstants;
import org.tizen.dynamicanalyzer.ui.opengl.GLPage;
import org.tizen.dynamicanalyzer.ui.opengl.data.GLDataManager;
import org.tizen.dynamicanalyzer.ui.opengl.data.type.GLSelectionData;
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.widgets.TitleComboPopupRenderer;
import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonRenderer;
frameRateChartBoard.updateViewFromDBData();
}
}
+ } else if (vdata instanceof DASelectionData) {
+ DASelectionData selData = (DASelectionData) vdata;
+ if (selData.isLogData()) {
+ Object obData = selData.getData();
+ if (null != obData && (obData instanceof LogData)) { // summary
+ LogData ldata = (LogData) obData;
+ long dataTime = ldata.getTime();
+ double selectionTime = dataTime
+ / TimelineConstants.MEGA_DOUBLE;
+ if (selectionTime <= 1) {
+ selectionTime = GLDataManager.getInstance()
+ .getStartFrameRateTime();
+ }
+ frameRateChartBoard.setVisibleMiddleTime(selectionTime);
+ DAChartPlotIntervalMarker intervalMarker = (DAChartPlotIntervalMarker) frameRateChartBoard
+ .getMarkers().get(
+ UICommonConstants.SELECTION_MARKER_INDEX);
+ intervalMarker.setInterval(selectionTime, selectionTime);
+ frameRateChartBoard.updateViewFromDBData();
+ }
+ }
}
}
*/
package org.tizen.dynamicanalyzer.ui.opengl.data;
-import java.io.File;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
-import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
-import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.constant.CommonConstants;
import org.tizen.dynamicanalyzer.database.DBColumn;
import org.tizen.dynamicanalyzer.database.DBConstants;
}
public GLFrameType selectOpenGLAPIData(int frameIndex) {
- if (null != AnalyzerManager.getProject()) {
- SqlConnectionManager.establishConnection(AnalyzerManager
- .getProject().getSavePath()
- + File.separator
- + AnalyzerConstants.DATABASE_NAME);
- }
String query = String.format(
SELECT_API_TABLE_QUERY_FROM_FRAME_TIME_CHART, frameIndex);
List<List<Object>> result = SqlConnectionManager.executeQuery(query);
public List<List<Object>> selectOpenGLAPIData(int frameStartIndex,
int frameEndIndex) {
- if (null != AnalyzerManager.getProject()) {
- SqlConnectionManager.establishConnection(AnalyzerManager
- .getProject().getSavePath()
- + File.separator
- + AnalyzerConstants.DATABASE_NAME);
- }
String query = String.format(
SELECT_API_TABLE_QUERY_FROM_FRAME_RATE_CHART, frameStartIndex,
frameEndIndex);
import org.tizen.dynamicanalyzer.ui.opengl.data.type.FrameCountInfoType;
import org.tizen.dynamicanalyzer.ui.opengl.data.type.GLAPINameDefine;
import org.tizen.dynamicanalyzer.ui.opengl.data.type.GLAPIType;
+import org.tizen.dynamicanalyzer.ui.opengl.data.type.GLES20ErrorDefine;
import org.tizen.dynamicanalyzer.ui.opengl.data.type.GLFrameType;
+import org.tizen.dynamicanalyzer.ui.opengl.data.type.GLSharingContextType;
+import org.tizen.dynamicanalyzer.ui.summary.failed.FailedData;
import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
-import org.tizen.dynamicanalyzer.util.DALogger;
public class GLDataManager extends PageDataManager {
- private static final DALogger DA_LOG = DALogger.getInstance();
private static GLDataManager instance = null;
- private GLStateDataMaker GLStateDataMagerInstance = null;
+ private GLStateDataMaker GLStateDataMaker = null;
private GLFrameType glFrameData = null;
private List<FrameCountInfoType> frameInfoList;
private GLStateProgramDBTableManager stateProgramDBTable = null;
private GLStateHistoryDBTableManager stateHistoryDBTable = null;
private GLStateTextureDBTableManager stateTextureDBTable = null;
+ private GLStateSharingDBTableManager stateSharingDBTable = null;
private boolean isShowFrameRateChart = true;
+ List<GLSharingContextType> sharingContextList = null;
+
public static GLDataManager getInstance() {
if (instance == null) {
instance = new GLDataManager();
currentFrameTimeIndex = 1;
glFrameData = new GLFrameType(currentFrameTimeIndex);
frameInfoList = new ArrayList<FrameCountInfoType>();
- GLStateDataMagerInstance = new GLStateDataMaker();
+ GLStateDataMaker = new GLStateDataMaker();
apiDBTable = new GLAPIDBTableManager();
addDBTable(apiDBTable);
frameRateDBTable = new GLFrameRateDBTableManager();
addDBTable(stateHistoryDBTable);
stateTextureDBTable = new GLStateTextureDBTableManager();
addDBTable(stateTextureDBTable);
+ stateSharingDBTable = new GLStateSharingDBTableManager();
+ addDBTable(stateSharingDBTable);
}
public void clear() {
currentFrameTimeIndex = 1;
glFrameData = new GLFrameType(currentFrameTimeIndex);
frameInfoList = new ArrayList<FrameCountInfoType>();
- GLStateDataMagerInstance.clear();
+ GLStateDataMaker.clear();
+ sharingContextList = new ArrayList<GLSharingContextType>();
}
public void openProcess() {
stateProgramDBTable.insertData();
}
- @Override
- public void run() {
- while (!AnalyzerManager.isExit()) {
- LogPackage pack = pollPack();
- if (pack == null) // stop thread
- break;
-
- Logs glesLogs = pack.getLogs(DataChannelConstants.MSG_PROBE_GLES20);
- if (glesLogs != null && glesLogs.getRawLogs().size() != 0) {
- makeGLData(glesLogs);
- }
- }
- DA_LOG.debug(getName() + " thread ended!");
- }
-
public void makeGLData(Logs glesLogs) {
List<LogData> logDataList = glesLogs.getRawLogs();
List<List<Object>> insetFrameTimeChartDataList = new ArrayList<List<Object>>();
if (currentFrameTimeIndex == 1) {
frameRateIndex = 1;
}
- GLStateDataMagerInstance.addGLAPIData(logData, frameRateIndex,
+ GLStateDataMaker.addGLAPIData(logData, frameRateIndex,
currentFrameTimeIndex);
+
+ checkFailedAPI(logData);
+
}
frameTimeDBTable.insertData(insetFrameTimeChartDataList);
}
+ private void checkFailedAPI(GLES20LogData logData) {
+ if (logData.getErrno() != GLES20ErrorDefine.EGL_SUCCESS
+ && logData.getErrno() != GLES20ErrorDefine.GL_SUCCESS) {
+ FailedData ffd = new FailedData(logData);
+ AnalyzerManager.getFailedChecker().getFailedList().add(ffd);
+ }
+ }
+
private void makeFrameRateChartDataList(GLES20LogData logData) {
int time = getTimeLieTime(logData);
for (FrameCountInfoType data : frameInfoList) {
frameRateData.setTime(time);
frameRateData.setStartFrameIndex(currentFrameTimeIndex);
frameRateData.setErrno(glFrameData.hasError());
+ frameRateData.setPid(logData.getPid());
frameRateData.addFrameCount();
frameInfoList.add(frameRateData);
}
framRateChartData.add(data.getFrameCount() - 1);
framRateChartData.add(data.getStartFrameIndex());
framRateChartData.add(data.hasErrno());
+ framRateChartData.add(data.getPid());
insetData.add(framRateChartData);
removeframeInfoList.add(data);
framRateChartData.add(data.getFrameCount());
framRateChartData.add(data.getStartFrameIndex());
framRateChartData.add(data.hasErrno());
+ framRateChartData.add(data.getPid());
insetData.add(framRateChartData);
removeframeInfoList.add(data);
}
framTimeChartData.add(glFrameData.hasError());
framTimeChartData.add(glFrameData.getStartSeq());
framTimeChartData.add(glFrameData.getEndSeq());
+ framTimeChartData.add(logData.getPid());
return framTimeChartData;
}
return apiDBTable;
}
- public GLStateDataMaker getStateDataMagerInstance() {
- return GLStateDataMagerInstance;
+ public GLStateDataMaker getStateDataMake() {
+ return GLStateDataMaker;
}
public GLFrameRateDBTableManager getFrameRateDBTableManager() {
return stateTextureDBTable;
}
+ public GLStateSharingDBTableManager getStateSharingDBTableManage() {
+ return stateSharingDBTable;
+ }
+
public boolean isShowFrameRateChart() {
return isShowFrameRateChart;
}
public void setStartFrameRateTime(int startFrameRateTime) {
this.startFrameRateTime = startFrameRateTime;
}
+
+ public void updateSharingContextList() {
+ this.sharingContextList = GLDataManager.getInstance()
+ .getStateSharingDBTableManage().selectSharingData();
+ }
+
+ public boolean isSharingData(long itemContextId) {
+ if (null == sharingContextList) {
+ return false;
+ }
+ for (int i = 0; i < sharingContextList.size(); i++) {
+ long contextId = sharingContextList.get(i).getContextId();
+ long sharingContextId = sharingContextList.get(i)
+ .getSharingContextId();
+ if (contextId == GLDataManager.getInstance().getSelectedContextID()
+ && sharingContextId == itemContextId) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ protected void makeData(LogPackage pack) {
+ Logs glesLogs = pack.getLogs(DataChannelConstants.MSG_PROBE_GLES20);
+ if (glesLogs != null && glesLogs.getRawLogs().size() != 0) {
+ makeGLData(glesLogs);
+ }
+ }
}
*/
package org.tizen.dynamicanalyzer.ui.opengl.data;
-import java.io.File;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.List;
-import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
-import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.constant.CommonConstants;
import org.tizen.dynamicanalyzer.database.DBColumn;
import org.tizen.dynamicanalyzer.database.DBConstants;
import org.tizen.dynamicanalyzer.database.DBTable;
import org.tizen.dynamicanalyzer.database.SqlConnectionManager;
import org.tizen.dynamicanalyzer.ui.opengl.data.type.FrameCountInfoType;
+import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
public class GLFrameRateDBTableManager extends DBTable {
private static final String TABLENAME = "GL_FRAME_RATE";//$NON-NLS-1$
public static final String FRAME_COUNT = "FRAME_COUNT";//$NON-NLS-1$
public static final String FRAME_INDEX = "FRAME_INDEX";//$NON-NLS-1$
public static final String ERROR_INFO = "ERROR_INFO";//$NON-NLS-1$
+ public static final String PID = DBConstants.COMMON_COLUMN_PID;
public final static int TABLE_CHART_TIME_INDEX = 0;
public final static int TABLE_FRAME_COUNT_INDEX = 1;
public final static int TABLE_FRAME_INDEX_INDEX = 2;
public final static int TABLE_ERROR_INFO_INDEX = 3;
+ public final static int TABLE_PID_INDEX = 4;
private static final String SELECT_FRAME_RATE_TABLE_QUERY = "select "//$NON-NLS-1$
+ CHART_TIME + CommonConstants.COMMA
+ FRAME_COUNT
+ CommonConstants.COMMA + FRAME_INDEX
+ CommonConstants.COMMA
- + ERROR_INFO + " from "//$NON-NLS-1$
+ + ERROR_INFO + CommonConstants.COMMA + PID + " from "//$NON-NLS-1$
+ TABLENAME + " where '%s' <= " + CHART_TIME + " and " + CHART_TIME//$NON-NLS-1$ //$NON-NLS-2$
+ " <= '%s'";//$NON-NLS-1$
+ private static final String SELECT_PID_FRAME_RATE_TABLE_QUERY = "select "//$NON-NLS-1$
+ + CHART_TIME + CommonConstants.COMMA
+ + FRAME_COUNT
+ + CommonConstants.COMMA + FRAME_INDEX
+ + CommonConstants.COMMA
+ + ERROR_INFO + CommonConstants.COMMA + PID + " from "//$NON-NLS-1$
+ + TABLENAME + " where '%s' <= " + CHART_TIME + " and " + CHART_TIME//$NON-NLS-1$ //$NON-NLS-2$
+ + " <= '%s' and " + PID + " = '%s'";//$NON-NLS-1$
+
@Override
public String getTableName() {
return TABLENAME;
DBConstants.INTEGER));
addColumn(new DBColumn(ERROR_INFO, DBConstants.NOT_NULL,
DBConstants.INTEGER));
+ addColumn(new DBColumn(PID, DBConstants.NOT_NULL, DBConstants.INTEGER));
}
public final void insert(List<List<Object>> data) {
}
public FrameCountInfoType selectFrameCountInfo(int startIndex, int endIndex) {
- if (null != AnalyzerManager.getProject()) {
- SqlConnectionManager.establishConnection(AnalyzerManager
- .getProject().getSavePath()
- + File.separator
- + AnalyzerConstants.DATABASE_NAME);
- }
String query = String.format(SELECT_FRAME_RATE_TABLE_QUERY, startIndex,
endIndex);
List<List<Object>> result = SqlConnectionManager.executeQuery(query);
}
public List<List<Object>> selectFrameRate(double startIndex, double endIndex) {
- if (null != AnalyzerManager.getProject()) {
- SqlConnectionManager.establishConnection(AnalyzerManager
- .getProject().getSavePath()
- + File.separator
- + AnalyzerConstants.DATABASE_NAME);
- }
- if (null != AnalyzerManager.getProject()) {
- SqlConnectionManager.establishConnection(AnalyzerManager
- .getProject().getSavePath()
- + File.separator
- + AnalyzerConstants.DATABASE_NAME);
- }
String query = String.format(SELECT_FRAME_RATE_TABLE_QUERY, startIndex,
endIndex);
+ if (ToolbarArea.getInstance().getSelectedPid() != 0) {
+ query = String.format(SELECT_PID_FRAME_RATE_TABLE_QUERY,
+ startIndex, endIndex, ToolbarArea.getInstance()
+ .getSelectedPid());
+ }
return SqlConnectionManager.executeQuery(query);
}
(Integer) (rowData.get(TABLE_FRAME_INDEX_INDEX)));
prep.setInt(TABLE_ERROR_INFO_INDEX + 1,
(Integer) (rowData.get(TABLE_ERROR_INFO_INDEX)));
+ prep.setInt(TABLE_PID_INDEX + 1,
+ (Integer) (rowData.get(TABLE_PID_INDEX)));
} catch (SQLException e) {
e.printStackTrace();
isPrepared = false;
*/
package org.tizen.dynamicanalyzer.ui.opengl.data;
-import java.io.File;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.List;
-import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
-import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.constant.CommonConstants;
import org.tizen.dynamicanalyzer.database.DBColumn;
import org.tizen.dynamicanalyzer.database.DBConstants;
import org.tizen.dynamicanalyzer.database.DBTable;
import org.tizen.dynamicanalyzer.database.SqlConnectionManager;
+import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
public class GLFrameTimeDBTableManager extends DBTable {
private static final String TABLENAME = "GL_FRAME_TIME";//$NON-NLS-1$
public static final String ERROR_INFO = "ERROR_INFO";//$NON-NLS-1$
public static final String START_SEQ = "START_SEQ";//$NON-NLS-1$
public static final String END_SEQ = "END_SEQ";//$NON-NLS-1$
+ public static final String PID = DBConstants.COMMON_COLUMN_PID;
public final static int TABLE_CHART_TIME_INDEX = 0;
public final static int TABLE_FRAME_RATE_INDEX = 1;
public final static int TABLE_ERROR_INFO_INDEX = 3;
public final static int TABLE_START_SEQ_INDEX = 4;
public final static int TABLE_END_SEQ_INDEX = 5;
+ public final static int TABLE_PID_INDEX = 6;
- private static final String SELECT_TOTALB_FRAME_TIME_TABLE_QUERY = "select "//$NON-NLS-1$
- + CHART_TIME
- + CommonConstants.COMMA
+ private static final String SELECT_TOTAL_FRAME_TIME_TABLE_QUERY = "select "//$NON-NLS-1$
+ + CHART_TIME + CommonConstants.COMMA
+ FRAME_RATE
+ + CommonConstants.COMMA + VALUE
+ CommonConstants.COMMA
- + VALUE
- + CommonConstants.COMMA
- + ERROR_INFO
- + CommonConstants.COMMA
+ + ERROR_INFO + CommonConstants.COMMA
+ START_SEQ
+ CommonConstants.COMMA + END_SEQ + " from "//$NON-NLS-1$
+ TABLENAME;
+ TABLENAME + " where '%s' <= " + CHART_TIME + " and "//$NON-NLS-1$//$NON-NLS-2$
+ CHART_TIME + " <= '%s'";//$NON-NLS-1$
+ private static final String SELECT_PID_FRAME_TIME_TABLE_QUERY = "select "//$NON-NLS-1$
+ + CHART_TIME + CommonConstants.COMMA
+ + FRAME_RATE
+ + CommonConstants.COMMA + VALUE
+ + CommonConstants.COMMA
+ + ERROR_INFO + CommonConstants.COMMA
+ + START_SEQ
+ + CommonConstants.COMMA + END_SEQ + " from "//$NON-NLS-1$
+ + TABLENAME + " where '%s' <= " + CHART_TIME + " and "//$NON-NLS-1$//$NON-NLS-2$
+ + CHART_TIME + " <= '%s' and " + PID + " = '%'";//$NON-NLS-1$
+
@Override
public String getTableName() {
return TABLENAME;
DBConstants.INTEGER));
addColumn(new DBColumn(END_SEQ, DBConstants.NOT_NULL,
DBConstants.INTEGER));
+ addColumn(new DBColumn(PID, DBConstants.NOT_NULL, DBConstants.INTEGER));
}
public int getFrameSize() {
- if (null != AnalyzerManager.getProject()) {
- SqlConnectionManager.establishConnection(AnalyzerManager
- .getProject().getSavePath()
- + File.separator
- + AnalyzerConstants.DATABASE_NAME);
- }
List<List<Object>> result = SqlConnectionManager
- .executeQuery(SELECT_TOTALB_FRAME_TIME_TABLE_QUERY);
+ .executeQuery(SELECT_TOTAL_FRAME_TIME_TABLE_QUERY);
if (null == result || result.size() == 0 || result.get(0).size() == 0) {
return 0;
} else {
}
public List<List<Object>> selectFrameTime(double startIndex, double endIndex) {
- if (null != AnalyzerManager.getProject()) {
- SqlConnectionManager.establishConnection(AnalyzerManager
- .getProject().getSavePath()
- + File.separator
- + AnalyzerConstants.DATABASE_NAME);
- }
String query = String.format(SELECT_FRAME_TIME_TABLE_QUERY, startIndex,
endIndex);
+ if (ToolbarArea.getInstance().getSelectedPid() != 0) {
+ query = String.format(SELECT_PID_FRAME_TIME_TABLE_QUERY,
+ startIndex, endIndex, ToolbarArea.getInstance()
+ .getSelectedPid());
+ }
+
return SqlConnectionManager.executeQuery(query);
}
@Override
public boolean prepare(PreparedStatement prep, List<Object> rowData) {
boolean isPrepared = true;
-
int columnsize = getColumnSize();
if (columnsize != rowData.size()) {
isPrepared = false;
(Integer) (rowData.get(TABLE_START_SEQ_INDEX)));
prep.setInt(TABLE_END_SEQ_INDEX + 1,
(Integer) (rowData.get(TABLE_END_SEQ_INDEX)));
+ prep.setInt(TABLE_PID_INDEX + 1,
+ (Integer) (rowData.get(TABLE_PID_INDEX)));
} catch (SQLException e) {
e.printStackTrace();
*/
package org.tizen.dynamicanalyzer.ui.opengl.data;
-import java.io.File;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
-import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
-import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.constant.CommonConstants;
import org.tizen.dynamicanalyzer.database.DBColumn;
import org.tizen.dynamicanalyzer.database.DBConstants;
}
public List<String> getContextData(String seq, long contextID) {
- if (null != AnalyzerManager.getProject()) {
- SqlConnectionManager.establishConnection(AnalyzerManager
- .getProject().getSavePath()
- + File.separator
- + AnalyzerConstants.DATABASE_NAME);
- }
String query = String.format(SELECT_CONTEXT_TABLE__QUERY, seq,
contextID);
List<List<Object>> result = SqlConnectionManager.executeQuery(query);
package org.tizen.dynamicanalyzer.ui.opengl.data;
import java.util.ArrayList;
+import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
import org.tizen.dynamicanalyzer.constant.CommonConstants;
import org.tizen.dynamicanalyzer.swap.model.data.GLES20LogData;
import org.tizen.dynamicanalyzer.ui.opengl.data.type.GLAPINameDefine;
import org.tizen.dynamicanalyzer.ui.opengl.data.type.GLConstantDefine;
import org.tizen.dynamicanalyzer.ui.opengl.data.type.GLContextNameEnum;
+import org.tizen.dynamicanalyzer.ui.opengl.data.type.GLES20ErrorDefine;
+import org.tizen.dynamicanalyzer.ui.opengl.data.type.GLSharingContextType;
import org.tizen.dynamicanalyzer.ui.opengl.data.type.GLStateProgramType;
import org.tizen.dynamicanalyzer.ui.opengl.data.type.GLStateShaderType;
import org.tizen.dynamicanalyzer.ui.opengl.data.type.GLStateTextureType;
import org.tizen.dynamicanalyzer.util.DALogger;
+import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
+import org.tizen.dynamicanalyzer.utils.DownloadContentfileManager;
public class GLStateDataMaker {
public static int API_TYPE_INIT = 0;
public static int API_TYPE_CONTEXT = 1;
public static int API_TYPE_NO_CONTEXT = 2;
- private List<GLStateProgramType> programList;
- private List<GLStateShaderType> shaderList;
- private List<GLStateTextureType> textureList;
-
private LinkedHashMap<Long, ContextValueType> contextHashMap;
public GLStateDataMaker() {
}
public void init() {
- programList = new ArrayList<GLStateProgramType>();
- shaderList = new ArrayList<GLStateShaderType>();
- textureList = new ArrayList<GLStateTextureType>();
contextHashMap = new LinkedHashMap<Long, ContextValueType>();
}
String parameter = logData.getArgs();
long errorNo = logData.getErrno();
long contextId = logData.getCurrentContextName();
- setContextValueList(contextId, seq,
- GLContextNameEnum.CONTEXT_ID.ordinal(),
- Long.toString(contextId), currentFrameRateIndex,
- currentFrameIndex);
String contextValue = logData.getContextValue().trim();
ContextValueType curretnContextValue = contextHashMap.get(contextId);
}
if (apiType == API_TYPE_INIT) {
- String contextValues[] = contextValue.split(CommonConstants.COMMA);
- int maxVertexAttribs = Integer.parseInt(contextValues[0]);
- int maxTextureUnits = Integer.parseInt(contextValues[1].trim());
-
+ int maxVertexAttribs = 0;
+ int maxTextureUnits = 0;
+ if (contextValue.contains(CommonConstants.COMMA)) {
+ String contextValues[] = contextValue
+ .split(CommonConstants.COMMA);
+ maxVertexAttribs = Integer.parseInt(contextValues[0]);
+ maxTextureUnits = Integer.parseInt(contextValues[1].trim());
+ } else {
+ maxVertexAttribs = 5;
+ maxTextureUnits = 5;
+ }
curretnContextValue.setTextureUnits(maxTextureUnits);
curretnContextValue.setVertexAttribs(maxVertexAttribs);
- } else if (apiType == API_TYPE_CONTEXT && errorNo == 0) {
+ } else if (apiType == API_TYPE_CONTEXT
+ && (errorNo == GLES20ErrorDefine.EGL_SUCCESS || errorNo == GLES20ErrorDefine.GL_SUCCESS)) {
String parameters[] = parameter.split(CommonConstants.COMMA
+ CommonConstants.SPACE);
String contextValues[] = contextValue.split(CommonConstants.COMMA);
viewPort.toString(), currentFrameRateIndex,
currentFrameIndex);
}
-
+ eglAPILogManager(logData, currentFrameRateIndex, currentFrameIndex);
programLogManage(logData);
textureLogManager(logData, currentFrameRateIndex, currentFrameIndex);
- }
+ }
}
- private void textureLogManager(GLES20LogData logData,
+ private void eglAPILogManager(GLES20LogData logData,
int currentFrameRateIndex, int currentFrameIndex) {
- int apiType = logData.getApiType();
- long errorNo = logData.getErrno();
- if (apiType == API_TYPE_CONTEXT && errorNo == 0) {
-
- String seq = String.valueOf(logData.getSeq());
- String apiName = logData.getApiName();
- String parameter = logData.getArgs();
- long contextId = logData.getCurrentContextName();
+ String seq = String.valueOf(logData.getSeq());
+ String apiName = logData.getApiName();
+ String parameter = logData.getArgs();
+ long contextId = logData.getCurrentContextName();
+ String parameters[] = parameter.split(CommonConstants.COMMA
+ + CommonConstants.SPACE);
+ String returnValue = logData.getReturn();
+ if (apiName.equals(GLAPINameDefine.API_EGL_CREATE_CONTEXT)) {
+ contextId = AnalyzerUtil.addrToLong(returnValue);
+ long sharingContextId = -1;
+ if (parameters.length > 2) {
+ sharingContextId = AnalyzerUtil.addrToLong(parameters[2]);
+ }
setContextValueList(contextId, seq,
GLContextNameEnum.CONTEXT_ID.ordinal(),
Long.toString(contextId), currentFrameRateIndex,
currentFrameIndex);
- String contextValue = logData.getContextValue().trim();
- String parameters[] = parameter.split(CommonConstants.COMMA
- + CommonConstants.SPACE);
- String contextValues[] = contextValue.split(CommonConstants.COMMA);
+ if (sharingContextId != 0) {
+ ContextValueType curretnContextValue = contextHashMap
+ .get(contextId);
+ curretnContextValue.addSharingContextID(contextHashMap,
+ sharingContextId);
+ }
- if (apiName.equals(GLAPINameDefine.API_GL_TEXTURE_ACTIVE)) {
- setContextValueList(contextId, seq,
- GLContextNameEnum.TEXTURE_ACTIVE.ordinal(),
- parameters[0], currentFrameRateIndex, currentFrameIndex);
- } else if (apiName.equals(GLAPINameDefine.API_GL_TEXTURE_GEN)) {
- int num = Integer.parseInt(parameters[0]);
+ List<GLSharingContextType> sharingInfoList = new ArrayList<GLSharingContextType>();
+ Set<Entry<Long, ContextValueType>> set = contextHashMap.entrySet();
+ Iterator<Entry<Long, ContextValueType>> itr = set.iterator();
+ while (itr.hasNext()) {
+ Map.Entry<Long, ContextValueType> e = (Map.Entry<Long, ContextValueType>) itr
+ .next();
+ ContextValueType contextValue = e.getValue();
+ for (int i = 0; i < contextValue.sharingContextIdList.size(); i++) {
+ sharingInfoList.add(new GLSharingContextType(
+ contextValue.contextID,
+ contextValue.sharingContextIdList.get(i)));
+ }
+ }
+ GLDataManager.getInstance().getStateSharingDBTableManage()
+ .insertSharingData(sharingInfoList);
+ }
- for (int i = 0; i < num; i++) {
- textureList.add(new GLStateTextureType(Integer
- .parseInt(contextValues[i].trim()), contextId,
- logData.getSeq()));
+ }
+
+ private void textureLogManager(GLES20LogData logData,
+ int currentFrameRateIndex, int currentFrameIndex) {
+
+ String seq = String.valueOf(logData.getSeq());
+ String apiName = logData.getApiName();
+ String parameter = logData.getArgs();
+ long contextId = logData.getCurrentContextName();
+ setContextValueList(contextId, seq,
+ GLContextNameEnum.CONTEXT_ID.ordinal(),
+ Long.toString(contextId), currentFrameRateIndex,
+ currentFrameIndex);
+ String contextValue = logData.getContextValue().trim();
+ String parameters[] = parameter.split(CommonConstants.COMMA
+ + CommonConstants.SPACE);
+ String contextValues[] = contextValue.split(CommonConstants.COMMA);
+ ContextValueType curretnContextValue = contextHashMap.get(contextId);
+
+ if (apiName.equals(GLAPINameDefine.API_GL_TEXTURE_ACTIVE)) {
+ setContextValueList(contextId, seq,
+ GLContextNameEnum.TEXTURE_ACTIVE.ordinal(), parameters[0],
+ currentFrameRateIndex, currentFrameIndex);
+ } else if (apiName.equals(GLAPINameDefine.API_GL_TEXTURE_GEN)) {
+ int num = Integer.parseInt(parameters[0]);
+
+ for (int i = 0; i < num; i++) {
+ curretnContextValue.textureList.add(new GLStateTextureType(
+ Integer.parseInt(contextValues[i].trim()), contextId,
+ logData.getSeq()));
+ }
+ } else if (apiName.equals(GLAPINameDefine.API_GL_TEXTURE_BIND)) {
+ for (int i = 0; i < curretnContextValue.textureList.size(); i++) {
+ if (curretnContextValue.textureList.get(i).getObjID() == Integer
+ .parseInt(parameters[1].trim())
+ && curretnContextValue.textureList.get(i)
+ .getContextID() == contextId) {
+ curretnContextValue.textureList.get(i).setTrxtureType(
+ Integer.parseInt(parameters[0].trim()));
}
- } else if (apiName.equals(GLAPINameDefine.API_GL_TEXTURE_BIND)) {
- for (int i = 0; i < textureList.size(); i++) {
- if (textureList.get(i).getObjID() == Integer
- .parseInt(parameters[1].trim())
- && textureList.get(i).getContextID() == contextId) {
- textureList.get(i).setTrxtureType(
+ }
+ } else if (apiName.equals(GLAPINameDefine.API_GL_TEXTURE_DEL)) {
+ int num = Integer.parseInt(parameters[0]);
+
+ for (int i = 0; i < num; i++) {
+ for (int j = 0; j < curretnContextValue.textureList.size(); j++) {
+ if (curretnContextValue.textureList.get(j).getObjID() == Integer
+ .parseInt(parameters[0].trim())
+ && curretnContextValue.textureList.get(j)
+ .getContextID() == contextId) {
+ curretnContextValue.textureList.get(j).setTrxtureType(
Integer.parseInt(parameters[0].trim()));
}
}
- } else if (apiName.equals(GLAPINameDefine.API_GL_TEXTURE_DEL)) {
- int num = Integer.parseInt(parameters[0]);
+ }
+ } else if (apiName.equals(GLAPINameDefine.API_GL_TEXTURE_PARAM_F)
+ || apiName.equals(GLAPINameDefine.API_GL_TEXTURE_PARAM_I)) {
- for (int i = 0; i < num; i++) {
- for (int j = 0; j < textureList.size(); j++) {
- if (textureList.get(j).getObjID() == Integer
- .parseInt(parameters[0].trim())
- && textureList.get(j).getContextID() == contextId) {
- textureList.get(j).setTrxtureType(
- Integer.parseInt(parameters[0].trim()));
- }
- }
- }
- } else if (apiName.equals(GLAPINameDefine.API_GL_TEXTURE_PARAM_F)
- || apiName.equals(GLAPINameDefine.API_GL_TEXTURE_PARAM_I)) {
-
- for (int i = 0; i < textureList.size(); i++) {
- if (textureList.get(i).getContextID() == contextId) {
- if (textureList.get(i).getTrxtureType() == Integer
- .parseInt(parameters[0].trim())) {
-
- if (parameters[1]
- .equals(GLAPINameDefine.GL_TEXTURE_MAG_FILTER)) {
- textureList.get(i).setMagFilter(
- Integer.parseInt(parameters[2]));
- } else if (parameters[1]
- .equals(GLAPINameDefine.GL_TEXTURE_MIN_FILTER)) {
- textureList.get(i).setMinFilter(
- Integer.parseInt(parameters[2]));
- } else if (parameters[1]
- .equals(GLAPINameDefine.GL_TEXTURE_WRAP_S)) {
- textureList.get(i).setWrapS(
- Integer.parseInt(parameters[2]));
- } else if (parameters[1]
- .equals(GLAPINameDefine.GL_TEXTURE_WRAP_T)) {
- textureList.get(i).setWrapT(
- Integer.parseInt(parameters[2]));
- } else {
- DALogger.getInstance().error(
- "undefine type : " + parameters[1]);
- }
+ for (int i = 0; i < curretnContextValue.textureList.size(); i++) {
+ if (curretnContextValue.textureList.get(i).getContextID() == contextId) {
+ if (curretnContextValue.textureList.get(i).getTrxtureType() == Integer
+ .parseInt(parameters[0].trim())) {
+
+ if (parameters[1]
+ .equals(GLAPINameDefine.GL_TEXTURE_MAG_FILTER)) {
+ curretnContextValue.textureList.get(i)
+ .setMagFilter(
+ Integer.parseInt(parameters[2]));
+ } else if (parameters[1]
+ .equals(GLAPINameDefine.GL_TEXTURE_MIN_FILTER)) {
+ curretnContextValue.textureList.get(i)
+ .setMinFilter(
+ Integer.parseInt(parameters[2]));
+ } else if (parameters[1]
+ .equals(GLAPINameDefine.GL_TEXTURE_WRAP_S)) {
+ curretnContextValue.textureList.get(i).setWrapS(
+ Integer.parseInt(parameters[2]));
+ } else if (parameters[1]
+ .equals(GLAPINameDefine.GL_TEXTURE_WRAP_T)) {
+ curretnContextValue.textureList.get(i).setWrapT(
+ Integer.parseInt(parameters[2]));
+ } else {
+ DALogger.getInstance().error(
+ "undefine type : " + parameters[1]);
}
}
}
- insertTextureData();
- } else if (apiName.equals(GLAPINameDefine.API_GL_TEXTURE_PARAM_FV)
- || apiName.equals(GLAPINameDefine.API_GL_TEXTURE_PARAM_IV)) {
+ }
+ insertTextureData();
+ } else if (apiName.equals(GLAPINameDefine.API_GL_TEXTURE_PARAM_FV)
+ || apiName.equals(GLAPINameDefine.API_GL_TEXTURE_PARAM_IV)) {
- for (int i = 0; i < textureList.size(); i++) {
- if (textureList.get(i).getObjID() == Integer
- .parseInt(parameters[0].trim())
- && textureList.get(i).getContextID() == contextId) {
- if (textureList.get(i).getTrxtureType() == Integer
- .parseInt(parameters[0].trim())) {
-
- if (parameters[1]
- .equals(GLAPINameDefine.GL_TEXTURE_MAG_FILTER)) {
- textureList.get(i).setMagFilter(
- Integer.parseInt(parameters[2]));
- } else if (parameters[1]
- .equals(GLAPINameDefine.GL_TEXTURE_MIN_FILTER)) {
- textureList.get(i).setMinFilter(
- Integer.parseInt(parameters[2]));
- } else if (parameters[1]
- .equals(GLAPINameDefine.GL_TEXTURE_WRAP_S)) {
- textureList.get(i).setWrapS(
- Integer.parseInt(parameters[2]));
- } else if (parameters[1]
- .equals(GLAPINameDefine.GL_TEXTURE_WRAP_T)) {
- textureList.get(i).setWrapT(
- Integer.parseInt(parameters[2]));
- }
+ for (int i = 0; i < curretnContextValue.textureList.size(); i++) {
+ if (curretnContextValue.textureList.get(i).getObjID() == Integer
+ .parseInt(parameters[0].trim())
+ && curretnContextValue.textureList.get(i)
+ .getContextID() == contextId) {
+ if (curretnContextValue.textureList.get(i).getTrxtureType() == Integer
+ .parseInt(parameters[0].trim())) {
+
+ if (parameters[1]
+ .equals(GLAPINameDefine.GL_TEXTURE_MAG_FILTER)) {
+ curretnContextValue.textureList.get(i)
+ .setMagFilter(
+ Integer.parseInt(parameters[2]));
+ } else if (parameters[1]
+ .equals(GLAPINameDefine.GL_TEXTURE_MIN_FILTER)) {
+ curretnContextValue.textureList.get(i)
+ .setMinFilter(
+ Integer.parseInt(parameters[2]));
+ } else if (parameters[1]
+ .equals(GLAPINameDefine.GL_TEXTURE_WRAP_S)) {
+ curretnContextValue.textureList.get(i).setWrapS(
+ Integer.parseInt(parameters[2]));
+ } else if (parameters[1]
+ .equals(GLAPINameDefine.GL_TEXTURE_WRAP_T)) {
+ curretnContextValue.textureList.get(i).setWrapT(
+ Integer.parseInt(parameters[2]));
}
}
}
- insertTextureData();
}
+ insertTextureData();
}
}
private void insertTextureData() {
- for (int i = 0; i < textureList.size(); i++) {
- if (textureList.get(i).validInsertState()) {
- GLDataManager.getInstance().getStateTextureDBTableManage()
- .insertData(textureList.get(i));
- textureList.remove(i);
- break;
+ Set<Entry<Long, ContextValueType>> set = contextHashMap.entrySet();
+ Iterator<Entry<Long, ContextValueType>> itr = set.iterator();
+ while (itr.hasNext()) {
+ Map.Entry<Long, ContextValueType> e = (Map.Entry<Long, ContextValueType>) itr
+ .next();
+ ContextValueType contextValue = e.getValue();
+ for (int i = 0; i < contextValue.textureList.size(); i++) {
+ if (contextValue.textureList.get(i).validInsertState()) {
+ GLDataManager.getInstance().getStateTextureDBTableManage()
+ .insertData(contextValue.textureList.get(i));
+ contextValue.textureList.remove(i);
+ break;
+ }
}
}
-
}
private void programLogManage(GLES20LogData logData) {
- int apiType = logData.getApiType();
- long errorNo = logData.getErrno();
- if (apiType == API_TYPE_CONTEXT && errorNo == 0) {
+ String apiName = logData.getApiName();
+ String parameter = logData.getArgs();
+ String contextValue = logData.getContextValue().trim();
+ String returnValue = logData.getReturn();
+ String parameters[] = parameter.split(CommonConstants.COMMA
+ + CommonConstants.SPACE);
+ String contextID = Long.toString(logData.getCurrentContextName());
+ long contextId = logData.getCurrentContextName();
+ ContextValueType curretnContextValue = contextHashMap.get(contextId);
- String apiName = logData.getApiName();
- String parameter = logData.getArgs();
- String contextValue = logData.getContextValue().trim();
- String returnValue = logData.getReturn();
- String parameters[] = parameter.split(CommonConstants.COMMA
- + CommonConstants.SPACE);
- String contextID = Long.toString(logData.getCurrentContextName());
-
- if (apiName.equals(GLAPINameDefine.API_GL_SHADER_CREATE)) {
- int shaderID = Integer.parseInt(returnValue);
- int shaderType = Integer.parseInt(parameter);
- GLStateShaderType stateShaderType = new GLStateShaderType(
- shaderID);
- stateShaderType.setShaderType(shaderType);
- shaderList.add(stateShaderType);
-
- } else if (apiName.equals(GLAPINameDefine.API_GL_SHADER_SOURCE)) {
- int shaderID = Integer.parseInt(parameters[0]);
- for (int i = 0; i < shaderList.size(); i++) {
- if (shaderList.get(i).getId() == shaderID) {
- shaderList.get(i).setShaderSrc(contextValue);
- return;
- }
+ if (apiName.equals(GLAPINameDefine.API_GL_SHADER_CREATE)) {
+ int shaderID = Integer.parseInt(returnValue);
+ int shaderType = Integer.parseInt(parameter);
+ GLStateShaderType stateShaderType = new GLStateShaderType(
+ contextId, shaderID);
+ stateShaderType.setShaderType(shaderType);
+ curretnContextValue.shaderList.add(stateShaderType);
+
+ } else if (apiName.equals(GLAPINameDefine.API_GL_SHADER_SOURCE)) {
+ int shaderID = Integer.parseInt(parameters[0]);
+ for (int i = 0; i < curretnContextValue.shaderList.size(); i++) {
+ if (curretnContextValue.shaderList.get(i).getId() == shaderID) {
+ curretnContextValue.shaderList.get(i).setShaderSrc(
+ DownloadContentfileManager
+ .getDowonloadFilePath(contextValue));
+ return;
}
- } else if (apiName.equals(GLAPINameDefine.API_GL_SHADER_COMPILE)) {
- int shaderID = Integer.parseInt(parameter);
- for (int i = 0; i < shaderList.size(); i++) {
- if (shaderList.get(i).getId() == shaderID) {
- shaderList.get(i).setCompileStatus(1);
- return;
- }
+ }
+ } else if (apiName.equals(GLAPINameDefine.API_GL_SHADER_COMPILE)) {
+ int shaderID = Integer.parseInt(parameter);
+ for (int i = 0; i < curretnContextValue.shaderList.size(); i++) {
+ if (curretnContextValue.shaderList.get(i).getId() == shaderID) {
+ curretnContextValue.shaderList.get(i).setCompileStatus(1);
+ return;
}
}
+ }
- else if (apiName.equals(GLAPINameDefine.API_GL_SHADER_DEL)) {
- int shaderId = Integer.parseInt(parameter);
- for (int i = 0; i < shaderList.size(); i++) {
- if (shaderList.get(i).getId() == shaderId) {
- shaderList.get(i).setDeleteStatus(1);
- break;
- }
+ else if (apiName.equals(GLAPINameDefine.API_GL_SHADER_DEL)) {
+ int shaderId = Integer.parseInt(parameter);
+ for (int i = 0; i < curretnContextValue.shaderList.size(); i++) {
+ if (curretnContextValue.shaderList.get(i).getId() == shaderId) {
+ curretnContextValue.shaderList.get(i).setDeleteStatus(1);
+ break;
}
}
+ }
- else if (apiName.equals(GLAPINameDefine.API_GL_PROGRAM_CREATE)) {
- int programID = Integer.parseInt(returnValue);
- GLStateProgramType stateProgramType = new GLStateProgramType(
- programID);
- programList.add(stateProgramType);
- } else if (apiName
- .equals(GLAPINameDefine.API_GL_PROGRAM_ATTACH_SHADER)) {
- int programID = Integer.parseInt(parameters[0]);
- int shaderID = Integer.parseInt(parameters[1]);
-
- boolean isFragementShaser = false;
- for (int i = 0; i < shaderList.size(); i++) {
- if (shaderList.get(i).getId() == shaderID) {
- if (shaderList.get(i).isFragementShader()) {
- isFragementShaser = true;
- } else {
- isFragementShaser = false;
- }
- break;
+ else if (apiName.equals(GLAPINameDefine.API_GL_PROGRAM_CREATE)) {
+ int programID = Integer.parseInt(returnValue);
+ GLStateProgramType stateProgramType = new GLStateProgramType(
+ programID);
+ curretnContextValue.programList.add(stateProgramType);
+ } else if (apiName.equals(GLAPINameDefine.API_GL_PROGRAM_ATTACH_SHADER)) {
+ int programID = Integer.parseInt(parameters[0]);
+ int shaderID = Integer.parseInt(parameters[1]);
+
+ boolean isFragementShaser = false;
+ for (int i = 0; i < curretnContextValue.shaderList.size(); i++) {
+ if (curretnContextValue.shaderList.get(i).getId() == shaderID) {
+ if (curretnContextValue.shaderList.get(i)
+ .isFragementShader()) {
+ isFragementShaser = true;
+ } else {
+ isFragementShaser = false;
}
+ break;
}
+ }
- for (int i = 0; i < programList.size(); i++) {
- if (programList.get(i).getId() == programID) {
- if (isFragementShaser) {
- programList.get(i).setFragmentShaderId(shaderID);
- } else {
- programList.get(i).setVertexShaderId(shaderID);
- }
- return;
+ for (int i = 0; i < curretnContextValue.programList.size(); i++) {
+ if (curretnContextValue.programList.get(i).getId() == programID) {
+ if (isFragementShaser) {
+ curretnContextValue.programList.get(i)
+ .setFragmentShaderId(shaderID);
+ } else {
+ curretnContextValue.programList.get(i)
+ .setVertexShaderId(shaderID);
}
+ return;
}
- } else if (apiName.equals(GLAPINameDefine.API_GL_PROGRAM_LINK)) {
- int programID = Integer.parseInt(parameter);
- for (int i = 0; i < programList.size(); i++) {
- if (programList.get(i).getId() == programID) {
- programList.get(i).setLinkStatus(1);
- break;
- }
+ }
+ } else if (apiName.equals(GLAPINameDefine.API_GL_PROGRAM_LINK)) {
+ int programID = Integer.parseInt(parameter);
+ for (int i = 0; i < curretnContextValue.programList.size(); i++) {
+ if (curretnContextValue.programList.get(i).getId() == programID) {
+ curretnContextValue.programList.get(i).setLinkStatus(1);
+ break;
}
- } else if (apiName
- .equals(GLAPINameDefine.API_GL_PROGRAM_DETATCH_SHADER)) {
- int programID = Integer.parseInt(parameters[0]);
- int shaderID = Integer.parseInt(parameters[1]);
- boolean isFragementShaser = false;
- for (int i = 0; i < shaderList.size(); i++) {
- if (shaderList.get(i).getId() == shaderID) {
- if (shaderList.get(i).isFragementShader()) {
- isFragementShaser = true;
- } else {
- isFragementShaser = false;
- }
- break;
+ }
+ } else if (apiName
+ .equals(GLAPINameDefine.API_GL_PROGRAM_DETATCH_SHADER)) {
+ int programID = Integer.parseInt(parameters[0]);
+ int shaderID = Integer.parseInt(parameters[1]);
+ boolean isFragementShaser = false;
+ for (int i = 0; i < curretnContextValue.shaderList.size(); i++) {
+ if (curretnContextValue.shaderList.get(i).getId() == shaderID) {
+ if (curretnContextValue.shaderList.get(i)
+ .isFragementShader()) {
+ isFragementShaser = true;
+ } else {
+ isFragementShaser = false;
}
+ break;
}
+ }
- for (int i = 0; i < programList.size(); i++) {
- if (programList.get(i).getId() == programID) {
- if (isFragementShaser) {
- programList.get(i).setFragmentShaderId(-1);
- } else {
- programList.get(i).setVertexShaderId(-1);
- }
- return;
+ for (int i = 0; i < curretnContextValue.programList.size(); i++) {
+ if (curretnContextValue.programList.get(i).getId() == programID) {
+ if (isFragementShaser) {
+ curretnContextValue.programList.get(i)
+ .setFragmentShaderId(-1);
+ } else {
+ curretnContextValue.programList.get(i)
+ .setVertexShaderId(-1);
}
+ return;
}
+ }
- } else if (apiName.equals(GLAPINameDefine.API_GL_PROGRAM_USE)) {
- int programId = Integer.parseInt(parameter);
- for (int i = 0; i < programList.size(); i++) {
- if (programList.get(i).getId() == programId) {
- programList.get(i).setContextName(
- Integer.parseInt(contextID));
- break;
- }
+ } else if (apiName.equals(GLAPINameDefine.API_GL_PROGRAM_USE)) {
+ long programId = Long.parseLong(parameter);
+ for (int i = 0; i < curretnContextValue.programList.size(); i++) {
+ if (curretnContextValue.programList.get(i).getId() == programId) {
+ curretnContextValue.programList.get(i).setContextId(
+ Integer.parseInt(contextID));
+ break;
}
+ }
- } else if (apiName.equals(GLAPINameDefine.API_GL_PROGRAM_DEL)) {
- int programId = Integer.parseInt(parameter);
- for (int i = 0; i < programList.size(); i++) {
- if (programList.get(i).getId() == programId) {
- programList.get(i).setDeleteStatus(1);
- break;
- }
+ } else if (apiName.equals(GLAPINameDefine.API_GL_PROGRAM_DEL)) {
+ int programId = Integer.parseInt(parameter);
+ for (int i = 0; i < curretnContextValue.programList.size(); i++) {
+ if (curretnContextValue.programList.get(i).getId() == programId) {
+ curretnContextValue.programList.get(i).setDeleteStatus(1);
+ break;
}
}
}
}
public List<GLStateProgramType> getProgramList() {
+ List<GLStateProgramType> programList = new ArrayList<GLStateProgramType>();
+ Set<Entry<Long, ContextValueType>> set = contextHashMap.entrySet();
+ Iterator<Entry<Long, ContextValueType>> itr = set.iterator();
+ while (itr.hasNext()) {
+ Map.Entry<Long, ContextValueType> e = (Map.Entry<Long, ContextValueType>) itr
+ .next();
+ ContextValueType contextValue = e.getValue();
+ for (int i = 0; i < contextValue.programList.size(); i++) {
+ programList.add(contextValue.programList.get(i));
+ }
+ }
return programList;
}
public List<GLStateShaderType> getShaderList() {
+ List<GLStateShaderType> shaderList = new ArrayList<GLStateShaderType>();
+ Set<Entry<Long, ContextValueType>> set = contextHashMap.entrySet();
+ Iterator<Entry<Long, ContextValueType>> itr = set.iterator();
+ while (itr.hasNext()) {
+ Map.Entry<Long, ContextValueType> e = (Map.Entry<Long, ContextValueType>) itr
+ .next();
+ ContextValueType contextValue = e.getValue();
+ for (int i = 0; i < contextValue.shaderList.size(); i++) {
+ shaderList.add(contextValue.shaderList.get(i));
+ }
+ }
return shaderList;
}
*/
package org.tizen.dynamicanalyzer.ui.opengl.data;
-import java.io.File;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
-import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
-import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.constant.CommonConstants;
import org.tizen.dynamicanalyzer.database.DBColumn;
import org.tizen.dynamicanalyzer.database.DBConstants;
public List<Object> selectLastChangedSeq(long contextId, int stateIndex,
long seq) {
- if (null != AnalyzerManager.getProject()) {
- SqlConnectionManager.establishConnection(AnalyzerManager
- .getProject().getSavePath()
- + File.separator
- + AnalyzerConstants.DATABASE_NAME);
- }
String query = String.format(SELECT_LAST_CHANGED_SEQ_QUERY, contextId,
stateIndex, seq);
List<List<Object>> result = SqlConnectionManager.executeQuery(query);
public List<Object> selectNextChangedSeq(long contextId, int stateIndex,
long seq) {
- if (null != AnalyzerManager.getProject()) {
- SqlConnectionManager.establishConnection(AnalyzerManager
- .getProject().getSavePath()
- + File.separator
- + AnalyzerConstants.DATABASE_NAME);
-
- }
String query = String.format(SELECT_NEXT_CHANGED_SEQ_QUERY, contextId,
stateIndex, seq);
List<List<Object>> result = SqlConnectionManager.executeQuery(query);
*/
package org.tizen.dynamicanalyzer.ui.opengl.data;
-import java.io.File;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
-import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
-import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.constant.CommonConstants;
import org.tizen.dynamicanalyzer.database.DBColumn;
import org.tizen.dynamicanalyzer.database.DBConstants;
public static final String COMPILE_STATUS = "COMPILE_STATUS"; // only shader//$NON-NLS-1$
public static final String FRAGMENT_ID = "FRAGMENT_ID"; // only program//$NON-NLS-1$
public static final String VERTEX_ID = "VERTEX_ID"; // only program//$NON-NLS-1$
- public static final String CONTEXT_NAME = "CONTEXT_NAME"; // only program//$NON-NLS-1$
+ public static final String CONTEXT_ID = "CONTEXT_ID"; // only program//$NON-NLS-1$
private static final String SELECT_QUERY = "select " + TYPE//$NON-NLS-1$
+ CommonConstants.COMMA + ID + CommonConstants.COMMA + SHADER_SRC
+ CommonConstants.COMMA + DELETE_STATUS + CommonConstants.COMMA
+ LINK_STATUS + CommonConstants.COMMA + COMPILE_STATUS
+ CommonConstants.COMMA + FRAGMENT_ID + CommonConstants.COMMA
- + VERTEX_ID + CommonConstants.COMMA + CONTEXT_NAME + " from "
+ + VERTEX_ID + CommonConstants.COMMA + CONTEXT_ID + " from "
+ TABLENAME;
public final static int TABLE_TYPE_INDEX = 0;
DBConstants.INTEGER));
addColumn(new DBColumn(VERTEX_ID, DBConstants.NOT_NULL,
DBConstants.INTEGER));
- addColumn(new DBColumn(CONTEXT_NAME, DBConstants.NOT_NULL,
- DBConstants.INTEGER));
+ addColumn(new DBColumn(CONTEXT_ID, DBConstants.NOT_NULL,
+ DBConstants.LONG));
}
public void insertData() {
List<GLStateProgramType> programList = GLDataManager.getInstance()
- .getStateDataMagerInstance().getProgramList();
+ .getStateDataMake().getProgramList();
List<List<Object>> insertObjectList = new ArrayList<List<Object>>();
for (int i = 0; i < programList.size(); i++) {
itemList.add(STATUS_NULL);
itemList.add(programType.getFragmentShaderId());
itemList.add(programType.getVertexShaderId());
- itemList.add(programType.getContextName());
+ itemList.add(programType.getContextId());
insertObjectList.add(itemList);
}
List<GLStateShaderType> shaderList = GLDataManager.getInstance()
- .getStateDataMagerInstance().getShaderList();
+ .getStateDataMake().getShaderList();
for (int i = 0; i < shaderList.size(); i++) {
GLStateShaderType shaderType = shaderList.get(i);
itemList.add(shaderType.getCompileStatus());
itemList.add(STATUS_NULL);
itemList.add(STATUS_NULL);
- itemList.add(STATUS_NULL);
+ itemList.add(shaderType.getContextId());
insertObjectList.add(itemList);
}
insertData(insertObjectList);
}
public void initProgramData() {
- if (null != AnalyzerManager.getProject()) {
- SqlConnectionManager.establishConnection(AnalyzerManager
- .getProject().getSavePath()
- + File.separator
- + AnalyzerConstants.DATABASE_NAME);
- }
List<List<Object>> result = SqlConnectionManager
.executeQuery(SELECT_QUERY);
if (null == result || result.size() == 0 || result.get(0).size() == 0) {
TABLE_FRAGMENT_ID_INDEX));
programType.setVertexShaderId((Integer) result.get(i).get(
TABLE_VERTEX_ID_INDEX));
- programType.setContextName((Integer) result.get(i).get(
+ programType.setContextId((Integer) result.get(i).get(
TABLE_CONTEXT_NAME_INDEX));
- GLDataManager.getInstance().getStateDataMagerInstance()
- .getProgramList().add(programType);
+ GLDataManager.getInstance().getStateDataMake().getProgramList()
+ .add(programType);
} else {
GLStateShaderType shaderType = new GLStateShaderType(
- (Integer) result.get(i).get(1));
- shaderType.setShaderSrc((String) result.get(i).get(2));
- shaderType.setDeleteStatus((Integer) result.get(i).get(3));
- shaderType.setCompileStatus((Integer) result.get(i).get(4));
- GLDataManager.getInstance().getStateDataMagerInstance()
- .getShaderList().add(shaderType);
+ (Long) result.get(i).get(TABLE_CONTEXT_NAME_INDEX),
+ (Integer) result.get(i).get(TABLE_ID_INDEX));
+ shaderType.setShaderSrc((String) result.get(i).get(
+ TABLE_SHADER_SRC_INDEX));
+ shaderType.setDeleteStatus((Integer) result.get(i).get(
+ TABLE_DELETE_STATUS_INDEX));
+ shaderType.setCompileStatus((Integer) result.get(i).get(
+ TABLE_LINK_STATUS_INDEX));
+ GLDataManager.getInstance().getStateDataMake().getShaderList()
+ .add(shaderType);
}
}
}
@Override
public boolean prepare(PreparedStatement prep, List<Object> rowData) {
boolean isPrepared = true;
-
int columnsize = getColumnSize();
if (columnsize != rowData.size()) {
isPrepared = false;
(Integer) (rowData.get(TABLE_FRAGMENT_ID_INDEX)));
prep.setInt(TABLE_VERTEX_ID_INDEX + 1,
(Integer) (rowData.get(TABLE_VERTEX_ID_INDEX)));
- prep.setInt(TABLE_CONTEXT_NAME_INDEX + 1,
- (Integer) (rowData.get(TABLE_CONTEXT_NAME_INDEX)));
+ prep.setLong(TABLE_CONTEXT_NAME_INDEX + 1,
+ (Long) (rowData.get(TABLE_CONTEXT_NAME_INDEX)));
} catch (SQLException e) {
e.printStackTrace();
isPrepared = false;
--- /dev/null
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2013 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.opengl.data;
+
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.tizen.dynamicanalyzer.constant.CommonConstants;
+import org.tizen.dynamicanalyzer.database.DBColumn;
+import org.tizen.dynamicanalyzer.database.DBConstants;
+import org.tizen.dynamicanalyzer.database.DBTable;
+import org.tizen.dynamicanalyzer.database.SqlConnectionManager;
+import org.tizen.dynamicanalyzer.ui.opengl.data.type.GLSharingContextType;
+
+public class GLStateSharingDBTableManager extends DBTable {
+ private static final String TABLENAME = "GL_SHARING";//$NON-NLS-1$
+
+ public static final String CONTEXT_ID = "CONTEXT_ID";//$NON-NLS-1$
+ public static final String SHARING_CONTEXT_ID = "SHARING_CONTEXT_ID";//$NON-NLS-1$
+
+ public final static int TABLE_CONTEXT_ID_INDEX = 0;
+ public final static int TABLE_SHARING_CONTEXT_ID_INDEX = 1;
+
+ private static final String SELECT_QUERY = "select "//$NON-NLS-1$
+ + CONTEXT_ID + CommonConstants.COMMA
+ + SHARING_CONTEXT_ID
+ + " from " + TABLENAME;//$NON-NLS-1$
+
+ List<GLSharingContextType> savedSharingInfoList = null;
+
+ @Override
+ public String getTableName() {
+ return TABLENAME;
+ }
+
+ public GLStateSharingDBTableManager() {
+ addColumn(new DBColumn(CONTEXT_ID, DBConstants.NOT_NULL,
+ DBConstants.LONG));
+ addColumn(new DBColumn(SHARING_CONTEXT_ID, DBConstants.NOT_NULL,
+ DBConstants.LONG));
+ savedSharingInfoList = new ArrayList<GLSharingContextType>();
+ }
+
+ public void insertSharingData(List<GLSharingContextType> sharingInfoList) {
+ List<List<Object>> insertList = new ArrayList<List<Object>>();
+ for (int i = 0; i < sharingInfoList.size(); i++) {
+ GLSharingContextType insertSharingType = sharingInfoList.get(i);
+ boolean isSavedData = false;
+ for (int j = 0; j < savedSharingInfoList.size(); j++) {
+ GLSharingContextType savedSharingType = savedSharingInfoList
+ .get(j);
+ if (savedSharingType.getContextId() == insertSharingType
+ .getContextId()
+ && savedSharingType.getSharingContextId() == insertSharingType
+ .getSharingContextId()) {
+ isSavedData = true;
+ break;
+ }
+ }
+ if (!isSavedData) {
+ List<Object> objectList = new ArrayList<Object>();
+ objectList.add(insertSharingType.getContextId());
+ objectList.add(insertSharingType.getSharingContextId());
+ insertList.add(objectList);
+ savedSharingInfoList.add(insertSharingType);
+ }
+ }
+
+ insertData(insertList);
+ }
+
+ public List<GLSharingContextType> selectSharingData() {
+ List<List<Object>> result = SqlConnectionManager
+ .executeQuery(SELECT_QUERY);
+ if (null == result || result.size() == 0 || result.get(0).size() == 0) {
+ return null;
+ }
+
+ List<GLSharingContextType> sharingInfoList = new ArrayList<GLSharingContextType>();
+
+ for (int i = 0; i < result.size(); i++) {
+ long contextId = (Long) result.get(i).get(TABLE_CONTEXT_ID_INDEX);
+ long sharingContextId = (Long) result.get(i).get(
+ TABLE_SHARING_CONTEXT_ID_INDEX);
+
+ sharingInfoList.add(new GLSharingContextType(contextId,
+ sharingContextId));
+ }
+
+ return sharingInfoList;
+ }
+
+ @Override
+ public boolean prepare(PreparedStatement prep, List<Object> rowData) {
+ boolean isPrepared = true;
+ int columnsize = getColumnSize();
+ if (columnsize != rowData.size()) {
+ isPrepared = false;
+ } else {
+ try {
+ prep.setLong(TABLE_CONTEXT_ID_INDEX + 1,
+ (Long) (rowData.get(TABLE_CONTEXT_ID_INDEX)));
+ prep.setLong(TABLE_SHARING_CONTEXT_ID_INDEX + 1,
+ (Long) (rowData.get(TABLE_SHARING_CONTEXT_ID_INDEX)));
+ } catch (SQLException e) {
+ e.printStackTrace();
+ isPrepared = false;
+ }
+ }
+ return isPrepared;
+ }
+
+}
*/
package org.tizen.dynamicanalyzer.ui.opengl.data;
-import java.io.File;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
-import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
-import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.constant.CommonConstants;
import org.tizen.dynamicanalyzer.database.DBColumn;
import org.tizen.dynamicanalyzer.database.DBConstants;
}
public List<GLStateTextureType> select() {
- if (null != AnalyzerManager.getProject()) {
- SqlConnectionManager.establishConnection(AnalyzerManager
- .getProject().getSavePath()
- + File.separator
- + AnalyzerConstants.DATABASE_NAME);
- }
List<List<Object>> result = SqlConnectionManager
.executeQuery(SELECT_QUERY);
if (null == result || result.size() == 0 || result.get(0).size() == 0) {
public class ContextValueType {
private static final int CONTEXT_VALUE_SIZE = GLContextNameEnum.values().length;
- private long contextID = -1;
+ public long contextID = -1;
+
+ public List<Long> sharingContextIdList = null;
+
+ public List<GLStateProgramType> programList;
+ public List<GLStateShaderType> shaderList;
+ public List<GLStateTextureType> textureList;
+
private List<String> defaultValueList = null;
private List<String> preValueList = null;
private List<String> currentValueList = null;
vboSizeMap = new LinkedHashMap<String, String>();
vboDataMap = new LinkedHashMap<String, String>();
vboUsageMap = new LinkedHashMap<String, String>();
+
+ programList = new ArrayList<GLStateProgramType>();
+ shaderList = new ArrayList<GLStateShaderType>();
+ textureList = new ArrayList<GLStateTextureType>();
+
+ sharingContextIdList = new ArrayList<Long>();
}
public void setVertexAttribs(int size) {
}
return list;
}
+
+ public void addSharingContextID(
+ LinkedHashMap<Long, ContextValueType> contextMap,
+ long sharingContextId) {
+
+ sharingContextIdList.add(sharingContextId);
+ ContextValueType sharingContextValueType = contextMap
+ .get(sharingContextId);
+
+ // update sharingContextIdList of current contextValueType from
+ // sharingContextID of all shared contextValueType
+ for (int i = 0; i < sharingContextValueType.sharingContextIdList.size(); i++) {
+ long savedSharingContextId = sharingContextValueType.sharingContextIdList
+ .get(i);
+ if (savedSharingContextId == contextID
+ || savedSharingContextId == sharingContextId) {
+ return;
+ }
+ for (int j = 0; j < sharingContextIdList.size(); j++) {
+ long ContextId = sharingContextIdList.get(j);
+ if (savedSharingContextId == ContextId) {
+ return;
+ }
+ }
+
+ sharingContextIdList.add(savedSharingContextId);
+ }
+
+ sharingContextValueType.addSharingContextID(contextMap, contextID);
+
+ // update sharingContextIdList of all shared contextValueType from
+ // current sharingContextId
+ for (int i = 0; i < sharingContextValueType.sharingContextIdList.size(); i++) {
+ long savedSharingContextId = sharingContextValueType.sharingContextIdList
+ .get(i);
+ if (savedSharingContextId == contextID
+ || savedSharingContextId == sharingContextId) {
+ return;
+ }
+ ContextValueType savedSharingContextValueType = contextMap
+ .get(savedSharingContextId);
+
+ savedSharingContextValueType.addSharingContextID(contextMap,
+ contextID);
+ }
+ }
}
private int endFrameIndex = 0;
private int frameCount = 0;
private int errno = 0;
+ private int pid = 0;
public int getTime() {
return time;
public void setEndFrameIndex(int endFrameIndex) {
this.endFrameIndex = endFrameIndex;
}
+
+ public int getPid() {
+ return pid;
+ }
+
+ public void setPid(int pid) {
+ this.pid = pid;
+ }
}
public static final String API_GL_ENABLE = "glEnable";//$NON-NLS-1$
public static final String API_EGL_SWAPBUFFERS = "eglSwapBuffers";//$NON-NLS-1$
public static final String API_SGL_SWAPBUFFERS = "_SglSwapBuffers";//$NON-NLS-1$
+
+ //EGL
+ public static final String API_EGL_CREATE_CONTEXT = "_SglCreateContext";//$NON-NLS-1$
+
}
defaultContextHashMap.put("BLEND_SRC_RGB", "1"); //$NON-NLS-1$
defaultContextHashMap.put("BLEND_SRC_ALPHA", "1"); //$NON-NLS-1$
- defaultContextHashMap.put("CULLING_ENABLED", CommonConstants.DISABLE); //$NON-NLS-1$
+ defaultContextHashMap.put("CULLING_ENABLED", CommonConstants.ENABLE); //$NON-NLS-1$
defaultContextHashMap.put("CULLING_ORIENTATION", "2305"); //$NON-NLS-1$
defaultContextHashMap.put("CULLING_MODE", "1029"); //$NON-NLS-1$
- defaultContextHashMap.put("DEPTH_ENABLED", CommonConstants.DISABLE); //$NON-NLS-1$
+ defaultContextHashMap.put("DEPTH_ENABLED", CommonConstants.ENABLE); //$NON-NLS-1$
defaultContextHashMap.put("DEPTH_FUNC", "513"); //$NON-NLS-1$
defaultContextHashMap.put("DEPTH_RANGE_N", "0"); //$NON-NLS-1$
- defaultContextHashMap.put("DEPTH_RANGE_F", "1"); //$NON-NLS-1$
+ defaultContextHashMap.put("DEPTH_RANGE_F", "0"); //$NON-NLS-1$
- defaultContextHashMap.put("DITHER_ENABLED", CommonConstants.DISABLE); //$NON-NLS-1$
+ defaultContextHashMap.put("DITHER_ENABLED", CommonConstants.ENABLE); //$NON-NLS-1$
defaultContextHashMap.put("FRAME_BUFFER_BINDING", "0"); //$NON-NLS-1$
--- /dev/null
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Hyunjong Park <phjwithyou.park@samsung.com>
+ * Sanghyun Lee <sanghyunnim.lee@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.dynamicanalyzer.ui.opengl.data.type;
+
+public class GLSharingContextType {
+ private long contextId = -1;
+ private long sharingContextId = -1;
+
+ public GLSharingContextType(long contextId, long sharingContextId) {
+ this.contextId = contextId;
+ this.sharingContextId = sharingContextId;
+ }
+
+ public long getContextId() {
+ return contextId;
+ }
+
+ public void setContextId(long contextId) {
+ this.contextId = contextId;
+ }
+
+ public long getSharingContextId() {
+ return sharingContextId;
+ }
+
+ public void setSharingContextId(long sharingContextId) {
+ this.sharingContextId = sharingContextId;
+ }
+
+}
\ No newline at end of file
private int deleteStatus = -1;
private int fragmentShaderId = -1;
private int vertexShaderId = -1;
- private int contextName = -1;
+ private long contextId = -1;
public GLStateProgramType(int id) {
setId(id);
this.vertexShaderId = vertexShaderId;
}
- public int getContextName() {
- return contextName;
+ public long getContextId() {
+ return contextId;
}
- public void setContextName(int contextName) {
- this.contextName = contextName;
+ public void setContextId(long contextId) {
+ this.contextId = contextId;
}
}
\ No newline at end of file
public static int GL_FRAGMENT_SHADER = 1;
public static int GL_VERTEX_SHADER = 2;
+ private long contextId = -1;
private int id = -1;
private int shaderType = -1;
private String shaderSrc = CommonConstants.EMPTY;
private int deleteStatus = -1;
private int compileStatus = -1;
- public GLStateShaderType(int id) {
+ public GLStateShaderType(long contextId, int id) {
+ setContextId(contextId);
setId(id);
}
this.compileStatus = compileStatus;
}
+ public long getContextId() {
+ return contextId;
+ }
+
+ public void setContextId(long contextId) {
+ this.contextId = contextId;
+ }
+
}
\ No newline at end of file
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
+import org.tizen.dynamicanalyzer.common.DASelectionData;
import org.tizen.dynamicanalyzer.constant.CommonConstants;
import org.tizen.dynamicanalyzer.nl.GLPageLabels;
import org.tizen.dynamicanalyzer.resources.ColorResources;
+import org.tizen.dynamicanalyzer.swap.model.data.LogData;
import org.tizen.dynamicanalyzer.ui.opengl.GLPage;
import org.tizen.dynamicanalyzer.ui.opengl.data.GLDataManager;
import org.tizen.dynamicanalyzer.ui.opengl.data.type.FrameCountInfoType;
import org.tizen.dynamicanalyzer.ui.opengl.data.type.GLSelectionData;
+import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
import org.tizen.dynamicanalyzer.widgets.da.view.DAViewComposite;
import org.tizen.dynamicanalyzer.widgets.da.view.DAViewData;
GLSelectionData data = (GLSelectionData) vdata;
String id = data.getViewID();
if (id.equals(GLPage.chartViewID)) {
+ int startFrameIndex = data.getFrameTimeIndex();
int endFrameIndex = data.getSecondFrameIndex();
- int frameIndex = data.getFrameTimeIndex();
- if (GLDataManager.getInstance().isShowFrameRateChart()) {
+
+ if (startFrameIndex == endFrameIndex) {
title = GLPageLabels.GL_API_LIST_VIEW_TITLE
- + CommonConstants.OPEN_BRACKET + frameIndex
- + CommonConstants.DASH + endFrameIndex
+ + CommonConstants.OPEN_BRACKET + startFrameIndex
+ GLPageLabels.GL_FRAME
+ CommonConstants.CLOSE_BRACKET;
-
} else {
title = GLPageLabels.GL_API_LIST_VIEW_TITLE
- + CommonConstants.OPEN_BRACKET + frameIndex
+ + CommonConstants.OPEN_BRACKET + startFrameIndex
+ + CommonConstants.DASH + endFrameIndex
+ GLPageLabels.GL_FRAME
+ CommonConstants.CLOSE_BRACKET;
}
setTitle(title);
- glAPIListTable.updateTableFromChart(frameIndex, endFrameIndex);
+ glAPIListTable.updateTableFromChart(startFrameIndex,
+ endFrameIndex);
} else if (id.equals(GLPage.contextHistoryID)) {
if (GLDataManager.getInstance().isShowFrameRateChart()) {
frameRateIndex = GLDataManager.getInstance()
.getStartFrameRateTime();
}
-
- FrameCountInfoType selectionFrameCountInfo = GLDataManager
- .getInstance().getFrameRateStartIndex(
- frameRateIndex, frameRateIndex);
- if (null == selectionFrameCountInfo) {
- return;
- }
- int startFrameIndex = selectionFrameCountInfo
- .getStartFrameIndex();
-
- int endFrameIdnex = selectionFrameCountInfo
- .getEndFrameIndex();
- title = GLPageLabels.GL_API_LIST_VIEW_TITLE
- + CommonConstants.OPEN_BRACKET + startFrameIndex
- + CommonConstants.DASH + endFrameIdnex
- + GLPageLabels.GL_FRAME
- + CommonConstants.CLOSE_BRACKET;
-
- setTitle(title);
- glAPIListTable.updateTableFromContext(startFrameIndex,
- endFrameIdnex, data.getSeq());
+ setSelectedAPI(frameRateIndex, data.getSeq());
} else {
int frameIndex = data.getFrameTimeIndex();
title = GLPageLabels.GL_API_LIST_VIEW_TITLE
frameIndex, data.getSeq());
}
}
+ } else if (vdata instanceof DASelectionData) {
+ DASelectionData selData = (DASelectionData) vdata;
+ Object obData = selData.getData();
+ LogData ldata = (LogData) obData;
+ long dataTime = ldata.getTime();
+ double selectionTime = dataTime / TimelineConstants.MEGA_DOUBLE;
+ if (selectionTime <= 1) {
+ selectionTime = GLDataManager.getInstance()
+ .getStartFrameRateTime();
+ }
+ setSelectedAPI((int) selectionTime,
+ Integer.toString(ldata.getSeq()));
}
+ }
+
+ private void setSelectedAPI(int selectionTime, String seq) {
+ FrameCountInfoType selectionFrameCountInfo = GLDataManager
+ .getInstance().getFrameRateStartIndex(selectionTime,
+ selectionTime);
+ if (null == selectionFrameCountInfo) {
+ return;
+ }
+ int startFrameIndex = selectionFrameCountInfo.getStartFrameIndex();
+
+ int endFrameIdnex = selectionFrameCountInfo.getEndFrameIndex();
+ title = GLPageLabels.GL_API_LIST_VIEW_TITLE
+ + CommonConstants.OPEN_BRACKET + startFrameIndex
+ + CommonConstants.DASH + endFrameIdnex + GLPageLabels.GL_FRAME
+ + CommonConstants.CLOSE_BRACKET;
+ setTitle(title);
+ glAPIListTable.updateTableFromContext(startFrameIndex, endFrameIdnex,
+ seq);
}
@Override
for (int i = 0; i < size; i++) {
if (i == GLContextNameEnum.RID.ordinal()
|| i == GLContextNameEnum.SEQ.ordinal()
- || i == GLContextNameEnum.CONTEXT_ID.ordinal()) {
+ || i == GLContextNameEnum.CONTEXT_ID.ordinal()
+ || i == GLContextNameEnum.TEXTURE_ACTIVE.ordinal()) {
continue;
}
}
if (isInteger(currentValue)) {
- if (i != GLContextNameEnum.TEXTURE_ACTIVE.ordinal()) {
- String glConstantDefine = GLConstantDefine
- .getConstantString(currentValue);
- if (null != glConstantDefine) {
- defaultValue = glConstantDefine;
- currentValue = glConstantDefine;
- }
+ String glConstantDefine = GLConstantDefine
+ .getConstantString(currentValue);
+ if (null != glConstantDefine) {
+ defaultValue = glConstantDefine;
+ currentValue = glConstantDefine;
}
}
text.add(stateName);
private List<String> selectedStateValueList = null;
private String selectedSeq = CommonConstants.EMPTY;
private boolean isCheckedBox = true;
- private Image checkImg = ImageResources.CHECKBOX_SELECTED;
+ private Image checkImg = ImageResources.OPENGL_SHOW_ONLY_CHANGED_SELECTED;
private String[] columnNames = { GLPageLabels.GL_CONTEXT_VIEW_NAME,
GLPageLabels.GL_CONTEXT_VIEW_DEFAULT_VALUE,
if (width - checkBoxOffSet <= event.x && event.x <= width) {
if (isCheckedBox) {
isCheckedBox = false;
- checkImg = ImageResources.CHECKBOX_UNSELECTED;
+ checkImg = ImageResources.OPENGL_SHOW_ONLY_CHANGED_UNSELECTED;
} else {
isCheckedBox = true;
- checkImg = ImageResources.CHECKBOX_SELECTED;
+ checkImg = ImageResources.OPENGL_SHOW_ONLY_CHANGED_SELECTED;
}
titleBar.redraw();
tableComp.setSelectedSeq(isCheckedBox, selectedSeq,
List<TableInput> input = new ArrayList<TableInput>();
+ GLDataManager.getInstance().updateSharingContextList();
+
List<GLStateProgramType> programList = GLDataManager.getInstance()
- .getStateDataMagerInstance().getProgramList();
+ .getStateDataMake().getProgramList();
int size = programList.size();
Long.parseLong(programId));
String contextName = GLPageLabels.GL_CONTEXT
- + programList.get(i).getContextName();
+ + programList.get(i).getContextId();
String programID = GLPageLabels.GL_PROGRAM + programId;
String vertexShaderID = GLPageLabels.GL_SHADER
+ programList.get(i).getVertexShaderId();
tableInput.setData(tableData);
input.add(tableInput);
- int contextID = programList.get(i).getContextName();
+ long contextID = programList.get(i).getContextId();
if (GLDataManager.getInstance().getSelectedContextID() == contextID) {
tableInput.setInRange(true);
}
+ if (GLDataManager.getInstance().isSharingData(contextID)) {
+ tableInput.setInRange(true);
+ }
}
return input;
List<TableInput> input = new ArrayList<TableInput>();
+ GLDataManager.getInstance().updateSharingContextList();
+
List<GLStateTextureType> textureList = GLDataManager.getInstance()
.getStateTextureDBTableManage().select();
+ if (null == textureList) {
+ return null;
+ }
int size = textureList.size();
for (int i = 0; i < size; i++) {
if (GLDataManager.getInstance().getSelectedContextID() == contextID) {
tableInput.setInRange(true);
}
-
+ if (GLDataManager.getInstance().isSharingData(contextID)) {
+ tableInput.setInRange(true);
+ }
}
return input;
}
// create tab view in base composite
tabView = new DATabComposite(parent, SWT.DOUBLE_BUFFERED);
- tabView.setTabWidth(110);
+ tabView.setTabWidth(114);
+ tabView.isImageTab(true);
{
DABaseComposite timelinePage = new TimelinePage(
tabView.getContentComposite(), SWT.NONE);
import org.tizen.dynamicanalyzer.swap.model.data.LogData;
import org.tizen.dynamicanalyzer.swap.model.data.ProfileData;
import org.tizen.dynamicanalyzer.ui.toolbar.configuration.ConfigurationDialogDataManager;
-import org.tizen.dynamicanalyzer.util.DALogger;
public class FunctionUsageProfiler extends PageDataManager {
- private static final DALogger DA_LOG = DALogger.getInstance();
-
// default sampling rate = 10 ms
- public static long SAMPLE_TIME = 10;
+ public static long SAMPLE_TIME = -1;
public static final String APPLICATION = SummaryLabels.FUNCTION_USAGE_PROFILER_APPLICATION;
public static final String DEPENDENT_LIB = SummaryLabels.FUNCTION_USAGE_PROFILER_DEPENDENT_LIB;
public static final String APPLICATION_KEY = "profiling_app_bin_key";//$NON-NLS-1$
private static FunctionUsageProfiler instance = null;
private HashMap<Integer, ProfileDataMaker> profileDataMakerMap = null;
+
/**
* key: symbol(child) or file path (parent) - value : sequence num of
* profiling data. all parent and child data is in
return instance;
}
- /*** profiling thread ***/
- @Override
- public void run() {
- SAMPLE_TIME = ConfigurationDialogDataManager
- .getInstance()
- .getfeatureValue(
- ConfigureLabels.FUNCTION_PROFILING_SAMPLING_PERIODIC);
+ public static void clear() {
+ instance = null;
+ }
- while (!AnalyzerManager.isExit()) {
- LogPackage pack = pollPack();
- if (pack == null) // stop thread
- break;
+ @Override
+ protected void makeData(LogPackage pack) {
+ if (SAMPLE_TIME < 0) {
+ SAMPLE_TIME = ConfigurationDialogDataManager
+ .getInstance()
+ .getfeatureValue(
+ ConfigureLabels.FUNCTION_PROFILING_SAMPLING_PERIODIC);
+ }
- Logs logs = pack.getLogs(DataChannelConstants.MSG_DATA_SAMPLE);
- if (null != logs && logs.getRawLogs().size() != 0) {
- List<LogData> sample = logs.getLogs();
- int size = sample.size();
- for (int i = 0; i < size; i++) {
- getInstance().getProfileDataMakerByPid(
- sample.get(i).getPid())
- .makeFunctionUsageProfileData(
- (ProfileData) sample.get(i));
- }
+ Logs logs = pack.getLogs(DataChannelConstants.MSG_DATA_SAMPLE);
+ if (null != logs && logs.getRawLogs().size() != 0) {
+ List<LogData> sample = logs.getLogs();
+ int size = sample.size();
+ for (int i = 0; i < size; i++) {
+ getInstance().getProfileDataMakerByPid(sample.get(i).getPid())
+ .makeFunctionUsageProfileData(
+ (ProfileData) sample.get(i));
}
}
-
- /* log for debug */
- DA_LOG.debug(getName() + " thread end!!"); //$NON-NLS-1$
- }
-
- public static void clear() {
- instance = null;
}
}
}
addrs.add(0, selfAddr);
} else {
- // DA_LOG.debug("makeFunctionUsageProfileData : cannot find seq by time");
+ DA_LOG.debug("makeFunctionUsageProfileData : cannot find seq by time");
addrs = new ArrayList<Long>();
addrs.add(selfAddr);
}
import java.util.List;
-import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants;
import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
import org.tizen.dynamicanalyzer.swap.logparser.Logs;
import org.tizen.dynamicanalyzer.swap.model.data.LogData;
import org.tizen.dynamicanalyzer.ui.thread.sync.ThreadPageSyncDataManager;
import org.tizen.dynamicanalyzer.ui.thread.thread.ThreadPageThreadDataManager;
-import org.tizen.dynamicanalyzer.util.DALogger;
import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
public class ThreadChartManager extends PageDataManager {
- private static final DALogger DA_LOG = DALogger.getInstance();
-
private static ThreadChartManager instance = null;
private ThreadPageThreadDataManager tManager;
sManager.clear();
}
- @Override
- public void run() {
- while (!AnalyzerManager.isExit()) {
- LogPackage pack = pollPack();
- if (pack == null) // stop thread;
- break;
-
- List<LogData> loadInputs = getLogsFromLogPackage(pack,
- DataChannelConstants.MSG_DATA_SYSTEM);
- if (null != loadInputs) {
- int logSize = loadInputs.size();
- for (int i = 0; i < logSize; i++) {
- tManager.parseLoad(loadInputs.get(i));
- }
- }
-
- List<LogData> threadInputs = getLogsFromLogPackage(pack,
- DataChannelConstants.MSG_PROBE_THREAD);
- if (null != threadInputs) {
- int logSize = threadInputs.size();
- for (int i = 0; i < logSize; i++) {
- tManager.parseAPI(threadInputs.get(i));
- }
- }
-
- List<LogData> syncInputs = getLogsFromLogPackage(pack,
- DataChannelConstants.MSG_PROBE_SYNC);
- if (null != syncInputs) {
- int logSize = syncInputs.size();
- for (int i = 0; i < logSize; i++) {
- tManager.parseSync(syncInputs.get(i));
- sManager.parseSync(syncInputs.get(i));
- }
- }
- }
-
- /* log for debug */
- DA_LOG.debug(getName() + " thread end!!"); //$NON-NLS-1$
- }
-
public int getItemIndexByTid(String tid) {
return tManager.getItemIndexByTid(tid);
}
tManager.setBoard(threadBoard);
sManager.setBoard(syncBoard);
}
+
+ @Override
+ protected void makeData(LogPackage pack) {
+ List<LogData> loadInputs = getLogsFromLogPackage(pack,
+ DataChannelConstants.MSG_DATA_SYSTEM);
+ if (null != loadInputs) {
+ int logSize = loadInputs.size();
+ for (int i = 0; i < logSize; i++) {
+ tManager.parseLoad(loadInputs.get(i));
+ }
+ }
+
+ List<LogData> threadInputs = getLogsFromLogPackage(pack,
+ DataChannelConstants.MSG_PROBE_THREAD);
+ if (null != threadInputs) {
+ int logSize = threadInputs.size();
+ for (int i = 0; i < logSize; i++) {
+ tManager.parseAPI(threadInputs.get(i));
+ }
+ }
+
+ List<LogData> syncInputs = getLogsFromLogPackage(pack,
+ DataChannelConstants.MSG_PROBE_SYNC);
+ if (null != syncInputs) {
+ int logSize = syncInputs.size();
+ for (int i = 0; i < logSize; i++) {
+ tManager.parseSync(syncInputs.get(i));
+ sManager.parseSync(syncInputs.get(i));
+ }
+ }
+ }
}
isPrepared = false;
} else {
try {
- prep.setLong(1, (Long) (rowData.get(0)));
- prep.setInt(2, (Integer) (rowData.get(1)));
- prep.setFloat(3, (Float) (rowData.get(2)));
- prep.setFloat(4, (Float) (rowData.get(3)));
+ prep.setLong(1, (Long) (rowData.get(COLUMN.TIME.ordinal())));
+ prep.setInt(2, (Integer) (rowData.get(COLUMN.CORE_NUM.ordinal())));
+ prep.setFloat(3, (Float) (rowData.get(COLUMN.CPU_LOAD.ordinal())));
+ prep.setFloat(4, (Float) (rowData.get(COLUMN.CPU_FREQUENCY.ordinal())));
} catch (SQLException e) {
e.printStackTrace();
isPrepared = false;
isPrepared = false;
} else {
try {
- prep.setLong(1, (Long) (rowData.get(0)));
- prep.setInt(2, (Integer) (rowData.get(1)));
- prep.setFloat(3, (Float) (rowData.get(2)));
+ prep.setLong(1, (Long) (rowData.get(COLUMN.TIME.ordinal())));
+ prep.setInt(2, (Integer) (rowData.get(COLUMN.CHART_HANDLE.ordinal())));
+ prep.setFloat(3, (Float) (rowData.get(COLUMN.CHART_VALUE.ordinal())));
} catch (SQLException e) {
e.printStackTrace();
isPrepared = false;
isPrepared = false;
} else {
try {
- prep.setLong(1, (Long) (rowData.get(0)));
- prep.setInt(2, (Integer) (rowData.get(1)));
- prep.setInt(3, (Integer) (rowData.get(2)));
- prep.setInt(4, (Integer) (rowData.get(3)));
+ prep.setLong(1, (Long) (rowData.get(COLUMN.TIME.ordinal())));
+ prep.setInt(2, (Integer) (rowData.get(COLUMN.DEVICE_NUM.ordinal())));
+ prep.setInt(3, (Integer) (rowData.get(COLUMN.ENERGY_USAGE_DEVICE.ordinal())));
+ prep.setInt(4, (Integer) (rowData.get(COLUMN.ENERGY_USAGE_APP.ordinal())));
} catch (SQLException e) {
e.printStackTrace();
isPrepared = false;
isPrepared = false;
} else {
try {
- prep.setLong(1, (Long) (rowData.get(0)));
- prep.setInt(2, (Integer) (rowData.get(1)));
- prep.setFloat(3, (Float) (rowData.get(2)));
+ prep.setLong(1, (Long) (rowData.get(COLUMN.TIME.ordinal())));
+ prep.setInt(2, (Integer) (rowData.get(COLUMN.PID.ordinal())));
+ prep.setFloat(3, (Float) (rowData.get(COLUMN.CPU_LOAD.ordinal())));
} catch (SQLException e) {
e.printStackTrace();
isPrepared = false;
isPrepared = false;
} else {
try {
- prep.setLong(1, (Long) (rowData.get(0)));
- prep.setString(2, (String) (rowData.get(1)));
- prep.setInt(3, (Integer) (rowData.get(2)));
+ prep.setLong(1, (Long) (rowData.get(COLUMN.TIME.ordinal())));
+ prep.setString(2, (String) (rowData.get(COLUMN.IMAGE_FILE_PATH.ordinal())));
+ prep.setInt(3, (Integer) (rowData.get(COLUMN.IMAGE_ORIENTATION.ordinal())));
} catch (SQLException e) {
e.printStackTrace();
isPrepared = false;
isPrepared = false;
} else {
try {
- prep.setLong(1, (Long) (rowData.get(0)));
- prep.setFloat(2, (Float) (rowData.get(1)));
- prep.setFloat(3, (Float) (rowData.get(2)));
- prep.setInt(4, (Integer) (rowData.get(3)));
- prep.setLong(5, (Long) (rowData.get(4)));
- prep.setLong(6, (Long) (rowData.get(5)));
- prep.setInt(7, (Integer) (rowData.get(6)));
- prep.setInt(8, (Integer) (rowData.get(7)));
- prep.setInt(9, (Integer) (rowData.get(8)));
- prep.setInt(10, (Integer) (rowData.get(9)));
- prep.setLong(11, (Long) (rowData.get(10)));
- prep.setLong(12, (Long) (rowData.get(11)));
- prep.setInt(13, (Integer) (rowData.get(12)));
- prep.setInt(14, (Integer) (rowData.get(13)));
- prep.setInt(15, (Integer) (rowData.get(14)));
- prep.setInt(16, (Integer) (rowData.get(15)));
- prep.setInt(17, (Integer) (rowData.get(16)));
- prep.setInt(18, (Integer) (rowData.get(17)));
- prep.setInt(19, (Integer) (rowData.get(18)));
- prep.setInt(20, (Integer) (rowData.get(19)));
- prep.setInt(21, (Integer) (rowData.get(20)));
- prep.setInt(22, (Integer) (rowData.get(21)));
- prep.setInt(23, (Integer) (rowData.get(22)));
- prep.setInt(24, (Integer) (rowData.get(23)));
- prep.setInt(25, (Integer) (rowData.get(24)));
- prep.setInt(26, (Integer) (rowData.get(25)));
- prep.setInt(27, (Integer) (rowData.get(26)));
- prep.setInt(28, (Integer) (rowData.get(27)));
- prep.setInt(29, (Integer) (rowData.get(28)));
- prep.setInt(30, (Integer) (rowData.get(29)));
- prep.setInt(31, (Integer) (rowData.get(30)));
- prep.setInt(32, (Integer) (rowData.get(31)));
- prep.setInt(33, (Integer) (rowData.get(32)));
+ prep.setLong(1, (Long) (rowData.get(COLUMN.TIME.ordinal())));
+ prep.setFloat(2, (Float) (rowData.get(COLUMN.CPU_LOAD_APP.ordinal())));
+ prep.setFloat(3, (Float) (rowData.get(COLUMN.CPU_LOAD_TOTAL.ordinal())));
+ prep.setInt(4, (Integer) (rowData.get(COLUMN.PROCESS_COUNT.ordinal())));
+ prep.setLong(5, (Long) (rowData.get(COLUMN.HEAP_ALLOCATION_TOTAL.ordinal())));
+ prep.setLong(6, (Long) (rowData.get(COLUMN.HEAP_ALLOCATION_APP.ordinal())));
+ prep.setInt(7, (Integer) (rowData.get(COLUMN.MEMORY_VIRTUAL.ordinal())));
+ prep.setInt(8, (Integer) (rowData.get(COLUMN.MEMORY_RESIDENT.ordinal())));
+ prep.setInt(9, (Integer) (rowData.get(COLUMN.MEMORY_SHARED.ordinal())));
+ prep.setInt(10, (Integer) (rowData.get(COLUMN.MEMORY_PSS.ordinal())));
+ prep.setLong(11, (Long) (rowData.get(COLUMN.MEMORY_TOTAL_SYSTEM.ordinal())));
+ prep.setLong(12, (Long) (rowData.get(COLUMN.MEMORY_USAGE_SYSTEM.ordinal())));
+ prep.setInt(13, (Integer) (rowData.get(COLUMN.NETWORK_SIZE_SEND.ordinal())));
+ prep.setInt(14, (Integer) (rowData.get(COLUMN.NETWORK_SIZE_RECEIVE.ordinal())));
+ prep.setInt(15, (Integer) (rowData.get(COLUMN.DEVICE_STATUS_WIFI.ordinal())));
+ prep.setInt(16, (Integer) (rowData.get(COLUMN.DEVICE_STATUS_BLUETOOTH.ordinal())));
+ prep.setInt(17, (Integer) (rowData.get(COLUMN.DEVICE_STATUS_GPS.ordinal())));
+ prep.setInt(18, (Integer) (rowData.get(COLUMN.DEVICE_STATUS_BRIGHTNESS.ordinal())));
+ prep.setInt(19, (Integer) (rowData.get(COLUMN.DEVICE_STATUS_DNET.ordinal())));
+ prep.setInt(20, (Integer) (rowData.get(COLUMN.DEVICE_STATUS_CAMERA.ordinal())));
+ prep.setInt(21, (Integer) (rowData.get(COLUMN.DEVICE_STATUS_SOUND.ordinal())));
+ prep.setInt(22, (Integer) (rowData.get(COLUMN.DEVICE_STATUS_AUDIO.ordinal())));
+ prep.setInt(23, (Integer) (rowData.get(COLUMN.DEVICE_STATUS_VIBRATION.ordinal())));
+ prep.setInt(24, (Integer) (rowData.get(COLUMN.DEVICE_STATUS_VOLTAGE.ordinal())));
+ prep.setInt(25, (Integer) (rowData.get(COLUMN.DEVICE_STATUS_RSSI.ordinal())));
+ prep.setInt(26, (Integer) (rowData.get(COLUMN.DEVICE_STATUS_VIDEO.ordinal())));
+ prep.setInt(27, (Integer) (rowData.get(COLUMN.DEVICE_STATUS_CALL.ordinal())));
+ prep.setInt(28, (Integer) (rowData.get(COLUMN.DISK_TOTAL_USAGE.ordinal())));
+ prep.setInt(29, (Integer) (rowData.get(COLUMN.DISK_IO_READ_SIZE.ordinal())));
+ prep.setInt(30, (Integer) (rowData.get(COLUMN.DISK_IO_READ_SECTOR.ordinal())));
+ prep.setInt(31, (Integer) (rowData.get(COLUMN.DISK_IO_WRITE_SIZE.ordinal())));
+ prep.setInt(32, (Integer) (rowData.get(COLUMN.DISK_IO_WRITE_SECTOR.ordinal())));
+ prep.setInt(33, (Integer) (rowData.get(COLUMN.ENERGY_USAGE.ordinal())));
} catch (SQLException e) {
e.printStackTrace();
isPrepared = false;
isPrepared = false;
} else {
try {
- prep.setLong(1, (Long) (rowData.get(0)));
- prep.setInt(2, (Integer) (rowData.get(1)));
- prep.setInt(3, (Integer) (rowData.get(2)));
- prep.setInt(4, (Integer) (rowData.get(3)));
- prep.setInt(5, (Integer) (rowData.get(4)));
- prep.setString(6, (String) (rowData.get(5)));
- prep.setInt(7, (Integer) (rowData.get(6)));
+ prep.setLong(1, (Long) (rowData.get(COLUMN.TIME.ordinal())));
+ prep.setInt(2, (Integer) (rowData.get(COLUMN.EVENT_TYPE.ordinal())));
+ prep.setInt(3, (Integer) (rowData.get(COLUMN.DETAIL_TYPE.ordinal())));
+ prep.setInt(4, (Integer) (rowData.get(COLUMN.POINT_X.ordinal())));
+ prep.setInt(5, (Integer) (rowData.get(COLUMN.POINT_Y.ordinal())));
+ prep.setString(6, (String) (rowData.get(COLUMN.INFO_INTEGER.ordinal())));
+ prep.setInt(7, (Integer) (rowData.get(COLUMN.INFO_INTEGER.ordinal())));
} catch (SQLException e) {
e.printStackTrace();
isPrepared = false;
DAChartSeries chartSeries = new DAChartSeries(
TimelineChartLabels.CPU_CORE_CHART_SERIES_NAME_CORE + i,
DAChartSeries.SERIES_STYLE_LINE,
- coreChartSeriesColors[i % ColorResources.MAX_SERIES_COLOR_COUNT]);
+ coreChartSeriesColors[i % coreSize]);
chart.addSeries(chartSeries);
coreChartSeriesList.add(chartSeries);
}
DAChartSeries chartSeries =
new DAChartSeries(TimelineChartLabels.CPU_CORE_CHART_SERIES_NAME_CORE + i,
DAChartSeries.SERIES_STYLE_LINE,
- coreChartSeriesColors[i % ColorResources.MAX_SERIES_COLOR_COUNT]);
+ coreChartSeriesColors[i % coreSize]);
chart.addSeries(chartSeries);
coreFrequencyChartSeriesList.add(chartSeries);
}
import java.util.List;
import java.util.Map;
-import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.common.GlobalInformation;
import org.tizen.dynamicanalyzer.communicator.DACommunicator;
import org.tizen.dynamicanalyzer.constant.CommonConstants;
import org.tizen.dynamicanalyzer.ui.timeline.logparser.CustomLogParser;
import org.tizen.dynamicanalyzer.ui.timeline.logparser.LifecycleLogParser;
import org.tizen.dynamicanalyzer.ui.toolbar.ConfigureManager;
-import org.tizen.dynamicanalyzer.util.DALogger;
import org.tizen.dynamicanalyzer.widgets.chart.DAChart;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeries;
import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
public class TimelineChartManager extends PageDataManager implements IDAChartSeriesMaker {
- private static final DALogger DA_LOG = DALogger.getInstance();
private static TimelineChartManager instance = null;
private boolean newCustomChart = false;
allocationSeriesDataSetMap.clear();
}
- @Override
- public void run() {
- while (!AnalyzerManager.isExit()) {
- LogPackage pack = pollPack();
- if (null == pack) // stop thread
- break;
-
- /*
- * 1. Make SystemDataTable column
- */
- Logs systemLogs = pack.getLogs(DataChannelConstants.MSG_DATA_SYSTEM);
- Logs memoryLogs = pack.getLogs(DataChannelConstants.MSG_PROBE_MEMORY);
- Logs uiEventLogs = pack.getLogs(DataChannelConstants.MSG_PROBE_UIEVENT);
- Logs screenShotLogs = pack.getLogs(DataChannelConstants.MSG_PROBE_SCREENSHOT);
- makeSystemDataTableData(systemLogs, memoryLogs);
- makeUIEventDBTableData(uiEventLogs);
- makeScreenShotDBTableData(screenShotLogs);
-
-
- Logs customLogs = pack.getLogs(DataChannelConstants.MSG_PROBE_CUSTOM);
- if (customLogs != null && !customLogs.getRawLogs().isEmpty()) {
- customLogParser.parseLogPackage(pack);
- }
- Logs lifecycleLogs = pack.getLogs(DataChannelConstants.MSG_PROBE_LIFECYCLE);
- if (lifecycleLogs != null && !lifecycleLogs.getRawLogs().isEmpty()) {
- lifecycleLogParser.parseLogPackage(pack);
- }
- }
-
- /* log for debug */
- DA_LOG.debug(getName() + " thread end!!"); //$NON-NLS-1$
- }
-
private void makeSystemDataTableData(Logs systemLogs, Logs memoryLogs) {
int coreSize = GlobalInformation.getCurrentDeviceInfo().getTargetInfo().getCpuCount();
*/
customLogParser.inputChartSeries(customDBData);
}
+
+ @Override
+ protected void makeData(LogPackage pack) {
+ /*
+ * 1. Make SystemDataTable column
+ */
+ Logs systemLogs = pack.getLogs(DataChannelConstants.MSG_DATA_SYSTEM);
+ Logs memoryLogs = pack.getLogs(DataChannelConstants.MSG_PROBE_MEMORY);
+ Logs uiEventLogs = pack.getLogs(DataChannelConstants.MSG_PROBE_UIEVENT);
+ Logs screenShotLogs = pack.getLogs(DataChannelConstants.MSG_PROBE_SCREENSHOT);
+ makeSystemDataTableData(systemLogs, memoryLogs);
+ makeUIEventDBTableData(uiEventLogs);
+ makeScreenShotDBTableData(screenShotLogs);
+
+
+ Logs customLogs = pack.getLogs(DataChannelConstants.MSG_PROBE_CUSTOM);
+ if (customLogs != null && !customLogs.getRawLogs().isEmpty()) {
+ customLogParser.parseLogPackage(pack);
+ }
+ Logs lifecycleLogs = pack.getLogs(DataChannelConstants.MSG_PROBE_LIFECYCLE);
+ if (lifecycleLogs != null && !lifecycleLogs.getRawLogs().isEmpty()) {
+ lifecycleLogParser.parseLogPackage(pack);
+ }
+ }
}
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact:
+ * Heeyoung Hwang <heeyoung1008.hwang@samsung.com>
* jooyoul lee<jy.exe.lee@samsung.com>
* Juyoung Kim <j0.kim@samsung.com>
*
if (opened) {
return false;
}
- shell.setSize(446, 254);
+ shell.setSize(436, 254);
shell.setLayout(new FormLayout());
shell.setText(AnalyzerLabels.ABOUT_TITLE);
shell.addDisposeListener(new DisposeListener() {
compData.top = new FormAttachment(base, 0);
compData.left = new FormAttachment(0, 0);
compData.right = new FormAttachment(100, 0);
- compData.bottom = new FormAttachment(100, 0);
+ compData.height = 51;
buttonComp.setLayoutData(compData);
okButton = new DAButton(buttonComp, SWT.NONE);
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact:
+ * Heeyoung Hwang <heeyoung1008.hwang@samsung.com>
* yeongtaik byeon <yeongtaik.byeon@samsung.com>
* Juyoung Kim <j0.kim@samsung.com>
*
public int open() {
shell = new Shell(parent, SWT.APPLICATION_MODAL | SWT.DIALOG_TRIM);
- shell.setSize(608, 476 + 22);
+ shell.setSize(608, 438 + 22);
FormLayout shellLayout = new FormLayout();
shell.setLayout(shellLayout);
shell.setText(AnalyzerLabels.LICENSE);
Text contents = new Text(base, SWT.MULTI | SWT.WRAP | SWT.READ_ONLY);
contents.setForeground(ColorResources.DEFAULT_FONT_COLOR);
contents.setBackground(ColorResources.DIALOG_BG_UPPER);
- contents.setFont(FontResources.getDADefaultFont());
+ contents.setFont(FontResources.LICENSE_TEXT);
contents.setText(getLicenseString());
layoutData = new FormData();
layoutData.left = new FormAttachment(0, 18);
layoutData.right = new FormAttachment(100, -18);
layoutData.top = new FormAttachment(icon, 18);
- layoutData.height = 327;
+ layoutData.height = 287;
contents.setLayoutData(layoutData);
Composite buttonComp = new Composite(base, SWT.NONE);
compData.top = new FormAttachment(contents, 0);
compData.left = new FormAttachment(0, 0);
compData.right = new FormAttachment(100, 0);
- compData.bottom = new FormAttachment(100, 0);
+ compData.height = 51;
buttonComp.setLayoutData(compData);
okButton = new DAButton(buttonComp, SWT.NONE);
okButton.setFont(FontResources.DIALOG_BUTTON_FONT);
FormData okData = new FormData();
- okData.top = new FormAttachment(0, 8);
+ okData.top = new FormAttachment(0, 9);
okData.right = new FormAttachment(100, -9);
okData.width = DesignConstants.DA_BUTTON_WIDTH;
okData.height = DesignConstants.DA_BUTTON_HEIGHT;
&& (null != appName && !appName.isEmpty()
&& !text.isEmpty() && appName.equals(text))) {
replayButton.setButtonEnabled(true);
- replayEditButton.setButtonEnabled(true);
+ replayEditButton.setButtonEnabled(false); //disable button until complete TV SDK
} else {
replayButton.setButtonEnabled(false);
replayEditButton.setButtonEnabled(false);
.values());
for (ProcessInfoPackage pkg : processInfoPkgList) {
// String pid = Integer.toString(pkg.getPid());
- String binPath = pkg.getTargetBinaryPath();
String binName = CommonConstants.EMPTY;
- if (null != binPath && !binPath.isEmpty()) {
- int index = binPath.lastIndexOf(CommonConstants.SLASH);
- binName = binPath.substring(index + 1, binPath.length());
+
+ String cmdLineName = pkg.getCmdLineName();
+ if(cmdLineName != null && !cmdLineName.isEmpty()) {
+ binName = cmdLineName;
+ } else {
+ String binPath = pkg.getTargetBinaryPath();
+ if (null != binPath && !binPath.isEmpty()) {
+ int index = binPath.lastIndexOf(CommonConstants.SLASH);
+ binName = binPath.substring(index + 1, binPath.length());
+ }
}
StringBuffer buffer = new StringBuffer();
buffer.append(pkg.getPid()).append(PROCESS_SPLITER);
OpenTraceInputReader.stopOpenTraceInputReader();
DataManagerRegistry.stopThreads();
try {
- if (DataManagerRegistry.isAnyoneAlive()) {
+ if (!DataManagerRegistry.isAnyoneAlive()) {
break;
} else {
Thread.sleep(AnalyzerConstants.LOG_CHECK_INTERVAL);
+/*
+ * 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.toolbar.replay.data;
import java.sql.PreparedStatement;
+import java.sql.SQLException;
import java.util.List;
+import org.tizen.dynamicanalyzer.constant.CommonConstants;
import org.tizen.dynamicanalyzer.database.DBColumn;
import org.tizen.dynamicanalyzer.database.DBConstants;
import org.tizen.dynamicanalyzer.database.DBTable;
public class ReplayDBManager extends DBTable {
- private static final String TABLENAME = "REPLAY";
- public static final String RID = "RID";
- public static final String MESSAGE_ID = "MESSAGE_ID";
- public static final String SEQ = "SEQ";
- public static final String TIME = "TIME";
- public static final String SEC = "SEC";
- public static final String NANO = "NANO";
- public static final String EVENT_ID = "EVENT_ID";
- public static final String EVENT_TYPE = "EVENT_TYPE";
- public static final String EVENT_CODE = "EVENT_CODE";
- public static final String EVENT_VALUE = "EVENT_VALUE";
+ private static final String TABLENAME = "REPLAY";//$NON-NLS-1$
+ public static final String RID = "RID";//$NON-NLS-1$
+ public static final String SEQ = "SEQ";//$NON-NLS-1$
+ public static final String TIME = "TIME";//$NON-NLS-1$
+ public static final String SEC = "SEC";//$NON-NLS-1$
+ public static final String NANO = "NANO";//$NON-NLS-1$
+ public static final String EVENT_ID = "EVENT_ID";//$NON-NLS-1$
+ public static final String EVENT_TYPE = "EVENT_TYPE";//$NON-NLS-1$
+ public static final String EVENT_CODE = "EVENT_CODE";//$NON-NLS-1$
+ public static final String EVENT_VALUE = "EVENT_VALUE";//$NON-NLS-1$
- private static final String SELECT_QUERY = "select * from " + TABLENAME + " order by " + TIME + " , " + RID; //$NON-NLS-1$
+ private final int DB_RID_INDEX = 0;
+ private final int DB_SEQ_INDEX = 1;
+ private final int DB_TIME_INDEX = 2;
+ private final int DB_SEC_INDEX = 3;
+ private final int DB_NANO_INDEX = 4;
+ private final int DB_EVENT_ID_INDEX = 5;
+ private final int DB_EVENT_TYPE_INDEX = 6;
+ private final int DB_EVENT_CODE_INDEX = 7;
+ private final int DB_EVENT_VALUE = 8;
+
+ private static final String SELECT_QUERY = "select "
+ + RID
+ + CommonConstants.COMMA
+ + SEQ
+ + CommonConstants.COMMA
+ + TIME
+ + CommonConstants.COMMA
+ + SEC
+ + CommonConstants.COMMA
+ + NANO
+ + CommonConstants.COMMA
+ + EVENT_ID
+ + CommonConstants.COMMA
+ + EVENT_TYPE
+ + CommonConstants.COMMA
+ + EVENT_CODE
+ + CommonConstants.COMMA
+ + EVENT_VALUE
+ + " from " + TABLENAME + " order by " + TIME + CommonConstants.COMMA + RID; //$NON-NLS-1$
private static final String DELETE_QUERY = "delete from " + TABLENAME;
@Override
public ReplayDBManager() {
addColumn(new DBColumn(RID, DBConstants.PRIMARY_KEY,
DBConstants.INTEGER));
- addColumn(new DBColumn(MESSAGE_ID, DBConstants.NOT_NULL,
- DBConstants.INTEGER));
addColumn(new DBColumn(SEQ, DBConstants.NOT_NULL, DBConstants.INTEGER));
addColumn(new DBColumn(TIME, DBConstants.NOT_NULL, DBConstants.LONG));
addColumn(new DBColumn(SEC, DBConstants.NOT_NULL, DBConstants.INTEGER));
List<RecordEventObject> eventObjs = output.getRecordEvent();
for (List<Object> data : result) {
RecordEventObject reObj = new RecordEventObject();
- reObj.setId((Integer) data.get(0));
- reObj.setSeq((Integer) data.get(2));
- reObj.setTime((Long) data.get(3));
+ reObj.setId((Integer) data.get(DB_RID_INDEX));
+ reObj.setSeq((Integer) data.get(DB_SEQ_INDEX));
+ reObj.setTime((Long) data.get(DB_TIME_INDEX));
DATime eventTime = new DATime();
- eventTime.setSec((Integer) data.get(4));
- eventTime.setNano((Integer) data.get(5));
+ eventTime.setSec((Integer) data.get(DB_SEC_INDEX));
+ eventTime.setNano((Integer) data.get(DB_NANO_INDEX));
reObj.setEventTime(eventTime);
- reObj.setEventId((Integer) data.get(6));
- reObj.setEventType((Integer) data.get(7));
- reObj.setEventCode((Integer) data.get(8));
- reObj.setEventValue((Integer) data.get(9));
+ reObj.setEventId((Integer) data.get(DB_EVENT_ID_INDEX));
+ reObj.setEventType((Integer) data.get(DB_EVENT_TYPE_INDEX));
+ reObj.setEventCode((Integer) data.get(DB_EVENT_CODE_INDEX));
+ reObj.setEventValue((Integer) data.get(DB_EVENT_VALUE));
eventObjs.add(reObj);
}
output.setObjectCount(eventObjs.size());
@Override
public boolean prepare(PreparedStatement prep, List<Object> rowData) {
- // TODO Auto-generated method stub
- return false;
+ boolean isPrepared = true;
+
+ int columnsize = getColumnSize();
+ if (columnsize != rowData.size()) {
+ isPrepared = false;
+ } else {
+ try {
+ prep.setInt(DB_RID_INDEX + 1,
+ (Integer) (rowData.get(DB_RID_INDEX)));
+ prep.setInt(DB_SEQ_INDEX + 1,
+ (Integer) (rowData.get(DB_SEQ_INDEX)));
+ prep.setLong(DB_TIME_INDEX + 1,
+ (Long) (rowData.get(DB_TIME_INDEX)));
+ prep.setInt(DB_SEC_INDEX + 1,
+ (Integer) (rowData.get(DB_SEC_INDEX)));
+ prep.setInt(DB_NANO_INDEX + 1,
+ (Integer) (rowData.get(DB_NANO_INDEX)));
+ prep.setInt(DB_EVENT_ID_INDEX + 1,
+ (Integer) (rowData.get(DB_EVENT_ID_INDEX)));
+ prep.setInt(DB_EVENT_TYPE_INDEX + 1,
+ (Integer) (rowData.get(DB_EVENT_TYPE_INDEX)));
+ prep.setInt(DB_EVENT_CODE_INDEX + 1,
+ (Integer) (rowData.get(DB_EVENT_CODE_INDEX)));
+ prep.setInt(DB_EVENT_VALUE + 1,
+ (Integer) (rowData.get(DB_EVENT_VALUE)));
+ } catch (SQLException e) {
+ e.printStackTrace();
+ isPrepared = false;
+ }
+ }
+
+ return isPrepared;
}
}
import java.util.ArrayList;
import java.util.List;
-import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants;
import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
import org.tizen.dynamicanalyzer.swap.logparser.Logs;
import org.tizen.dynamicanalyzer.swap.model.RecordEventObject;
import org.tizen.dynamicanalyzer.swap.model.data.LogData;
import org.tizen.dynamicanalyzer.swap.model.data.ReplayData;
-import org.tizen.dynamicanalyzer.util.DALogger;
public class ReplayDataManager extends PageDataManager {
private static ReplayDataManager instance = null;
private ReplayDBManager replayDBManager = null;
private int rid = 0;
- public ReplayDataManager() {
+ private ReplayDataManager() {
replayDBManager = new ReplayDBManager();
addDBTable(replayDBManager);
}
return instance;
}
- /*** make network data thread ***/
- @Override
- public void run() {
- while (!AnalyzerManager.isExit()) {
- LogPackage pack = pollPack();
- if (pack == null) // stop thread
- break;
-
- Logs logs = pack.getLogs(DataChannelConstants.MSG_DATA_RECORD);
- if (null != logs && logs.getRawLogs().size() != 0) {
-
- List<List<Object>> insertData = new ArrayList<List<Object>>();
-
- List<LogData> inputs = logs.getLogs();
- int dataRowSize = inputs.size();
- for (int i = 0; i < dataRowSize; i++) {
- ReplayData replayData = (ReplayData) inputs.get(i);
- List<RecordEventObject> events = replayData
- .getRecordEvent();
- for (int ii = 0; ii < replayData.getObjectCount(); ii++) {
- RecordEventObject reo = events.get(ii);
- List<Object> insertObject = new ArrayList<Object>();
- insertObject.add(rid++);
- insertObject.add(7);
- insertObject.add(reo.getSeq());
- insertObject.add(reo.getTime());
- insertObject.add(reo.getEventTime().getSec());
- insertObject.add(reo.getEventTime().getNano());
- insertObject.add(reo.getEventId());
- insertObject.add(reo.getEventType());
- insertObject.add(reo.getEventCode());
- insertObject.add(reo.getEventValue());
- insertData.add(insertObject);
- }
- }
- replayDBManager.insertData(insertData);
- }
- }
-
- /* log for debug */
- DALogger.getInstance().info(getName() + " thread end!!");
- }
-
public void clear() {
instance = null;
replayDBManager = null;
return replayDBManager;
}
+ @Override
+ protected void makeData(LogPackage pack) {
+ Logs logs = pack.getLogs(DataChannelConstants.MSG_DATA_RECORD);
+ if (null != logs && logs.getRawLogs().size() != 0) {
+
+ List<List<Object>> insertData = new ArrayList<List<Object>>();
+
+ List<LogData> inputs = logs.getLogs();
+ int dataRowSize = inputs.size();
+ for (int i = 0; i < dataRowSize; i++) {
+ ReplayData replayData = (ReplayData) inputs.get(i);
+ List<RecordEventObject> events = replayData
+ .getRecordEvent();
+ for (int ii = 0; ii < replayData.getObjectCount(); ii++) {
+ RecordEventObject reo = events.get(ii);
+ List<Object> insertObject = new ArrayList<Object>();
+ insertObject.add(rid++);
+ insertObject.add(reo.getSeq());
+ insertObject.add(reo.getTime());
+ insertObject.add(reo.getEventTime().getSec());
+ insertObject.add(reo.getEventTime().getNano());
+ insertObject.add(reo.getEventId());
+ insertObject.add(reo.getEventType());
+ insertObject.add(reo.getEventCode());
+ insertObject.add(reo.getEventValue());
+ insertData.add(insertObject);
+ }
+ }
+ replayDBManager.insertData(insertData);
+ }
+ }
+
}
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact:
- * Jooyoul Lee <jy.exe.lee@samsung.com>
+ * Hyunjong Park <phjwithyou.park@samsung.com>
* Juyoung Kim <j0.kim@samsung.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
public String saveFileName = null;
private DAButton okButton = null;
private DAButton cancelButton = null;
-
- private String targetPath = "";
+
+ private String targetPath = CommonConstants.EMPTY;
public RepalyEditSaveDialog(Shell parentShell) {
super(parentShell);
private boolean executeSaveTrace() {
Project project = AnalyzerManager.getProject();
String sourcePath = project.getSavePath();
- targetPath = PathManager.DA_SAVE_PATH
- + File.separator + saveFileName;
+ targetPath = PathManager.DA_SAVE_PATH + File.separator + saveFileName;
- if(AnalyzerManager.getProject().getSavePath().equals(targetPath)){
+ if (AnalyzerManager.getProject().getSavePath().equals(targetPath)) {
return true;
}
}
return true;
}
- public String getSavedPath(){
+
+ public String getSavedPath() {
return this.targetPath;
}
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
-import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
import org.tizen.dynamicanalyzer.nl.ReplayEditLabels;
import org.tizen.dynamicanalyzer.resources.ColorResources;
public class ReplayEditDialog extends DAMessageBox {
private static final DALogger DA_LOG = DALogger.getInstance();
-
+
private static boolean opened = false;
private DACustomButton cancelButton = null;
- //private DATabComposite tabView = null;
private DATableComposite replayTable;
public ReplayEditDialog(Shell parent) {
super(parent);
}
- private DACustomButtonClickEventListener saveButtonListener = new DACustomButtonClickEventListener() {
-
- @Override
- public void handleClickEvent(DACustomButton button) {
- ReplayEditDialogDataManager.getInstance().setTableItemsList(replayTable);
- ReplayEditDialogDataManager.getInstance().saveDialog();
- }
- };
-
private DACustomButtonClickEventListener okButtonListener = new DACustomButtonClickEventListener() {
@Override
public void handleClickEvent(DACustomButton button) {
- ReplayEditDialogDataManager.getInstance().setTableItemsList(replayTable);
- ReplayEditDialogDataManager.getInstance().insertDB(false,
- AnalyzerManager.getProject().getSavePath());
+ ReplayEditDialogDataManager.getInstance().setTableItemsList(
+ replayTable);
+ ReplayEditDialogDataManager.getInstance().insertDB();
shell.dispose();
}
};
compData.bottom = new FormAttachment(100, 0);
featuresPage.setLayoutData(compData);
- replayTable =featuresPage.getReplayTable();
-
-
-
+ replayTable = featuresPage.getReplayTable();
+
// button
Composite buttonContentsComp = new Composite(shell, SWT.NONE);
buttonContentsComp.addPaintListener(new PaintListener() {
buttonData.height = 28;
cancelButton.setLayoutData(buttonData);
- ReplayEditDialogDataManager.getInstance().setOkButton(new DAButton(buttonContentsComp, SWT.NONE));
- ReplayEditDialogDataManager.getInstance().getOkButton().addClickListener(okButtonListener);
- ReplayEditDialogDataManager.getInstance().getOkButton().setText(ReplayEditLabels.OK);
- ReplayEditDialogDataManager.getInstance().getOkButton().setFont(FontResources.DIALOG_BUTTON_FONT);
+ ReplayEditDialogDataManager.getInstance().setOkButton(
+ new DAButton(buttonContentsComp, SWT.NONE));
+ ReplayEditDialogDataManager.getInstance().getOkButton()
+ .addClickListener(okButtonListener);
+ ReplayEditDialogDataManager.getInstance().getOkButton()
+ .setText(ReplayEditLabels.OK);
+ ReplayEditDialogDataManager.getInstance().getOkButton()
+ .setFont(FontResources.DIALOG_BUTTON_FONT);
buttonData = new FormData();
buttonData.right = new FormAttachment(cancelButton, -8);
buttonData.top = new FormAttachment(0, 11);
buttonData.width = 100;
buttonData.height = 28;
- ReplayEditDialogDataManager.getInstance().getOkButton().setLayoutData(buttonData);
-
- ReplayEditDialogDataManager.getInstance().setSaveButton(new DAButton(buttonContentsComp, SWT.NONE));
- ReplayEditDialogDataManager.getInstance().getSaveButton().addClickListener(saveButtonListener);
- ReplayEditDialogDataManager.getInstance().getSaveButton().setText(ReplayEditLabels.SAVE);
- ReplayEditDialogDataManager.getInstance().getSaveButton().setFont(FontResources.DIALOG_BUTTON_FONT);
- buttonData = new FormData();
- buttonData.right = new FormAttachment(ReplayEditDialogDataManager.getInstance().getOkButton(), -8);
- buttonData.top = new FormAttachment(0, 11);
- buttonData.width = 100;
- buttonData.height = 28;
- ReplayEditDialogDataManager.getInstance().getSaveButton().setLayoutData(buttonData);
+ ReplayEditDialogDataManager.getInstance().getOkButton()
+ .setLayoutData(buttonData);
opened = true;
ShortCutManager.getInstance().setEnabled(!opened);
public class ReplayEditDialogDataManager {
private DACustomButton saveButton = null;
private DACustomButton okButton = null;
- private final int MESSAGE_ID = 7;
private final int sequenceNaumber = 0000;
public static String MODIFIABILITY_TRUE = "MODIFIABILITY_TRUE ";
public static String SELECTED_ITEM_COPY = "SELECTED_ITEM_COPY ";
replayDBData = new ReplayData();
replayDBData = ReplayDataManager.getInstance().getReplayDBManager()
.getReplayLogs(false);
- // replayDBData = SqlManager.getInstance().getReplayLogs(false);
}
return replayDBData;
}
if (dbPath.equals(AnalyzerManager.getProject().getSavePath())) {
dbPath = AnalyzerManager.getProject().getSavePath();
}
- insertDB(true, dbPath);
+ insertDB();
}
}
- public void insertDB(boolean isSave, String dbPath) {
+ public void insertDB() {
ReplayDataManager.getInstance().getReplayDBManager()
.deleteReplayTableItems();
- insertDBData(isSave, dbPath);
+ insertDBData();
}
private void cleanInsertData() {
insertkeySequence = 1;
}
- private void insertDBData(boolean isSave, String dbPath) {
+ private void insertDBData() {
cleanInsertData();
int size = getTableItemsList().size();
for (int i = 0; i < size; i++) {
.get(EVENT_MOUSE_DOWN_TIME_TABLE_INDEX));
String itemMouseUpTime = getDBTime(item
.get(EVENT_MOUSE_UP_TIME_TABLE_INDEX));
+ if (itemMouseUpTime.equals(CommonConstants.EMPTY)) {
+ itemMouseUpTime = itemMouseDownTime;
+ }
DATime mouseDownTime = getDATimeValue(Long.parseLong(itemMouseDownTime));
DATime mouseUpTime = getDATimeValue(Long.parseLong(itemMouseUpTime));
int itemValue1 = getKeyValue(item);
List<Object> keyData = new ArrayList<Object>();
if (i == 0) {
keyData.add(mouseDownTime.getSec() + insertDBRid++);
- keyData.add(MESSAGE_ID);
keyData.add(sequenceNaumber);
keyData.add(Long.parseLong(itemMouseDownTime));
keyData.add(mouseDownTime.getSec());
keyData.add(1);
} else if (i == 1) {
keyData.add(mouseUpTime.getSec() + insertDBRid++);
- keyData.add(MESSAGE_ID);
keyData.add(sequenceNaumber);
keyData.add(Long.parseLong(itemMouseDownTime));
keyData.add(mouseDownTime.getSec());
keyData.add(0);
} else if (i == 2) {
keyData.add(mouseUpTime.getSec() + insertDBRid++);
- keyData.add(MESSAGE_ID);
keyData.add(sequenceNaumber);
keyData.add(Long.parseLong(itemMouseDownTime));
keyData.add(mouseUpTime.getSec());
keyData.add(0);
} else if (i == 3) {
keyData.add(mouseUpTime.getSec() + insertDBRid++);
- keyData.add(MESSAGE_ID);
keyData.add(sequenceNaumber);
keyData.add(Long.parseLong(itemMouseDownTime));
keyData.add(mouseUpTime.getSec());
List<Object> keyData = new ArrayList<Object>();
if (i == 0) {
keyData.add(mouseDownTime.getSec() + insertDBRid++);
- keyData.add(MESSAGE_ID);
keyData.add(sequenceNaumber);
keyData.add(Long.parseLong(itemMouseDownTime));
keyData.add(mouseDownTime.getSec());
keyData.add(insertkeySequence++);
} else if (i == 1) {
keyData.add(mouseDownTime.getSec() + insertDBRid++);
- keyData.add(MESSAGE_ID);
keyData.add(sequenceNaumber);
keyData.add(Long.parseLong(itemMouseDownTime));
keyData.add(mouseDownTime.getSec());
keyData.add(TOUCH_EVENT_VALUE_SECOND_ITEM);
} else if (i == 2) {
keyData.add(mouseDownTime.getSec() + insertDBRid++);
- keyData.add(MESSAGE_ID);
keyData.add(sequenceNaumber);
keyData.add(Long.parseLong(itemMouseDownTime));
keyData.add(mouseDownTime.getSec());
keyData.add(getDBPoint(itemValue1));
} else if (i == 3) {
keyData.add(mouseDownTime.getSec() + insertDBRid++);
- keyData.add(MESSAGE_ID);
keyData.add(sequenceNaumber);
keyData.add(Long.parseLong(itemMouseDownTime));
keyData.add(mouseDownTime.getSec());
keyData.add(getDBPoint(itemValue2));
} else if (i == 4) {
keyData.add(mouseDownTime.getSec() + insertDBRid++);
- keyData.add(MESSAGE_ID);
keyData.add(sequenceNaumber);
keyData.add(Long.parseLong(itemMouseDownTime));
keyData.add(mouseDownTime.getSec());
keyData.add(0);
} else if (i == 5) {
keyData.add(mouseDownTime.getSec() + insertDBRid++);
- keyData.add(MESSAGE_ID);
keyData.add(sequenceNaumber);
keyData.add(Long.parseLong(itemMouseDownTime));
keyData.add(mouseUpTime.getSec());
keyData.add(-1);
} else if (i == 6) {
keyData.add(mouseDownTime.getSec() + insertDBRid++);
- keyData.add(MESSAGE_ID);
keyData.add(sequenceNaumber);
keyData.add(Long.parseLong(itemMouseDownTime));
keyData.add(mouseUpTime.getSec());
* Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact:
- * yeongtaik byeon <yeongtaik.byeon@samsung.com>
+ * Hyunjong Park <phjwithyou.park@samsung.com>
* Juyoung Kim <j0.kim@samsung.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact:
- * Jooyoul Lee <jy.exe.lee@samsung.com>
+ * Hyunjong Park <phjwithyou.park@samsung.com>
* Juyoung Kim <j0.kim@samsung.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
import org.tizen.dynamicanalyzer.common.GlobalInformation;
import org.tizen.dynamicanalyzer.common.ScreenshotConstants;
import org.tizen.dynamicanalyzer.common.path.PathManager;
-import org.tizen.dynamicanalyzer.communicator.DACommunicator;
import org.tizen.dynamicanalyzer.constant.CommonConstants;
import org.tizen.dynamicanalyzer.nl.ReplayEditLabels;
import org.tizen.dynamicanalyzer.resources.ColorResources;
int point = 0;
if (value.contains(ReplayEditLabels.CONTEXT_VALUE_X)) {
point = Integer.parseInt(value.replace(
- ReplayEditLabels.CONTEXT_VALUE_X, ""));
- point = (point * ScreenshotConstants.DEFAULT_IMAGE_WIDTH) / Integer.parseInt(resolutionWidth);
+ ReplayEditLabels.CONTEXT_VALUE_X, CommonConstants.EMPTY));
+ point = (point * ScreenshotConstants.DEFAULT_IMAGE_WIDTH)
+ / Integer.parseInt(resolutionWidth);
}
if (value.contains(ReplayEditLabels.CONTEXT_VALUE_Y)) {
point = Integer.parseInt(value.replace(
- ReplayEditLabels.CONTEXT_VALUE_Y, ""));
- point = (point * ScreenshotConstants.DEFAULT_IMAGE_HEIGHT) / Integer.parseInt(resolutionHeight);
+ ReplayEditLabels.CONTEXT_VALUE_Y, CommonConstants.EMPTY));
+ point = (point * ScreenshotConstants.DEFAULT_IMAGE_HEIGHT)
+ / Integer.parseInt(resolutionHeight);
}
return point;
}
private void getDeviceResolution() {
- String selDeviceName = GlobalInformation.getCurrentDeviceInfo().getIDevice()
- .getDeviceName();
+ String selDeviceName = GlobalInformation.getCurrentDeviceInfo()
+ .getIDevice().getDeviceName();
String resolutionInfoXmlPath = PathManager.TIZEN_SDK_DATA_PATH
+ File.separator + "emulator-vms" + File.separator + "vms"//$NON-NLS-1$
+ File.separator + selDeviceName + File.separator
private DAText inputValueText = null;
+ private boolean enableCoordinateIcon = true;
+
@Override
protected List<TableInput> makeTableInput() {
List<TableInput> input = new ArrayList<TableInput>();
break;
}
case MOUSE_RIGHT: {
- openPoppupMenuMouseDownSequenceColumn(item, event);
break;
}
default: {
item.setImage(null);
} else if (selectedText.contains(ReplayEditLabels.CONTEXT_VALUE_X)
|| selectedText.contains(ReplayEditLabels.CONTEXT_VALUE_Y)) {
- item.setImage(ImageResources.REPLAY_EDIT_SNAPSHOT_DOWN);
+ if (enableCoordinateIcon) {
+ item.setImage(ImageResources.REPLAY_EDIT_SNAPSHOT_DOWN);
+ } else {
+ item.setImage(null);
+ }
} else {
item.setImage(ImageResources.REPLAY_EDIT_DROPDOWN_DOWN);
}
MousePt.x, MousePt.y);
} else if (selectedText.contains(ReplayEditLabels.CONTEXT_VALUE_X)
|| selectedText.contains(ReplayEditLabels.CONTEXT_VALUE_Y)) {
- ReplayEditScreenshotDialog dialog = new ReplayEditScreenshotDialog(
- table.getShell(), item);
- dialog.open();
+ if (enableCoordinateIcon) {
+ ReplayEditScreenshotDialog dialog = new ReplayEditScreenshotDialog(
+ table.getShell(), item);
+ dialog.open();
+ }
return false;
+ } else {
+ openPoppupMenuMouseDownSequenceColumn(item, event);
}
}
return true;
import org.eclipse.nebula.widgets.grid.GridItem;
import org.eclipse.nebula.widgets.grid.internal.DefaultCellRenderer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Rectangle;
public void paint(GC gc, Object value) {
GridItem item = (GridItem) value;
gc.setFont(item.getFont(getColumn()));
- paintBackground(gc, item);
paintImage(gc, item);
paintText(gc, item);
paintTableBoardLine(gc, item);
paintMouseOverColumn(gc, item);
paintSelectedInputKey(gc, item);
- // paintSelectedCopy(gc, item);
paintVaildTime(gc, item);
}
- private void paintBackground(GC gc, GridItem item) {
- boolean drawBackground = true;
- String optionColumn = item.getText(6);
- if (item.getChecked() && getColumn() == 0) {
- gc.setForeground(ColorResources.TABLE_CONTENTS_SELECTED_START);
- gc.setBackground(ColorResources.TABLE_CONTENTS_SELECTED_END);
- } else if (!optionColumn
- .contains(ReplayEditDialogDataManager.MODIFIABILITY_TRUE)) {
- gc.setBackground(ColorResources.YELLOW);
- } else if (item.getText(ReplayEditTable.UP_TIME_TABLE_INDEX).equals("")) {
- gc.setBackground(ColorResources.YELLOW);
- } else {
- if (item.getParent().isEnabled()) {
- Color bg = item.getBackground();
- if (bg != null) {
- gc.setBackground(bg);
- } else {
- drawBackground = false;
- }
- } else {
- gc.setBackground(getDisplay().getSystemColor(
- SWT.COLOR_WIDGET_BACKGROUND));
- }
- }
-
- if (drawBackground && item.getChecked() && getColumn() == 0) {
- gc.fillGradientRectangle(getBounds().x, getBounds().y,
- getBounds().width, getBounds().height, true);
- } else if (drawBackground) {
- gc.fillRectangle(getBounds().x, getBounds().y + 1,
- getBounds().width, getBounds().height);
- }
- }
-
private void paintImage(GC gc, GridItem item) {
menuImg = item.getImage();
- if (menuImg != null && getColumn() != 0 && item.getChecked(getColumn())) {
+ if (menuImg != null && item.getChecked(getColumn())) {
int y = getBounds().y;
y += (getBounds().height - menuImg.getBounds().height) / 2;
}
private void paintMouseOverColumn(GC gc, GridItem item) {
- if (getColumn() != 0 && item.getChecked(getColumn())) {
+ if (item.getChecked(getColumn())) {
Rectangle focusRect = new Rectangle(getBounds().x - 1,
getBounds().y - 1, getBounds().width,
getBounds().height + 1);
private void paintSelectedInputKey(GC gc, GridItem item) {
String optionColumn = item.getText(6);
- if (getColumn() != 0
- && item.getChecked(getColumn())
+ if (item.getChecked(getColumn())
&& optionColumn
.contains(ReplayEditDialogDataManager.SELECTED_ITEM_KEY_INPUT)) {
Rectangle focusRect = new Rectangle(getBounds().x - 1,
}
}
- // private void paintSelectedCopy(GC gc, GridItem item) {
- // String optionColumn = item.getText(6);
- // if (optionColumn
- // .contains(ReplayEditDialogDataManager.SELECTED_ITEM_COPY)) {
- // gc.setForeground(ColorResources.BLACK);
- // gc.setLineWidth(2);
- // gc.setLineStyle(SWT.LINE_DOT);
- // gc.drawLine(getBounds().x, getBounds().y, getBounds().x
- // + getBounds().width, getBounds().y);
- //
- // gc.drawLine(getBounds().x, getBounds().y + getBounds().height,
- // getBounds().x + getBounds().width, getBounds().y
- // + getBounds().height);
- // if (getColumn() == 0) {
- // gc.drawLine(getBounds().x, getBounds().y, getBounds().x,
- // getBounds().y + getBounds().height);
- // }
- //
- // if (getColumn() == 0) {
- // gc.drawLine(getBounds().x, getBounds().y, getBounds().x,
- // getBounds().y + getBounds().height);
- // }
- //
- // gc.setLineStyle(SWT.LINE_SOLID);
- // gc.setLineWidth(1);
- //
- // }
- // }
-
private void paintVaildTime(GC gc, GridItem item) {
String optionColumn = item.getText(6);
if (optionColumn
+/*
+ * 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.toolbar.replayEditor;
import org.tizen.dynamicanalyzer.constant.CommonConstants;
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact:
- * Jooyoul Lee <jy.exe.lee@samsung.com>
+ * Hyunjong Park <phjwithyou.park@samsung.com>
* Juyoung Kim <j0.kim@samsung.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
import java.util.HashMap;
import java.util.List;
-import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.constant.CommonConstants;
import org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants;
import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
import org.tizen.dynamicanalyzer.ui.userinterface.control.UIControlListDataChecker;
import org.tizen.dynamicanalyzer.ui.userinterface.profiling.UIFunctionProfilingDataChecker;
import org.tizen.dynamicanalyzer.ui.userinterface.scene.UISceneDataChecker;
-import org.tizen.dynamicanalyzer.util.DALogger;
public class UIDataManager extends PageDataManager {
- private static final DALogger DA_LOG = DALogger.getInstance();
-
private static UIDataManager instance = null;
private static UIControlListDataChecker controlListDataChecker = null;
private UIDataManager() {
}
- @Override
- public void run() {
- while (!AnalyzerManager.isExit()) {
- LogPackage pack = pollPack();
- if (pack == null) // stop thread
- break;
-
- Logs logs = pack.getLogs(DataChannelConstants.MSG_PROBE_UICONTROL);
- if (null != logs && logs.getRawLogs() != null
- && logs.getRawLogs().size() != 0) {
- List<LogData> inputs = logs.getLogs();
- int size = inputs.size();
- for (int i = 0; i < size; i++) {
- getControlDataChecker().parserLog(
- (ControlData) inputs.get(i));
- }
- }
-
- logs = pack.getLogs(DataChannelConstants.MSG_PROBE_SCENE);
- if (null != logs && logs.getRawLogs() != null
- && logs.getRawLogs().size() != 0) {
- List<LogData> inputs = logs.getLogs();
- int size = inputs.size();
- for (int i = 0; i < size; i++) {
- getSceneTransformDataChecker().parserLog(
- (SceneData) inputs.get(i));
- }
- }
-
- UIDataManager.getInstance().getfunctionProfilingDataChecker().updateUIApiTreeSet();
- }
-
- /* log for debug */
- DA_LOG.debug(getName() + " thread end!!"); //$NON-NLS-1$
- }
-
public void clear() {
controlListDataChecker = null;
sceneTransformDataChecker = null;
public HashMap<String, Long> getFindScreenshotViewHashMap() {
return findScreenshotViewHashMap;
}
+
+ @Override
+ protected void makeData(LogPackage pack) {
+ Logs logs = pack.getLogs(DataChannelConstants.MSG_PROBE_UICONTROL);
+ if (null != logs && logs.getRawLogs() != null
+ && logs.getRawLogs().size() != 0) {
+ List<LogData> inputs = logs.getLogs();
+ int size = inputs.size();
+ for (int i = 0; i < size; i++) {
+ getControlDataChecker().parserLog(
+ (ControlData) inputs.get(i));
+ }
+ }
+
+ logs = pack.getLogs(DataChannelConstants.MSG_PROBE_SCENE);
+ if (null != logs && logs.getRawLogs() != null
+ && logs.getRawLogs().size() != 0) {
+ List<LogData> inputs = logs.getLogs();
+ int size = inputs.size();
+ for (int i = 0; i < size; i++) {
+ getSceneTransformDataChecker().parserLog(
+ (SceneData) inputs.get(i));
+ }
+ }
+
+ UIDataManager.getInstance().getfunctionProfilingDataChecker().updateUIApiTreeSet();
+ }
}
\ No newline at end of file
gc.setFont(FontResources.DROPDOWN);
gc.drawString(items.get(i), 5, 6 + i * r.height, true);
+
Rectangle rect = canvas.getClientArea();
gc.setForeground(ColorResources.DEVICE_APPLICATION_POPUP_OUTER_1);
- gc.drawRectangle(rect);
+ gc.drawLine(rect.x, rect.y, rect.x, rect.height);
+ gc.drawLine(rect.width - 1, rect.y, rect.width - 1, rect.height);
gc.setForeground(ColorResources.DEVICE_APPLICATION_POPUP_OUTER_2);
- gc.drawRectangle(rect.x + 1, rect.y + 1, rect.width - 2,
+ gc.drawRectangle(rect.x + 1, rect.y + 1, rect.width - 3,
rect.height - 2);
}
}
package org.tizen.dynamicanalyzer.ui.widgets;
+import java.util.List;
+
import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.tizen.dynamicanalyzer.constant.CommonConstants;
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.resources.FontResources;
+import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
import org.tizen.dynamicanalyzer.widgets.combo.DACustomCombo;
import org.tizen.dynamicanalyzer.widgets.combo.DACustomComboRenderer;
}
@Override
- public void drawPattern(GC gc, Canvas canvas, Image patternImage,
- String text, int state) {
-
- }
-
- @Override
public void drawImage(GC gc, Canvas canvas, Image image, String text,
int textAlign, Font font, int state) {
Rectangle rect = canvas.getClientArea();
}
}
+ @Override
+ public void draw(GC gc, Canvas canvas, int drawType, List<Color> colors,
+ List<Color> outlineColors, Point comboImagePoint,
+ List<Image> comboImages, String text, int textAlign, Font font,
+ Point fontPoint, int state) {
+ Rectangle rect = canvas.getClientArea();
+ if (drawType == DACustomCombo.TYPE_COLOR) {
+ gc.setBackground(colors.get(state));
+ gc.fillRectangle(rect);
+ } else if (drawType == DACustomCombo.TYPE_GRADATION) {
+ int index = state * 2;
+ gc.setForeground(colors.get(index));
+ gc.setBackground(colors.get(index + 1));
+ gc.fillGradientRectangle(rect.x, rect.y, rect.width, rect.height, true);
+ }
+
+ // text and font(size, style)
+ if (null == text) {
+ text = CommonConstants.EMPTY;
+ }
+ if (null == font) {
+ gc.setFont(FontResources.COMBO);
+ } else {
+ gc.setFont(font);
+ }
+
+ // font color
+ if (state == DACustomButton.STATE_DISABLE) {
+ gc.setForeground(ColorResources.DEVICE_APPLICATION_DISABLE);
+ } else {
+ gc.setForeground(ColorResources.DEVICE_APPLICATION_ENABLE);
+ }
+
+ // text position
+ if (fontPoint == null) {
+ Point p = gc.textExtent(text, SWT.DRAW_MNEMONIC);
+ int textX = 0;
+ if (textAlign == DACustomCombo.TEXT_ALIGN_LEFT) {
+ textX = 5;
+ } else if (textAlign == DACustomCombo.TEXT_ALIGN_RIGHT) {
+ textX = rect.width - p.x;
+ } else { // DACustomCombo.TEXT_ALIGN_CENTER
+ textX = (rect.width / 2) - (p.x / 2);
+ }
+ gc.drawString(text, textX, (rect.height - p.y) / 2, true);
+ } else {
+ gc.drawString(text, fontPoint.x, fontPoint.y, true);
+ }
+
+ // stroke
+ Color c = gc.getForeground();
+ Rectangle r = new Rectangle(rect.x, rect.y, rect.width - 1, rect.height - 1);
+ if (null != outlineColors.get(state)) {
+ gc.setForeground(outlineColors.get(state));
+ } else {
+ gc.setForeground(c);
+ return;
+ }
+ gc.drawRectangle(r);
+ gc.setForeground(c);
+
+ // draw button image
+ drawComboImage(gc, rect, state, comboImagePoint, comboImages);
+
+ }
+
+ protected void drawComboImage(GC gc, Rectangle rect,
+ int state, Point comboImagePoint, List<Image> comboImages) {
+ Image img = comboImages.get(state);
+ Rectangle imgRect = null;
+
+ if (null != img) {
+ imgRect = img.getBounds();
+ int x = 0, y = 0;
+ if (null == comboImagePoint) {
+ int width = rect.width - imgRect.width;
+ int height = rect.height - imgRect.height;
+ if (width > 0) {
+ x = width / 2;
+ }
+
+ if (height > 0) {
+ y = height / 2;
+ }
+ } else {
+ x = comboImagePoint.x;
+ y = comboImagePoint.y;
+ }
+ gc.drawImage(img, x, y);
+ }
+
+ }
+
}
DATableDataFormat tableData = (DATableDataFormat) selections[i]
.getData();
LogData data = tableData.getLogData();
+
if(null != data){
selSeqs.add((long) data.getSeq());
}
import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.common.GlobalInformation;
-import org.tizen.dynamicanalyzer.communicator.DACommunicator;
import org.tizen.dynamicanalyzer.constant.CommonConstants;
+import org.tizen.dynamicanalyzer.project.AppInfo;
import org.tizen.dynamicanalyzer.swap.channel.control.BinaryInfo;
import org.tizen.dynamicanalyzer.swap.channel.data.ProcessInfo;
import org.tizen.dynamicanalyzer.swap.channel.data.ProcessInfoPackage;
String path = processInfo.getMainTargetBinaryPath();
String key = getTargetPathKey(path);
- BinaryInfo binInfo = GlobalInformation.getCurrentApplication().getBinaryInfo(key);
+ AppInfo curApp = GlobalInformation.getCurrentApplication();
+ if(curApp == null)
+ return false;
+
+ BinaryInfo binInfo = curApp.getBinaryInfo(key);
if (null == binInfo) {
return false;
}
--- /dev/null
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2014 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.utils;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
+import org.tizen.dynamicanalyzer.common.AnalyzerManager;
+import org.tizen.dynamicanalyzer.communicator.CommunicatorUtils;
+import org.tizen.dynamicanalyzer.constant.CommonConstants;
+import org.tizen.dynamicanalyzer.util.CommonUtil;
+import org.tizen.dynamicanalyzer.util.DALogger;
+import org.tizen.sdblib.service.SyncResult;
+
+public class DownloadContentfileManager {
+
+ private final static int SPLIT_PATH_INDEX = 1;
+
+ /**
+ * Download file of contents that payload of network or shader source of
+ * OpenGL from device.
+ *
+ * @param contents
+ * It will check that string like
+ * "SkWek2n3_File:/tmp/<file_name>" is included.
+ * @return new file path of download file
+ */
+ public static String getDowonloadFilePath(String contents) {
+ String returnString = contents;
+ if (contents.contains(AnalyzerConstants.CHECK_DOWNLOAD_FILE_STRING)) {
+ String[] strFile = contents
+ .split(AnalyzerConstants.CHECK_DOWNLOAD_FILE_STRING);
+ if (strFile.length < SPLIT_PATH_INDEX) {
+ return returnString;
+ }
+ String deviceFilePath = strFile[SPLIT_PATH_INDEX];
+
+ String[] fileNameSplit = deviceFilePath.split(File.separator
+ + AnalyzerConstants.TMP_FOLDER + File.separator);
+ if (fileNameSplit.length < SPLIT_PATH_INDEX) {
+ return returnString;
+ }
+ String downloadFolderPath = File.separator
+ + AnalyzerConstants.DOWNLOAD_FILE_FOLDER;
+
+ makeFolder(AnalyzerManager.getProject().getSavePath()
+ + downloadFolderPath);
+
+ String saveFilePath = downloadFolderPath + File.separator
+ + fileNameSplit[SPLIT_PATH_INDEX];
+
+ if (pullFile(deviceFilePath, AnalyzerManager.getProject()
+ .getSavePath() + saveFilePath)) {
+ returnString = saveFilePath;
+ }
+ }
+ return returnString;
+ }
+
+ /**
+ * copy contents file from device to local save folder. if the copy of the
+ * file is successful, delete the file on the device.
+ *
+ * @param from
+ * device file path
+ * @param to
+ * local file path
+ * @return
+ */
+ public static boolean pullFile(String from, String to) {
+ SyncResult res = CommunicatorUtils.pull(from, to);
+ if (null != res && res.isOk()) {
+ DALogger.getInstance().debug(from + "file copying success!!");//$NON-NLS-1$
+ } else {
+ DALogger.getInstance().debug("Failed to get " + from); //$NON-NLS-1$
+ return false;
+ }
+ CommunicatorUtils.removeCommand(from);
+ return true;
+ }
+
+ /**
+ * get contents of file
+ *
+ * @param contents
+ * get file path from database. It will check that string like
+ * "/download_file/<file_name>" is included.
+ * @return contents
+ */
+ public static String getFileContents(String contents) {
+ String returnString = contents;
+ if (contents.contains(AnalyzerConstants.DOWNLOAD_FILE_FOLDER
+ + File.separator)) {
+ StringBuffer contextsBuffer = new StringBuffer();
+
+ String filePath = AnalyzerManager.getProject().getSavePath()
+ + contents;
+ File contentsFile = new File(filePath);
+ if (contentsFile.isFile()) {
+ BufferedReader in = null;
+ String content;
+ try {
+ in = new BufferedReader(new FileReader(contentsFile));
+ while (null != (content = in.readLine())) {
+ contextsBuffer.append(content).append(
+ CommonConstants.NEW_LINE);
+ }
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ } finally {
+ CommonUtil.tryClose(in);
+ }
+ }
+ returnString = contextsBuffer.toString();
+ }
+ return returnString;
+ }
+
+ /**
+ * make new folder when not exist folder
+ *
+ * @param folderPath
+ *
+ */
+ private static void makeFolder(String folderPath) {
+ File toDir = new File(folderPath);
+ if (!toDir.exists() || !toDir.isDirectory()) {
+ toDir.mkdirs();
+ }
+ }
+
+}
import java.text.DecimalFormat;
+import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
+
public class Formatter {
public static String toHexString(String decimal) {
}
return value;
}
+
+ // translate long time to double time
+ public static double toLongTimeForDoubleTime(long time) {
+ return time / TimelineConstants.MEGA_DOUBLE;
+ }
}