import org.tizen.dynamicanalyzer.ui.info.screenshot.ScreenshotTimerTask;
import org.tizen.dynamicanalyzer.ui.page.BaseView;
import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
-import org.tizen.dynamicanalyzer.ui.summary.failed.FailedChecker;
-import org.tizen.dynamicanalyzer.ui.summary.leaks.LeakDetector;
import org.tizen.dynamicanalyzer.ui.summary.leaks.NewLeakDetector;
import org.tizen.dynamicanalyzer.ui.summary.profiling.FunctionUsageProfiler;
import org.tizen.dynamicanalyzer.ui.summary.warning.WarningChecker;
import org.tizen.dynamicanalyzer.ui.toolbar.ConfigureManager;
import org.tizen.dynamicanalyzer.ui.toolbar.StopProcessManager;
import org.tizen.dynamicanalyzer.ui.toolbar.configuration.ConfigurationDialogDataManager;
+import org.tizen.dynamicanalyzer.util.DALogger;
import org.tizen.dynamicanalyzer.util.WorkbenchUtil;
import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
-import org.tizen.dynamicanalyzer.util.DALogger;
import org.tizen.dynamicanalyzer.utils.ImageListSortComparator;
import org.tizen.dynamicanalyzer.widgets.da.view.DAPageComposite;
private static HashMap<Integer, HashMap<Long, String>> funcNameMapByPid = null;
- private static LeakDetector leakDetector = new LeakDetector();
private static NewLeakDetector newLeakDetector = new NewLeakDetector();
- private static FailedChecker failedChecker = new FailedChecker();
- private static FailedChecker calledChecker = new FailedChecker();
private static WarningChecker warningChecker = new WarningChecker();
private static CallStackManager callstackManager = new CallStackManager();
private static SWAPCallStackManager swapCallstackManager = new SWAPCallStackManager(
imageList = null;
imageListSize = 0;
- leakDetector.clear();
newLeakDetector.clear();
- failedChecker.clear();
warningChecker.clear();
- calledChecker.clear();
callstackManager.clear();
swapCallstackManager.clear();
isHaveSampleThread = false;
return project;
}
- public static LeakDetector getLeakDetector() {
- return leakDetector;
- }
-
public static NewLeakDetector getNewLeakDetector() {
return newLeakDetector;
}
- public static FailedChecker getFailedChecker() {
- return failedChecker;
- }
-
public static WarningChecker getWarningChecker() {
return warningChecker;
}
}
}
- public static FailedChecker getCalledFunctionChecker() {
- return calledChecker;
- }
-
public static void initTraceStart() {
AnalyzerUtil.executeCommand(ClearHandler.ID);
if (!AnalyzerManager.isExit()) {
import org.tizen.dynamicanalyzer.ui.opengl.data.GLDataManager;
import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
import org.tizen.dynamicanalyzer.ui.range.RangePage;
-import org.tizen.dynamicanalyzer.ui.summary.failed.FailedChecker;
-import org.tizen.dynamicanalyzer.ui.summary.failed.FailedData;
-import org.tizen.dynamicanalyzer.ui.summary.leaks.LeakData;
-import org.tizen.dynamicanalyzer.ui.summary.leaks.LeakDetector;
import org.tizen.dynamicanalyzer.ui.summary.profiling.FunctionUsageProfiler;
import org.tizen.dynamicanalyzer.ui.summary.profiling.ProfileDataMaker;
import org.tizen.dynamicanalyzer.ui.summary.profiling.ProfilingChildData;
int percent = OpenTraceProgressManager.getInstance().getPercent();
if (loadCallStackApis() && loadProfilingData() && loadProfilingChildData() &&
// loadCallStackData() &&
- // loadLeakData() &&
- // loadFailedData() &&
loadImageSet()) {
OpenTraceProgressManager.getInstance().setProgressPercent(
AnalyzerLabels.OPEN_TRACE_PROGRESS_LOADING, percent += 60);
return true;
}
- private boolean loadLeakData() {
- boolean isSuccess = true;
- List<List<String>> dbInfo = SqlManager.getInstance().setloadLeakData();
- if (null == dbInfo) {
- DA_LOG.debug("leak data loading failed..");
- isSuccess = false;
- } else {
- LeakDetector leakDectector = AnalyzerManager.getLeakDetector();
- for (int i = 0; i < dbInfo.size(); i++) {
- List<String> info = dbInfo.get(i);
- LeakData leakData = new LeakData(info);
- if (-1 != leakData.getParentKey()) {
- LeakData parent = leakDectector.getLeakHash().get(
- leakData.getParentKey());
- if (null == parent) {
- continue;
- } else {
- parent.getChildren().add(leakData);
- }
- } else {
- leakDectector.getLeakHash().put((long) leakData.getKey(), leakData);
- }
- }
- }
- return isSuccess;
- }
-
- private boolean loadFailedData() {
- boolean isSuccess = true;
- List<List<String>> dbInfo = SqlManager.getInstance().setloadFailedData();
- if (null == dbInfo) {
- DA_LOG.debug("failed - loadFailedData");
- isSuccess = false;
- } else {
- FailedChecker failedChecker = AnalyzerManager.getFailedChecker();
- for (int i = 0; i < dbInfo.size(); i++) {
- List<String> pInfo = dbInfo.get(i);
- // possibility of extensions - network, efl, db, etc...
- int id = Integer.parseInt(pInfo.get(LogCenterConstants.ID_INDEX));
- if (id == DataChannelConstants.MSG_PROBE_FILE) {
- // if file failed api data is skip - file chart make it!
- int type = Integer.parseInt(pInfo
- .get(LogCenterConstants.RESOURCE_FDTYPE_INDEX));
- if (type == LogCenterConstants.FD_TYPE_FILE) {
- continue;
- }
- }
- FailedData failedData = new FailedData(pInfo);
- failedChecker.getFailedList().add(failedData);
- }
- }
- return isSuccess;
- }
-
private boolean loadProfilingData() {
boolean isSuccess = true;
List<List<Object>> profilingDatas = FunctionUsageProfiler.getInstance()
public static DBTableManager instance = null;
- private static final String TABLE_NAME_FAILED_DATA = "FailedData";//$NON-NLS-1$
- private static final String TABLE_NAME_LEAK_DATA = "LeakData";//$NON-NLS-1$
+// private static final String TABLE_NAME_FAILED_DATA = "FailedData";//$NON-NLS-1$
+// private static final String TABLE_NAME_LEAK_DATA = "LeakData";//$NON-NLS-1$
private static List<DBTableInfo> tableInfos;
- public static final int TABLE_INDEX_FAILED_DATA = 0;
- public static final int TABLE_INDEX_LEAK_DATA = 1;
+// public static final int TABLE_INDEX_FAILED_DATA = 0;
+// public static final int TABLE_INDEX_LEAK_DATA = 1;
public static final String EMPTY = CommonConstants.EMPTY;
public static final String TEXT = "VARCHAR(256)";//$NON-NLS-1$
getTableInfos();
// "failed data" table info block
- {
- String[] names = { "Rid", "MsgId", "SeqNumber", "Time", "ApiName",
- "Parameter", "Return", "ErrorCode", "CallerPc", "Pid",
- "LibName" };
- String[] options = { EMPTY, EMPTY, NOT_NULL, EMPTY, EMPTY, EMPTY,
- EMPTY, EMPTY, EMPTY, EMPTY, EMPTY };
- String[] types = { TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT,
- TEXT, TEXT, TEXT };
- DBTableInfo failedDataTableInfo = new DBTableInfo(
- TABLE_NAME_FAILED_DATA, names, options, types);
- tableInfos.add(failedDataTableInfo);
- }
+// {
+// String[] names = { "Rid", "MsgId", "SeqNumber", "Time", "ApiName",
+// "Parameter", "Return", "ErrorCode", "CallerPc", "Pid",
+// "LibName" };
+// String[] options = { EMPTY, EMPTY, NOT_NULL, EMPTY, EMPTY, EMPTY,
+// EMPTY, EMPTY, EMPTY, EMPTY, EMPTY };
+// String[] types = { TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT,
+// TEXT, TEXT, TEXT };
+// DBTableInfo failedDataTableInfo = new DBTableInfo(
+// TABLE_NAME_FAILED_DATA, names, options, types);
+// tableInfos.add(failedDataTableInfo);
+// }
// "leak data" table info block
- {
- String[] names = { "Rid", "LeakSeq", "MsgId", "SeqNumber", "Time",
- "ApiName", "Pid", "Address", "CallerPc", "Parameter",
- "Return", "LibName", "Key", "ParentKey" };
- // commonColumns;
- String[] options = { EMPTY, EMPTY, EMPTY, NOT_NULL, EMPTY, EMPTY,
- EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY };
- String[] types = { TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT,
- TEXT, TEXT, TEXT, TEXT, TEXT, TEXT };
- DBTableInfo leakDataTableInfo = new DBTableInfo(
- TABLE_NAME_LEAK_DATA, names, options, types);
- tableInfos.add(leakDataTableInfo);
- }
+// {
+// String[] names = { "Rid", "LeakSeq", "MsgId", "SeqNumber", "Time",
+// "ApiName", "Pid", "Address", "CallerPc", "Parameter",
+// "Return", "LibName", "Key", "ParentKey" };
+// // commonColumns;
+// String[] options = { EMPTY, EMPTY, EMPTY, NOT_NULL, EMPTY, EMPTY,
+// EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY };
+// String[] types = { TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT,
+// TEXT, TEXT, TEXT, TEXT, TEXT, TEXT };
+// DBTableInfo leakDataTableInfo = new DBTableInfo(
+// TABLE_NAME_LEAK_DATA, names, options, types);
+// tableInfos.add(leakDataTableInfo);
+// }
}
public DBTableInfo getTableInfo(int tableInfoIndex) {
import org.tizen.dynamicanalyzer.swap.model.data.LogData;
import org.tizen.dynamicanalyzer.swap.model.data.LogDataFactory;
import org.tizen.dynamicanalyzer.swap.model.format.LogFormat;
-import org.tizen.dynamicanalyzer.ui.summary.failed.FailedChecker;
-import org.tizen.dynamicanalyzer.ui.summary.failed.FailedData;
-import org.tizen.dynamicanalyzer.ui.summary.leaks.LeakData;
-import org.tizen.dynamicanalyzer.ui.summary.leaks.LeakDetector;
import org.tizen.dynamicanalyzer.util.CommonUtil;
import org.tizen.dynamicanalyzer.util.DALogger;
return true;
}
- public void saveLeakData() {
- LeakDetector leakDectector = AnalyzerManager.getLeakDetector();
- DBTableInfo leakTableInfo = DBTableManager.getInstance().getTableInfo(
- DBTableManager.TABLE_INDEX_LEAK_DATA);
- String insertQuery = leakTableInfo.insertQuery();
- List<LeakData> leakList = leakDectector.getLeakDataList();
- List<LeakData> insertData = new ArrayList<LeakData>();
- for (LeakData leakData : leakList) {
- insertData.add(leakData);
- if (!leakData.getChildren().isEmpty()) {
- List<LeakData> children = leakData.getChildren();
- for (LeakData child : children) {
- insertData.add(child);
- }
- }
- }
- insertLeakQuery(insertQuery, insertData);
- }
-
- private boolean insertLeakQuery(String query, List<LeakData> input) {
- PreparedStatement prep = null;
- try {
- Connection conn = getConnection();
- if (null == conn || null == query || null == input) {
- DA_LOG.debug("insert leak data failed.. : " + input);
- return false;
- }
- semaphoreAcquire();
- prep = conn.prepareStatement(query);
- int dataRowSize = input.size();
- for (int i = 0; i < dataRowSize; i++) {
- LeakData data = input.get(i);
- prep.setInt(1, LeakData.getLogNum());
- prep.setInt(2, data.getLeakSeq());
- prep.setInt(3, data.getId());
- prep.setInt(4, data.getSeq());
- prep.setLong(5, data.getTime());
- prep.setString(6, data.getName());
- prep.setInt(7, data.getPid());
- prep.setLong(8, data.getAddr());
- prep.setLong(9, data.getCallerPc());
- prep.setString(10, data.getParam());
- prep.setString(11, data.getRet());
- prep.setString(12, data.getLibName());
- prep.setInt(13, data.getKey());
- prep.setInt(14, data.getParentKey());
- prep.addBatch();
- }
- if (dataRowSize > 0) {
- conn.setAutoCommit(false);
- prep.executeBatch();
- conn.setAutoCommit(true);
- }
- } catch (SQLException e) {
- e.printStackTrace();
- } finally {
- if (null != prep) {
- try {
- prep.close();
- } catch (SQLException e) {
- e.printStackTrace();
- }
- }
- semaphoreRelease();
- }
- return true;
- }
-
- public void saveFailedData() {
- FailedChecker failedChecker = AnalyzerManager.getFailedChecker();
-
- List<FailedData> failedList = failedChecker.getFailedList();
- DBTableInfo failedTableInfo = DBTableManager.getInstance().getTableInfo(
- DBTableManager.TABLE_INDEX_FAILED_DATA);
- String insertQuery = failedTableInfo.insertQuery();
- insertFailedQuery(insertQuery, failedList);
- }
-
- private boolean insertFailedQuery(String query, List<FailedData> input) {
- PreparedStatement prep = null;
- try {
- Connection conn = getConnection();
- if (null == conn || null == query || null == input) {
- DA_LOG.debug("failed sql inset : " + input);
- return false;
- }
- semaphoreAcquire();
- prep = conn.prepareStatement(query);
- int dataRowSize = input.size();
- for (int i = 0; i < dataRowSize; i++) {
- FailedData data = input.get(i);
- prep.setInt(1, FailedData.getLogNum());
- prep.setInt(2, data.getId());
- prep.setInt(3, data.getSeq());
- prep.setLong(4, data.getTime());
- prep.setString(5, data.getName());
- prep.setString(6, data.getArgs());
- prep.setString(7, data.getReturn());
- prep.setLong(8, data.getErrorCode());
- prep.setLong(9, data.getCallerPc());
- prep.setInt(10, data.getPid());
- prep.setString(11, data.getLibName());
- prep.addBatch();
- }
- if (dataRowSize > 0) {
- conn.setAutoCommit(false);
- prep.executeBatch();
- conn.setAutoCommit(true);
- }
- } catch (SQLException e) {
- e.printStackTrace();
- } finally {
- if (null != prep) {
- try {
- prep.close();
- } catch (SQLException e) {
- e.printStackTrace();
- }
- }
- semaphoreRelease();
- }
- return true;
- }
-
/**
* select query function
*
return dbInfo;
}
- public List<List<String>> setloadLeakData() {
- return selectQuery(
- null,
- DBTableManager.getInstance()
- .getTableInfo(DBTableManager.TABLE_INDEX_LEAK_DATA)
- .getColumnNames(),
- DBTableManager.getInstance()
- .getTableInfo(DBTableManager.TABLE_INDEX_LEAK_DATA)
- .getTableName(), null);
- }
-
- public List<List<String>> setloadFailedData() {
- return selectQuery(
- null,
- DBTableManager.getInstance()
- .getTableInfo(DBTableManager.TABLE_INDEX_FAILED_DATA)
- .getColumnNames(),
- DBTableManager.getInstance()
- .getTableInfo(DBTableManager.TABLE_INDEX_FAILED_DATA)
- .getTableName(), null);
- }
-
public List<String> getPids() {
List<List<String>> dbInfo = selectQuery(null, new String[] { "distinct pid" },
"ProcessInfo", null);
}
pushLog(log, logPack);
AnalyzerManager.getCallstackManager().makeCallstackWithoutBacktrace(log);
- if (id == DataChannelConstants.MSG_PROBE_FILE
- || id == DataChannelConstants.MSG_PROBE_MEMORY) {
- AnalyzerManager.getLeakDetector().runLeakDectect(log);
- }
-
- AnalyzerManager.getFailedChecker().check(log);
+// if (id == DataChannelConstants.MSG_PROBE_FILE
+// || id == DataChannelConstants.MSG_PROBE_MEMORY) {
+// AnalyzerManager.getLeakDetector().runLeakDectect(log);
+// }
+//
+// AnalyzerManager.getFailedChecker().check(log);
}
}
import java.util.ArrayList;
-
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.tizen.dynamicanalyzer.ui.file.model.FileAccess;
import org.tizen.dynamicanalyzer.ui.file.model.FileEvent;
import org.tizen.dynamicanalyzer.ui.file.model.FileStatus;
-import org.tizen.dynamicanalyzer.ui.summary.failed.FailedChecker;
-import org.tizen.dynamicanalyzer.ui.summary.failed.FailedData;
-import org.tizen.dynamicanalyzer.ui.summary.leaks.LeakDetector;
-import org.tizen.dynamicanalyzer.ui.summary.warning.WarningChecker;
+import org.tizen.dynamicanalyzer.ui.summary.SummaryDataManager;
import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
import org.tizen.dynamicanalyzer.ui.toolbar.configuration.ConfigurationDialogDataManager;
import org.tizen.dynamicanalyzer.util.DALogger;
public class FileChartDataMaker {
private static final DALogger DA_LOG = DALogger.getInstance();
- private FailedChecker failedChecker = null;
- private WarningChecker warningChecker = null;
-
private List<FileStatus> fileStatusList = new ArrayList<FileStatus>();
private List<FileAccess> fileAccessList = new ArrayList<FileAccess>();
private Map<String, Long> fileAccessorMap = new HashMap<String, Long>();
// TODO: rename queue
private Queue<List<FileEvent>> queue = new ConcurrentLinkedQueue<List<FileEvent>>();
- public FileChartDataMaker(FailedChecker failedChecker,
- LeakDetector leakDetector, WarningChecker warningChecker) {
- this.failedChecker = failedChecker;
- this.warningChecker = warningChecker;
+ public FileChartDataMaker() {
}
public void clear(){
// check error
if (errNo != 0) {
- FailedData failedData = new FailedData(input);
- this.failedChecker.getFailedList().add(failedData);
+ SummaryDataManager.getInstance().getFailedApiDataMaker().makeData(input);
} else if (apiName.equals("fdopen")) { //$NON-NLS-1$
// TODO: legacy code, need to check
DA_LOG.debug("fdopen");
import java.util.ArrayList;
import java.util.List;
-import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants;
import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
import org.tizen.dynamicanalyzer.swap.logparser.Logs;
import org.tizen.dynamicanalyzer.ui.file.data.FileAccessDB;
import org.tizen.dynamicanalyzer.ui.file.data.FileApiDB;
import org.tizen.dynamicanalyzer.ui.file.data.FileStatusDB;
-import org.tizen.dynamicanalyzer.ui.file.manager.FileChartDataMaker;
import org.tizen.dynamicanalyzer.ui.file.model.FileEvent;
private List<FileEvent> selectedTableAPIList = new ArrayList<FileEvent>();
private FileChartManager() {
- dataMaker = new FileChartDataMaker(
- AnalyzerManager.getFailedChecker(),
- AnalyzerManager.getLeakDetector(),
- AnalyzerManager.getWarningChecker());
+ dataMaker = new FileChartDataMaker();
initDB();
}
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.resources.FontResources;
import org.tizen.dynamicanalyzer.resources.ImageResources;
+import org.tizen.dynamicanalyzer.ui.summary.SummaryDataManager;
import org.tizen.dynamicanalyzer.widgets.da.view.DAViewComposite;
public class ScoreView extends DAViewComposite {
e.gc.setForeground(ColorResources.TITLEBAR_TEXT_COLOR);
e.gc.setFont(FontResources.SCORE_TITLE_FONT);
- Point textSize = e.gc.textExtent(
- InformationViewLabels.SCORE_VIEW_SCORE,
+ Point textSize = e.gc.textExtent(InformationViewLabels.SCORE_VIEW_SCORE,
SWT.DRAW_MNEMONIC);
x = (rect.width - textSize.x) / 2;
- e.gc.drawString(InformationViewLabels.SCORE_VIEW_SCORE, x,
- y += 5);
+ e.gc.drawString(InformationViewLabels.SCORE_VIEW_SCORE, x, y += 5);
e.gc.drawLine(x = 1, y += 25, rect.width - 2, y);
// draw score
e.gc.drawRectangle(colRect);
e.gc.setForeground(ColorResources.SNAPSHOT_VIEW_TABLE_TITLE_TEXT);
e.gc.setFont(FontResources.TABLE_CELL_FONT);
- textSize = e.gc.textExtent(columnString.get(i),
- SWT.DRAW_MNEMONIC);
+ textSize = e.gc.textExtent(columnString.get(i), SWT.DRAW_MNEMONIC);
x = (colRect.width - textSize.x) / 2;
y = colRect.y + (colRect.height - textSize.y) / 2;
e.gc.drawString(columnString.get(i), x, y);
e.gc.drawRectangle(colRect);
e.gc.setForeground(ColorResources.SNAPSHOT_VIEW_TABLE_CONTENTS_TEXT);
e.gc.setFont(FontResources.TABLE_CELL_FONT);
- textSize = e.gc.textExtent(columnValue.get(i).toString(),
- SWT.DRAW_MNEMONIC);
+ textSize = e.gc.textExtent(columnValue.get(i).toString(), SWT.DRAW_MNEMONIC);
x = colRect.x + (colRect.width - textSize.x) / 2;
y = colRect.y + (colRect.height - textSize.y) / 2;
e.gc.drawString(columnValue.get(i).toString(), x, y);
@Override
public void updateView() {
- failCount = AnalyzerManager.getFailedChecker().getFailedList().size();
- leakSize = AnalyzerManager.getLeakDetector().getLeakDataList().size();
+ failCount = SummaryDataManager.getInstance().getFailedApiDataMaker()
+ .getFailedApiDataFromDB().size();
+ leakSize = AnalyzerManager.getNewLeakDetector().getLeakHash().size();
warningSize = AnalyzerManager.getWarningChecker().getWarningData().size();
columnValue.set(0, failCount);
columnValue.set(1, leakSize);
import org.tizen.dynamicanalyzer.swap.model.data.NetworkData;
import org.tizen.dynamicanalyzer.ui.network.data.type.NetworkAPIType;
import org.tizen.dynamicanalyzer.ui.network.data.type.NetworkSeriesType;
-import org.tizen.dynamicanalyzer.ui.summary.failed.FailedChecker;
-import org.tizen.dynamicanalyzer.ui.summary.leaks.LeakDetector;
-import org.tizen.dynamicanalyzer.ui.summary.warning.WarningChecker;
import org.tizen.dynamicanalyzer.ui.toolbar.configuration.ConfigurationDialogDataManager;
import org.tizen.dynamicanalyzer.util.DALogger;
import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
List<NetworkAPIType> noDestinationApiSeriesList = new ArrayList<NetworkAPIType>();
List<NetworkAPIType> destinationApiSeriesList = new ArrayList<NetworkAPIType>();
- public NetworkDataMaker(FailedChecker failedChecker,
- LeakDetector leakDetector, WarningChecker warningChecker) {
+ public NetworkDataMaker() {
}
public void clear() {
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
-import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.common.path.PathManager;
import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
import org.tizen.dynamicanalyzer.resources.ImageResources;
private boolean isStopTrace = false;
public NetworkDataManager() {
- networkDataMaker = new NetworkDataMaker(
- AnalyzerManager.getFailedChecker(),
- AnalyzerManager.getLeakDetector(),
- AnalyzerManager.getWarningChecker());
+ networkDataMaker = new NetworkDataMaker();
apiDBManager = new NetworkAPIDBManager();
seriesDBManager = new NetworkSeriesDBManager();
package org.tizen.dynamicanalyzer.ui.summary;
import java.util.List;
+import java.util.Map;
+import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.database.DBTable;
import org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants;
import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
import org.tizen.dynamicanalyzer.swap.model.data.LogData;
import org.tizen.dynamicanalyzer.ui.summary.failed.FailedApiDataDBTable;
import org.tizen.dynamicanalyzer.ui.summary.failed.FailedApiDataMaker;
+import org.tizen.dynamicanalyzer.ui.summary.leaks.CurrentLeakData;
import org.tizen.dynamicanalyzer.ui.summary.leaks.FreeDataDBTable;
import org.tizen.dynamicanalyzer.ui.summary.leaks.LeakDataMaker;
import org.tizen.dynamicanalyzer.ui.summary.leaks.MemoryAllocationDataDBTable;
+import org.tizen.dynamicanalyzer.ui.summary.leaks.LeakDataDBTable;
+import org.tizen.dynamicanalyzer.ui.summary.leaks.NewLeakDetector;
import org.tizen.dynamicanalyzer.ui.summary.warning.WarningDataDBTable;
import org.tizen.dynamicanalyzer.ui.summary.warning.WarningDataMaker;
import org.tizen.dynamicanalyzer.util.DALogger;
private MemoryAllocationDataDBTable memoryAllocationDataTable = null;
private FreeDataDBTable freeDataTable = null;
+ private LeakDataDBTable leakDataTable = null;
private FailedApiDataDBTable failedApiDataTable = null;
private WarningDataDBTable warningDataDBTable = null;
warningDataMaker = new WarningDataMaker();
memoryAllocationDataTable = new MemoryAllocationDataDBTable();
freeDataTable = new FreeDataDBTable();
+ leakDataTable = new LeakDataDBTable();
failedApiDataTable = new FailedApiDataDBTable();
warningDataDBTable = new WarningDataDBTable();
}
return freeDataTable;
}
+ public DBTable getLeakDataDBTable() {
+ return leakDataTable;
+ }
+
public DBTable getFailedApiDataDBTable() {
return failedApiDataTable;
}
leakDataMaker.makeData(inputs);
}
}
+
+ @Override
+ public void saveData(Map<String, String> dataMap) {
+ leakDataMaker.makeData();
+ }
+
+ @Override
+ public void openData(Map<String, String> dataMap) {
+ List<List<Object>> leakDataList = leakDataMaker.getLeakDataFromDB();
+ if (leakDataList == null)
+ return;
+
+ int size = leakDataList.size();
+ NewLeakDetector leakDetector = AnalyzerManager.getNewLeakDetector();
+ leakDetector.clear();
+
+ for (int i = 0; i < size; i++) {
+ List<Object> iLeakData = leakDataList.get(i);
+ int seqNum = (Integer) iLeakData.get(LeakDataDBTable.COLUMN_INDEX_SEQUENCE_NUMBER);
+ long allocValue = (Long) iLeakData.get(LeakDataDBTable.COLUMN_INDEX_ALLOCATED_VALUE);
+ int pid = (Integer) iLeakData.get(LeakDataDBTable.COLUMN_INDEX_PROCESS_ID);
+ CurrentLeakData newLeakData = new CurrentLeakData(seqNum, allocValue, pid);
+ leakDetector.addCurrentLeakData(newLeakData);
+ }
+ }
}
--- /dev/null
+package org.tizen.dynamicanalyzer.ui.summary.leaks;
+
+import java.util.List;
+
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
+import org.tizen.dynamicanalyzer.common.AnalyzerManager;
+import org.tizen.dynamicanalyzer.swap.logparser.ReadBlockingQueue;
+import org.tizen.dynamicanalyzer.ui.summary.SummaryDataManager;
+
+public class LeakDataDBInserter implements Runnable {
+ private static ReadBlockingQueue<List<List<Object>>> LeakDataQueue = new ReadBlockingQueue<List<List<Object>>>();
+
+ private static volatile Thread inserterThread = null;
+
+ public static void startThread() {
+ if (inserterThread == null || !inserterThread.isAlive()) {
+ synchronized (LeakDataDBInserter.class) {
+ if (inserterThread == null || !inserterThread.isAlive()) {
+ inserterThread = new Thread(null, new LeakDataDBInserter());
+ inserterThread.start();
+ }
+ }
+ }
+ }
+
+ public static void stopThread() {
+ if (inserterThread != null && inserterThread.isAlive()) {
+ try {
+ sendNotify();
+ inserterThread.join(AnalyzerConstants.THREAD_JOIN_WAIT_TIME);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public static void pushFunctionData(List<List<Object>> data) {
+ LeakDataQueue.offer(data);
+ }
+
+ public static void clear() {
+ stopThread();
+ }
+
+ @Override
+ public void run() {
+ while (!AnalyzerManager.isExit()) {
+ List<List<Object>> leakData = LeakDataQueue.poll();
+
+ if (leakData != null && leakData.size() != 0) {
+ SummaryDataManager.getInstance().getLeakDataDBTable().insertData(leakData);
+ }
+ }
+ }
+
+ public static void sendNotify() {
+ LeakDataQueue.wake();
+ }
+
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.ui.summary.leaks;
+
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.util.List;
+
+import org.tizen.dynamicanalyzer.database.DBColumn;
+import org.tizen.dynamicanalyzer.database.DBConstants;
+import org.tizen.dynamicanalyzer.database.DBTable;
+
+public class LeakDataDBTable extends DBTable {
+ private static final String TABLENAME = "LeakData";
+
+ public static final String SEQUENCE_NUMBER = DBConstants.DBCOLUMN_SEQUENCE_NUMBER;
+ public static final String ALLOCATED_VALUE = "ALLOCATED_VALUE";
+ public static final String PROCESS_ID = DBConstants.DBCOLUMN_PROCESS_ID;
+
+ public final static int COLUMN_INDEX_SEQUENCE_NUMBER = 0;
+ public final static int COLUMN_INDEX_ALLOCATED_VALUE = 0;
+ public final static int COLUMN_INDEX_PROCESS_ID = 0;
+
+ public LeakDataDBTable() {
+ addColumn(new DBColumn(SEQUENCE_NUMBER, DBConstants.PRIMARY_KEY, DBConstants.DBTYPE_INT4));
+ addColumn(new DBColumn(ALLOCATED_VALUE, DBConstants.NOT_NULL, DBConstants.DBTYPE_LONG));
+ addColumn(new DBColumn(PROCESS_ID, DBConstants.NOT_NULL, DBConstants.DBTYPE_INT4));
+ }
+
+ @Override
+ public boolean prepare(PreparedStatement prep, List<Object> rowData) {
+ boolean isPrepared = true;
+
+ int columnsize = getColumnSize();
+ if (columnsize != rowData.size()) {
+ isPrepared = false;
+ } else {
+ try {
+ prep.setInt(1, (Integer) (rowData.get(0)));
+ prep.setLong(2, (Long) (rowData.get(1)));
+ prep.setInt(3, (Integer) (rowData.get(2)));
+ } catch (SQLException e) {
+ e.printStackTrace();
+ isPrepared = false;
+ }
+ }
+
+ return isPrepared;
+ }
+
+ @Override
+ public String getTableName() {
+ return TABLENAME;
+ }
+
+}
package org.tizen.dynamicanalyzer.ui.summary.leaks;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
import org.eclipse.swt.SWT;
private ArrayList<List<Object>> memoryAllocDataList;
private ArrayList<List<Object>> freeDataList;
+ private ArrayList<List<Object>> leakDataList;
private List<List<Object>> rangeDataList;
private NewLeakDetector leakDetector = AnalyzerManager.getNewLeakDetector();
FreeDataDBInserter.startThread();
}
}
+
+ public void makeData() {
+ HashMap<Integer, CurrentLeakData> leaks = leakDetector.getLeakHash();
+ for (Integer key : leaks.keySet()) {
+ makeLeakData(leaks.get(key));
+ }
+
+ if (leakDataList.size() > 0) {
+ @SuppressWarnings("unchecked")
+ List<List<Object>> lList = (List<List<Object>>) leakDataList.clone();
+ leakDataList.clear();
+
+ LeakDataDBInserter.pushFunctionData(lList);
+ LeakDataDBInserter.startThread();
+ }
+ }
private void checkHeapMemory() {
if (leakDetector.getLeakHash().size() > DALimit.MAX_LEAK_CHECK_BUFFER_SIZE) {
freeDataList.add(dbFreeData);
}
+
+ public void makeLeakData(CurrentLeakData input) {
+ ArrayList<Object> dbLeakData = new ArrayList<Object>();
+
+ dbLeakData.add(Integer.valueOf(input.getSequenceNumber()));
+ dbLeakData.add(Long.valueOf(input.getAllocatedValue()));
+ dbLeakData.add(Integer.valueOf(input.getPid()));
+
+ leakDataList.add(dbLeakData);
+ }
public void clear() {
memoryAllocDataList.clear();
return table.selectData(columns, where);
}
+
+ public List<List<Object>> getLeakDataFromDB() {
+ DBTable table = SummaryDataManager.getInstance().getLeakDataDBTable();
+ List<String> columns = new ArrayList<String>();
+ columns.add(LeakDataDBTable.SEQUENCE_NUMBER);
+ columns.add(LeakDataDBTable.ALLOCATED_VALUE);
+ columns.add(LeakDataDBTable.PROCESS_ID);
+
+ return table.selectData(columns, null);
+ }
public List<List<Object>> getLeakDataWithSeq(List<Integer> leakSequenceNumbers) {
String where = String
leakSeq++;
}
+ public void addCurrentLeakData(CurrentLeakData leakData) {
+ Integer key = leakData.getSequenceNumber();
+ getLeakHash().put(key.hashCode(), leakData);
+ leakSeq++;
+ }
+
private int findAllocatedKey(HashMap<Integer, CurrentLeakData> leaks, long addr, int pid) {
for (Integer key : leaks.keySet()) {
CurrentLeakData iLeakData = leaks.get(key);
DA_LOG.debug("project temp save is fail : project is not valid"); //$NON-NLS-1$
} else {
project.setTotalStopTime(ToolbarArea.getInstance().getTime());
- SqlManager.getInstance().saveLeakData();
- SqlManager.getInstance().saveFailedData();
+// SqlManager.getInstance().saveLeakData();
+// SqlManager.getInstance().saveFailedData();
CallStackInserter.getInstance().stopInserterThread();
FunctionUsageProfiler.getInstance().saveProfilingData();
FunctionUsageProfiler.getInstance().saveProfilingChildData();