* @param font
* The font of the button text.
*/
- public void setFont(Font font) {
+ public void setButtonFont(Font font) {
attr.setFont(font);
}
}
public void setEnabled(boolean enabled) {
+ super.setEnabled(enabled);
setCheckboxEnabled(enabled);
}
}
public void setForeground(Color color) {
+ super.setForeground(color);
fgColor = color;
}
public void setBackground(Color color) {
+ super.setBackground(color);
bgColor = color;
}
this.titleAlign = align;
}
- public void setFont(Font font) {
+ public void setComboFont(Font font) {
this.font = font;
}
}
}
public void setFont(Font font) {
+ super.setFont(font);
label.setFont(font);
this.labelFont = font;
}
}
public void setFont(Font font) {
+ super.setFont(font);
this.font = font;
}
}
label.setText(text);
}
- public void setFont(Font font) {
+ public void setLabelFont(Font font) {
label.setFont(font);
this.labelFont = font;
}
}
else{
remainder /= 100;
- remainder = Math.round((float)remainder);
+ float fValue = remainder;
+ remainder = Math.round(fValue);
ret = String.format("%d.%d%s", quotient,remainder,unit);
}
return ret;
this.bgImage = bg;
}
- public void setFont(Font font) {
+ public void setClockFont(Font font) {
this.clockFont = font;
}
if (STDOUT_TO_FILE) {
String logPath = WorkbenchUtils.getLogsPath();
File logs = new File(logPath);
+ boolean success = true;
if (!logs.exists()) {
- logs.mkdirs();
+ if (!logs.mkdirs()) {
+ System.out
+ .println("Log directory create failed.. log file create failed...");
+ success = false;
+ }
}
+ if (success) {
+ String logFileName = LOG_PREFIX + logPostFix;//$NON-NLS-1$
+ logPath += File.separator + logFileName;
- String logFileName = LOG_PREFIX + logPostFix;//$NON-NLS-1$
- logPath += File.separator + logFileName;
-
- File file = new File(logPath);
- FileOutputStream fos = new FileOutputStream(file);
- PrintStream ps = new PrintStream(fos);
- System.setOut(ps);
- System.setErr(ps);
+ File file = new File(logPath);
+ FileOutputStream fos = new FileOutputStream(file);
+ PrintStream ps = new PrintStream(fos);
+ System.setOut(ps);
+ System.setErr(ps);
- checkLogs(logs.getPath());
+ checkLogs(logs.getPath());
+ }
}
if (WorkbenchSingletonFocusManager.checkDASingleton()) {
} else {
System.out.println("First DA Running");
}
-
+
String[] argv = (String[]) context.getArguments().get(
"application.args");//$NON-NLS-1$
if (argv.length > 0) {
private void checkLogs(String path) {
List<String> logFiles = WorkbenchUtils.getFiles(path);
-
+ if (null == logFiles) {
+ return;
+ }
List<String> daLogFiles = new ArrayList<String>();
for (String name : logFiles) {
if (name.contains(LOG_PREFIX)) {
File daSaveFile = new File(saveFolderPath);
if (!daSaveFile.isDirectory()) {
- daSaveFile.mkdirs();
+ if (!daSaveFile.mkdirs()) {
+ System.out.println("da save file create failed...");
+ return false;
+ }
}
String activeFilePath = saveFolderPath + File.separator + ACTIVE_DA;
funcNameMap.clear();
}
- public static List<ImageInfo> getImageList() {
+ public static synchronized List<ImageInfo> getImageList() {
if (null == imageList) {
imageList = new ArrayList<ImageInfo>();
imageListSize = 0;
return imageList;
}
- public static HashMap<String, ImageInfo> getImageSet() {
+ public static synchronized HashMap<String, ImageInfo> getImageSet() {
if (null == imageSet) {
imageSet = new HashMap<String, ImageInfo>();
ImageInfo noImage = new ImageInfo();
}\r
}\r
if (!saveFolder.isDirectory()) {\r
- saveFolder.mkdirs();\r
+ if (!saveFolder.mkdirs()) {\r
+ System.out.println("save folder create failed...");\r
+ }\r
}\r
\r
IPartService partService = PlatformUI.getWorkbench()\r
}
public static void loadDevices() {
- IDevice[] devices = null;
List<DeviceInfo> devs = new ArrayList<DeviceInfo>();
if (null != sdbBridge) {
- devices = sdbBridge.getDevices();
+ IDevice[] devices = sdbBridge.getDevices();
int size = devices.length;
if (size > 0) {
for (int i = 0; i < size; i++) {
public static void setSelectedDeviceBySerial(String serial) {
if (null == serial || serial.isEmpty()) {
setSelectedDevice(null);
- }
- int size = getDevices().size();
- for (int i = 0; i < size; i++) {
- IDevice idev = devices.get(i).getIDevice();
- if (null != idev) {
- if (serial.equals(idev.getSerialNumber())) {
- setSelectedDevice(devices.get(i));
+ } else {
+ int size = getDevices().size();
+ for (int i = 0; i < size; i++) {
+ IDevice idev = devices.get(i).getIDevice();
+ if (null != idev) {
+ if (serial.equals(idev.getSerialNumber())) {
+ setSelectedDevice(devices.get(i));
+ break;
+ }
}
}
}
DACommunicator.addDeviceListener();
DACommunicator.loadDevices();
DACommunicator.updateToolbarDevice();
-// DACommunicator.setSelectedApp(DACommunicator.getSelectedApp());
init = true;
}
}
private static InsertLogQueue insertLogQueue = null;
private static boolean isCompleted = false;
- public static void startInsertLogThread() {
+ public static synchronized void startInsertLogThread() {
if (null == insertLogThread || !insertLogThread.isAlive()) {
insertLogThread = new Thread(null, new LogInserter(),
AnalyzerConstants.INSERT_LOG_THREAD);
}
}
- public static InsertLogQueue getInsertLogQueue() {
+ public static synchronized InsertLogQueue getInsertLogQueue() {
if (null == insertLogQueue) {
insertLogQueue = new InsertLogQueue();
}
private static final int INDEX_LOG_COUNT = 8;
private static final int INDEX_SYSTEM_COUNT = 9;
private static final int INDEX_PROFILE_COUNT = 10;
- private static final int INDEX_SAVE_PATH = 11;
+// private static final int INDEX_SAVE_PATH = 11;
private static final int INDEX_MAIN_PID = 12;
private final static int MAX_FILENAME_LENGTH = 50;
File imgFolder = new File(savePath + File.separator
+ AnalyzerConstants.IMAGE_FOLDER_NAME);
if (!imgFolder.isDirectory()) {
- imgFolder.mkdirs();
- }
-
- File samallImage = new File(savePath + File.separator
- + AnalyzerConstants.IMAGE_FOLDER_NAME + File.separator
- + AnalyzerConstants.SMALL_IMAGE_FOLDER_NAME);
- if (!samallImage.isDirectory()) {
- samallImage.mkdirs();
+ if (!imgFolder.mkdirs()) {
+ System.out.println("image directory create failed...");
+ } else {
+ File samallImage = new File(savePath + File.separator
+ + AnalyzerConstants.IMAGE_FOLDER_NAME + File.separator
+ + AnalyzerConstants.SMALL_IMAGE_FOLDER_NAME);
+ if (!samallImage.isDirectory()) {
+ if (!samallImage.mkdirs()) {
+ System.out
+ .println("small image directory create failed...");
+ }
+ }
+ }
}
AnalyzerManager.setProject(this);
return true;
}
- public long getBaseAddress(int pid, long time) {
+ public long getBaseAddress(int pid, long time) {
ProcessInfoPackage pInfoPack = processInfoPackHash.get(pid);
ProcessInfo processInfo = pInfoPack.getProcessInfo(time);
return processInfo.getLowestAddress();
lastLogNum = Long.parseLong(data.get(INDEX_LOG_COUNT));
lastDeviceLogNum = Long.parseLong(data.get(INDEX_SYSTEM_COUNT));
lastProfileLogNum = Long.parseLong(data.get(INDEX_PROFILE_COUNT));
-// savePath = data.get(INDEX_SAVE_PATH);
+ // savePath = data.get(INDEX_SAVE_PATH);
mainPid = Integer.parseInt(data.get(INDEX_MAIN_PID));
}
}
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Shell;
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.handlers.ReplayTraceHandler;
import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
private static ShortCutManager instance = null;
private boolean enabled = true;
private int CTRL_STATE_MASK = SWT.CTRL;
-
+
private static int KEY_1 = 49;
private static int KEY_2 = 50;
private static int KEY_3 = 51;
DACustomButton button = (DACustomButton) ToolbarArea
.getInstance().getButton(ToolbarArea.REPLAY_BUTTON);
if (button.isButtonEnabled()) {
- if (AnalyzerUtil.executeCommand(ReplayTraceHandler.ID) != ReplayTraceHandler.FAILED) {
+ if (AnalyzerUtil.executeCommand(ReplayTraceHandler.ID) == AnalyzerConstants.SUCCESS) {
ToolbarArea.getInstance().startTrace();
}
}
import org.tizen.dynamicanalyzer.swap.model.data.LogData;
import org.tizen.dynamicanalyzer.swap.model.data.LogDataFactory;
import org.tizen.dynamicanalyzer.swap.model.data.LogDataUtils;
-import org.tizen.dynamicanalyzer.swap.model.data.ProbeCommonData;
import org.tizen.dynamicanalyzer.ui.toolbar.StopLogProcessor;
import org.tizen.dynamicanalyzer.ui.toolbar.StopProcessManager;
import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
public class MessageParser {
- final int MSG_ID_INDEX = 0;
- final int MSG_LENGTH_INDEX = 1;
- final int MSG_PAYLOAD_INDEX = 2;
- final int MSG_SPLIT_SIZE = 3;
+ static final int MSG_ID_INDEX = 0;
+ static final int MSG_LENGTH_INDEX = 1;
+ static final int MSG_PAYLOAD_INDEX = 2;
+ static final int MSG_SPLIT_SIZE = 3;
/* Message Buffer max length */
- final int MSG_BUFFER_MAX = 1000;
- final int MSG_BUFFER_TIMER_DELAY = 5;
- final int MSG_BUFFER_TIMER_PERIOD = 1000; // 1 second
- final int WAITING_TIME = 100;
+ static final int MSG_BUFFER_MAX = 1000;
+ static final int MSG_BUFFER_TIMER_DELAY = 5;
+ static final int MSG_BUFFER_TIMER_PERIOD = 1000; // 1 second
+ static final int WAITING_TIME = 100;
public static final int MSG_HEADER_SIZE = 20;
final int MSG_PAYLOAD_SIZE_INDEX = 16;
lock.unlock();
return;
}
- SWAPLogParser.getLogQueue().putLog(buffer);
- buffer = new ArrayList<LogData>();
- lock.unlock();
+ try {
+ SWAPLogParser.getLogQueue().putLog(buffer);
+ } catch (UnsupportedOperationException e) {
+ e.printStackTrace();
+ } catch (ClassCastException e) {
+ e.printStackTrace();
+ } catch (NullPointerException e) {
+ e.printStackTrace();
+ } catch (IllegalArgumentException e) {
+ e.printStackTrace();
+ } catch (IllegalMonitorStateException e) {
+ e.printStackTrace();
+ } finally {
+ buffer = new ArrayList<LogData>();
+ lock.unlock();
+ }
}
private void processProcessInfo(byte[] data) {
int index = 0;
int id = ByteUtils.toInt(data, index);
index += INT_SIZE;
-// int seq = ByteUtils.toInt(data, index);
+ // int seq = ByteUtils.toInt(data, index);
index += INT_SIZE;
DATime changeTime = new DATime();
int sec = ByteUtils.toInt(data, index);
changeTime.setSec(sec);
changeTime.setNano(nano);
-// int length = ByteUtils.toInt(data, index);
+ // int length = ByteUtils.toInt(data, index);
index += INT_SIZE;
int pid = ByteUtils.toInt(data, index);
import org.tizen.sdblib.service.SyncResult;
public class SWAPLogParser implements Runnable {
- private final String OSP_MAIN = "OspMain"; //$NON-NLS-1$
+ private static final String OSP_MAIN = "OspMain"; //$NON-NLS-1$
private static Thread logParser = null;
// default false, turn on when Tizen C++ app
// private static boolean dropCallTraceLog = true;
private int DEFAULT_IMG_WIDTH = 480;
private int DEFAULT_IMG_HEIGHT = 800;
- public static LogQueue getLogQueue() {
+ public static synchronized LogQueue getLogQueue() {
if (null == logQueue) {
logQueue = new LogQueue();
}
return dropCallTraceLog;
}
- public static void startLogParser() {
+ public static synchronized void startLogParser() {
getLogQueue().clear();
// why here?
// dropCallTraceLog = true;
+ libFullName;
File rpms = new File(rpmPath);
if (!rpms.exists()) {
- rpms.mkdirs();
+ if (!rpms.mkdirs()) {
+ System.out.println("rpm directory create failed...");
+ continue;
+ }
}
String from = debugPath;
if (null != debugInfoSourceRpmName
&& !debugInfoSourceRpmName.isEmpty()) {
- from = debugInfoFile.getParent() + File.separator + debugInfoSourceRpmName;
+ from = debugInfoFile.getParent() + File.separator
+ + debugInfoSourceRpmName;
to = rpmPath + File.separator + debugInfoSourceRpmName;
if (AnalyzerUtil.copyFile(from, to)) {
debugRpmSourcePath = to;
new InputStreamReader(
process.getErrorStream()));
String errorStr = error.readLine();
- System.out.println("debug info file extract failed... : "
- + errorStr);
+ System.out
+ .println("debug info file extract failed... : "
+ + errorStr);
continue;
}
} catch (IOException e) {
BufferedReader error = new BufferedReader(
new InputStreamReader(process.getErrorStream()));
String errorStr = error.readLine();
- System.out.println("debug source file extract failed... : "
- + errorStr);
+ System.out
+ .println("debug source file extract failed... : "
+ + errorStr);
continue;
}
debugFilePath = rpmPath + line.substring(1, line.length());
@Override
public void updateView(DASelectionData data) {
- FileChartData pageData = (FileChartData) data.getData();
-
- if (!(pageData instanceof FileChartData)) {
+ if (!(data.getData() instanceof FileChartData)) {
selectionStartTime = data.getStartTime();
selectionEndTime = data.getEndTime();
- } else {
- this.data = pageData;
+ tableComp.getTable().removeAll();
+ tableComp.updateTable();
+ tableComp.setSelectionByTime(selectionStartTime, selectionEndTime);
}
- tableComp.getTable().removeAll();
- tableComp.updateTable();
- tableComp.setSelectionByTime(selectionStartTime, selectionEndTime);
-
}
@Override
public class ImageViewer extends Composite {
- class ImageData {
+ static class ImageData {
public GC gc;
public int imgWidth;
public int imgHeight;
private boolean rightEnable = false;
// +2 means outer offset
- private final int defaultShellMaxWidth = 480 / 2 + 2;
- private final int defaultShellMaxHeight = 800 / 2 + 2;
- private final int defaultChildWidth = 69;
- private final int defaultChildHeight = 108;
+ private static final int defaultShellMaxWidth = 480 / 2 + 2;
+ private static final int defaultShellMaxHeight = 800 / 2 + 2;
+ private static final int defaultChildWidth = 69;
+ private static final int defaultChildHeight = 108;
private int shellMaxWidth = 0;
private int shellMaxHeight = 0;
processGraph.setTextColor(ColorResources.PROCESS_GRAPH_COLOR);
processGraph.setText(InformationViewLabels.SNAPSHOT_VIEW_PROCESS);
processGraph.setLabelBg(ColorResources.VIEW_BG_COLOR);
- processGraph.setFont(FontResources.CIRCULAR_LABEL_FONT);
+ processGraph.setLabelFont(FontResources.CIRCULAR_LABEL_FONT);
processGraph.setMeasureFont(FontResources.CIRCULAR_GRAPH_MEASURE_FONT);
processGraph.setValueFont(FontResources.CIRCULAR_GRAPH_VALUE_FONT);
private List<ViewAction> views = null;
protected String name = null;
- private final double DEFAULT_WIDTH = DesignConstants.SNAPSHOT_VIEW_WIDTH + 10;
- private final double DEFAULT_HEIGHT = DesignConstants.SNAPSHOT_VIEW_HEIGHT
+ private static final double DEFAULT_WIDTH = DesignConstants.SNAPSHOT_VIEW_WIDTH + 10;
+ private static final double DEFAULT_HEIGHT = DesignConstants.SNAPSHOT_VIEW_HEIGHT
+ 10 + DesignConstants.VIEW_TITLEBAR_HEIGHT;
protected int wRate = 0;
public class ColumnGroupRenderer extends DefaultColumnGroupHeaderRenderer {
- int leftMargin = 6;
-
- int rightMargin = 6;
-
- int topMargin = 3;
-
int bottomMargin = 3;
- int arrowMargin = 6;
-
- int imageSpacing = 3;
-
@Override
public boolean notify(int arg0, Point arg1, Object arg2) {
// TODO Auto-generated method stub
return profileDataMaker;
}
- public static FunctionUsageProfiler getInstance() {
+ public static synchronized FunctionUsageProfiler getInstance() {
if (null == instance) {
instance = new FunctionUsageProfiler();
}
notifyAll();
}
- public static void startProfiler() {
+ public static synchronized void startProfiler() {
if (null == profiler || !profiler.isAlive()) {
profiler = new Thread(null, getInstance(),
AnalyzerConstants.LOG_QUEUE_OBSERVING_THREAD);
return children;
}
- public boolean equals(ProfilingChildData input) {
+ public boolean isEualsl(ProfilingChildData input) {
if (!input.getSeq().equals(seq)) {
return false;
}
package org.tizen.dynamicanalyzer.ui.timeline.calltrace;
-
-
-
-//import java.util.ArrayList;
-//import java.util.List;
-//
-//import org.eclipse.nebula.widgets.grid.Grid;
-//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.AnalyzerConstants;
-//import org.tizen.dynamicanalyzer.common.AnalyzerManager;
-//import org.tizen.dynamicanalyzer.common.DASelectionData;
-//import org.tizen.dynamicanalyzer.model.TableInput;
-//import org.tizen.dynamicanalyzer.swap.model.data.LogData;
-//import org.tizen.dynamicanalyzer.swap.model.data.ProfileData;
-//import org.tizen.dynamicanalyzer.swap.model.data.UserFunctionData;
-//import org.tizen.dynamicanalyzer.ui.common.UICommonConstants;
-//import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
-//import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
-//import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineView;
-//import org.tizen.dynamicanalyzer.ui.widgets.table.DATableComposite;
-//import org.tizen.dynamicanalyzer.ui.widgets.table.DATableDataFormat;
-//import org.tizen.dynamicanalyzer.utils.Formatter;
-//import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotIntervalMarker;
-//import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
-//
-//public class CallTraceTable extends DATableComposite {
-// private DAChartBoard chartBoard = null;
-//
-// public CallTraceTable(Composite parent, int compStyle, int tableStyle) {
-// super(parent, compStyle, tableStyle);
-// setRangePopup();
-//
-// table.addSelectionListener(new SelectionListener() {
-//
-// @Override
-// public void widgetSelected(SelectionEvent e) {
-// GridItem[] ti = ((Grid) e.widget).getSelection();
-// if (null == ti || ti.length == 0) {
-// return;
-// }
-// int size = ti.length;
-// LogData startData = ((DATableDataFormat) ti[0].getData())
-// .getLogData();
-// LogData endData = ((DATableDataFormat) ti[size - 1].getData())
-// .getLogData();
-// long startTime = startData.getTime();
-// long endTime = endData.getTime();
-//
-// DASelectionData data = new DASelectionData(CallTraceView.ID,
-// startTime, endTime, ti, table);
-// AnalyzerManager.getCurrentPage().updatePage(data);
-// }
-//
-// @Override
-// public void widgetDefaultSelected(SelectionEvent e) {
-// }
-// });
-//
-// }
-//
-// protected List<TableInput> makeTableInput() {
-// List<LogData> userLog = UserFunctionManager.getInstance().getLog();
-// List<TableInput> input = new ArrayList<TableInput>();
-// int size = userLog.size();
-// for (int i = 0; i < size; i++) {
-// LogData logData = userLog.get(i);
-// List<String> text = new ArrayList<String>();
-// if (logData instanceof UserFunctionData) {
-// // create text
-// UserFunctionData data = (UserFunctionData) logData;
-// String time = Formatter.toTimeFormat(data.getTime());
-// text.add(time);
-// text.add(Integer.toString(data.getTid()));
-// text.add(Integer.toString(data.getPid()));
-// text.add(data.getApiName());
-// text.add(data.getArgs());
-// text.add(data.getReturn());
-// text.add(data.getLibName());
-// } else if (logData instanceof ProfileData) {
-// ProfileData data = (ProfileData) logData;
-// String time = Formatter.toTimeFormat(data.getTime());
-// text.add(time);
-// text.add(Integer.toString(data.getTid()));
-// text.add(Integer.toString(data.getPid()));
-// text.add(data.getApiName());
-// text.add(data.getArgs());
-// text.add(data.getHexReturn());
-// text.add(data.getLibName());
-// } else {
-// System.out.println("wrong log data in calltrace view");
-// continue;
-// }
-// // create images
-//
-// // create DATableDataFormat
-// DATableDataFormat tableData = new DATableDataFormat(
-// logData.getSeq());
-// tableData.setLogData(logData);
-// tableData.setType(AnalyzerConstants.TYPE_TABLE_CALLTRACE);
-//
-// TableInput tableInput = new TableInput();
-// tableInput.setText(text);
-// tableInput.setData(tableData);
-// input.add(tableInput);
-//
-// if (RangeDataManager.getInstance().isBeingAnalyzed()) {
-// long logTime = logData.getTime();
-// long analysisStartTime = RangeDataManager.getInstance()
-// .getAnalysisStartTime();
-// long analysisEndTime = RangeDataManager.getInstance()
-// .getAnalysisEndTime();
-// if (logTime >= analysisStartTime && logTime <= analysisEndTime) {
-// tableInput.setInRange(true);
-// }
-// }
-// }
-// return input;
-// }
-//
-// private DAChartBoard getChartBoard() {
-// if (chartBoard == null) {
-// return (DAChartBoard) (AnalyzerManager.getCurrentPage().getView(
-// TimelineView.ID).getControl());
-// }
-// return chartBoard;
-// }
-//
-// protected void actionSetStartEnd(int type) {
-// GridItem item = table.getItem(mousePoint);
-// if (null != item) {
-// LogData data = ((DATableDataFormat) item.getData()).getLogData();
-// long inputTime = data.getTime();
-// double startTime = -1;
-// double endTime = -1;
-// DAChartBoard board = getChartBoard();
-//
-// if (type == START_TIME) {
-// rangeDataManager.setMarkerStartTime(inputTime);
-// startTime = inputTime / TimelineConstants.MEGA_DOUBLE;
-// endTime = rangeDataManager.getMarkerEndTime()
-// / TimelineConstants.MEGA_DOUBLE;
-//
-// } else if (type == END_TIME) {
-// rangeDataManager.setMarkerEndTime(inputTime);
-// endTime = inputTime / TimelineConstants.MEGA_DOUBLE;
-// startTime = rangeDataManager.getMarkerStartTime()
-// / TimelineConstants.MEGA_DOUBLE;
-// }
-//
-// board.setTimelineMarkerStartTime(startTime);
-// board.setTimelineMarkerEndTime(endTime);
-//
-// ((DAChartPlotIntervalMarker) board.getMarkers().get(
-// UICommonConstants.RANGE_MARKER_INDEX))
-// .setStartVal(startTime);
-// ((DAChartPlotIntervalMarker) board.getMarkers().get(
-// UICommonConstants.RANGE_MARKER_INDEX)).setEndVal(endTime);
-// //
-// //
-// //
-// //
-// // if (type == START_TIME) {
-// // rangeDataManager.setMarkerStartTime(inputTime);
-// // getChartBoard().setTimelineMarkerStartTime(
-// // inputTime / TimelineConstants.MEGA);
-// // } else if (type == END_TIME) {
-// // rangeDataManager.setMarkerEndTime(inputTime);
-// // getChartBoard().setTimelineMarkerEndTime(
-// // inputTime / TimelineConstants.MEGA);
-// // }
-// }
-// }
-//
-// public void setSelectionByTime(long startTime, long endTime) {
-// GridItem[] items = table.getItems();
-// int size = items.length;
-// List<Integer> selectionArray = new ArrayList<Integer>();
-// int topIndex = 0;
-// long topIndexTime = 0;
-//
-// for (int i = 0; i < size; i++) {
-// DATableDataFormat dataFormat = (DATableDataFormat) items[i]
-// .getData();
-// long time = dataFormat.getLogData().getTime();
-//
-// if (time < startTime) {
-// if (time > topIndexTime) {
-// topIndexTime = time;
-// topIndex = i;
-// }
-// } else if (time <= endTime) {
-// if (topIndexTime < startTime) {
-// topIndexTime = time;
-// topIndex = i;
-// } else {
-// if (topIndexTime > time) {
-// topIndexTime = time;
-// topIndex = i;
-// }
-// }
-// selectionArray.add(i);
-// } else {
-// break;
-// }
-// }
-//
-// int[] sel = new int[selectionArray.size()];
-// for (int i = 0; i < sel.length; i++) {
-// sel[i] = selectionArray.get(i).intValue();
-// }
-// table.setSelection(sel);
-// table.setTopIndex(topIndex);
-// }
-//}
-
-
import java.util.ArrayList;
import java.util.List;
ColorResources.DEFAULT_FONT_COLOR,
ColorResources.DEFAULT_FONT_COLOR,
ColorResources.DEFAULT_FONT_COLOR);
- addItems.setFont(FontResources.ADDITEM_BUTTON_FONT);
+ addItems.setButtonFont(FontResources.ADDITEM_BUTTON_FONT);
GridData gDataAddBtn = new GridData();
gDataAddBtn.horizontalAlignment = GridData.FILL;
okButton = new DAButton(buttonComp, SWT.NONE);
okButton.addClickListener(okButtonListener);
okButton.setText(AnalyzerLabels.OK);
- okButton.setFont(FontResources.DIALOG_BUTTON_FONT);
+ okButton.setButtonFont(FontResources.DIALOG_BUTTON_FONT);
FormData okData = new FormData();
okData.top = new FormAttachment(0, 9);
licenseButton = new DAButton(buttonComp, SWT.NONE);
licenseButton.addClickListener(licenseButtonListener);
licenseButton.setText(AnalyzerLabels.ABOUT_DIALOG_LICENSE);
- licenseButton.setFont(FontResources.DIALOG_BUTTON_FONT);
+ licenseButton.setButtonFont(FontResources.DIALOG_BUTTON_FONT);
FormData licenceData = new FormData();
licenceData.top = new FormAttachment(0, 9);
File configFolder = new File(AnalyzerPaths.CONFIG_FOLDER_PATH);
if (!configFolder.isDirectory()) {
- configFolder.mkdirs();
+ if (!configFolder.mkdirs()) {
+ System.out.println("config directory create failed...");
+ return;
+ }
}
File configFile = new File(configFolder,
if (DACommunicator.isSWAPVersion(devInfo)) {
state |= getValueInt(ConfigureLabels.FEATURE_SYSCALL);
// state |= getValueInt(ConfigureLabels.FEATURE_SYSCALL_FILE);
-// state |= getValueInt(ConfigureLabels.FEATURE_SYSCALL_IPC);
-// state |= getValueInt(ConfigureLabels.FEATURE_SYSCALL_PROCESS);
-// state |= getValueInt(ConfigureLabels.FEATURE_SYSCALL_SIGNAL);
-// state |= getValueInt(ConfigureLabels.FEATURE_SYSCALL_NETWORK);
-// state |= getValueInt(ConfigureLabels.FEATURE_SYSCALL_DESC);
+ // state |= getValueInt(ConfigureLabels.FEATURE_SYSCALL_IPC);
+ // state |= getValueInt(ConfigureLabels.FEATURE_SYSCALL_PROCESS);
+ // state |= getValueInt(ConfigureLabels.FEATURE_SYSCALL_SIGNAL);
+ // state |= getValueInt(ConfigureLabels.FEATURE_SYSCALL_NETWORK);
+ // state |= getValueInt(ConfigureLabels.FEATURE_SYSCALL_DESC);
state |= getValueInt(ConfigureLabels.FEATURE_CONTEXT_SWITCH);
state |= getValueInt(ConfigureLabels.FEATURE_NETWORK);
state |= getValueInt(ConfigureLabels.FEATURE_OPENGL);
-// state |= getValueInt(ConfigureLabels.FEATURE_FUNCTION_SAMPLING);
+ // state |= getValueInt(ConfigureLabels.FEATURE_FUNCTION_SAMPLING);
state |= getValueInt(ConfigureLabels.FEATURE_SYSTEM);
// state |= getValueInt(ConfigureLabels.FEATURE_SYSTEM_CPU);
-// state |= getValueInt(ConfigureLabels.FEATURE_SYSTEM_PROCESSES);
-// state |= getValueInt(ConfigureLabels.FEATURE_SYSTEM_MEMORY);
-// state |= getValueInt(ConfigureLabels.FEATURE_SYSTEM_DISK);
-// state |= getValueInt(ConfigureLabels.FEATURE_SYSTEM_NETWORK);
-// state |= getValueInt(ConfigureLabels.FEATURE_SYSTEM_DEVICE);
+ // state |= getValueInt(ConfigureLabels.FEATURE_SYSTEM_PROCESSES);
+ // state |= getValueInt(ConfigureLabels.FEATURE_SYSTEM_MEMORY);
+ // state |= getValueInt(ConfigureLabels.FEATURE_SYSTEM_DISK);
+ // state |= getValueInt(ConfigureLabels.FEATURE_SYSTEM_NETWORK);
+ // state |= getValueInt(ConfigureLabels.FEATURE_SYSTEM_DEVICE);
state |= getValueInt(ConfigureLabels.FEATURE_SYSTEM_ENERGY);
}
import java.io.FileReader;
import java.io.IOException;
-import org.eclipse.jface.window.Window;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonClickEventListener;
-public class LicenseDialog extends Window {
+public class LicenseDialog {
private Shell parent = null;
private Shell shell = null;
private DACustomButton okButton = null;
public LicenseDialog(Shell parent, int style) {
- super(parent);
this.parent = parent;
}
return ret.toString();
}
- @Override
public int open() {
shell = new Shell(parent, SWT.APPLICATION_MODAL | SWT.DIALOG_TRIM);
shell.setSize(608, 476 + 22);
e.gc.setForeground(ColorResources.BUTTON_OUTLINE_HOVER_IN_COLOR);
Text text = (Text) e.widget;
Rectangle rect = text.getClientArea();
- e.gc.drawRectangle(rect.x, rect.y, rect.width -1, rect.height - 1);
-// e.gc.drawRectangle(rect.x+1, rect.y+1, rect.width -3, rect.height - 3);
+ e.gc.drawRectangle(rect.x, rect.y, rect.width - 1,
+ rect.height - 1);
+ // e.gc.drawRectangle(rect.x+1, rect.y+1, rect.width -3,
+ // rect.height - 3);
}
});
File sourceFolder = new File(sourcePath);
if (!sourceFolder.isDirectory()) {
- sourceFolder.mkdirs();
+ if (!sourceFolder.mkdirs()) {
+ System.out.println("source directory create failed...");
+ return false;
+ }
}
File targetFolder = new File(targetPath);
if (!targetFolder.isDirectory()) {
- targetFolder.mkdirs();
+ if (!targetFolder.mkdirs()) {
+ System.out.println("target directory create failed...");
+ return false;
+ }
}
AnalyzerUtil.copyDirectory(sourceFolder, targetFolder);
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.common.CommonConstants;
import org.tizen.dynamicanalyzer.common.DesignConstants;
@Override
public void handleClickEvent(DACustomButton button) {
if (!AnalyzerManager.isRunning()) {
- if (AnalyzerUtil.executeCommand(ReplayTraceHandler.ID) != ReplayTraceHandler.FAILED) {
+ if (AnalyzerUtil.executeCommand(ReplayTraceHandler.ID) != AnalyzerConstants.FAIL) {
startTrace();
}
}
// Creates TimerClock widget.
timerClock = new TimerClock(parent, SWT.NONE);
timerClock.setBgImage(ImageResources.TIMER);
- timerClock.setFont(FontResources.TIMER);
+ timerClock.setClockFont(FontResources.TIMER);
// // Creates save trace button.
saveTraceButton = new DACustomButton(parent, ImageResources.SAVE,
private boolean checkValidApplication() {
List<DeviceInfo> devices = DACommunicator.getDevices();
if (null == devices || devices.isEmpty()) {
+ System.out.println("Device is empty");
return false;
}
String selectedDevice = deviceCombo.getText();
String settingPath = AnalyzerPaths.DYNAMIC_ANALYZER_SETTING_PATH;
File settingFolder = new File(settingPath);
if (!settingFolder.exists() || !settingFolder.isDirectory()) {
- settingFolder.mkdirs();
+ if (!settingFolder.mkdirs()) {
+ System.out.println("setting directory create failed...");
+ }
}
this.setLayout(new FormLayout());
cancelButton = new DAButton(buttonContentsComp, SWT.NONE);
cancelButton.addClickListener(cancelButtonListener);
cancelButton.setText(AnalyzerLabels.CLOSE);
- cancelButton.setFont(FontResources.DIALOG_BUTTON_FONT);
+ cancelButton.setButtonFont(FontResources.DIALOG_BUTTON_FONT);
FormData buttonData = new FormData();
buttonData.left = new FormAttachment(50, 4);
buttonData.top = new FormAttachment(0, 11);
applyButton = new DAButton(buttonContentsComp, SWT.NONE);
applyButton.addClickListener(applyButtonListener);
applyButton.setText(AnalyzerLabels.APPLY);
- applyButton.setFont(FontResources.DIALOG_BUTTON_FONT);
+ applyButton.setButtonFont(FontResources.DIALOG_BUTTON_FONT);
buttonData = new FormData();
buttonData.right = new FormAttachment(50, -4);
buttonData.top = new FormAttachment(0, 11);
cancelButton = new DAButton(buttonContentsComp, SWT.NONE);
cancelButton.addClickListener(cancelButtonListener);
cancelButton.setText(AnalyzerLabels.CANCEL);
- cancelButton.setFont(FontResources.DIALOG_BUTTON_FONT);
+ cancelButton.setButtonFont(FontResources.DIALOG_BUTTON_FONT);
FormData buttonData = new FormData();
buttonData.right = new FormAttachment(100, -9);
buttonData.top = new FormAttachment(0, 11);
okButton = new DAButton(buttonContentsComp, SWT.NONE);
okButton.addClickListener(okButtonListener);
okButton.setText(AnalyzerLabels.OK);
- okButton.setFont(FontResources.DIALOG_BUTTON_FONT);
+ okButton.setButtonFont(FontResources.DIALOG_BUTTON_FONT);
buttonData = new FormData();
buttonData.right = new FormAttachment(cancelButton, -8);
buttonData.top = new FormAttachment(0, 11);
okButton = new DAButton(buttonComp, SWT.NONE);
okButton.addClickListener(okButtonListener);
okButton.setText(AnalyzerLabels.OPEN);
- okButton.setFont(FontResources.DIALOG_BUTTON_FONT);
+ okButton.setButtonFont(FontResources.DIALOG_BUTTON_FONT);
FormData okData = new FormData();
okData.top = new FormAttachment(0, 7);
okData.left = new FormAttachment(50,
cancelButton = new DAButton(buttonComp, SWT.NONE);
cancelButton.addClickListener(cancelButtonListener);
cancelButton.setText(AnalyzerLabels.CLOSE);
- cancelButton.setFont(FontResources.DIALOG_BUTTON_FONT);
+ cancelButton.setButtonFont(FontResources.DIALOG_BUTTON_FONT);
FormData cancelData = new FormData();
cancelData.top = new FormAttachment(0, 7);
cancelData.left = new FormAttachment(50, 4);
private static Thread openTraceInputThread = null;
- public static void startOpenTraceInputReader() {
+ public static synchronized void startOpenTraceInputReader() {
if (null == openTraceInputThread || !openTraceInputThread.isAlive()) {
openTraceInputThread = new Thread(null, new OpenTraceInputReader(),
AnalyzerConstants.OPEN_TRACE_THREAD);
public class SaveFilesTable extends DATableComposite {
private boolean isVaildVersion = true;
- private final int TRACE_NAME_INDEX = 0;
- private final int DATE_INDEX = 1;
- private final int VALIDATE_INDEX = 2;
- private final int COLUMN_COUNT = 2;
+ private static final int TRACE_NAME_INDEX = 0;
+ private static final int DATE_INDEX = 1;
+ private static final int VALIDATE_INDEX = 2;
+ private static final int COLUMN_COUNT = 2;
public SaveFilesTable(Composite parent, int style) {
super(parent, style);
import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
public class TempFilesTable extends DATableComposite {
- private final int TRACE_NAME_INDEX = 0;
- private final int DATE_INDEX = 1;
+ private static final int TRACE_NAME_INDEX = 0;
+ private static final int DATE_INDEX = 1;
public TempFilesTable(Composite parent, int style) {
super(parent, style);
okButton = new DAButton(buttonComp, SWT.NONE);
okButton.addClickListener(okButtonListener);
okButton.setText(AnalyzerLabels.OK);
- okButton.setFont(FontResources.DIALOG_BUTTON_FONT);
+ okButton.setButtonFont(FontResources.DIALOG_BUTTON_FONT);
FormData okData = new FormData();
okData.top = new FormAttachment(0, 12);
ColorResources.TAB_OUTLINE_SELECTED_COLOR);
tabButton.setRenderer(new TabButtonRenderer());
tabButton.setButtonEnabled(true);
- tabButton.setFont(FontResources.TAB_BUTTON_FONT);
+ tabButton.setButtonFont(FontResources.TAB_BUTTON_FONT);
tabButton.setText(title);
tabButton.setToolTipText((String) child.getData("tooltip"));
tabButton.setClosable(closeable);
public class FindDialog extends DAMessageBox {
- private final int ENTER_KEY_CODE = 13;
+ private static final int ENTER_KEY_CODE = 13;
private Text textBox = null;
private DAButton findButton = null;
public void draw(GC gc, Canvas canvas, int state,
DACustomButtonAttribute attr) {
Rectangle rect = canvas.getClientArea();
-
- if (attr.getDrawType() == DACustomButton.TYPE_IMAGE) {
- drawImageButton(gc, rect, state, attr, (DATabButton) canvas);
- } else if (attr.getDrawType() == DACustomButton.TYPE_COLOR
- || attr.getDrawType() == DACustomButton.TYPE_GRADATION) {
- drawButton(gc, rect, state, attr, (DATabButton) canvas);
+ DATabButton tab = null;
+ if (canvas instanceof DATabButton) {
+ tab = (DATabButton) canvas;
+
+ if (attr.getDrawType() == DACustomButton.TYPE_IMAGE) {
+ drawImageButton(gc, rect, state, attr, tab);
+ } else if (attr.getDrawType() == DACustomButton.TYPE_COLOR
+ || attr.getDrawType() == DACustomButton.TYPE_GRADATION) {
+ drawButton(gc, rect, state, attr, tab);
+ }
+ // drawButtonImage(gc, rect, attr);
+ drawIcon(gc, rect, attr);
}
- // drawButtonImage(gc, rect, attr);
- drawIcon(gc, rect, attr);
}
protected void drawIcon(GC gc, Rectangle parentRect,
}
if (item.getParent().getLinesVisible()) {
- if (isCellSelected()) {
+// if (isCellSelected()) {
gc.setForeground(ColorResources.TABLE_LINE);
- } else {
- gc.setForeground(ColorResources.TABLE_LINE);
- }
+// } else {
+// gc.setForeground(ColorResources.TABLE_LINE);
+// }
gc.drawLine(getBounds().x, getBounds().y + getBounds().height,
getBounds().x + getBounds().width - 1, getBounds().y
+ getBounds().height);
}
if (table.getLinesVisible()) {
- if (isCellSelected()) {
+// if (isCellSelected()) {
gc.setForeground(ColorResources.TABLE_LINE);
- } else {
- gc.setForeground(ColorResources.TABLE_LINE);
- }
+// } else {
+// gc.setForeground(ColorResources.TABLE_LINE);
+// }
gc.drawLine(getBounds().x, getBounds().y + getBounds().height,
getBounds().x + getBounds().width - 1, getBounds().y
+ getBounds().height);
package org.tizen.dynamicanalyzer.ui.widgets.table;
+import java.io.Serializable;
import java.util.Comparator;
import java.util.List;
import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.model.TableInput;
-public class DefaultTableComparator implements Comparator<Object> {
+public class DefaultTableComparator implements Comparator<Object>, Serializable {
+ private static final long serialVersionUID = 1L;
protected int type = AnalyzerConstants.SORT_TYPE_GRID;
protected int column = 0;
protected int oldColumn = 0;
package org.tizen.dynamicanalyzer.ui.widgets.table;
+import java.io.Serializable;
+
import org.tizen.dynamicanalyzer.model.TreeInput;
-public class TreeDataComparator extends DefaultTableComparator {
+public class TreeDataComparator extends DefaultTableComparator implements
+ Serializable {
+
+ private static final long serialVersionUID = 1L;
@Override
public int userCompare(Object obj1, Object obj2) {
import org.tizen.dynamicanalyzer.communicator.DACommunicator;
public class UIRecorderPlayThread extends Thread {
- private final String FILTER_STRING = "ls:";//$NON-NLS-1$
+ private static final String FILTER_STRING = "ls:";//$NON-NLS-1$
private long readyTime = 100000;
- long pauseTime;
private static UIRecorderPlayThread instance = null;
private String xmlFileName = null;
public void run() {
long preTime = 0;
long nowTime = 0;
- pauseTime = 0;
RecorderXml xml = new RecorderXml();
XmlData oldData = new XmlData();
oldData.event_code = CommonConstants.ZERO;
public static void copyDirectory(File sourceLocation, File targetLocation) {
if (sourceLocation.isDirectory()) {
if (!targetLocation.exists()) {
- targetLocation.mkdir();
+ if (!targetLocation.mkdir()) {
+ System.out
+ .println("Copy Failed : target directory create failed..");
+ return;
+ }
}
String[] children = sourceLocation.list();
for (int i = 0; i < children.length; i++) {
while ((len = in.read(buf)) > 0) {
out.write(buf, 0, len);
}
- if (null != in) {
- in.close();
- }
- if (null != out) {
- out.close();
- }
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
+ } finally {
+ tryClose(in, out);
}
}
}
IHandlerService handlerService = (IHandlerService) PlatformUI
.getWorkbench().getService(IHandlerService.class);
try {
- return (Integer) handlerService.executeCommand(commandId,
- new Event());
+
+ handlerService.executeCommand(commandId, new Event());
+ return AnalyzerConstants.SUCCESS;
} catch (ExecutionException e) {
e.printStackTrace();
} catch (NotEnabledException e) {
} catch (NotDefinedException e) {
e.printStackTrace();
}
- return -1;
+ return AnalyzerConstants.FAIL;
}
public static List<String> getDirs(String path) {
public static void checkLogs(String path, String prefix, int limitCount) {
List<String> logFiles = getFiles(path);
-
+ if (null == logFiles) {
+ return;
+ }
List<String> daLogFiles = new ArrayList<String>();
for (String name : logFiles) {
if (name.contains(prefix)) {
return false;
}
- public static boolean isAddrInBinaryRange(int pid, long time, long addr)
- {
- ProcessInfoPackage processInfoPkg = AnalyzerManager
- .getProject().getProcessInfo(pid);
- ProcessInfo processInfo = processInfoPkg.getProcessInfo(time);
+ public static boolean isAddrInBinaryRange(int pid, long time, long addr) {
+ ProcessInfoPackage processInfoPkg = AnalyzerManager.getProject()
+ .getProcessInfo(pid);
+ ProcessInfo processInfo = processInfoPkg.getProcessInfo(time);
if (null == processInfo) {
return false;
- }
-
+ }
+
if (addr >= processInfo.getLowestAddress()
- && addr <= processInfo.getHighestAddress()) {
+ && addr <= processInfo.getHighestAddress()) {
return true;
} else {
return false;
}
}
-
+
public static boolean getBinaryBuildType(String localBinaryPath) {
HashMap<String, BinaryInfo> binMap = DACommunicator.getSelectedApp()
.getBinaryInfoMap();
*/
package org.tizen.dynamicanalyzer.utils;
+import java.io.Serializable;
import java.util.Comparator;
import java.util.List;
import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
+public class DefaultComparator implements Comparator<List<String>>,
+ Serializable {
-public class DefaultComparator implements Comparator<List<String>> {
+ private static final long serialVersionUID = 1L;
@Override
public int compare(List<String> arg0, List<String> arg1) {
package org.tizen.dynamicanalyzer.utils;
+import java.io.Serializable;
import java.util.Comparator;
import org.tizen.dynamicanalyzer.model.ImageInfo;
+public class ImageListSortComparator implements Comparator<ImageInfo>,
+ Serializable {
-public class ImageListSortComparator implements Comparator<ImageInfo> {
+ private static final long serialVersionUID = 1L;
@Override
public int compare(ImageInfo one, ImageInfo two) {
msg.append("\" name=\"");
msg.append(name);
msg.append("\" time=\"");
- msg.append(String.format("%.3f", (double)spendTime / 1000000000.0));
+ msg.append(String.format("%.3f",
+ (double) spendTime / 1000000000.0));
msg.append("\"/>\n");
printOutput(msg);
}
}
private void openWriter() {
-// Date time = Calendar.getInstance().getTime();
-
- File autotestPath = new File(AnalyzerPaths.DYNAMIC_ANALYZER_AUTOTEST_PATH);
- if(!autotestPath.exists()) {
- autotestPath.mkdirs();
+ // Date time = Calendar.getInstance().getTime();
+
+ File autotestPath = new File(
+ AnalyzerPaths.DYNAMIC_ANALYZER_AUTOTEST_PATH);
+ if (!autotestPath.exists()) {
+ if (!autotestPath.mkdirs()) {
+ System.out.println("auto test path file create failed...");
+ return;
+ }
}
StringBuilder savePath = new StringBuilder();
bStartRecord = state;
}
- public static void start() {
- if (null != timer) {
- timer.cancel();
- timer = null;
- }
+ public static synchronized void start() {
+ stop();
+
timer = new Timer();
timer.schedule(new UpdateTimerTask(),
AnalyzerConstants.TIMER_START_TIME_DEFAULT,