import org.eclipse.swt.graphics.Point;
public class DACustomButtonAttribute {
- private final int MAX_SIZE = 10;
+ private final int MAX_SIZE = 12;
private String text;
private Image buttonImage = null;
private Font font;
public DACustomButtonAttribute() {
enabled = true;
- // init array
+ // init array list
for (int i = 0; i < MAX_SIZE; i++) {
images.add(null);
colors.add(null);
public class DACustomToggleButton extends DACustomButton {\r
\r
public static final int STATE_TOGGLE = 4;\r
+ public static final int STATE_TOGGLE_HOVER = 5;\r
private boolean toggle = false;\r
private boolean toggleByButton = false;\r
\r
public DACustomToggleButton(Composite parent, Image normal,\r
- Image mouseDown, Image hover, Image disable, Image toggle) {\r
+ Image mouseDown, Image hover, Image disable, Image toggle,\r
+ Image toggleHover) {\r
super(parent, normal, mouseDown, hover, disable);\r
buttonRenderer = new DACustomToggleButtonRenderer();\r
\r
attr.setImage(STATE_TOGGLE, toggle);\r
+ attr.setImage(STATE_TOGGLE_HOVER, toggleHover);\r
addListeners();\r
}\r
\r
super(parent, style);\r
buttonRenderer = new DACustomToggleButtonRenderer();\r
attr.setColor(STATE_TOGGLE, ColorResources.BLUE);\r
+ attr.setColor(STATE_TOGGLE_HOVER, ColorResources.WHITE);\r
addListeners();\r
}\r
\r
public DACustomToggleButton(Composite parent, Color normalStart,\r
Color normalEnd, Color pushStart, Color pushEnd, Color hoverStart,\r
Color hoverEnd, Color disableStart, Color disableEnd,\r
- Color toggleStart, Color toggleEnd) {\r
+ Color toggleStart, Color toggleEnd, Color toggleHoverStart,\r
+ Color toggleHoverEnd) {\r
this(parent, SWT.NONE);\r
attr.setColor(0, normalStart);\r
attr.setColor(1, normalEnd);\r
attr.setColor(7, disableEnd);\r
attr.setColor(8, toggleStart);\r
attr.setColor(9, toggleEnd);\r
+ attr.setColor(10, toggleHoverStart);\r
+ attr.setColor(11, toggleHoverEnd);\r
attr.setDrawType(TYPE_GRADATION);\r
}\r
\r
}\r
\r
if (event.type == SWT.MouseEnter) {\r
- changeButtonState(STATE_HOVER);\r
+ if (toggle) {\r
+ changeButtonState(STATE_TOGGLE_HOVER);\r
+ } else {\r
+ changeButtonState(STATE_HOVER);\r
+ }\r
}\r
\r
if (event.type == SWT.MouseExit) {\r
if (event.type == SWT.MouseUp) { // FIXME\r
toggle = !toggle;\r
toggleByButton = !toggleByButton;\r
- changeButtonState(STATE_HOVER);\r
+ if (toggle) {\r
+ changeButtonState(STATE_TOGGLE_HOVER);\r
+ } else {\r
+ changeButtonState(STATE_HOVER);\r
+ }\r
}\r
}\r
};\r
}
childExpandButton = new DACustomToggleButton(nameCell,
ImageResources.TREE_FOLD, ImageResources.TREE_FOLD,
- ImageResources.TREE_FOLD, null, ImageResources.TREE_OPEN);
+ ImageResources.TREE_FOLD, null, ImageResources.TREE_OPEN, ImageResources.TREE_OPEN);
childExpandButton
.setBackground(ColorResources.CHART_BOARD_ITEM_NAME_FOLD_BG);
Rectangle rt = nameCell.getClientArea();
ImageResources.VIEW_SOURCE, ImageResources.VIEW_SOURCE_PUSH,
ImageResources.VIEW_SOURCE_HOVER,
ImageResources.VIEW_SOURCE_DISABLE,
- ImageResources.VIEW_SOURCE_TOGGLE);
+ ImageResources.VIEW_SOURCE_TOGGLE,
+ ImageResources.VIEW_SOURCE_HOVER);
imgToggle.setText("toggle");
data = new FormData();
data.top = new FormAttachment(toggle, 10);
import org.tizen.dynamicanalyzer.ui.summary.failed.FailedChecker;
import org.tizen.dynamicanalyzer.ui.summary.leaks.LeakDetector;
import org.tizen.dynamicanalyzer.ui.summary.profiling.FunctionUsageProfiler;
+import org.tizen.dynamicanalyzer.ui.summary.warning.WarningChecker;
import org.tizen.dynamicanalyzer.ui.timeline.calltrace.UserFunctionManager;
import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
import org.tizen.dynamicanalyzer.utils.ExtensionFilter;
private static DATheme theme = null;
private static Project project = null;
+ private static boolean isLogParsingComplete = false;
+
private static List<BaseLogCenter> baseLogCenters;
private static List<LogCenter> logCenters;
private static List<String> projectList = null;
private static LeakDetector leakDetector = null;
private static FailedChecker failedChecker = null;
private static FailedChecker calledChecker = null;
+ private static WarningChecker warningChecker = null;
private static boolean appInfoArrived = false;
private static boolean sampleThread = false;
// .getActiveWorkbenchWindow();
}
+ public static boolean isLogParsingComplete() {
+ return isLogParsingComplete;
+ }
+
+ public static void setLogParsingComplete(boolean complete) {
+ isLogParsingComplete = complete;
+ }
+
public static boolean hasSampleThread() {
return sampleThread;
}
leakDetector = null;
failedChecker = null;
+ warningChecker = null;
calledChecker = null;
sampleThread = false;
UserFunctionManager.getInstance().clear();
return logcs;
}
- public static LeakDetector getLeakDectector() {
+ public static LeakDetector getLeakDetector() {
if (leakDetector == null) {
leakDetector = new LeakDetector();
return failedChecker;
}
+ public static WarningChecker getWarningChecker() {
+ if (null == warningChecker) {
+ warningChecker = new WarningChecker();
+ }
+ return warningChecker;
+ }
+
public static FailedChecker getCalledFunctionChecker() {
if (null == calledChecker) {
calledChecker = new FailedChecker();
private static List<IDevice> devs = null;
private static List<AppDesktopInfo> appDesktopList = null;
private static List<String> appDesktopString = null;
+ private static boolean isDeviceConnected = false;
public static void init() {
SmartDevelopmentBridge.init();
return devs;
}
+ public static boolean isDeviceConnected() {
+ return isDeviceConnected;
+ }
+
public static void setDevs(List<IDevice> devs) {
+ if (null != devs && !devs.isEmpty()) {
+ isDeviceConnected = true;
+ } else {
+ isDeviceConnected = false;
+ }
DACommunicator.devs = devs;
}
protected static void reloadDevices() {
IDevice[] devices = null;
getDevs().clear();
+ isDeviceConnected = false;
if (null != sdbBridge) {
devices = sdbBridge.getDevices();
- for (IDevice device : devices) {
- devs.add(device);
+ int size = devices.length;
+ if (size > 0) {
+ isDeviceConnected = true;
+ for (int i = 0; i < size; i++) {
+ devs.add(devices[i]);
+ }
}
}
}
protected static List<String> getDevicesNameList() {
List<String> deviceList = null;
- SmartDevelopmentBridge sdbBridge = getBridge();
if (null != sdbBridge) {
List<IDevice> devicesList = getDevs();
deviceList = new ArrayList<String>();
import org.tizen.dynamicanalyzer.sql.SqlManager;
import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackManager;
import org.tizen.dynamicanalyzer.ui.page.BaseView;
-import org.tizen.dynamicanalyzer.ui.summary.warning.WarningDataManager;
import org.tizen.dynamicanalyzer.ui.toolbar.StopLogProcessor;
import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
LogParser.clear();
LogInserter.clear();
CallStackManager.clear();
- WarningDataManager.clear();
+ AnalyzerManager.getWarningChecker().clear();
StopLogProcessor.clear();
SqlManager.unlockDB();
import org.eclipse.swt.widgets.Shell;\r
import org.tizen.dynamicanalyzer.common.AnalyzerConstants;\r
import org.tizen.dynamicanalyzer.common.AnalyzerManager;\r
+import org.tizen.dynamicanalyzer.communicator.DACommunicator;\r
import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;\r
import org.tizen.dynamicanalyzer.logparser.OpenTraceProgressManager;\r
import org.tizen.dynamicanalyzer.model.ImageInfo;\r
import org.tizen.dynamicanalyzer.ui.summary.profiling.ProfilingChildData;\r
import org.tizen.dynamicanalyzer.ui.summary.profiling.ProfilingData;\r
import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;\r
-import org.tizen.dynamicanalyzer.ui.userinterface.UIDataManager;\r
import org.tizen.dynamicanalyzer.ui.widgets.DADialog;\r
import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;\r
+import org.tizen.dynamicanalyzer.widgets.combo.DACustomCombo;\r
\r
public class OpenTraceHandler extends AbstractHandler {\r
\r
}\r
}\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 (p.initLogCenters(logCenterNames) && loadAppInfo(p)\r
&& loadCallStackData(p) && loadCallStackApis(p)\r
int dataSize = SqlManager.selectCount(center);\r
center.setDataSize(dataSize);\r
}\r
- /* Timeline + file chart */\r
+\r
OpenTraceProgressManager.getInstance().runThreads();\r
OpenTraceProgressManager.getInstance().openTraceComplete();\r
\r
private boolean loadLeakData(Project p) {\r
ResultSet rs = SqlManager\r
.selectAllFromTable(AnalyzerConstants.LEAK_DATA_TABLE_NAME);\r
- LeakDetector leakDectector = AnalyzerManager.getLeakDectector();\r
+ LeakDetector leakDectector = AnalyzerManager.getLeakDetector();\r
if (null == rs || leakDectector == null) {\r
return false;\r
}\r
DBTableManager.TABLE_INDEX_PROFILING_DATA);\r
String tableName = profilingData.getTableName();\r
ResultSet rs = SqlManager.selectAllFromTable(tableName);\r
- // FunctionUsageProfiler profiler = AnalyzerManager\r
- // .getFunctionUserProfiler();\r
FunctionUsageProfiler profiler = FunctionUsageProfiler.getInstance();\r
if (null == rs || profiler == null) {\r
return false;\r
profiler.getProfilingDataMap().put(seq, fupData);\r
String symbol = data.get(ProfilingData.KEY_INDEX);\r
profiler.getSymbolSeqHash().put(symbol, seq);\r
-\r
- UIDataManager.getInstance().getfunctionProfilingDataChecker()\r
- .addProfilingData(fupData);\r
}\r
rs.close();\r
} catch (SQLException e) {\r
ProfilingData ab = profiler\r
.getProfilingDataByKey(FunctionUsageProfiler.APPLICATION_KEY);\r
profiler.setAppBin(ab);\r
-\r
ProfilingData dl = profiler\r
.getProfilingDataByKey(FunctionUsageProfiler.DEPENDENT_LIB_KEY);\r
profiler.setDependentLib(dl);\r
-\r
return true;\r
}\r
\r
List<String> childData = new ArrayList<String>();\r
for (int ii = 0; ii < splitSeqs.length; ii++) {\r
childData.add(new String(splitSeqs[ii]));\r
-\r
}\r
ProfilingData parent = profiler.getProfilingDataMap().get(\r
data.get(0));\r
profiler.getChildListMap().put(data.get(0), child);\r
}\r
rs.close();\r
-\r
} catch (SQLException e) {\r
e.printStackTrace();\r
return false;\r
/*** log parsing thread ***/
@Override
public void run() {
+ AnalyzerManager.setLogParsingComplete(false);
LogQueue logQueue = getLogQueue();
while (true) {
try {
/* log for debug */
System.out.println("log parsing thread end!!"); //$NON-NLS-1$
+ AnalyzerManager.setLogParsingComplete(true);
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
- StopProcessManager.getInstance().logQueueObserverThreadEnd();
+ StopProcessManager.getInstance().logParsingThreadEnd();
}
});
ToolbarArea.getInstance().stopTimer();
slicedLog);
if (id == LogCenterConstants.LOG_RESOURCE
|| id == LogCenterConstants.LOG_MEMORY) {
- AnalyzerManager.getLeakDectector()
- .runLeakDectect(slicedLog);
+ AnalyzerManager.getLeakDetector().runLeakDectect(slicedLog);
}
AnalyzerManager.getFailedChecker().check(slicedLog);
package org.tizen.dynamicanalyzer.model;
import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import org.tizen.dynamicanalyzer.sql.SqlManager;
-import org.tizen.dynamicanalyzer.ui.summary.leaks.LeakComparator;
import org.tizen.dynamicanalyzer.ui.summary.leaks.LeakData;
public class LogCenter extends BaseLogCenter {
leakHashUnLock();
return ret;
}
-
- public List<LeakData> getLeakDataList() {
- leakHashLock();
- Collection<LeakData> cols = getLeakHash().values();
- List<LeakData> leakList = new ArrayList<LeakData>();
- leakList.addAll(cols);
- Collections.sort(leakList, new LeakComparator());
- leakHashUnLock();
- return leakList;
- }
-
}
public static String COOLBAR_AREA_THREAD;
public static String COOLBAR_AREA_UI;
public static String COOLBAR_AREA_TIMELINE;
+ public static String COOLBAR_AREA_RANGE;
public static String LICENSE_DIALOG_LICENSE_FILE_NAME;
public static String LICENSE_DIALOG_NOT_FOUND;
COOLBAR_AREA_THREAD=Thread
COOLBAR_AREA_UI=UI
COOLBAR_AREA_TIMELINE=Timeline
+COOLBAR_AREA_RANGE=Range
LICENSE_DIALOG_LICENSE_FILE_NAME=license
LICENSE_DIALOG_NOT_FOUND=License file not found
return 0;
}
+ public static int executeQueryMinMax(String query) {
+ lockDB();
+ Connection conn = getConnection();
+ if (null == conn) {
+ unlockDB();
+ return 0;
+ }
+
+ try {
+ Statement stat = conn.createStatement();
+ ResultSet rs = stat.executeQuery(query);
+
+ if (rs.next()) {
+ if (null != rs.getString(1)) {
+ int ret = Integer.parseInt(rs.getString(1));
+ if (!rs.isClosed()) {
+ rs.close();
+ }
+ unlockDB();
+ return ret;
+ }
+ }
+ } catch (Exception e) {
+ System.out.println("Error!"); //$NON-NLS-1$
+ e.printStackTrace();
+ }
+
+ unlockDB();
+ return -1;
+ }
+
public static int executeSelectOperation(String query) {
lockDB();
Connection conn = getConnection();
unlockDB();
return;
}
- LeakDetector leakDectector = AnalyzerManager.getLeakDectector();
+ LeakDetector leakDectector = AnalyzerManager.getLeakDetector();
try {
DBTableInfo leakTableInfo = DBTableManager.getInstance()
--- /dev/null
+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.logparser.LogCenterConstants;
+import org.tizen.dynamicanalyzer.ui.file.chart.FileTimelineData;
+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.utils.AnalyzerUtil;
+
+public class FileDataMaker {
+ private List<FileChartItemData> fileList = null;
+ private HashMap<String, FileChartItemData> fileRegister = null;
+ private HashMap<String, FileChartItemData> fdRegister = null;
+ private List<FileTimelineData> fileTimelineDataList = null;
+
+ private final int TYPE_OPEN = 1;
+ private final int TYPE_CLOSE = 2;
+
+ private int openApiCount = 0;
+ private int closeApiCount = 0;
+ private int openCount = 0;
+
+ private int seq = 0;
+
+ private FailedChecker failedChecker = null;
+ @SuppressWarnings("unused")
+ private LeakDetector leakDetector = null; // for leak check upgrade
+ private WarningChecker warningChecker = null;
+
+ public FileDataMaker(FailedChecker failedChecker,
+ LeakDetector leakDetector, WarningChecker warningChecker) {
+
+ this.failedChecker = failedChecker;
+ this.leakDetector = leakDetector;
+ this.warningChecker = warningChecker;
+
+ fileList = new ArrayList<FileChartItemData>();
+ fileRegister = new HashMap<String, FileChartItemData>();
+ fdRegister = new HashMap<String, FileChartItemData>();
+ fileTimelineDataList = new ArrayList<FileTimelineData>();
+
+ openApiCount = 0;
+ closeApiCount = 0;
+ openCount = 0;
+ seq = 0;
+ }
+
+ public void clear() {
+ fileList.clear();
+ fileRegister.clear();
+ fdRegister.clear();
+ fileTimelineDataList.clear();
+ }
+
+ public List<FileTimelineData> getFileTimelineDataList() {
+ if (null == fileTimelineDataList) {
+ fileTimelineDataList = new ArrayList<FileTimelineData>();
+ }
+ return fileTimelineDataList;
+ }
+
+ public List<FileChartItemData> getFileList() {
+ if (null == fileList) {
+ fileList = new ArrayList<FileChartItemData>();
+ }
+ return fileList;
+ }
+
+ public HashMap<String, FileChartItemData> getFileRegister() {
+ if (null == fileRegister) {
+ fileRegister = new HashMap<String, FileChartItemData>();
+ }
+ return fileRegister;
+ }
+
+ private HashMap<String, FileChartItemData> getFDRegister() {
+ if (null == fdRegister) {
+ fdRegister = new HashMap<String, FileChartItemData>();
+ }
+ return fdRegister;
+ }
+
+ public void makeData(List<List<String>> inputs) {
+ int size = inputs.size();
+ for (int i = 0; i < size; i++) {
+ List<String> input = inputs.get(i);
+ if (AnalyzerUtil.isInternal(input, false)) {
+ continue;
+ }
+ String fdType = input.get(LogCenterConstants.RESOURCE_FDTYPE_INDEX);
+ String seqNum = input.get(LogCenterConstants.SEQUENCE_NUMBER_INDEX);
+ // socket
+ int type = Integer.parseInt(fdType);
+ if (type == 1 || type == 2) {
+ continue;
+ }
+
+ String fdApiType = input
+ .get(LogCenterConstants.RESOURCE_FDAPITYPE_INDEX);
+ String path = input
+ .get(LogCenterConstants.RESOURCE_FILE_PATH_INDEX);
+ String fd = input.get(LogCenterConstants.RESOURCE_FDVALUE_INDEX);
+ String err = input.get(LogCenterConstants.ERROR_INDEX);
+ long errno = Long.parseLong(err);
+ String name = input.get(LogCenterConstants.APINAME_INDEX);
+
+ // error check
+ if (errno != 0) {
+ FailedData ffd = new FailedData(input);
+ if (fdApiType.equals(LogCenterConstants.FD_API_TYPE_READ)
+ || fdApiType
+ .equals(LogCenterConstants.FD_API_TYPE_WRITE)) {
+ FileChartItemData fcid = getFDRegister().get(fd);
+ if (null == fcid) {
+ ffd = null;
+ continue;
+ }
+ path = fcid.getParentKey();
+ if (path.isEmpty()) {
+ // FIXME : why?
+ System.out.println();
+ }
+ fcid.getFailedData().add(ffd);
+ }
+ FileChartItemData parent = getFileRegister().get(path);
+ if (null == parent) {
+ parent = createNewFileData(path);
+ }
+ parent.getFailedData().add(ffd);
+ failedChecker.getFailedList().add(ffd);
+ continue;
+ } else if (name.equals("fdopen")) { //$NON-NLS-1$
+ continue;
+ }
+
+ // open, fopen
+ if (fdApiType.equals(LogCenterConstants.FD_API_TYPE_OPEN)) {
+ FileChartItemData fciData = getFileRegister().get(path);
+ if (null != fciData) {
+ try {
+ warningCheck(fciData, input, TYPE_OPEN);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ if (null == fciData) {
+ // parent = file ItemData
+ fciData = createNewFileData(path);
+ // create Data
+ FileChartData innerData = new FileChartData();
+ long openTime = Long.parseLong(input
+ .get(LogCenterConstants.TIME_INDEX));
+ innerData.setOpenTime(openTime);
+ fciData.getData().add(innerData);
+ innerData.getInput().addAll(input);
+
+ // child = fd
+ FileChartItemData child = new FileChartItemData(fd, seq++);
+ FileChartData childInnerData = new FileChartData();
+ childInnerData.setOpenTime(openTime);
+ childInnerData.getRelations().add(seqNum);
+ child.getData().add(childInnerData);
+ fciData.getChildern().add(child);
+ child.setParentKey(fciData.getKey());
+ getFDRegister().put(fd, child);
+ child.setColsed(false);
+ } else {
+ if (fciData.isClosed() || fciData.getData().isEmpty()) {
+ // create Data
+ FileChartData fcData = new FileChartData();
+ long openTime = Long.parseLong(input
+ .get(LogCenterConstants.TIME_INDEX));
+ fcData.setOpenTime(openTime);
+ fciData.getData().add(fcData);
+ fciData.setColsed(false);
+ // FIXME DEBUG
+ fcData.getInput().addAll(input);
+ }
+
+ // child = fd
+ FileChartItemData child = fciData.getFindChild(fd);
+ if (null == child) {
+ child = new FileChartItemData(fd, seq++);
+ child.setParentKey(fciData.getKey());
+ fciData.getChildern().add(child);
+ }
+ long openTime = Long.parseLong(input
+ .get(LogCenterConstants.TIME_INDEX));
+ FileChartData childInnerData = new FileChartData();
+ childInnerData.setOpenTime(openTime);
+ childInnerData.getRelations().add(seqNum);
+ child.getData().add(childInnerData);
+ getFDRegister().put(fd, child);
+ child.setColsed(false);
+ }
+ // file timeline data create
+ openApiCount++;
+ openCount++;
+ FileTimelineData ftd = new FileTimelineData(
+ input.get(LogCenterConstants.TIME_INDEX), openApiCount,
+ closeApiCount, openCount);
+ getFileTimelineDataList().add(ftd);
+ FileChart.getInstance().setFDCount(ftd.getOpenCount());
+ // close
+ } else if (fdApiType.equals(LogCenterConstants.FD_API_TYPE_CLOSE)) {
+
+ FileChartItemData child = getFDRegister().get(fd);
+ if (null == child) {
+ continue;
+ }
+ long closeTime = Long.parseLong(input
+ .get(LogCenterConstants.TIME_INDEX));
+ child.getLastData().setCloseTime(closeTime);
+ child.getLastData().getRelations().add(seqNum);
+ child.setColsed(true);
+ getFDRegister().remove(fd);
+ long useTime = child.getTotalFileUseTime();
+ child.setTotalFileUseTime(closeTime
+ - child.getLastData().getOpenTime() + useTime);
+
+ String parentKey = child.getParentKey();
+ FileChartItemData fileData = getFileRegister().get(parentKey);
+ long pUseTime = fileData.getTotalFileUseTime();
+ fileData.setTotalFileUseTime(pUseTime + closeTime
+ - child.getLastData().getOpenTime());
+
+ // warning check
+ warningCheck(fileData, input, TYPE_CLOSE);
+
+ if (fileData.isAllChildrenClosed()) {
+ fileData.getLastData().setCloseTime(closeTime);
+ fileData.setColsed(true);
+ }
+
+ // file timeline data create
+ closeApiCount++;
+ openCount--;
+ FileTimelineData ftd = new FileTimelineData(
+ input.get(LogCenterConstants.TIME_INDEX), openApiCount,
+ closeApiCount, openCount);
+ getFileTimelineDataList().add(ftd);
+ FileChart.getInstance().setFDCount(ftd.getOpenCount());
+
+ // read / write
+ } else if (fdApiType.equals(LogCenterConstants.FD_API_TYPE_READ)
+ || fdApiType.equals(LogCenterConstants.FD_API_TYPE_WRITE)) {
+
+ System.out.print("Read Write " + input + "\n");
+
+ if (printCalledFunctionChart(input) == false) {
+ continue;
+ }
+
+ // calculate read/write size
+ FileChartItemData child = getFDRegister().get(fd);
+ FileChartItemData parent = getFileRegister().get(
+ child.getParentKey());
+
+ String rwSizeStr1 = input
+ .get(LogCenterConstants.RESOURCE_SIZE_INDEX);
+ long rwSize = Long.parseLong(rwSizeStr1);
+ if (fdApiType.equals(LogCenterConstants.FD_API_TYPE_READ)) {
+ long rSize = child.getReadSize();
+ child.setReadSize(rSize + rwSize);
+ long prSize = parent.getReadSize();
+ parent.setReadSize(child.getReadSize() + prSize);
+ } else if (fdApiType
+ .equals(LogCenterConstants.FD_API_TYPE_WRITE)) {
+ String strTotalSize = input
+ .get(LogCenterConstants.RESOURCE_FILE_SIZE_INDEX);
+ if (strTotalSize.equals("?") == false) {
+ long totalSize = Long.parseLong(strTotalSize);
+ child.setTotalSize(totalSize);
+ }
+
+ long wSize = child.getWriteSize();
+ child.setWriteSize(wSize + rwSize);
+ long pwSize = parent.getWriteSize();
+ parent.setWriteSize(child.getWriteSize() + pwSize);
+ }
+ } else // / Other
+ {
+ // System.out.print(" Other "+input+"\n");
+ if (printCalledFunctionChart(input) == false) {
+ continue;
+ }
+ }
+ }
+ }
+
+ private boolean printCalledFunctionChart(List<String> input) {
+
+ String seqNum = input.get(LogCenterConstants.SEQUENCE_NUMBER_INDEX);
+ String path = input.get(LogCenterConstants.RESOURCE_FILE_PATH_INDEX);
+ String fd = input.get(LogCenterConstants.RESOURCE_FDVALUE_INDEX);
+
+ // Print Called Function - File Chart Except( Open, close, Error )
+ FailedData ffd = new FailedData(input);
+
+ FileChartItemData fcid = getFDRegister().get(fd);
+ if (null == fcid) {
+ ffd = null;
+ return false;
+ }
+ path = fcid.getParentKey();
+ if (path.isEmpty()) {
+ System.out.println();
+ }
+ fcid.getCalledFunctionData().add(ffd);
+
+ FileChartItemData parentCalled = getFileRegister().get(path);
+ if (null == parentCalled) {
+ parentCalled = createNewFileData(path);
+ }
+ parentCalled.getCalledFunctionData().add(ffd);
+ AnalyzerManager.getCalledFunctionChecker().getFailedList().add(ffd);
+
+ // Insert File API List - Table
+ FileChartItemData child = getFDRegister().get(fd);
+ if (null == child) {
+ return false;
+ }
+ child.getLastData().getRelations().add(seqNum);
+
+ // Print API Range
+ FileChartItemData parent = getFileRegister().get(child.getParentKey());
+ try {
+ long time = Long
+ .parseLong(input.get(LogCenterConstants.TIME_INDEX));
+ if (child.getLastData().getFirstTime() < 0) {
+ child.getLastData().setFirstTime(time);
+ child.getLastData().setLastTime(time);
+ } else {
+ child.getLastData().setLastTime(time);
+ }
+
+ if (parent.getLastData().getFirstTime() < 0) {
+ parent.getLastData().setFirstTime(time);
+ parent.getLastData().setLastTime(time);
+ } else {
+ parent.getLastData().setLastTime(time);
+ }
+
+ } catch (NullPointerException e) {
+ System.out.println("PrintCalledFunctionChart Exception"); //$NON-NLS-1$
+ e.printStackTrace();
+ }
+
+ return true;
+ }
+
+ private void warningCheck(FileChartItemData file, List<String> input,
+ int type) {
+ if (type == TYPE_CLOSE) {
+ long firstTime = file.getLastData().getFirstTime();
+ if (firstTime < 0) {
+ if (!warningChecker.isChecked(file.getKey(),
+ WarningCase.WITHOUT_USING.getType())) {
+ WarningData wData = new WarningData(
+ LogCenterConstants.LOG_RESOURCE,
+ WarningCase.WITHOUT_USING.getType(), input,
+ file.getKey());
+ warningChecker.getWarningData().add(wData);
+ }
+ }
+
+ } else if (type == TYPE_OPEN) {
+ if (!file.isClosed()) {
+ if (!warningChecker.isChecked(file.getKey(),
+ WarningCase.DUPLICATE_OPEN.getType())) {
+ WarningData wData = new WarningData(
+ LogCenterConstants.LOG_RESOURCE,
+ WarningCase.DUPLICATE_OPEN.getType(), input,
+ file.getKey());
+ warningChecker.getWarningData().add(wData);
+ }
+ }
+ }
+
+ long closedTime = 0;
+ if (null != file.getLastData()) {
+ closedTime = file.getLastData().getCloseTime();
+ }
+
+ if (closedTime < 0) {
+ closedTime = ToolbarArea.getInstance().getTime();
+ }
+
+ }
+
+ private FileChartItemData createNewFileData(String path) {
+ String[] splitPath = path.split("\\/"); //$NON-NLS-1$
+ String fileName = new String(splitPath[splitPath.length - 1]);
+ FileChartItemData newFileData = new FileChartItemData(path, seq++);
+ newFileData.setFileName(fileName);
+ newFileData.setPath(path);
+ getFileList().add(newFileData);
+ getFileRegister().put(path, newFileData);
+ newFileData.setParent();
+ return newFileData;
+ }
+}
getSelectionIndex().clear();
getExpandMap().clear();
getSelections().clear();
- FileChartManager.clear();
+ FileChartManager.getInstance().clear();
scale.setSelection(0);
}
package org.tizen.dynamicanalyzer.ui.file.chart;
-import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.communicator.ResourceCommunicator;
-import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
import org.tizen.dynamicanalyzer.logparser.LogListQueue;
import org.tizen.dynamicanalyzer.resources.ColorResources;
-import org.tizen.dynamicanalyzer.services.RecordStateSourceProvider;
-import org.tizen.dynamicanalyzer.ui.file.FileChartData;
import org.tizen.dynamicanalyzer.ui.file.FileChartItemData;
-import org.tizen.dynamicanalyzer.ui.summary.failed.FailedData;
-import org.tizen.dynamicanalyzer.ui.summary.warning.WarningCase;
-import org.tizen.dynamicanalyzer.ui.summary.warning.WarningData;
-import org.tizen.dynamicanalyzer.ui.summary.warning.WarningDataManager;
-import org.tizen.dynamicanalyzer.ui.timeline.chart.FileChart;
-import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
-import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
+import org.tizen.dynamicanalyzer.ui.file.FileDataMaker;
public class FileChartManager implements Runnable {
public final static int FILE_CHART_START_MARGIN = 5;
- private final int QUEUE_CHECK_INTERVAL = 2; // sec
-
public static double chartPixel = DEFAULT_PIXEL;
private static int scale = 1;
private LogListQueue logListQueue = null;
private Thread updateLogThread = null;
- private final int TYPE_OPEN = 1;
- private final int TYPE_CLOSE = 2;
-
- private int openApiCount = 0;
- private int closeApiCount = 0;
- private int openCount = 0;
-
+ private FileDataMaker fileDataMaker = null;
private long start = 0;
private long end = 0;
- private int seq = 0;
private static FileChartManager instance = null;
- private List<FileChartItemData> fileList = null;
- private HashMap<String, FileChartItemData> fileRegister = null;
- private HashMap<String, FileChartItemData> fdRegister = null;
- private List<FileTimelineData> fileTimelineDataList = null;
+ public FileChartManager() {
+ fileDataMaker = new FileDataMaker(AnalyzerManager.getFailedChecker(),
+ AnalyzerManager.getLeakDetector(),
+ AnalyzerManager.getWarningChecker());
+ }
public static FileChartManager getInstance() {
if (null == instance) {
public void startUpdateLogThread() {
if (null == updateLogThread || !updateLogThread.isAlive()) {
- updateLogThread = new Thread(null, new FileChartManager(),
+ updateLogThread = new Thread(null, getInstance(),
AnalyzerConstants.FILE_CHART_MANAGER_THREAD);
updateLogThread.start();
}
return true;
}
+ public FileDataMaker getFileDataMaker() {
+ return fileDataMaker;
+ }
+
/*** make file data thread ***/
@Override
public void run() {
LogListQueue logListQueue = getInstance().getLogListQueue();
- int emptyCount = 0;
while (true) {
try {
if (!logListQueue.isEmpty()) {
List<List<String>> logs = logListQueue.getFirst();
- getInstance().makeData(logs);
- emptyCount = 0;
- // } else if (!LogParser.isLogParsingEnd()
- } else if (emptyCount < QUEUE_CHECK_INTERVAL
- || (AnalyzerUtil.getRecordState()
- .equals(RecordStateSourceProvider.RECORD_RECORDING))) {
- emptyCount++;
- Thread.sleep(AnalyzerConstants.LOG_CHECK_INTERVAL);
- } else {
+ getInstance().getFileDataMaker().makeData(logs);
+ } else if (AnalyzerManager.isLogParsingComplete()) {
break;
+ } else {
+ Thread.sleep(AnalyzerConstants.LOG_CHECK_INTERVAL);
}
} catch (InterruptedException e) {
/** thread stop by interrupt */
return ColorResources.FILE_OPEN_END_STOP;
}
- public static void clear() {
+ public void clear() {
instance = null;
chartPixel = DEFAULT_PIXEL;
scale = 1;
+ fileDataMaker.clear();
}
public static void setScale(int sc) {
}
public List<FileTimelineData> getFileTimelineDataList() {
- if (null == fileTimelineDataList) {
- fileTimelineDataList = new ArrayList<FileTimelineData>();
- }
- return fileTimelineDataList;
+ return fileDataMaker.getFileTimelineDataList();
}
public List<FileChartItemData> getFileList() {
- if (null == fileList) {
- fileList = new ArrayList<FileChartItemData>();
- }
- return fileList;
+ return fileDataMaker.getFileList();
}
public long getStartTime() {
}
public HashMap<String, FileChartItemData> getFileRegister() {
- if (null == fileRegister) {
- fileRegister = new HashMap<String, FileChartItemData>();
- }
- return fileRegister;
+ return fileDataMaker.getFileRegister();
}
- private HashMap<String, FileChartItemData> getFDRegister() {
- if (null == fdRegister) {
- fdRegister = new HashMap<String, FileChartItemData>();
- }
- return fdRegister;
- }
-
- private void makeData(List<List<String>> inputs) {
- int size = inputs.size();
- for (int i = 0; i < size; i++) {
- List<String> input = inputs.get(i);
- if (AnalyzerUtil.isInternal(input, false)) {
- continue;
- }
- String fdType = input.get(LogCenterConstants.RESOURCE_FDTYPE_INDEX);
- String seqNum = input.get(LogCenterConstants.SEQUENCE_NUMBER_INDEX);
- // socket
- int type = Integer.parseInt(fdType);
- if (type == 1 || type == 2) {
- continue;
- }
-
- String fdApiType = input
- .get(LogCenterConstants.RESOURCE_FDAPITYPE_INDEX);
- String path = input
- .get(LogCenterConstants.RESOURCE_FILE_PATH_INDEX);
- String fd = input.get(LogCenterConstants.RESOURCE_FDVALUE_INDEX);
- String err = input.get(LogCenterConstants.ERROR_INDEX);
- long errno = Long.parseLong(err);
- String name = input.get(LogCenterConstants.APINAME_INDEX);
-
- // error check
- if (errno != 0) {
- FailedData ffd = new FailedData(input);
- // if (fdApiType.equals("2") || fdApiType.equals("3")) {
- if (fdApiType.equals(LogCenterConstants.FD_API_TYPE_READ)
- || fdApiType
- .equals(LogCenterConstants.FD_API_TYPE_WRITE)) {
- FileChartItemData fcid = getFDRegister().get(fd);
- if (null == fcid) {
- ffd = null;
- continue;
- }
- path = fcid.getParentKey();
- if (path.isEmpty()) {
- // FIXME : why?
- System.out.println();
- }
- fcid.getFailedData().add(ffd);
- }
- FileChartItemData parent = getFileRegister().get(path);
- if (null == parent) {
- parent = createNewFileData(path);
- }
- parent.getFailedData().add(ffd);
- AnalyzerManager.getFailedChecker().getFailedList().add(ffd);
- continue;
- } else if (name.equals("fdopen")) { //$NON-NLS-1$
- continue;
- }
-
- // open, fopen
- if (fdApiType.equals(LogCenterConstants.FD_API_TYPE_OPEN)) {
- FileChartItemData fciData = getFileRegister().get(path);
- if (null != fciData) {
- try {
- warningCheck(fciData, input, TYPE_OPEN);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- if (null == fciData) {
- // parent = file ItemData
- fciData = createNewFileData(path);
- // create Data
- FileChartData innerData = new FileChartData();
- long openTime = Long.parseLong(input
- .get(LogCenterConstants.TIME_INDEX));
- innerData.setOpenTime(openTime);
- fciData.getData().add(innerData);
- innerData.getInput().addAll(input);
-
- // child = fd
- FileChartItemData child = new FileChartItemData(fd, seq++);
- FileChartData childInnerData = new FileChartData();
- childInnerData.setOpenTime(openTime);
- childInnerData.getRelations().add(seqNum);
- child.getData().add(childInnerData);
- fciData.getChildern().add(child);
- child.setParentKey(fciData.getKey());
- getFDRegister().put(fd, child);
- child.setColsed(false);
- } else {
- if (fciData.isClosed() || fciData.getData().isEmpty()) {
- // create Data
- FileChartData fcData = new FileChartData();
- long openTime = Long.parseLong(input
- .get(LogCenterConstants.TIME_INDEX));
- fcData.setOpenTime(openTime);
- fciData.getData().add(fcData);
- fciData.setColsed(false);
- // FIXME DEBUG
- fcData.getInput().addAll(input);
- }
-
- // child = fd
- FileChartItemData child = fciData.getFindChild(fd);
- if (null == child) {
- child = new FileChartItemData(fd, seq++);
- child.setParentKey(fciData.getKey());
- fciData.getChildern().add(child);
- }
- long openTime = Long.parseLong(input
- .get(LogCenterConstants.TIME_INDEX));
- FileChartData childInnerData = new FileChartData();
- childInnerData.setOpenTime(openTime);
- childInnerData.getRelations().add(seqNum);
- child.getData().add(childInnerData);
- getFDRegister().put(fd, child);
- child.setColsed(false);
- }
- // file timeline data create
- openApiCount++;
- openCount++;
- FileTimelineData ftd = new FileTimelineData(
- input.get(LogCenterConstants.TIME_INDEX), openApiCount,
- closeApiCount, openCount);
- getFileTimelineDataList().add(ftd);
- FileChart.getInstance().setFDCount(ftd.getOpenCount());
- // close
- } else if (fdApiType.equals(LogCenterConstants.FD_API_TYPE_CLOSE)) {
-
- FileChartItemData child = getFDRegister().get(fd);
- if (null == child) {
- continue;
- }
- long closeTime = Long.parseLong(input
- .get(LogCenterConstants.TIME_INDEX));
- child.getLastData().setCloseTime(closeTime);
- child.getLastData().getRelations().add(seqNum);
- child.setColsed(true);
- getFDRegister().remove(fd);
- long useTime = child.getTotalFileUseTime();
- child.setTotalFileUseTime(closeTime
- - child.getLastData().getOpenTime() + useTime);
-
- String parentKey = child.getParentKey();
- FileChartItemData fileData = getFileRegister().get(parentKey);
- long pUseTime = fileData.getTotalFileUseTime();
- fileData.setTotalFileUseTime(pUseTime + closeTime
- - child.getLastData().getOpenTime());
-
- // warning check
- warningCheck(fileData, input, TYPE_CLOSE);
-
- if (fileData.isAllChildrenClosed()) {
- fileData.getLastData().setCloseTime(closeTime);
- fileData.setColsed(true);
- }
-
- // file timeline data create
- closeApiCount++;
- openCount--;
- FileTimelineData ftd = new FileTimelineData(
- input.get(LogCenterConstants.TIME_INDEX), openApiCount,
- closeApiCount, openCount);
- getFileTimelineDataList().add(ftd);
- FileChart.getInstance().setFDCount(ftd.getOpenCount());
-
- // read / write
- } else if (fdApiType.equals(LogCenterConstants.FD_API_TYPE_READ)
- || fdApiType.equals(LogCenterConstants.FD_API_TYPE_WRITE)) {
-
- System.out.print("Read Write " + input + "\n");
-
- if (PrintCalledFunctionChart(input) == false) {
- continue;
- }
-
- // calculate read/write size
- FileChartItemData child = getFDRegister().get(fd);
- FileChartItemData parent = getFileRegister().get(
- child.getParentKey());
-
- String rwSizeStr1 = input
- .get(LogCenterConstants.RESOURCE_SIZE_INDEX);
- long rwSize = Long.parseLong(rwSizeStr1);
- if (fdApiType.equals(LogCenterConstants.FD_API_TYPE_READ)) {
- long rSize = child.getReadSize();
- child.setReadSize(rSize + rwSize);
- long prSize = parent.getReadSize();
- parent.setReadSize(child.getReadSize() + prSize);
- } else if (fdApiType
- .equals(LogCenterConstants.FD_API_TYPE_WRITE)) {
- String strTotalSize = input
- .get(LogCenterConstants.RESOURCE_FILE_SIZE_INDEX);
- if (strTotalSize.equals("?") == false) {
- long totalSize = Long.parseLong(strTotalSize);
- child.setTotalSize(totalSize);
- }
-
- long wSize = child.getWriteSize();
- child.setWriteSize(wSize + rwSize);
- long pwSize = parent.getWriteSize();
- parent.setWriteSize(child.getWriteSize() + pwSize);
- }
- } else // / Other
- {
- // System.out.print(" Other "+input+"\n");
- if (PrintCalledFunctionChart(input) == false) {
- continue;
- }
- }
- }
- }
-
- private boolean PrintCalledFunctionChart(List<String> input) {
-
- String seqNum = input.get(LogCenterConstants.SEQUENCE_NUMBER_INDEX);
- String path = input.get(LogCenterConstants.RESOURCE_FILE_PATH_INDEX);
- String fd = input.get(LogCenterConstants.RESOURCE_FDVALUE_INDEX);
-
- // Print Called Function - File Chart Except( Open, close, Error )
- FailedData ffd = new FailedData(input);
-
- FileChartItemData fcid = getFDRegister().get(fd);
- if (null == fcid) {
- ffd = null;
- return false;
- }
- path = fcid.getParentKey();
- if (path.isEmpty()) {
- System.out.println();
- }
- fcid.getCalledFunctionData().add(ffd);
-
- FileChartItemData parentCalled = getFileRegister().get(path);
- if (null == parentCalled) {
- parentCalled = createNewFileData(path);
- }
- parentCalled.getCalledFunctionData().add(ffd);
- AnalyzerManager.getCalledFunctionChecker().getFailedList().add(ffd);
-
- // Insert File API List - Table
- FileChartItemData child = getFDRegister().get(fd);
- if (null == child) {
- return false;
- }
- child.getLastData().getRelations().add(seqNum);
-
- // Print API Range
- FileChartItemData parent = getFileRegister().get(child.getParentKey());
- try {
- long time = Long
- .parseLong(input.get(LogCenterConstants.TIME_INDEX));
- if (child.getLastData().getFirstTime() < 0) {
- child.getLastData().setFirstTime(time);
- child.getLastData().setLastTime(time);
- } else {
- child.getLastData().setLastTime(time);
- }
-
- if (parent.getLastData().getFirstTime() < 0) {
- parent.getLastData().setFirstTime(time);
- parent.getLastData().setLastTime(time);
- } else {
- parent.getLastData().setLastTime(time);
- }
-
- } catch (NullPointerException e) {
- System.out.println("PrintCalledFunctionChart Exception"); //$NON-NLS-1$
- e.printStackTrace();
- }
-
- return true;
- }
-
- private void warningCheck(FileChartItemData file, List<String> input,
- int type) {
- if (type == TYPE_CLOSE) {
- long firstTime = file.getLastData().getFirstTime();
- if (firstTime < 0) {
- if (!WarningDataManager.getInstance().isChecked(file.getKey(),
- WarningCase.WITHOUT_USING.getType())) {
- WarningData wData = new WarningData(
- LogCenterConstants.LOG_RESOURCE,
- WarningCase.WITHOUT_USING.getType(), input,
- file.getKey());
- WarningDataManager.getInstance().getWarningData()
- .add(wData);
- }
- }
-
- } else if (type == TYPE_OPEN) {
- if (!file.isClosed()) {
- if (!WarningDataManager.getInstance().isChecked(file.getKey(),
- WarningCase.DUPLICATE_OPEN.getType())) {
- WarningData wData = new WarningData(
- LogCenterConstants.LOG_RESOURCE,
- WarningCase.DUPLICATE_OPEN.getType(), input,
- file.getKey());
- WarningDataManager.getInstance().getWarningData()
- .add(wData);
- }
- }
- }
-
- long closedTime = 0;
- if (null != file.getLastData()) {
- closedTime = file.getLastData().getCloseTime();
- }
-
- if (closedTime < 0) {
- closedTime = ToolbarArea.getInstance().getTime();
- }
-
- }
-
- private FileChartItemData createNewFileData(String path) {
- String[] splitPath = path.split("\\/"); //$NON-NLS-1$
- String fileName = new String(splitPath[splitPath.length - 1]);
- FileChartItemData newFileData = new FileChartItemData(path, seq++);
- newFileData.setFileName(fileName);
- newFileData.setPath(path);
- getFileList().add(newFileData);
- getFileRegister().put(path, newFileData);
- newFileData.setParent();
- return newFileData;
- }
+ // private void makeData(List<List<String>> inputs) {
+ // int size = inputs.size();
+ // for (int i = 0; i < size; i++) {
+ // List<String> input = inputs.get(i);
+ // if (AnalyzerUtil.isInternal(input, false)) {
+ // continue;
+ // }
+ // String fdType = input.get(LogCenterConstants.RESOURCE_FDTYPE_INDEX);
+ // String seqNum = input.get(LogCenterConstants.SEQUENCE_NUMBER_INDEX);
+ // // socket
+ // int type = Integer.parseInt(fdType);
+ // if (type == 1 || type == 2) {
+ // continue;
+ // }
+ //
+ // String fdApiType = input
+ // .get(LogCenterConstants.RESOURCE_FDAPITYPE_INDEX);
+ // String path = input
+ // .get(LogCenterConstants.RESOURCE_FILE_PATH_INDEX);
+ // String fd = input.get(LogCenterConstants.RESOURCE_FDVALUE_INDEX);
+ // String err = input.get(LogCenterConstants.ERROR_INDEX);
+ // long errno = Long.parseLong(err);
+ // String name = input.get(LogCenterConstants.APINAME_INDEX);
+ //
+ // // error check
+ // if (errno != 0) {
+ // FailedData ffd = new FailedData(input);
+ // if (fdApiType.equals(LogCenterConstants.FD_API_TYPE_READ)
+ // || fdApiType
+ // .equals(LogCenterConstants.FD_API_TYPE_WRITE)) {
+ // FileChartItemData fcid = getFDRegister().get(fd);
+ // if (null == fcid) {
+ // ffd = null;
+ // continue;
+ // }
+ // path = fcid.getParentKey();
+ // if (path.isEmpty()) {
+ // // FIXME : why?
+ // System.out.println();
+ // }
+ // fcid.getFailedData().add(ffd);
+ // }
+ // FileChartItemData parent = getFileRegister().get(path);
+ // if (null == parent) {
+ // parent = createNewFileData(path);
+ // }
+ // parent.getFailedData().add(ffd);
+ // AnalyzerManager.getFailedChecker().getFailedList().add(ffd);
+ // continue;
+ // } else if (name.equals("fdopen")) { //$NON-NLS-1$
+ // continue;
+ // }
+ //
+ // // open, fopen
+ // if (fdApiType.equals(LogCenterConstants.FD_API_TYPE_OPEN)) {
+ // FileChartItemData fciData = getFileRegister().get(path);
+ // if (null != fciData) {
+ // try {
+ // warningCheck(fciData, input, TYPE_OPEN);
+ // } catch (Exception e) {
+ // e.printStackTrace();
+ // }
+ // }
+ //
+ // if (null == fciData) {
+ // // parent = file ItemData
+ // fciData = createNewFileData(path);
+ // // create Data
+ // FileChartData innerData = new FileChartData();
+ // long openTime = Long.parseLong(input
+ // .get(LogCenterConstants.TIME_INDEX));
+ // innerData.setOpenTime(openTime);
+ // fciData.getData().add(innerData);
+ // innerData.getInput().addAll(input);
+ //
+ // // child = fd
+ // FileChartItemData child = new FileChartItemData(fd, seq++);
+ // FileChartData childInnerData = new FileChartData();
+ // childInnerData.setOpenTime(openTime);
+ // childInnerData.getRelations().add(seqNum);
+ // child.getData().add(childInnerData);
+ // fciData.getChildern().add(child);
+ // child.setParentKey(fciData.getKey());
+ // getFDRegister().put(fd, child);
+ // child.setColsed(false);
+ // } else {
+ // if (fciData.isClosed() || fciData.getData().isEmpty()) {
+ // // create Data
+ // FileChartData fcData = new FileChartData();
+ // long openTime = Long.parseLong(input
+ // .get(LogCenterConstants.TIME_INDEX));
+ // fcData.setOpenTime(openTime);
+ // fciData.getData().add(fcData);
+ // fciData.setColsed(false);
+ // // FIXME DEBUG
+ // fcData.getInput().addAll(input);
+ // }
+ //
+ // // child = fd
+ // FileChartItemData child = fciData.getFindChild(fd);
+ // if (null == child) {
+ // child = new FileChartItemData(fd, seq++);
+ // child.setParentKey(fciData.getKey());
+ // fciData.getChildern().add(child);
+ // }
+ // long openTime = Long.parseLong(input
+ // .get(LogCenterConstants.TIME_INDEX));
+ // FileChartData childInnerData = new FileChartData();
+ // childInnerData.setOpenTime(openTime);
+ // childInnerData.getRelations().add(seqNum);
+ // child.getData().add(childInnerData);
+ // getFDRegister().put(fd, child);
+ // child.setColsed(false);
+ // }
+ // // file timeline data create
+ // openApiCount++;
+ // openCount++;
+ // FileTimelineData ftd = new FileTimelineData(
+ // input.get(LogCenterConstants.TIME_INDEX), openApiCount,
+ // closeApiCount, openCount);
+ // getFileTimelineDataList().add(ftd);
+ // FileChart.getInstance().setFDCount(ftd.getOpenCount());
+ // // close
+ // } else if (fdApiType.equals(LogCenterConstants.FD_API_TYPE_CLOSE)) {
+ //
+ // FileChartItemData child = getFDRegister().get(fd);
+ // if (null == child) {
+ // continue;
+ // }
+ // long closeTime = Long.parseLong(input
+ // .get(LogCenterConstants.TIME_INDEX));
+ // child.getLastData().setCloseTime(closeTime);
+ // child.getLastData().getRelations().add(seqNum);
+ // child.setColsed(true);
+ // getFDRegister().remove(fd);
+ // long useTime = child.getTotalFileUseTime();
+ // child.setTotalFileUseTime(closeTime
+ // - child.getLastData().getOpenTime() + useTime);
+ //
+ // String parentKey = child.getParentKey();
+ // FileChartItemData fileData = getFileRegister().get(parentKey);
+ // long pUseTime = fileData.getTotalFileUseTime();
+ // fileData.setTotalFileUseTime(pUseTime + closeTime
+ // - child.getLastData().getOpenTime());
+ //
+ // // warning check
+ // warningCheck(fileData, input, TYPE_CLOSE);
+ //
+ // if (fileData.isAllChildrenClosed()) {
+ // fileData.getLastData().setCloseTime(closeTime);
+ // fileData.setColsed(true);
+ // }
+ //
+ // // file timeline data create
+ // closeApiCount++;
+ // openCount--;
+ // FileTimelineData ftd = new FileTimelineData(
+ // input.get(LogCenterConstants.TIME_INDEX), openApiCount,
+ // closeApiCount, openCount);
+ // getFileTimelineDataList().add(ftd);
+ // FileChart.getInstance().setFDCount(ftd.getOpenCount());
+ //
+ // // read / write
+ // } else if (fdApiType.equals(LogCenterConstants.FD_API_TYPE_READ)
+ // || fdApiType.equals(LogCenterConstants.FD_API_TYPE_WRITE)) {
+ //
+ // System.out.print("Read Write " + input + "\n");
+ //
+ // if (PrintCalledFunctionChart(input) == false) {
+ // continue;
+ // }
+ //
+ // // calculate read/write size
+ // FileChartItemData child = getFDRegister().get(fd);
+ // FileChartItemData parent = getFileRegister().get(
+ // child.getParentKey());
+ //
+ // String rwSizeStr1 = input
+ // .get(LogCenterConstants.RESOURCE_SIZE_INDEX);
+ // long rwSize = Long.parseLong(rwSizeStr1);
+ // if (fdApiType.equals(LogCenterConstants.FD_API_TYPE_READ)) {
+ // long rSize = child.getReadSize();
+ // child.setReadSize(rSize + rwSize);
+ // long prSize = parent.getReadSize();
+ // parent.setReadSize(child.getReadSize() + prSize);
+ // } else if (fdApiType
+ // .equals(LogCenterConstants.FD_API_TYPE_WRITE)) {
+ // String strTotalSize = input
+ // .get(LogCenterConstants.RESOURCE_FILE_SIZE_INDEX);
+ // if (strTotalSize.equals("?") == false) {
+ // long totalSize = Long.parseLong(strTotalSize);
+ // child.setTotalSize(totalSize);
+ // }
+ //
+ // long wSize = child.getWriteSize();
+ // child.setWriteSize(wSize + rwSize);
+ // long pwSize = parent.getWriteSize();
+ // parent.setWriteSize(child.getWriteSize() + pwSize);
+ // }
+ // } else // / Other
+ // {
+ // // System.out.print(" Other "+input+"\n");
+ // if (PrintCalledFunctionChart(input) == false) {
+ // continue;
+ // }
+ // }
+ // }
+ // }
+ //
+ // private boolean PrintCalledFunctionChart(List<String> input) {
+ //
+ // String seqNum = input.get(LogCenterConstants.SEQUENCE_NUMBER_INDEX);
+ // String path = input.get(LogCenterConstants.RESOURCE_FILE_PATH_INDEX);
+ // String fd = input.get(LogCenterConstants.RESOURCE_FDVALUE_INDEX);
+ //
+ // // Print Called Function - File Chart Except( Open, close, Error )
+ // FailedData ffd = new FailedData(input);
+ //
+ // FileChartItemData fcid = getFDRegister().get(fd);
+ // if (null == fcid) {
+ // ffd = null;
+ // return false;
+ // }
+ // path = fcid.getParentKey();
+ // if (path.isEmpty()) {
+ // System.out.println();
+ // }
+ // fcid.getCalledFunctionData().add(ffd);
+ //
+ // FileChartItemData parentCalled = getFileRegister().get(path);
+ // if (null == parentCalled) {
+ // parentCalled = createNewFileData(path);
+ // }
+ // parentCalled.getCalledFunctionData().add(ffd);
+ // AnalyzerManager.getCalledFunctionChecker().getFailedList().add(ffd);
+ //
+ // // Insert File API List - Table
+ // FileChartItemData child = getFDRegister().get(fd);
+ // if (null == child) {
+ // return false;
+ // }
+ // child.getLastData().getRelations().add(seqNum);
+ //
+ // // Print API Range
+ // FileChartItemData parent = getFileRegister().get(child.getParentKey());
+ // try {
+ // long time = Long
+ // .parseLong(input.get(LogCenterConstants.TIME_INDEX));
+ // if (child.getLastData().getFirstTime() < 0) {
+ // child.getLastData().setFirstTime(time);
+ // child.getLastData().setLastTime(time);
+ // } else {
+ // child.getLastData().setLastTime(time);
+ // }
+ //
+ // if (parent.getLastData().getFirstTime() < 0) {
+ // parent.getLastData().setFirstTime(time);
+ // parent.getLastData().setLastTime(time);
+ // } else {
+ // parent.getLastData().setLastTime(time);
+ // }
+ //
+ // } catch (NullPointerException e) {
+ // System.out.println("PrintCalledFunctionChart Exception"); //$NON-NLS-1$
+ // e.printStackTrace();
+ // }
+ //
+ // return true;
+ // }
+
+ // private void warningCheck(FileChartItemData file, List<String> input,
+ // int type) {
+ // WarningChecker warningChecker = AnalyzerManager.getWarningChecker();
+ // if (type == TYPE_CLOSE) {
+ // long firstTime = file.getLastData().getFirstTime();
+ // if (firstTime < 0) {
+ // if (!warningChecker.isChecked(file.getKey(),
+ // WarningCase.WITHOUT_USING.getType())) {
+ // WarningData wData = new WarningData(
+ // LogCenterConstants.LOG_RESOURCE,
+ // WarningCase.WITHOUT_USING.getType(), input,
+ // file.getKey());
+ // warningChecker.getWarningData().add(wData);
+ // }
+ // }
+ //
+ // } else if (type == TYPE_OPEN) {
+ // if (!file.isClosed()) {
+ // if (!warningChecker.isChecked(file.getKey(),
+ // WarningCase.DUPLICATE_OPEN.getType())) {
+ // WarningData wData = new WarningData(
+ // LogCenterConstants.LOG_RESOURCE,
+ // WarningCase.DUPLICATE_OPEN.getType(), input,
+ // file.getKey());
+ // warningChecker.getWarningData().add(wData);
+ // }
+ // }
+ // }
+ //
+ // long closedTime = 0;
+ // if (null != file.getLastData()) {
+ // closedTime = file.getLastData().getCloseTime();
+ // }
+ //
+ // if (closedTime < 0) {
+ // closedTime = ToolbarArea.getInstance().getTime();
+ // }
+ //
+ // }
+ //
+ // private FileChartItemData createNewFileData(String path) {
+ // String[] splitPath = path.split("\\/"); //$NON-NLS-1$
+ // String fileName = new String(splitPath[splitPath.length - 1]);
+ // FileChartItemData newFileData = new FileChartItemData(path, seq++);
+ // newFileData.setFileName(fileName);
+ // newFileData.setPath(path);
+ // getFileList().add(newFileData);
+ // getFileRegister().put(path, newFileData);
+ // newFileData.setParent();
+ // return newFileData;
+ // }
}
.demanglingFunctionName(prevFunctionName);
}
} else {
- if (path.equals(DACommunicator.getSelectedApp().getExecPath())
- && AnalyzerManager.isOsp()) {
+ if (DACommunicator.isDeviceConnected()
+ && path.equals(DACommunicator.getSelectedApp()
+ .getExecPath()) && AnalyzerManager.isOsp()) {
path += ".exe";
}
}
}
- public void logQueueObserverThreadEnd() {
+ public void logParsingThreadEnd() {
if (null != dialog) {
dialog.setValue(70);
}
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.resources.FontResources;
import org.tizen.dynamicanalyzer.resources.ImageResources;
-import org.tizen.dynamicanalyzer.ui.summary.warning.WarningDataManager;
import org.tizen.dynamicanalyzer.ui.widgets.ViewContainer;
public class ScoreView extends DAView {
@Override
public void updateView() {
failCount = AnalyzerManager.getFailedChecker().getFailedList().size();
- leakSize = AnalyzerManager.getLeakDectector().getLeakDataList().size();
- warningSize = WarningDataManager.getInstance().getWarningData().size();
+ leakSize = AnalyzerManager.getLeakDetector().getLeakDataList().size();
+ warningSize = AnalyzerManager.getWarningChecker().getWarningData().size();
columnValue.set(0, failCount);
columnValue.set(1, leakSize);
columnValue.set(2, warningSize);
public class BaseView extends ViewPart {
public static final String ID = BaseView.class.getName();
- DAEffectFrame mainView = null;
DAPageComposite topComposite = null;
DATabComposite tabView = null;
tabView = new DATabComposite(parent, SWT.DOUBLE_BUFFERED, null);
tabView.setTabWidth(120);
{
- TimelinePage timelinePage = new TimelinePage(
+ Composite timelinePage = new TimelinePage(
tabView.getContentComposite(), SWT.NONE);
tabView.addView(timelinePage);
- SummaryPage summaryPage = new SummaryPage(
+ Composite summaryPage = new SummaryPage(
tabView.getContentComposite(), SWT.NONE);
tabView.addView(summaryPage);
- FilePage filePage = new FilePage(tabView.getContentComposite(),
+ Composite filePage = new FilePage(tabView.getContentComposite(),
SWT.NONE);
tabView.addView(filePage);
- ThreadPage threadPage = new ThreadPage(
+ Composite threadPage = new ThreadPage(
tabView.getContentComposite(), SWT.NONE);
tabView.addView(threadPage);
- UIPage uiPage = new UIPage(
- tabView.getContentComposite(), SWT.NONE);
+ Composite uiPage = new UIPage(tabView.getContentComposite(),
+ SWT.NONE);
tabView.addView(uiPage);
+
+// Composite rangePage = new RangePage(tabView.getContentComposite(),
+// SWT.NONE);
+// tabView.addView(rangePage);
}
}
--- /dev/null
+/*
+ * 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.ui.range;
+
+import org.eclipse.nebula.widgets.grid.GridItem;
+import org.eclipse.nebula.widgets.grid.IInternalWidget;
+import org.eclipse.nebula.widgets.grid.internal.CheckBoxRenderer;
+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.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.tizen.dynamicanalyzer.resources.ColorResources;
+import org.tizen.dynamicanalyzer.resources.FontResources;
+import org.tizen.dynamicanalyzer.ui.widgets.table.DATableToggleRenderer;
+
+public class FunctionUsageProfilingTableCellRenderer extends
+ DefaultCellRenderer {
+ int leftMargin = 4;
+ int rightMargin = 4;
+ int topMargin = 0;
+ int bottomMargin = 0;
+ int textTopMargin = 1;
+ int textBottomMargin = 2;
+ int insideMargin = 3;
+ int treeIndent = 20;
+
+ private DATableToggleRenderer toggleRenderer;
+ private CheckBoxRenderer checkRenderer;
+
+ @Override
+ public void paint(GC gc, Object value) {
+ GridItem item = (GridItem) value;
+
+ gc.setFont(item.getFont(getColumn()));
+
+ boolean drawAsSelected = isSelected();
+
+ boolean drawBackground = true;
+
+ if (isCellSelected()) {
+ drawAsSelected = true;// (!isCellFocus());
+ }
+
+ // if (isHover())
+ // {
+ // System.out.println("hover!!");
+ // }
+
+ if (drawAsSelected) {
+ gc.setForeground(ColorResources.TABLE_CONTENTS_SELECTED_START);
+ gc.setBackground(ColorResources.TABLE_CONTENTS_SELECTED_END);
+ } 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 && drawAsSelected) {
+ 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);
+ }
+
+ int x = leftMargin;
+
+ if (isTree()) {
+ x += getToggleIndent(item);
+ if (drawAsSelected) {
+ toggleRenderer.setSelected(true);
+ } else {
+ toggleRenderer.setSelected(false);
+ }
+ toggleRenderer.setExpanded(item.isExpanded());
+
+ toggleRenderer.setHover(getHoverDetail().equals("toggle")); //$NON-NLS-1$
+
+ toggleRenderer.setLocation(getBounds().x + x,
+ (getBounds().height - toggleRenderer.getBounds().height)
+ / 2 + getBounds().y);
+ toggleRenderer.paint(gc, item);
+
+ x += toggleRenderer.getBounds().width + insideMargin;
+
+ }
+
+ if (isCheck()) {
+
+ checkRenderer.setChecked(item.getChecked(getColumn()));
+ checkRenderer.setGrayed(item.getGrayed(getColumn()));
+ if (!item.getParent().isEnabled()) {
+ checkRenderer.setGrayed(true);
+ }
+ checkRenderer.setHover(getHoverDetail().equals("check")); //$NON-NLS-1$
+
+ checkRenderer.setBounds(getBounds().x + x,
+ (getBounds().height - checkRenderer.getBounds().height) / 2
+ + getBounds().y, checkRenderer.getBounds().width,
+ checkRenderer.getBounds().height);
+ checkRenderer.paint(gc, null);
+
+ x += checkRenderer.getBounds().width + insideMargin;
+ }
+
+ Image image = item.getImage(getColumn());
+ if (image != null) {
+ int y = getBounds().y;
+
+ y += (getBounds().height - image.getBounds().height) / 2;
+
+ gc.drawImage(image, getBounds().x + x, y);
+
+ x += image.getBounds().width + insideMargin;
+ }
+
+ int width = getBounds().width - x - rightMargin;
+
+ String text = item.getText(getColumn());
+
+ if (getAlignment() == SWT.RIGHT) {
+ int len = gc.stringExtent(text).x;
+ if (len < width) {
+ x += width - len;
+ }
+ } else if (getAlignment() == SWT.CENTER) {
+ int len = gc.stringExtent(text).x;
+ if (len < width) {
+ x += (width - len) / 2;
+ }
+ }
+
+ if (getColumn() == 2 || getColumn() == 4) {
+ if (drawAsSelected) {
+ gc.setForeground(ColorResources.PROFILING_GRAPH_SELECTION_COLOR_START);
+ gc.setBackground(ColorResources.PROFILING_GRAPH_SELECTION_COLOR_END);
+ } else {
+ gc.setForeground(ColorResources.PROFILING_GRAPH_COLOR_START);
+ gc.setBackground(ColorResources.PROFILING_GRAPH_COLOR_END);
+ }
+ String rateStr = item.getText(getColumn());
+ String[] splitRateStr = rateStr.split("%"); //$NON-NLS-1$
+ rateStr = new String(splitRateStr[0].trim());
+ if ( !rateStr.equals("-")) {
+ double rate = Double.parseDouble(rateStr);
+ Rectangle bounds = getBounds();
+ int rectWidth = (int) (bounds.width * (rate / 100));
+ gc.fillGradientRectangle(bounds.x + 1, bounds.y, rectWidth,
+ bounds.height, true);
+ }
+ }
+
+ if (drawAsSelected) {
+ gc.setForeground(ColorResources.TABLE_CONTENTS_SELECTED_FONT_COLOR);
+ } else {
+ Color fontColor = item.getForeground();
+ if (null != fontColor) {
+ gc.setForeground(item.getForeground());
+ } else {
+ gc.setForeground(ColorResources.TABLE_CONTENTS_FONT_COLOR);
+ }
+
+ // Color fg = item.getForeground(getColumn());
+ // if (null == fg || fg.equals(ColorResources.BLACK)) {
+ // gc.setForeground(ColorResources.WHITE);
+ // } else {
+ // gc.setForeground(fg);
+ // }
+ }
+
+ // Font font = item.getFont(getColumn());
+ // if (null == font) {
+ // if (getColumn() == 2 || getColumn() == 4) {
+ // gc.setForeground(ColorResources.TABLE_CONTENTS_FONT_COLOR);
+ // }
+ gc.setFont(FontResources.TABLE_CELL_FONT);
+ // } else {
+ // gc.setFont(font);
+ // }
+ if (getColumn() != 0) {
+ gc.drawText(text, getBounds().x + x, getBounds().y + textTopMargin,
+ true);
+ }
+
+ if (item.getParent().getLinesVisible()) {
+ if (isCellSelected()) {
+ 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);
+ gc.drawLine(getBounds().x + getBounds().width - 1, getBounds().y,
+ getBounds().x + getBounds().width - 1, getBounds().y
+ + getBounds().height);
+ }
+
+ if (isCellFocus()) {
+ Rectangle focusRect = new Rectangle(getBounds().x - 1,
+ getBounds().y - 1, getBounds().width,
+ getBounds().height + 1);
+
+ gc.setForeground(ColorResources.RED);
+ gc.drawRectangle(focusRect);
+
+ if (isFocus()) {
+ focusRect.x++;
+ focusRect.width -= 2;
+ focusRect.y++;
+ focusRect.height -= 2;
+
+ gc.drawRectangle(focusRect);
+ }
+ }
+ }
+
+ private int getToggleIndent(GridItem item) {
+ return item.getLevel() * 20;
+ }
+
+ public void setTree(boolean tree) {
+ super.setTree(tree);
+
+ if (tree) {
+ toggleRenderer = new DATableToggleRenderer();
+ toggleRenderer.setDisplay(getDisplay());
+ }
+ }
+
+ public Point computeSize(GC gc, int wHint, int hHint, Object value) {
+ GridItem item = (GridItem) value;
+ gc.setFont(item.getFont(getColumn()));
+ int x = 0;
+
+ x += leftMargin;
+
+ if (isTree()) {
+ x += getToggleIndent(item);
+ x += toggleRenderer.getBounds().width + insideMargin;
+ }
+
+ if (isCheck()) {
+ x += checkRenderer.getBounds().width + insideMargin;
+ }
+
+ int y = 0;
+ Image image = item.getImage(getColumn());
+ if (image != null) {
+ y = topMargin + image.getBounds().height + bottomMargin;
+
+ x += image.getBounds().width + insideMargin;
+ }
+
+ x += gc.stringExtent(item.getText(getColumn())).x + rightMargin;
+ y = Math.max(y, topMargin + gc.getFontMetrics().getHeight()
+ + bottomMargin);
+
+ return new Point(x, y);
+ }
+
+ public boolean notify(int event, Point point, Object value) {
+ GridItem item = (GridItem) value;
+ if (isCheck()) {
+ if (event == IInternalWidget.MouseMove) {
+ if (overCheck(item, point)) {
+ setHoverDetail("check"); //$NON-NLS-1$
+ return true;
+ }
+ }
+
+ if (event == IInternalWidget.LeftMouseButtonDown) {
+ if (overCheck(item, point)) {
+ item.setChecked(getColumn(), !item.getChecked(getColumn()));
+ item.getParent().redraw();
+ item.fireCheckEvent(getColumn());
+
+ return true;
+ }
+ }
+ }
+
+ if (isTree() && item.hasChildren()) {
+ if (event == IInternalWidget.MouseMove) {
+ if (overToggle(item, point)) {
+ setHoverDetail("toggle"); //$NON-NLS-1$
+ return true;
+ }
+ }
+
+ if (event == IInternalWidget.LeftMouseButtonDown) {
+ if (overToggle(item, point)) {
+ item.setExpanded(!item.isExpanded());
+ item.getParent().redraw();
+
+ if (item.isExpanded()) {
+ item.fireEvent(SWT.Expand);
+ } else {
+ item.fireEvent(SWT.Collapse);
+ }
+
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ private boolean overCheck(GridItem item, Point point) {
+ point = new Point(point.x, point.y);
+ point.x -= getBounds().x - 1;
+ point.y -= getBounds().y - 1;
+
+ int x = leftMargin;
+ if (isTree()) {
+ x += getToggleIndent(item);
+ x += toggleRenderer.getSize().x + insideMargin;
+ }
+
+ if (point.x >= x && point.x < (x + checkRenderer.getSize().x)) {
+ int yStart = ((getBounds().height - checkRenderer.getBounds().height) / 2);
+ if (point.y >= yStart
+ && point.y < yStart + checkRenderer.getSize().y) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ private boolean overToggle(GridItem item, Point point) {
+ point = new Point(point.x, point.y);
+ point.x -= getBounds().x - 1;
+ point.y -= getBounds().y - 1;
+
+ int x = leftMargin;
+ x += getToggleIndent(item);
+
+ if (point.x >= x && point.x < (x + toggleRenderer.getSize().x)) {
+ // return true;
+ int yStart = ((getBounds().height - toggleRenderer.getBounds().height) / 2);
+ if (point.y >= yStart
+ && point.y < yStart + toggleRenderer.getSize().y) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ public void setCheck(boolean check) {
+ super.setCheck(check);
+
+ if (check) {
+ checkRenderer = new CheckBoxRenderer();
+ checkRenderer.setDisplay(getDisplay());
+ } else {
+ checkRenderer = null;
+ }
+ }
+
+ public Rectangle getTextBounds(GridItem item, boolean preferred) {
+ int x = leftMargin;
+
+ if (isTree()) {
+ x += getToggleIndent(item);
+
+ x += toggleRenderer.getBounds().width + insideMargin;
+
+ }
+
+ if (isCheck()) {
+ x += checkRenderer.getBounds().width + insideMargin;
+ }
+
+ Image image = item.getImage(getColumn());
+ if (image != null) {
+ x += image.getBounds().width + insideMargin;
+ }
+
+ Rectangle bounds = new Rectangle(x, topMargin, 0, 0);
+
+ GC gc = new GC(item.getParent());
+ gc.setFont(item.getFont(getColumn()));
+ Point size = gc.stringExtent(item.getText(getColumn()));
+
+ bounds.height = size.y;
+
+ if (preferred) {
+ bounds.width = size.x;
+ } else {
+ bounds.width = getBounds().width - x - rightMargin;
+ }
+
+ gc.dispose();
+
+ return bounds;
+ }
+}
--- /dev/null
+/*
+ * 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.ui.range;
+
+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.model.DAView;
+import org.tizen.dynamicanalyzer.nl.SummaryLabels;
+import org.tizen.dynamicanalyzer.resources.ColorResources;
+import org.tizen.dynamicanalyzer.ui.summary.profiling.ProfilingData;
+import org.tizen.dynamicanalyzer.ui.summary.profiling.ProfilingTable;
+import org.tizen.dynamicanalyzer.ui.widgets.ViewContainer;
+
+public class FunctionUsageProfilingView extends DAView {
+
+ public static final String ID = FunctionUsageProfilingView.class.getName();
+ private ProfilingTable treeComp = null;
+ int[] innerMaxWeight = { 100, 0 };
+ int[] outerMaxWeight = { 0, 100 };
+
+ private String[] columnNames = {
+ SummaryLabels.FUNCTION_USER_PROFILING_VIEW_NAME,
+ SummaryLabels.FUNCTION_USER_PROFILING_VIEW_EXCLUSIVE_CPU_TIME,
+ SummaryLabels.FUNCTION_USER_PROFILING_VIEW_EXCLUSIVE_CPU_RATE,
+ SummaryLabels.FUNCTION_USER_PROFILING_VIEW_INCLUSIVE_CPU_TIME,
+ SummaryLabels.FUNCTION_USER_PROFILING_VIEW_INCLUSIVE_CPU_RATE,
+ SummaryLabels.FUNCTION_USER_PROFILING_VIEW_CALL_COUNT,
+ SummaryLabels.FUNCTION_USER_PROFILING_VIEW_INCLUSIVE_ELASPED_TIME,
+ SummaryLabels.FUNCTION_USER_PROFILING_VIEW_EXCLUSIVE_ELASPED_TIME };
+ private int[] columnSizes = { 200, 0, 0, 0, 0, 0, 0, 0 };
+ private boolean[] columnVisibility = { true, true, true, true, true, true,
+ true, true };
+ int[] sortTypes = { AnalyzerConstants.SORT_TYPE_NONE,
+ AnalyzerConstants.SORT_TYPE_NUM,
+ AnalyzerConstants.SORT_TYPE_NUM, AnalyzerConstants.SORT_TYPE_NUM,
+ AnalyzerConstants.SORT_TYPE_NUM, AnalyzerConstants.SORT_TYPE_NUM,
+ AnalyzerConstants.SORT_TYPE_NUM, AnalyzerConstants.SORT_TYPE_NUM };
+ int[] sourceColumns = { ProfilingData.NAME_INDEX,
+ ProfilingData.EXCOUNT_INDEX, ProfilingData.EXCOUNT_INDEX,
+ ProfilingData.INCOUNT_INDEX, ProfilingData.INCOUNT_INDEX,
+ ProfilingData.CALLCOUNT_INDEX,
+ ProfilingData.INCL_ELAPSED_TIME_INDEX,
+ ProfilingData.EXCL_ELAPSED_TIME_INDEX };
+
+ public FunctionUsageProfilingView(Composite parent, int style) {
+ super(parent, style);
+ this.setLayout(new FillLayout());
+
+ ViewContainer viewContainer = new ViewContainer(this, true);
+ viewContainer
+ .setTitleText(SummaryLabels.FUNCTION_USER_PROFILING_VIEW_TITLE);
+ setMaxWeight(innerMaxWeight, outerMaxWeight);
+ Composite contents = viewContainer.getContentArea();
+ contents.setBackground(ColorResources.WINDOW_BG_COLOR);
+ contents.setLayout(new FillLayout());
+ treeComp = new ProfilingTable(contents, SWT.NONE, SWT.SINGLE
+ | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
+ /*** setTree set first!!! ***/
+ treeComp.setTree(true);
+ treeComp.setSortTypes(sortTypes);
+ treeComp.setSourceColumns(sourceColumns);
+ treeComp.setColumns(columnNames);
+ treeComp.setColumnSize(columnSizes);
+ treeComp.setColumnVisibility(columnVisibility);
+ treeComp.setTableToolTipEnable(false);
+ treeComp.setTableName("R_Function Usage");
+ }
+
+ @Override
+ public void updateView() {
+ treeComp.updateTree();
+ }
+
+ @Override
+ public void clear() {
+ treeComp.clear();
+ }
+
+ @Override
+ public Control getControl() {
+ return treeComp;
+ }
+
+ @Override
+ public void otherViewSelectionOccured() {
+ treeComp.deselectAll();
+ }
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.ui.range;
+
+import java.util.List;
+
+import org.eclipse.swt.widgets.Display;
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
+import org.tizen.dynamicanalyzer.common.AnalyzerManager;
+import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
+import org.tizen.dynamicanalyzer.logparser.LogPackage;
+import org.tizen.dynamicanalyzer.logparser.Logs;
+import org.tizen.dynamicanalyzer.model.LogCenter;
+import org.tizen.dynamicanalyzer.sql.SqlManager;
+import org.tizen.dynamicanalyzer.ui.file.FileDataMaker;
+import org.tizen.dynamicanalyzer.ui.page.DAPageComposite;
+import org.tizen.dynamicanalyzer.ui.summary.failed.FailedChecker;
+import org.tizen.dynamicanalyzer.ui.summary.leaks.LeakDetector;
+import org.tizen.dynamicanalyzer.ui.summary.warning.WarningChecker;
+import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
+
+public class RangeDataManager implements Runnable {
+ private static RangeDataManager instance = null;
+ private Thread rangeThread = null;
+ private FailedChecker failedChecker = null;
+ private LeakDetector leakDetector = null;
+ private WarningChecker warningChecker = null;
+
+ private FileDataMaker fileDataMaker = null;
+ private String startTime = null;
+ private String endTime = null;
+
+ public RangeDataManager() {
+ failedChecker = new FailedChecker();
+ leakDetector = new LeakDetector();
+ warningChecker = new WarningChecker();
+
+ fileDataMaker = new FileDataMaker(failedChecker, leakDetector,
+ warningChecker);
+ }
+
+ public void clear() {
+ failedChecker.clear();
+ leakDetector.clear();
+ warningChecker.clear();
+ }
+
+ public void startRangeThread() {
+ if (null == rangeThread || !rangeThread.isAlive()) {
+ rangeThread = new Thread(null, getInstance(),
+ AnalyzerConstants.FILE_CHART_MANAGER_THREAD);
+ rangeThread.start();
+ }
+ }
+
+ public void stopUpdateLogThread() {
+ if (null != rangeThread && rangeThread.isAlive()) {
+ rangeThread.interrupt();
+ }
+ }
+
+ public static RangeDataManager getInstance() {
+ if (null == instance) {
+ instance = new RangeDataManager();
+ }
+ return instance;
+ }
+
+ public FailedChecker getFailedChecker() {
+ return failedChecker;
+ }
+
+ public void setFailedChecker(FailedChecker failedChecker) {
+ this.failedChecker = failedChecker;
+ }
+
+ public LeakDetector getLeakDetector() {
+ return leakDetector;
+ }
+
+ public void setLeakDetector(LeakDetector leakDetector) {
+ this.leakDetector = leakDetector;
+ }
+
+ public WarningChecker getWarningChecker() {
+ return warningChecker;
+ }
+
+ public void setWarningChecker(WarningChecker warningChecker) {
+ this.warningChecker = warningChecker;
+ }
+
+ public void setTimes(String startTime, String endTime) {
+ this.startTime = startTime;
+ this.endTime = endTime;
+ }
+
+ @Override
+ public void run() {
+ List<LogCenter> logCenters = AnalyzerManager.getLogCenters();
+ List<List<String>> input = null;
+ LogPackage logPackage = new LogPackage();
+ int size = logCenters.size();
+ String query = null;
+ int from = -1;
+ int last = -1;
+ for (int i = 0; i < size; i++) {
+ /* !! sample db table is null.. */
+ if (logCenters.get(i).getId() != LogCenterConstants.LOG_DEVICE
+ && logCenters.get(i).getId() != LogCenterConstants.LOG_SAMPLE) {
+ query = "select min(seqnumber) from "
+ + logCenters.get(i).getName() + " where time >= "
+ + startTime;
+ int ret = SqlManager.executeQueryMinMax(query);
+ if (ret >= 0) {
+ from = (from > 0 && from < ret) ? from : ret;
+ }
+
+ query = "select max(seqnumber) from "
+ + logCenters.get(i).getName() + " where time <= "
+ + endTime;
+ ret = SqlManager.executeQueryMinMax(query);
+ if (ret >= 0) {
+ last = (last > 0 && last > ret) ? last : ret;
+ }
+ }
+ }
+
+ System.out.println(from + " ~ " + last);
+ int to = AnalyzerConstants.DATABASE_READ_SIZE;
+
+ while (!Thread.interrupted()) {
+ if (to >= last) {
+ to = last;
+ }
+
+ for (int i = 0; i < size; i++) {
+ if (logCenters.get(i).getId() != LogCenterConstants.LOG_DEVICE
+ && logCenters.get(i).getId() != LogCenterConstants.LOG_SAMPLE) {
+ Logs logs = new Logs(logCenters.get(i).getId());
+ input = SqlManager.selectArea(logCenters.get(i), from, to);
+ logs.setLogs(input);
+ logPackage.setLogs(logCenters.get(i).getId(), logs);
+ }
+ } // for
+ // updateLog(logPackage);
+ makeRangeData(logPackage);
+ if (to == last) {
+ break;
+ }
+ from += AnalyzerConstants.DATABASE_READ_SIZE;
+ to = from + AnalyzerConstants.DATABASE_READ_SIZE;
+ }
+ System.out.println("range input reader complete");
+ // end
+ AnalyzerUtil.changePage(RangePage.ID);
+ final DAPageComposite page = AnalyzerManager.getCurrentPage();
+ Display.getDefault().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ page.updatePage();
+ }
+ });
+ }
+
+ private void makeRangeData(LogPackage logPack) {
+ Logs logs = logPack.getLogs(LogCenterConstants.LOG_RESOURCE);
+ List<List<String>> resourceInputs = logs.getLogs();
+
+ logs = logPack.getLogs(LogCenterConstants.LOG_MEMORY);
+ List<List<String>> memoryInputs = logs.getLogs();
+
+ // logs = logPack.getLogs(LogCenterConstants.LOG_THREAD);
+ // List<List<String>> threadInputs = logs.getLogs();
+
+ /* make file failed data and warning data */
+ fileDataMaker.makeData(resourceInputs);
+
+ /* resource leak check */
+ int size = resourceInputs.size();
+ for (int i = 0; i < size; i++) {
+ List<String> input = resourceInputs.get(i);
+ String[] inputArray = new String[input.size()];
+ input.toArray(inputArray);
+ leakDetector.runLeakDectect(inputArray);
+ }
+
+ /* memory leak check */
+ size = memoryInputs.size();
+ for (int i = 0; i < size; i++) {
+ List<String> input = memoryInputs.get(i);
+ String[] inputArray = new String[input.size()];
+ input.toArray(inputArray);
+ leakDetector.runLeakDectect(inputArray);
+ }
+
+ /* created failed and warning/leak data */
+ }
+}
--- /dev/null
+/*
+ * 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.ui.range;
+
+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.logparser.LogCenterConstants;
+import org.tizen.dynamicanalyzer.model.DAView;
+import org.tizen.dynamicanalyzer.nl.SummaryLabels;
+import org.tizen.dynamicanalyzer.resources.ColorResources;
+import org.tizen.dynamicanalyzer.ui.summary.failed.FailedApiTable;
+import org.tizen.dynamicanalyzer.ui.widgets.ViewContainer;
+import org.tizen.dynamicanalyzer.ui.widgets.table.DATableComposite;
+import org.tizen.dynamicanalyzer.ui.widgets.table.TableComparator;
+
+public class RangeFailedApiListView extends DAView {
+ public static final String ID = RangeFailedApiListView.class.getName();
+ private DATableComposite tableComp = null;
+
+ int[] innerMaxWeight = { 100, 0, 0 };
+ int[] outerMaxWeight = { 100, 0 };
+
+ private String[] columnNames = { SummaryLabels.FAILED_API_LIST_VIEW_INDEX,
+ SummaryLabels.FAILED_API_LIST_VIEW_TIME,
+ SummaryLabels.FAILED_API_LIST_VIEW_NAME,
+ SummaryLabels.FAILED_API_LIST_VIEW_PARAMETER,
+ SummaryLabels.FAILED_API_LIST_VIEW_RETURN,
+ SummaryLabels.FAILED_API_LIST_VIEW_ERROR_CODE,
+ SummaryLabels.FAILED_API_LIST_VIEW_ERROR_DESCRIPTION };
+ private int[] columnSizes = { 25, 60, 45, 125, 0, 70, 400 };
+ private boolean[] columnVisibility = { false, true, true, true, true, true,
+ true };
+ int[] sortTypes = { AnalyzerConstants.SORT_TYPE_NUM,
+ AnalyzerConstants.SORT_TYPE_NUM,
+ AnalyzerConstants.SORT_TYPE_STRING,
+ AnalyzerConstants.SORT_TYPE_STRING,
+ AnalyzerConstants.SORT_TYPE_STRING,
+ AnalyzerConstants.SORT_TYPE_GRID, AnalyzerConstants.SORT_TYPE_GRID };
+ int[] sourceColumns = { LogCenterConstants.SEQUENCE_NUMBER_INDEX,
+ LogCenterConstants.TIME_INDEX, LogCenterConstants.APINAME_INDEX,
+ LogCenterConstants.INPUTPARM_INDEX,
+ LogCenterConstants.RETURN_INDEX, LogCenterConstants.ERROR_INDEX,
+ LogCenterConstants.ERROR_INDEX };
+
+ public RangeFailedApiListView(Composite parent, int style) {
+ super(parent, style);
+ this.setLayout(new FillLayout());
+
+ ViewContainer viewContainer = new ViewContainer(this, true);
+ viewContainer
+ .setTitleText(SummaryLabels.FAILED_API_LIST_VIEW_TITLE);
+ setMaxWeight(innerMaxWeight, outerMaxWeight);
+ Composite contents = viewContainer.getContentArea();
+ contents.setBackground(ColorResources.WINDOW_BG_COLOR);
+ contents.setLayout(new FillLayout());
+ tableComp = new FailedApiTable(contents, SWT.NONE, SWT.SINGLE
+ | SWT.BORDER | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL);
+ ((FailedApiTable)tableComp).setRangeTable(true);
+ tableComp.setTableName("R_Failed APIs");
+ tableComp.setComparator(new TableComparator());
+ tableComp.setSortTypes(sortTypes);
+ tableComp.setSourceColumns(sourceColumns);
+ tableComp.setColumns(columnNames);
+ tableComp.setColumnSize(columnSizes);
+ tableComp.setColumnVisibility(columnVisibility);
+ }
+
+ @Override
+ public void updateView() {
+ tableComp.updateTable();
+ }
+
+ @Override
+ public void clear() {
+ // TODO Auto-generated method stub
+ tableComp.clear();
+ }
+
+ @Override
+ public Control getControl() {
+ return tableComp;
+ }
+
+ @Override
+ public void otherViewSelectionOccured() {
+ tableComp.deselectAll();
+ }
+}
--- /dev/null
+/*
+ * 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.ui.range;
+
+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.model.DAView;
+import org.tizen.dynamicanalyzer.nl.SummaryLabels;
+import org.tizen.dynamicanalyzer.resources.ColorResources;
+import org.tizen.dynamicanalyzer.ui.summary.leaks.LeakData;
+import org.tizen.dynamicanalyzer.ui.summary.leaks.LeakTable;
+import org.tizen.dynamicanalyzer.ui.widgets.ViewContainer;
+import org.tizen.dynamicanalyzer.ui.widgets.table.DATreeComposite;
+import org.tizen.dynamicanalyzer.ui.widgets.table.TreeDataComparator;
+
+public class RangeLeakView extends DAView {
+
+ public static final String ID = RangeLeakView.class.getName();
+
+ int[] innerMaxWeight = { 0, 100, 0 };
+ int[] outerMaxWeight = { 100, 0 };
+
+ private String[] columnNames = { SummaryLabels.LEAK_VIEW_NAME,
+ SummaryLabels.LEAK_VIEW_INDEX, SummaryLabels.LEAK_VIEW_TYPE,
+ SummaryLabels.LEAK_VIEW_TIME,
+ SummaryLabels.LEAK_VIEW_FILE_PARAMETER,
+ SummaryLabels.LEAK_VIEW_RETURN };
+ private int[] columnSizes = { 60, 25, 60, 50, 100, 100 };
+ private boolean[] columnVisibility = { true, false, true, true, true, true };
+ int[] sortTypes = { AnalyzerConstants.SORT_TYPE_GRID,
+ AnalyzerConstants.SORT_TYPE_NUM, AnalyzerConstants.SORT_TYPE_GRID,
+ AnalyzerConstants.SORT_TYPE_NUM,
+ AnalyzerConstants.SORT_TYPE_STRING,
+ AnalyzerConstants.SORT_TYPE_STRING };
+ int[] sourceColumns = { LeakData.SEQUENCE_INDEX, LeakData.SEQUENCE_INDEX,
+ LeakData.ID_INDEX, LeakData.TIME_INDEX, LeakData.NAME_INDEX,
+ LeakData.PARAM_INDEX, LeakData.RETURN_INDEX };
+
+ private DATreeComposite treeComp = null;
+
+ public RangeLeakView(Composite parent, int style) {
+ super(parent, style);
+ this.setLayout(new FillLayout());
+
+ ViewContainer viewContainer = new ViewContainer(this, true);
+ viewContainer.setTitleText(SummaryLabels.LEAK_VIEW_TITLE);
+ setMaxWeight(innerMaxWeight, outerMaxWeight);
+
+ Composite contents = viewContainer.getContentArea();
+ contents.setBackground(ColorResources.WINDOW_BG_COLOR);
+ contents.setLayout(new FillLayout());
+ treeComp = new LeakTable(contents, SWT.NONE, SWT.SINGLE | SWT.BORDER
+ | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL);
+ ((LeakTable) treeComp).setRangeTable(true);
+ /*** setTree set first!!! ***/
+ treeComp.setTree(true);
+ treeComp.setSortTypes(sortTypes);
+ treeComp.setSourceColumns(sourceColumns);
+ treeComp.setComparator(new TreeDataComparator());
+ treeComp.setColumns(columnNames);
+ treeComp.setColumnSize(columnSizes);
+ treeComp.setColumnVisibility(columnVisibility);
+ treeComp.setTableName("R_LEAK table");
+ }
+
+ @Override
+ public void updateView() {
+ treeComp.updateTree();
+ }
+
+ @Override
+ public void clear() {
+ treeComp.clear();
+ }
+
+ @Override
+ public Control getControl() {
+ return treeComp;
+ }
+
+ @Override
+ public void otherViewSelectionOccured() {
+ treeComp.deselectAll();
+ }
+}
--- /dev/null
+/*
+ * 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.ui.range;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.SashForm;
+import org.eclipse.swt.events.ControlEvent;
+import org.eclipse.swt.events.ControlListener;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.tizen.dynamicanalyzer.common.CommonConstants;
+import org.tizen.dynamicanalyzer.common.DesignConstants;
+import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
+import org.tizen.dynamicanalyzer.ui.info.callstack.CallstackView;
+import org.tizen.dynamicanalyzer.ui.info.snapshot.SnapshotView;
+import org.tizen.dynamicanalyzer.ui.page.DAPageComposite;
+import org.tizen.dynamicanalyzer.ui.summary.profiling.FunctionUsageProfilingView;
+import org.tizen.dynamicanalyzer.ui.summary.warning.WarningDetailView;
+import org.tizen.dynamicanalyzer.ui.widgets.DATabComposite;
+
+public class RangePage extends DAPageComposite {
+ public static final String ID = RangePage.class.getName();
+ public static final String TAB_ID = ID + CommonConstants.UNDERBAR + "tab";
+ public final static int FAILED_APILIST_VIEW_INDEX = 0;
+ public final static int LEAK_VIEW_INDEX = 1;
+ public final static int INFO_VIEW_INDEX = 2;
+ public final static int FUNCTION_PROFILING_VIEW_INDEX = 3;
+ public final static int WARNING_VIEW_INDEX = 4;
+ public final static int WARNING_VIEW_DETAIL_INDEX = 5;
+
+ SashForm upperForm;
+ SashForm bottomForm;
+ SashForm baseForm;
+ SashForm warningForm;
+
+ // 10 : offset
+ private final double DEFAULT_WIDTH = DesignConstants.SNAPSHOT_VIEW_WIDTH + 10;
+ private final double DEFAULT_HEIGHT = DesignConstants.SNAPSHOT_VIEW_HEIGHT
+ + 10 + DesignConstants.VIEW_TITLEBAR_HEIGHT;
+
+ public RangePage(Composite parent, int style) {
+ super(parent, style);
+ name = AnalyzerLabels.COOLBAR_AREA_RANGE;
+ this.setLayout(new FillLayout());
+
+ baseForm = new SashForm(this, SWT.VERTICAL);
+ baseForm.setLayout(new FillLayout());
+
+ upperForm = new SashForm(baseForm, SWT.HORIZONTAL);
+
+ // FAILED_APILIST_VIEW_INDEX = 0;
+ RangeFailedApiListView failedApiListView = new RangeFailedApiListView(upperForm,
+ SWT.NONE);
+ addView(failedApiListView);
+
+ // LEAK_VIEW_INDEX = 1;
+ RangeLeakView leakView = new RangeLeakView(upperForm, SWT.NONE);
+ addView(leakView);
+
+ // INFO_VIEW_INDEX = 2;
+ DATabComposite tabView = new DATabComposite(upperForm, SWT.NONE, TAB_ID);
+ addView(tabView);
+ {
+ SnapshotView currentView = new SnapshotView(
+ tabView.getContentComposite(), SWT.NONE, false);
+ tabView.addView(currentView);
+
+ CallstackView callstack = new CallstackView(
+ tabView.getContentComposite(), SWT.NONE);
+ callstack.setObservingViews(new String[] { RangeFailedApiListView.ID,
+ RangeLeakView.ID, RangeWarningListView.ID });
+ tabView.addView(callstack);
+ }
+ upperForm.setWeights(new int[] { 37, 40, 23 });
+
+ bottomForm = new SashForm(baseForm, SWT.HORIZONTAL);
+ // FUNCTION_PROFILING_VIEW_INDEX = 3;
+ FunctionUsageProfilingView userFunctionProfilingView = new FunctionUsageProfilingView(
+ bottomForm, SWT.NONE);
+ addView(userFunctionProfilingView);
+
+ warningForm = new SashForm(bottomForm, SWT.VERTICAL);
+ bottomForm.setWeights(new int[] { 70, 30 });
+
+ // WARNING_VIEW_INDEX = 4;
+ RangeWarningListView warningListView = new RangeWarningListView(warningForm,
+ SWT.NONE);
+ addView(warningListView);
+
+ // WARNING_VIEW_DETAIL_INDEX = 5;
+ WarningDetailView warningDetailView = new WarningDetailView(
+ warningForm, SWT.NONE);
+ addView(warningDetailView);
+ warningForm.setWeights(new int[] { 70, 30 });
+
+ this.addControlListener(new ControlListener() {
+
+ @Override
+ public void controlResized(ControlEvent e) {
+
+ Composite composite = (Composite) e.widget;
+ Rectangle rect = composite.getBounds();
+ int pageWidth = rect.width;
+ int pageHeight = rect.height;
+
+ int wRate = (int) (DEFAULT_WIDTH * 100 / pageWidth);
+ int hRate = (int) (DEFAULT_HEIGHT * 100 / pageHeight);
+ wRate = (wRate >= 100) ? 100 : wRate;
+ hRate = (hRate >= 100) ? 100 : hRate;
+
+ if ((wRate >= (100 - 37)) || hRate >= 100) {
+ return;
+ }
+ upperForm.setWeights(new int[] { 37, 100 - 37 - wRate, wRate });
+ baseForm.setWeights(new int[] { hRate, 100 - hRate });
+ }
+
+ @Override
+ public void controlMoved(ControlEvent e) {
+
+ }
+ });
+ }
+}
--- /dev/null
+/*
+ * 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.ui.range;
+
+import org.eclipse.nebula.widgets.grid.GridItem;
+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.tizen.dynamicanalyzer.common.AnalyzerManager;
+import org.tizen.dynamicanalyzer.common.DASelectionData;
+import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
+import org.tizen.dynamicanalyzer.model.DAView;
+import org.tizen.dynamicanalyzer.nl.SummaryLabels;
+import org.tizen.dynamicanalyzer.resources.ColorResources;
+import org.tizen.dynamicanalyzer.resources.FontResources;
+import org.tizen.dynamicanalyzer.ui.summary.warning.WarningChecker;
+import org.tizen.dynamicanalyzer.ui.summary.warning.WarningData;
+import org.tizen.dynamicanalyzer.ui.widgets.table.DATableDataFormat;
+
+public class RangeWarningDetailView extends DAView {
+
+ public static final String ID = RangeWarningDetailView.class.getName();
+
+ private Canvas canvas = null;
+ private String warningMessage = ""; //$NON-NLS-1$
+ private final String titleText = SummaryLabels.FILE_DETAILS_TITLE;
+
+ public RangeWarningDetailView(Composite parent, int style) {
+ super(parent, style);
+ this.setLayout(new FillLayout());
+ canvas = new Canvas(this, SWT.NONE);
+ canvas.addPaintListener(detailPaintListener);
+ canvas.setBackground(ColorResources.DIALOG_BG_UPPER);
+ }
+
+ private PaintListener detailPaintListener = new PaintListener() {
+
+ @Override
+ public void paintControl(PaintEvent e) {
+ Rectangle rect = canvas.getBounds();
+ int width = rect.width - 20;
+ e.gc.setFont(FontResources.TABLE_CELL_FONT);
+ e.gc.setForeground(ColorResources.DEFAULT_FONT_COLOR);
+ String text = warningMessage;
+ Point titleSize = e.gc.textExtent(titleText, SWT.DRAW_MNEMONIC);
+ int fontHeight = titleSize.y + 5;
+ e.gc.drawText(titleText, 5, 0);
+
+ for (int i = 1; text.length() > 0; i++) {
+ Point textSize = e.gc.textExtent(text, SWT.DRAW_MNEMONIC);
+ String inputText = ""; //$NON-NLS-1$
+ if (textSize.x > width) {
+ int strLen = (width * text.length()) / textSize.x;
+ inputText += text.substring(0, strLen - 1);
+ text = text.substring(strLen - 1, text.length());
+ } else {
+ inputText += text;
+ text = ""; //$NON-NLS-1$
+ }
+ e.gc.drawText(inputText, 10, fontHeight * i);
+ }
+ }
+ };
+
+ @Override
+ public void updateView(DASelectionData data) {
+ if (data.getViewId().equals(RangeWarningListView.ID)) {
+ GridItem[] items = (GridItem[]) data.getData();
+ if (items.length <= 0) {
+ return;
+ }
+ GridItem item = items[0];
+ DATableDataFormat tableData = (DATableDataFormat) item.getData();
+ String seq = tableData.getData().get(
+ LogCenterConstants.SEQUENCE_NUMBER_INDEX);
+ WarningData warning = AnalyzerManager.getWarningChecker()
+ .getWarningDataByLogSeq(seq);
+ if (null == warning) {
+ warningMessage = ""; //$NON-NLS-1$
+ } else {
+ warningMessage = WarningChecker
+ .messageMaker(warning, false);
+ }
+ canvas.redraw();
+ }
+ }
+
+ @Override
+ public void clear() {
+ warningMessage = ""; //$NON-NLS-1$
+ canvas.redraw();
+ }
+}
--- /dev/null
+/*
+ * 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.ui.range;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.SashForm;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
+import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
+import org.tizen.dynamicanalyzer.model.DAView;
+import org.tizen.dynamicanalyzer.nl.SummaryLabels;
+import org.tizen.dynamicanalyzer.resources.ColorResources;
+import org.tizen.dynamicanalyzer.ui.summary.warning.WarningTable;
+import org.tizen.dynamicanalyzer.ui.widgets.ViewContainer;
+import org.tizen.dynamicanalyzer.ui.widgets.table.DATableComposite;
+import org.tizen.dynamicanalyzer.ui.widgets.table.TableComparator;
+
+public class RangeWarningListView extends DAView {
+
+ public static final String ID = RangeWarningListView.class.getName();
+
+ int[] innerMaxWeight = { 0, 100 };
+ int[] outerMaxWeight = { 0, 100 };
+
+ private DATableComposite tableComp = null;
+ private String[] columnNames = { SummaryLabels.WARNING_LIST_VIEW_INDEX,
+ SummaryLabels.WARNING_LIST_VIEW_CATEGORY,
+ SummaryLabels.WARNING_LIST_VIEW_WARNING_MESSAGE };
+ private int[] columnSizes = { 25, 0, 200 };
+ int[] sortTypes = { AnalyzerConstants.SORT_TYPE_NUM,
+ AnalyzerConstants.SORT_TYPE_GRID, AnalyzerConstants.SORT_TYPE_GRID };
+ int[] sourceColumns = { LogCenterConstants.SEQUENCE_NUMBER_INDEX,
+ LogCenterConstants.ID_INDEX, LogCenterConstants.APINAME_INDEX };
+
+ public RangeWarningListView(Composite parent, int style) {
+ super(parent, style);
+ this.setLayout(new FillLayout());
+
+ ViewContainer viewContainer = new ViewContainer(this, true);
+ viewContainer.setTitleText(SummaryLabels.WARNING_LIST_VIEW_TITLE);
+ setMaxWeight(innerMaxWeight, outerMaxWeight);
+
+ Composite contents = viewContainer.getContentArea();
+ contents.setBackground(ColorResources.VIEW_BG_COLOR);
+ contents.setLayout(new FillLayout());
+ tableComp = new WarningTable(contents, SWT.NONE, SWT.SINGLE
+ | SWT.BORDER | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL);
+ ((WarningTable) tableComp).setRangeTable(true);
+ tableComp.setComparator(new TableComparator());
+ tableComp.setSortTypes(sortTypes);
+ tableComp.setSourceColumns(sourceColumns);
+ tableComp.setColumns(columnNames);
+ tableComp.setColumnSize(columnSizes);
+ tableComp.setTableName("R_Warning table");
+ }
+
+ @Override
+ public void updateView() {
+ tableComp.updateTable();
+ }
+
+ @Override
+ public void clear() {
+ tableComp.clear();
+ }
+
+ @Override
+ public Control getControl() {
+ return tableComp;
+ }
+
+ @Override
+ public void otherViewSelectionOccured() {
+ tableComp.deselectAll();
+ }
+
+ @Override
+ public void setMaxSize(boolean maximized) {
+
+ if (null == innerMaxWeight || null == outerMaxWeight) {
+ return;
+ }
+
+ Composite parent = getParent();
+ if (parent instanceof SashForm) {
+ parent = parent.getParent();
+ if (!(parent instanceof SashForm)) {
+ return;
+ }
+ }
+
+ Composite pParent = parent.getParent();
+ if (!(pParent instanceof SashForm)) {
+ return;
+ }
+
+ SashForm innerForm = (SashForm) parent;
+ SashForm outerForm = (SashForm) pParent;
+
+ if (maximized) {
+ oldInnerLayout = innerForm.getWeights();
+ oldOuterLayout = outerForm.getWeights();
+ innerForm.setWeights(innerMaxWeight);
+ outerForm.setWeights(outerMaxWeight);
+ } else {
+ innerForm.setWeights(oldInnerLayout);
+ outerForm.setWeights(oldOuterLayout);
+ }
+ }
+}
+++ /dev/null
-/*
- * 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.ui.summary.failed;
-
-import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
-import org.tizen.dynamicanalyzer.error.ErrorCodeManager;
-import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
-import org.tizen.dynamicanalyzer.ui.widgets.table.DefaultTableComparator;
-
-public class FailedApiComparator extends DefaultTableComparator {
-
- @Override
- public int userCompare(Object obj1, Object obj2) {
- FailedData data1 = (FailedData) obj1;
- FailedData data2 = (FailedData) obj2;
-
- int rc = 0;
- String str1 = null;
- String str2 = null;
- if (column == 0) {
- str1 = data1.getData()
- .get(LogCenterConstants.SEQUENCE_NUMBER_INDEX);
- str2 = data2.getData()
- .get(LogCenterConstants.SEQUENCE_NUMBER_INDEX);
- } else if (column == 1) {
- str1 = data1.getData().get(LogCenterConstants.TIME_INDEX);
- str2 = data2.getData().get(LogCenterConstants.TIME_INDEX);
- } else if (column == 2) {
- str1 = data1.getData().get(LogCenterConstants.APINAME_INDEX);
- str2 = data2.getData().get(LogCenterConstants.APINAME_INDEX);
- } else if (column == 3) {
- str1 = data1.getData().get(LogCenterConstants.INPUTPARM_INDEX);
- str2 = data2.getData().get(LogCenterConstants.INPUTPARM_INDEX);
- } else if (column == 4) {
- str1 = data1.getData().get(LogCenterConstants.RETURN_INDEX);
- str2 = data2.getData().get(LogCenterConstants.RETURN_INDEX);
- } else if (column == 5) {
- String err1 = data1.getData().get(LogCenterConstants.ERROR_INDEX);
- String err2 = data2.getData().get(LogCenterConstants.ERROR_INDEX);
- str1 = ErrorCodeManager.getInatance().getErrorCode(err1);
- str2 = ErrorCodeManager.getInatance().getErrorCode(err2);
- } else if (column == 6) {
- String err1 = data1.getData().get(LogCenterConstants.ERROR_INDEX);
- String err2 = data2.getData().get(LogCenterConstants.ERROR_INDEX);
- str1 = ErrorCodeManager.getInatance().getErrorDescription(err1);
- str2 = ErrorCodeManager.getInatance().getErrorDescription(err2);
- }
- switch (type) {
- case AnalyzerConstants.SORT_TYPE_NUM:
- try {
- rc = Integer.parseInt(str1) - Integer.parseInt(str2);
- break;
- } catch (Exception e) {
- break;
- }
- case AnalyzerConstants.SORT_TYPE_STRING:
- rc = str1.compareTo(str2);
- break;
- default :
- rc = 0;
- break;
- }
-
- if (!dirUp) {
- rc = -rc;
- }
- return rc;
- }
-
-}
import org.tizen.dynamicanalyzer.model.TableInput;
import org.tizen.dynamicanalyzer.ui.file.FilePage;
import org.tizen.dynamicanalyzer.ui.page.DAPageComposite;
+import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
import org.tizen.dynamicanalyzer.ui.thread.ThreadPage;
import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
import org.tizen.dynamicanalyzer.ui.userinterface.UIPage;
public class FailedApiTable extends DATableComposite {
- List<FailedData> failedList = null;
+ private boolean isRange = false;
public FailedApiTable(Composite parent, int style, int tableStyle) {
super(parent, style, tableStyle);
});
}
+ public void setRangeTable(boolean isRange) {
+ this.isRange = isRange;
+ }
+
protected List<TableInput> makeTableInput() {
- List<FailedData> failedList = AnalyzerManager.getFailedChecker()
- .getFailedList();
+ List<FailedData> failedList = null;
+ if (isRange) {
+ failedList = RangeDataManager.getInstance().getFailedChecker()
+ .getFailedList();
+ } else {
+ failedList = AnalyzerManager.getFailedChecker().getFailedList();
+ }
List<TableInput> input = new ArrayList<TableInput>();
int size = failedList.size();
import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
-
public class FailedChecker {
List<FailedData> failedList;
String errnoStr = log[LogCenterConstants.ERROR_INDEX];
int fdType = Integer.parseInt(fdTypeStr);
long errno = Long.parseLong(errnoStr);
- // file or (not error) - file error check file page
+ // file or (not error) - file error check file page
if (fdType == 0 || errno == 0) {
return;
}
return failedList;
}
+ public void clear() {
+ getFailedList().clear();
+ }
+
}
+++ /dev/null
-/*
- * 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.ui.summary.leaks;
-
-import java.util.List;
-
-import org.eclipse.nebula.widgets.grid.GridItem;
-import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
-import org.tizen.dynamicanalyzer.ui.widgets.table.DATableDataFormat;
-import org.tizen.dynamicanalyzer.ui.widgets.table.DefaultTableComparator;
-
-public class LeakComparator extends DefaultTableComparator {
-
- @Override
- public int userCompare(Object obj1, Object obj2) {
- GridItem item1 = (GridItem) obj1;
- GridItem item2 = (GridItem) obj2;
- DATableDataFormat tableData1 = (DATableDataFormat) item1.getData();
- DATableDataFormat tableData2 = (DATableDataFormat) item2.getData();
-
- List<String> data1 = tableData1.getData();
- List<String> data2 = tableData2.getData();
-
- int rc = 0;
- String str1 = null;
- String str2 = null;
- if (column == 0) {
- return 0;
- } else if (column == 1) {
- str1 = data1.get(LeakData.SEQUENCE_INDEX);
- str2 = data2.get(LeakData.SEQUENCE_INDEX);
- } else if (column == 2) {
- str1 = data1.get(LeakData.ID_INDEX);
- str2 = data2.get(LeakData.ID_INDEX);
- } else if (column == 3) {
- str1 = data1.get(LeakData.TIME_INDEX);
- str2 = data2.get(LeakData.TIME_INDEX);
- } else if (column == 4) {
- str1 = data1.get(LeakData.NAME_INDEX);
- str2 = data2.get(LeakData.NAME_INDEX);
- } else if (column == 5) {
- str1 = data1.get(LeakData.PARAM_INDEX);
- str2 = data2.get(LeakData.PARAM_INDEX);
- } else if (column == 6) {
- str1 = data1.get(LeakData.RETURN_INDEX);
- str2 = data2.get(LeakData.RETURN_INDEX);
- }
- switch (type) {
- case AnalyzerConstants.SORT_TYPE_NUM:
- try {
- rc = Integer.parseInt(str1) - Integer.parseInt(str2);
- if (rc < 0) {
- GridItem temp = null;
- temp = item1;
- item1 = item2;
- item2 = temp;
- }
- break;
- } catch (NumberFormatException e) {
- e.printStackTrace();
- break;
- }
- case AnalyzerConstants.SORT_TYPE_STRING:
- rc = str1.compareTo(str2);
- break;
- }
-
- if (!dirUp) {
- rc = -rc;
- }
- return rc;
- }
-
- // private String getName(String path) {
- // String[] firstSplit = path.split("\\(");
- // String text4 = "";
- // if (firstSplit.length > 1) {
- // String[] secondSplit = firstSplit[1].split("\\+");
- // text4 = firstSplit[0] + "(" + secondSplit[0] + ")";
- // } else {
- // text4 += path;
- // }
- // return text4;
- // }
-}
import org.tizen.dynamicanalyzer.nl.SummaryLabels;
import org.tizen.dynamicanalyzer.sql.DBTableManager;
-
public class LeakData {
public static final int KEY_INDEX = 18;
public static final int ADDR_INDEX = 14;
protected List<String> data;
private List<LeakData> children;
- public LeakData(String key, String[] log) {
+ public LeakData(String key, String[] log, LeakDetector leakDetector) {
List<String> data = getData();
- data.set(KEY_INDEX, key);
for (int i = 0; i < log.length; i++) {
data.set(i, log[i]);
}
+ data.set(KEY_INDEX, key);
- LeakDetector ld = AnalyzerManager.getLeakDectector();
- data.set(LEAK_SEQ_INDEX, Integer.toString(ld.getLeakSeq()));
- ld.increaseLeakSeq();
+ // LeakDetector ld = AnalyzerManager.getLeakDetector();
+ data.set(LEAK_SEQ_INDEX, Integer.toString(leakDetector.getLeakSeq()));
+ leakDetector.increaseLeakSeq();
setParentKey("");
}
data.set(NAME_INDEX, new String(funcName[0]));
}
}
- LeakDetector ld = AnalyzerManager.getLeakDectector();
+ LeakDetector ld = AnalyzerManager.getLeakDetector();
data.set(LEAK_SEQ_INDEX, Integer.toString(ld.getLeakSeq()));
ld.increaseLeakSeq();
}
public HashMap<String, Check> getLeakCheckHash() {
if (null == leakCheckHash) {
+ LeakCheckList leakCheckList = AnalyzerManager.getLeakCheckList();
leakCheckHash = new HashMap<String, Check>();
+ List<Check> checks = leakCheckList.getChecks();
+ int size = checks.size();
+ for (int i = 0; i < size; i++) {
+ leakCheckHash.put(checks.get(i).getName(), checks.get(i));
+ }
}
return leakCheckHash;
}
if (chk.isCheckUserCall()) {
checkUserFuncLeakData(input, chk);
} else {
- LeakData newLeak = new LeakData(input[chk.getKeyIndex()], input);
+ LeakData newLeak = new LeakData(input[chk.getKeyIndex()],
+ input, this);
leaks.put(newLeak.getKey(), newLeak);
}
} else if (chk.getType() == API_TYPE_CLOSE) {
checkUserFuncLeakData(input, chk);
} else {
String key = input[chk.getKeyIndex()];
- leaks.put(key, new LeakData(key, input));
+ leaks.put(key, new LeakData(key, input, this));
}
}
}
if (CallStackManager.getInstance().isUserCall(
callerFunc.getFunctionName())) {
HashMap<String, LeakData> leaks = getLeakHash();
- LeakData newLeak = new LeakData(input[chk.getKeyIndex()], input);
+ LeakData newLeak = new LeakData(input[chk.getKeyIndex()], input,
+ this);
leaks.put(newLeak.getKey(), newLeak);
} else {
// undefined internal call
leakSeq = 0;
}
+ public void clear() {
+ getLeakHash().clear();
+ getChildHash().clear();
+ leakSeq = 0;
+ }
}
import org.tizen.dynamicanalyzer.sql.SqlManager;
import org.tizen.dynamicanalyzer.ui.file.FilePage;
import org.tizen.dynamicanalyzer.ui.page.DAPageComposite;
+import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
import org.tizen.dynamicanalyzer.ui.thread.ThreadPage;
import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
import org.tizen.dynamicanalyzer.ui.userinterface.UIPage;
public class LeakTable extends DATreeComposite {
+ private boolean isRange = false;
+
public LeakTable(Composite parent, int compStyle, int tableStyle) {
super(parent, compStyle, tableStyle);
});
}
+ public void setRangeTable(boolean isRange) {
+ this.isRange = isRange;
+ }
+
private List<String> getLogData(int logCenterId, String seq) {
LogCenter logc = AnalyzerManager.getLogCenterById(logCenterId);
String dbName = logc.getName();
@Override
public List<TreeInput> makeTreeInput() {
List<TreeInput> output = new ArrayList<TreeInput>();
- HashMap<String, LeakData> leaks = AnalyzerManager.getLeakDectector()
- .getLeakHash();
+ HashMap<String, LeakData> leaks = null;
+ if (isRange) {
+ leaks = RangeDataManager.getInstance().getLeakDetector()
+ .getLeakHash();
+ } else {
+ leaks = AnalyzerManager.getLeakDetector().getLeakHash();
+ }
ArrayList<LeakData> leakList = new ArrayList<LeakData>();
leakList.addAll(leaks.values());
leakData.getParentKey());
output.add(leakInput);
}
-
return output;
}
import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.common.AnalyzerPaths;
import org.tizen.dynamicanalyzer.common.CommonConstants;
+import org.tizen.dynamicanalyzer.communicator.DACommunicator;
import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
import org.tizen.dynamicanalyzer.nl.SummaryLabels;
-import org.tizen.dynamicanalyzer.services.RecordStateSourceProvider;
import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackManager;
import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackUnit;
import org.tizen.dynamicanalyzer.ui.userinterface.UIDataManager;
-import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
import org.tizen.dynamicanalyzer.utils.Formatter;
public class FunctionUsageProfiler implements Runnable {
private int totalSampleCount = 0;
private CallstackTree current = null;
- private final int QUEUE_CHECK_INTERVAL = 2; // sec
-
private static FunctionUsageProfiler instance = null;
/**
public static void startProfiler() {
if (null == profiler || !profiler.isAlive()) {
- profiler = new Thread(null, new FunctionUsageProfiler(),
+ profiler = new Thread(null, getInstance(),
AnalyzerConstants.LOG_QUEUE_OBSERVING_THREAD);
profiler.start();
}
@Override
public void run() {
System.out.println("start profiling thread");
- int emptyCount = 0;
while (true) {
try {
if (!getInstance().getSampleInputs().isEmpty()) {
String sample = getInstance().getFirstSample();
getInstance().makeFunctionUsageProfileData(sample);
- emptyCount = 0;
- } else if (emptyCount < QUEUE_CHECK_INTERVAL
- || (AnalyzerUtil.getRecordState()
- .equals(RecordStateSourceProvider.RECORD_RECORDING))) {
- emptyCount++;
+ } else if (DACommunicator.isRunning()) {
Thread.sleep(AnalyzerConstants.LOG_CHECK_INTERVAL);
} else {
break;
import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
-public class WarningDataManager {
- private static WarningDataManager instance = null;
-
+public class WarningChecker {
private List<WarningData> warningData = null;
- public static WarningDataManager getInstance() {
- if (null == instance) {
- instance = new WarningDataManager();
- }
- return instance;
- }
-
- public static void clear() {
- instance = null;
+ public void clear() {
+ getWarningData().clear();
WarningData.resetSeq();
}
+++ /dev/null
-/*
- * 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.ui.summary.warning;
-
-import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
-import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
-import org.tizen.dynamicanalyzer.ui.widgets.table.DefaultTableComparator;
-
-public class WarningComparator extends DefaultTableComparator {
-
- @Override
- public int userCompare(Object obj1, Object obj2) {
- WarningData data1 = (WarningData) obj1;
- WarningData data2 = (WarningData) obj2;
-
- int rc = 0;
- String str1 = null;
- String str2 = null;
- if (column == 0) {
- // FIXME
- str1 = Integer.toString(data1.getSeq());
- str2 = Integer.toString(data2.getSeq());
- } else if (column == 1) {
- str1 = LogCenterConstants.getLogCenterNameFromId(data1.getCategory());
- str2 = LogCenterConstants.getLogCenterNameFromId(data2.getCategory());
- } else if (column == 2) {
- str1 = WarningDataManager.messageMaker(data1, true);
- str2 = WarningDataManager.messageMaker(data2, true);
- }
- switch (type) {
- case AnalyzerConstants.SORT_TYPE_NUM:
- try {
- rc = Integer.parseInt(str1) - Integer.parseInt(str2);
- break;
- } catch (Exception e) {
- break;
- }
- case AnalyzerConstants.SORT_TYPE_STRING:
- rc = str1.compareTo(str2);
- break;
- }
-
- if (!dirUp) {
- rc = -rc;
- }
- return rc;
- }
-
-}
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Composite;
+import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.common.DASelectionData;
import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
import org.tizen.dynamicanalyzer.model.DAView;
DATableDataFormat tableData = (DATableDataFormat) item.getData();
String seq = tableData.getData().get(
LogCenterConstants.SEQUENCE_NUMBER_INDEX);
- WarningData warning = WarningDataManager.getInstance()
+ WarningData warning = AnalyzerManager.getWarningChecker()
.getWarningDataByLogSeq(seq);
if (null == warning) {
warningMessage = ""; //$NON-NLS-1$
} else {
- warningMessage = WarningDataManager
+ warningMessage = WarningChecker
.messageMaker(warning, false);
}
canvas.redraw();
import org.tizen.dynamicanalyzer.nl.SummaryLabels;
import org.tizen.dynamicanalyzer.ui.file.FilePage;
import org.tizen.dynamicanalyzer.ui.page.DAPageComposite;
+import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
import org.tizen.dynamicanalyzer.ui.thread.ThreadPage;
import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
import org.tizen.dynamicanalyzer.ui.userinterface.UIPage;
import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
public class WarningTable extends DATableComposite {
+ private boolean isRange = false;
public WarningTable(Composite parent, int compStyle, int tableStyle) {
super(parent, compStyle, tableStyle);
}
});
-
+
table.addMouseListener(new MouseListener() {
@Override
});
}
+ public void setRangeTable(boolean isRange) {
+ this.isRange = isRange;
+ }
+
protected List<TableInput> makeTableInput() {
- List<WarningData> warningList = WarningDataManager.getInstance()
- .getWarningData();
+ List<WarningData> warningList = null;
+ if (isRange) {
+ warningList = RangeDataManager.getInstance().getWarningChecker()
+ .getWarningData();
+ } else {
+ warningList = AnalyzerManager.getWarningChecker().getWarningData();
+ }
List<TableInput> input = new ArrayList<TableInput>();
int size = warningList.size();
for (int i = 0; i < size; i++) {
.getLogCenterNameFromId(warningData.getCategory()));
}
}
- String message = WarningDataManager.messageMaker(warningData, true);
+ String message = WarningChecker.messageMaker(warningData, true);
text.add(message);
// create images
+ fileName;
}
int fontHeight = textSize.y + 5;
-// e.gc.drawString(fName, x += 10, y += fontHeight);
+ // 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);
+ // e.gc.drawString(pathLabel, x, y + fontHeight);
Point pathSize = e.gc.textExtent(pathLabel,
SWT.DRAW_MNEMONIC);
int xPos = x + pathSize.x;
inputText += text;
text = AnalyzerLabels.EMPTY_STRING;
}
-// e.gc.drawString(inputText, xPos, y += fontHeight);
+ // e.gc.drawString(inputText, xPos, y +=
+ // fontHeight);
}
} else {
y += fontHeight;
}
}
-// e.gc.drawString(FilePageLabels.FILE_DETAILS_TOTAL_SIZE
-// + Integer.toString(totalSize), x, y += fontHeight);
-// e.gc.drawString(
-// FilePageLabels.FILE_DETAILS_READ_SIZE
-// + Integer.toString(readSize), x,
-// y += fontHeight);
-// e.gc.drawString(FilePageLabels.FILE_DETAILS_WRITE_SIZE
-// + Integer.toString(writeSize), x, y += fontHeight);
-// e.gc.drawString(FilePageLabels.FILE_DETAILS_TOTAL_USE_TIME
-// + Formatter.toTimeFormat(Long.toString(totalUseTime)),
-// 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);
+ // e.gc.drawString(FilePageLabels.FILE_DETAILS_TOTAL_SIZE
+ // + Integer.toString(totalSize), x, y += fontHeight);
+ // e.gc.drawString(
+ // FilePageLabels.FILE_DETAILS_READ_SIZE
+ // + Integer.toString(readSize), x,
+ // y += fontHeight);
+ // e.gc.drawString(FilePageLabels.FILE_DETAILS_WRITE_SIZE
+ // + Integer.toString(writeSize), x, y += fontHeight);
+ // e.gc.drawString(FilePageLabels.FILE_DETAILS_TOTAL_USE_TIME
+ // + Formatter.toTimeFormat(Long.toString(totalUseTime)),
+ // 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);
}
});
import org.tizen.dynamicanalyzer.resources.FontResources;
import org.tizen.dynamicanalyzer.resources.ImageResources;
import org.tizen.dynamicanalyzer.services.RecordStateSourceProvider;
+import org.tizen.dynamicanalyzer.ui.page.DAPageComposite;
+import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
+import org.tizen.dynamicanalyzer.ui.range.RangePage;
import org.tizen.dynamicanalyzer.ui.timeline.TimelinePage;
import org.tizen.dynamicanalyzer.ui.toolbar.opentrace.OpenTraceDialog;
import org.tizen.dynamicanalyzer.ui.widgets.ComboButtonRenderer;
import org.tizen.dynamicanalyzer.ui.widgets.DADialog;
+import org.tizen.dynamicanalyzer.ui.widgets.DATabComposite;
import org.tizen.dynamicanalyzer.ui.widgets.TitleComboPopupRenderer;
import org.tizen.dynamicanalyzer.ui.widgets.TitleComboRenderer;
import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
}
}
+ public DACustomCombo getDeviceCombo() {
+ return deviceCombo;
+ }
+
+ public DACustomCombo getAppCombo() {
+ return appCombo;
+ }
+
private ShellListener shellListener = new ShellListener() {
@Override
public void handleClickEvent(DACustomButton button) {
// TODO : use for test code...
+// String state = AnalyzerUtil.getRecordState();
+// if (!state
+// .equals(RecordStateSourceProvider.RECORD_RECORDING)) {
+// if (getSourceViewToggleState()) {
+// DATabComposite mainTab = AnalyzerUtil
+// .getMainTab();
+// Composite rangePage = new RangePage(mainTab
+// .getContentComposite(), SWT.NONE);
+// mainTab.dynamicAddView(rangePage);
+//
+// RangeDataManager ranger = RangeDataManager
+// .getInstance();
+// ranger.setTimes("10000000", "100000000");
+// ranger.startRangeThread();
+//
+// } else {
+// DAPageComposite page = AnalyzerManager
+// .getCurrentPage();
+// if (page instanceof RangePage) {
+// AnalyzerUtil.changePage(TimelinePage.ID);
+// }
+//
+// DATabComposite mainTab = AnalyzerUtil
+// .getMainTab();
+// mainTab.dynamicRemoveView(RangePage.ID);
+// RangeDataManager.getInstance().clear();
+// }
+// }
// theme test
// if (toggle.isToggled()) {
// AnalyzerManager.setTheme(DAThemeBlack.getInstance());
ImageResources.VIEW_SOURCE, ImageResources.VIEW_SOURCE_PUSH,
ImageResources.VIEW_SOURCE_HOVER,
ImageResources.VIEW_SOURCE_DISABLE,
- ImageResources.VIEW_SOURCE_TOGGLE);
+ ImageResources.VIEW_SOURCE_TOGGLE,
+ ImageResources.VIEW_SOURCE_HOVER);
viewSourceButton.setToolTipText(AnalyzerLabels.VIEW_SOURCE);
FormData data = new FormData();
}
deviceCombo.select(selIndex);
setSelectedDevice(items.get(selIndex));
- initAppCombo();
deviceCombo.setToolTipText(items.get(selIndex));
+ initAppCombo();
appCombo.setEnabled(true);
setRepalyButtonEnable(true);
}
public static int SAVE_FOLDER = 0;
public static int TEMP_FOLDER = 1;
+ public static String VERSION_KEY = "version";
+ public static int VERSION_INVALID = 0;
+ public static int VERSION_VALID = 1;
+
+ public static String CURRENT_KEY = "current";
+ public static int CURRENT = 0;
+ public static int OTHERS = 1;
+
private DATableComposite saveTable = null;
private DATableComposite tempTable = null;
private Canvas detail = null;
saveTable.setColumns(columnNames);
saveTable.setColumnSize(columnSizes);
saveTable.setColumnVisibility(columnVisibility);
+ saveTable.setTableToolTipEnable(false);
saveTable.getTable().addSelectionListener(saveTableSelectionListener);
saveTable.getTable().addMouseListener(mouseListener);
tempTable.getTable().addSelectionListener(tempTableSelectionListener);
tempTable.getTable().addMouseListener(mouseListener);
tempTable.getTable().addKeyListener(keyListener);
+ tempTable.setTableToolTipEnable(false);
Label detailLabel = new Label(tableComp, SWT.TRANSPARENT);
detailLabel.setText("Trace details");
int index = grid.getSelectionIndex();
GridItem item = items[0];
- if (item.getForeground() == ColorResources.BLUE) {
+ if ((Integer) item.getData(CURRENT_KEY) == CURRENT) {
return;
}
} else {
return;
}
- if (item.getForeground().equals(ColorResources.ORANGE)
- || !setDetailsInfo(path)) {
+ int validCheck = (Integer) item.getData(VERSION_KEY);
+ if ((validCheck == VERSION_INVALID) || !setDetailsInfo(path)) {
createTime = CommonConstants.EMPTY;
device = CommonConstants.EMPTY;
application = CommonConstants.EMPTY;
@Override
public void run() {
+ AnalyzerManager.setLogParsingComplete(false);
Project p = AnalyzerManager.getProject();
List<LogCenter> logCenters = AnalyzerManager.getLogCenters();
List<List<String>> input = null;
to = from + AnalyzerConstants.DATABASE_READ_SIZE;
}
System.out.println("input reader complete");
+ AnalyzerManager.setLogParsingComplete(true);
// end
}
}
if (text.get(VALIDATE_INDEX).equals("N")) {
gridItem.setForeground(ColorResources.ORANGE);
+ gridItem.setData(OpenTraceDialog.VERSION_KEY,
+ OpenTraceDialog.VERSION_INVALID);
+ gridItem.setData(OpenTraceDialog.CURRENT_KEY,
+ OpenTraceDialog.OTHERS);
gridItem.setToolTipText(TRACE_NAME_INDEX,
"invalid save file - old version");
gridItem.setToolTipText(DATE_INDEX,
"invalid save file - old version");
} else {
+ gridItem.setData(OpenTraceDialog.VERSION_KEY,
+ OpenTraceDialog.VERSION_VALID);
String path = AnalyzerPaths.DYNAMIC_ANALYZER_SAVE_PATH
+ File.separator + text.get(TRACE_NAME_INDEX);
String projectPath = project.getSavePath();
if (path.equals(projectPath)) {
gridItem.setForeground(ColorResources.BLUE);
+ gridItem.setData(OpenTraceDialog.CURRENT_KEY,
+ OpenTraceDialog.CURRENT);
gridItem.setToolTipText(TRACE_NAME_INDEX,
"current project file - can't delete");
gridItem.setToolTipText(DATE_INDEX,
"current project file - can't delete");
+ } else {
+ gridItem.setData(OpenTraceDialog.CURRENT_KEY,
+ OpenTraceDialog.OTHERS);
}
}
}
@Override
public void updateTable() {
- table.removeAll();
- List<TableInput> input = makeTableInput();
- if (null == input) {
- return;
- }
- if (null != comparator) {
- Collections.sort(input, comparator);
- }
- int size = input.size();
- for (int i = 0; i < size; i++) {
- GridItem gridItem = new GridItem(table, SWT.NONE);
- gridItem.setData(OpenTraceDialog.TEMP_FOLDER);
- gridItem.setForeground(ColorResources.RED);
-
- List<String> text = input.get(i).getText();
- int columnCount = text.size();
- for (int index = 0; index < columnCount; index++) {
- gridItem.setText(index, text.get(index));
+ try {
+ table.removeAll();
+ List<TableInput> input = makeTableInput();
+ if (null == input) {
+ return;
+ }
+ if (null != comparator) {
+ Collections.sort(input, comparator);
}
+ int size = input.size();
+ for (int i = 0; i < size; i++) {
+ GridItem gridItem = new GridItem(table, SWT.NONE);
+ gridItem.setData(OpenTraceDialog.TEMP_FOLDER);
+ gridItem.setForeground(ColorResources.RED);
- String path = AnalyzerPaths.TEMP_FOLDER_PATH + File.separator
- + text.get(TRACE_NAME_INDEX);
- Project project = AnalyzerManager.getProject();
- if (null != project) {
- String projectPath = project.getSavePath();
- if (path.equals(projectPath)) {
- gridItem.setForeground(ColorResources.BLUE);
- gridItem.setToolTipText(TRACE_NAME_INDEX,
- "current project file - can't delete");
- gridItem.setToolTipText(DATE_INDEX,
- "current project file - can't delete");
+ gridItem.setData(OpenTraceDialog.VERSION_KEY,
+ OpenTraceDialog.VERSION_VALID);
+
+ List<String> text = input.get(i).getText();
+ int columnCount = text.size();
+ for (int index = 0; index < columnCount; index++) {
+ gridItem.setText(index, text.get(index));
+ }
+
+ String path = AnalyzerPaths.TEMP_FOLDER_PATH + File.separator
+ + text.get(TRACE_NAME_INDEX);
+ Project project = AnalyzerManager.getProject();
+ if (null != project) {
+ String projectPath = project.getSavePath();
+ if (path.equals(projectPath)) {
+ gridItem.setForeground(ColorResources.BLUE);
+ gridItem.setData(OpenTraceDialog.CURRENT_KEY,
+ OpenTraceDialog.CURRENT);
+ gridItem.setToolTipText(TRACE_NAME_INDEX,
+ "current project file - can't delete");
+ gridItem.setToolTipText(DATE_INDEX,
+ "current project file - can't delete");
+ } else {
+ gridItem.setData(OpenTraceDialog.CURRENT_KEY,
+ OpenTraceDialog.OTHERS);
+ }
}
}
+ table.update();
+ } catch (Exception e) {
+ e.printStackTrace();
+
}
- table.update();
}
private String getCreateTime(String savePath) {
package org.tizen.dynamicanalyzer.ui.userinterface;
-import java.util.ArrayList;
import java.util.List;
import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
+import java.util.Timer;
+import java.util.TimerTask;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StackLayout;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
import org.tizen.dynamicanalyzer.common.DASelectionData;
import org.tizen.dynamicanalyzer.common.DesignConstants;
import org.tizen.dynamicanalyzer.logparser.LogPackage;
@Override
public void handleClickEvent(DACustomButton button) {
stackLayout.topControl = tempChild;
- changeButtonLayout(tabButton);
+ changeButtonState(tabButton);
tabComposite.layout();
contentsComposite.layout();
((ViewAction) tempChild).updateView();
tabButton.setEnabled(false);
tabButton.setRenderer(new TabButtonRenderer());
}
+
+ tabComposite.layout();
+ }
+
+ public void dynamicAddView(Composite child) {
+ if (!(child instanceof ViewAction)) {
+ return;
+ }
+
+ String ID = child.getClass().getName();
+ String title = ((ViewAction) child).getViewName();
+
+ final DACustomButton tabButton = new DACustomButton(tabComposite,
+ ColorResources.TAB_NORMAL_COLOR_START,
+ ColorResources.TAB_NORMAL_COLOR_END,
+ ColorResources.TAB_PUSH_COLOR_START,
+ ColorResources.TAB_PUSH_COLOR_END,
+ ColorResources.TAB_HOVER_COLOR_START,
+ ColorResources.TAB_HOVER_COLOR_END,
+ ColorResources.TAB_SELECTED_COLOR_START,
+ ColorResources.TAB_SELECTED_COLOR_END);
+ tabButton.setFontColors(ColorResources.TAB_NORMAL_FONT_COLOR,
+ ColorResources.TAB_PUSH_FONT_COLOR,
+ ColorResources.TAB_HOVER_FONT_COLOR,
+ ColorResources.TAB_SELECTED_FONT_COLOR);
+ tabButton.setOutlineColors(ColorResources.TAB_OUTLINE_NORMAL_COLOR,
+ ColorResources.TAB_OUTLINE_PUSH_COLOR,
+ ColorResources.TAB_OUTLINE_HOVER_COLOR,
+ ColorResources.TAB_OUTLINE_SELECTED_COLOR);
+ tabButton.setRenderer(new TabButtonRenderer());
+ tabButton.setEnabled(true);
+ tabButton.setFont(FontResources.TAB_BUTTON_FONT);
+ tabButton.setText(title);
+ tabButton.setToolTipText(title);
+
+ FormData data = new FormData();
+ data.top = new FormAttachment(0, 0);
+ data.bottom = new FormAttachment(100, 0);
+
+ if (getButtons().size() > 0) {
+ DACustomButton button1 = getButtons().get(getButtons().size() - 1);
+ data.left = new FormAttachment(button1, 0);
+ // data.width = tabWidth; // short
+ } else {
+ data.left = new FormAttachment(0, 0);
+ // data.width = tabWidth; // long
+ }
+ tabButton.setLayoutData(data);
+
+ final Composite tempChild = child;
+ DACustomButtonClickEventListener buttonListener = new DACustomButtonClickEventListener() {
+
+ @Override
+ public void handleClickEvent(DACustomButton button) {
+ stackLayout.topControl = tempChild;
+ changeButtonState(tabButton);
+ tabComposite.layout();
+ contentsComposite.layout();
+ ((ViewAction) tempChild).updateView();
+ }
+ };
+ tabButton.addClickListener(buttonListener);
+
+ childrenMap.put(ID, child);
+ buttonMap.put(ID, tabButton);
+ getButtons().add(tabButton); // TODO : think about button map??
+ getTabChildren().add(child);
+
+ // default focus set
+ if (getTabChildren().size() == 1) {
+ stackLayout.topControl = child;
+ contentsComposite.layout();
+ tabButton.setGradationColor(DACustomButton.STATE_DISABLE,
+ ColorResources.TAB_SELECTED_COLOR_START,
+ ColorResources.TAB_SELECTED_COLOR_END);
+ tabButton.setEnabled(false);
+ tabButton.setRenderer(new TabButtonRenderer());
+ }
+ data.width = 1;
+ // tabComposite.layout();
+ tabAnimation(tabButton, true);
+ }
+
+ public void removeView(String ID) {
+ Composite child = childrenMap.get(ID);
+ getTabChildren().remove(child);
+ childrenMap.remove(ID);
+ DACustomButton button = buttonMap.get(ID);
+ button.setLayoutData(null);
+ getButtons().remove(button);
+ buttonMap.remove(ID);
+ tabComposite.layout();
}
- // dynamic tab size
- private void changeButtonLayout(DACustomButton button) {
+ public void dynamicRemoveView(String ID) {
+ Composite child = childrenMap.get(ID);
+ getTabChildren().remove(child);
+ childrenMap.remove(ID);
+ DACustomButton button = buttonMap.get(ID);
+ // button.setLayoutData(null);
+ getButtons().remove(button);
+ buttonMap.remove(ID);
+ tabAnimation(button, false);
+ // tabComposite.layout();
+ }
+
+ private void tabAnimation(final DACustomButton button, final boolean isShow) {
+ Timer timer = new Timer();
+ timer.schedule(new TimerTask() {
+ @Override
+ public void run() {
+ Display.getDefault().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ if (null != button && !button.isDisposed()) {
+ FormData data = (FormData) button.getLayoutData();
+ if (isShow) {
+ data.width += (tabWidth / 10);
+ if (data.width > tabWidth) {
+ data.width = tabWidth;
+ tabComposite.layout();
+ cancel();
+ } else {
+ tabComposite.layout();
+ }
+ } else {
+ data.width -= (tabWidth / 10);
+ tabComposite.layout();
+ if (data.width <= 0) {
+ cancel();
+ }
+ }
+ } else {
+ cancel();
+ }
+ }
+ });
+ }
+ }, 10, 50);
+ }
+
+ private void changeButtonState(DACustomButton button) {
int size = getButtons().size();
- DACustomButton prev = null;
if (size > 1) {
for (int i = 0; i < size; i++) {
DACustomButton sample = getButtons().get(i);
-
- FormData data = new FormData();
- data.top = new FormAttachment(0, 0);
- if (i == 0) {
- data.left = new FormAttachment(0, 0);
- } else {
- data.left = new FormAttachment(prev, 0);
- }
if (sample.equals(button)) {
- data.width = tabWidth; // long
- // button.setColor(DACustomButton.STATE_DISABLE,
- // ColorResources.CPU_CIRCULAR_GRAPH_COLOR);
button.setGradationColor(DACustomButton.STATE_DISABLE,
ColorResources.TAB_SELECTED_COLOR_START,
ColorResources.TAB_SELECTED_COLOR_END);
- // button.setDisableColor(ColorResources.CPU_CIRCULAR_GRAPH_COLOR);
button.setEnabled(false);
} else {
- data.width = tabWidth; // short
sample.setEnabled(true);
}
- prev = sample;
- data.bottom = new FormAttachment(100, 0);
- sample.setLayoutData(data);
}
}
}
return;
}
+ changeButtonState(button);
stackLayout.topControl = tab;
((ViewAction) tab).updateView();
contentsComposite.layout();
- changeButtonLayout(button);
}
@Override
ColorResources.BUTTON_DISABLE_COLOR_START,
ColorResources.BUTTON_DISABLE_COLOR_END,
ColorResources.TAB_SELECTED_COLOR_START,
- ColorResources.TAB_SELECTED_COLOR_END);
+ ColorResources.TAB_SELECTED_COLOR_END,
+ ColorResources.TAB_HOVER_COLOR_START,
+ ColorResources.TAB_HOVER_COLOR_END);
data = new FormData();
data.top = new FormAttachment(forwardButton, 5);
data.left = new FormAttachment(optionLabel, 0);
ColorResources.BUTTON_DISABLE_COLOR_START,
ColorResources.BUTTON_DISABLE_COLOR_END,
ColorResources.TAB_SELECTED_COLOR_START,
- ColorResources.TAB_SELECTED_COLOR_END);
+ ColorResources.TAB_SELECTED_COLOR_END,
+ ColorResources.TAB_HOVER_COLOR_START,
+ ColorResources.TAB_HOVER_COLOR_END);
data = new FormData();
data.top = new FormAttachment(forwardButton, 5);
data.left = new FormAttachment(caseButton, 1);
}
public static Composite getTabPage(String pageId) {
+ return getMainTab().getTab(pageId);
+ }
+
+ public static DATabComposite getMainTab() {
BaseView baseView = (BaseView) AnalyzerUtil.getViewPart(BaseView.ID);
- return baseView.getMainTab().getTab(pageId);
+ return baseView.getMainTab();
}
public static ViewAction getView(String pageId, String viewId) {