public void saveProfilingData() {
List<Integer> pids = FunctionUsageProfiler.getInstance()
.getPidsOfProfileDataMakerMap();
- for(int i = 0; i < pids.size(); i++)
- {
+ for (int i = 0; i < pids.size(); i++) {
ProfileDataMaker profiler = FunctionUsageProfiler.getInstance()
.getProfileDataMakerByPid(pids.get(i));
HashMap<Integer, ProfilingData> profilingDataMap = profiler
.getProfilingDataMap();
List<ProfilingData> pDataList = new ArrayList<ProfilingData>();
pDataList.addAll(profilingDataMap.values());
-
- DBTableInfo profilingData = DBTableManager.getInstance().getTableInfo(
- DBTableManager.TABLE_INDEX_PROFILING_DATA);
+
+ DBTableInfo profilingData = DBTableManager.getInstance()
+ .getTableInfo(DBTableManager.TABLE_INDEX_PROFILING_DATA);
String insertQuery = profilingData.insertQuery();
-
+
List<List<String>> insetData = new ArrayList<List<String>>();
int size = profilingData.getColumnNames().length;
int count = pDataList.size();
public void saveProfilingChildData() {
List<Integer> pids = FunctionUsageProfiler.getInstance()
.getPidsOfProfileDataMakerMap();
- for(int i = 0; i < pids.size(); i++)
- {
+ for (int i = 0; i < pids.size(); i++) {
ProfileDataMaker profiler = FunctionUsageProfiler.getInstance()
.getProfileDataMakerByPid(pids.get(i));
HashMap<String, ProfilingChildData> profilingDataMap = profiler
.getChildListMap();
List<ProfilingChildData> pDataList = new ArrayList<ProfilingChildData>();
pDataList.addAll(profilingDataMap.values());
-
+
DBTableInfo profilingChildData = DBTableManager.getInstance()
- .getTableInfo(DBTableManager.TABLE_INDEX_PROFILING_CHILD_DATA);
-
+ .getTableInfo(
+ DBTableManager.TABLE_INDEX_PROFILING_CHILD_DATA);
+
List<List<String>> insetData = new ArrayList<List<String>>();
int count = pDataList.size();
for (int j = 0; j < count; j++) {
return dbInfo;
}
- public synchronized List<LogData> selectTableData(int logId, int from,
- int to, String option) {
- String tableName = LogDataFactory.getLogFormatById(logId).getName();
- List<String> tableNames = LogDataFactory.getLogFormatById(logId)
- .getDBColumnNames();
+// public synchronized List<LogData> selectTableData(int logId, int from,
+// int to, String option) {
+// String tableName = LogDataFactory.getLogFormatById(logId).getName();
+// List<String> tableNames = LogDataFactory.getLogFormatById(logId)
+// .getDBColumnNames();
+// String[] columnName = new String[tableNames.size()];
+// for (int i = 0; i < tableNames.size(); i++) {
+// columnName[i] = tableNames.get(i);
+// }
+// String preQueryOption = " limit " + from + " " + to;//$NON-NLS-1$ //$NON-NLS-2$
+// String postQueryOption = " where " + option;//$NON-NLS-1$ //$NON-NLS-2$
+//
+// List<LogData> dbInfo = newSelectQuery2(null, columnName, tableName,
+// preQueryOption, postQueryOption);
+// return dbInfo;
+// }
+
+ public synchronized List<LogData> selectTableData(String tableName,
+ List<String> tableNames, int from, int to, String option) {
String[] columnName = new String[tableNames.size()];
for (int i = 0; i < tableNames.size(); i++) {
columnName[i] = tableNames.get(i);
return dbInfo;
}
- public synchronized List<Integer> getSelectionInfo(String tableName,
- long startTime, String option) {
- String query = null;
- Statement stat = null;
- ResultSet rs = null;
- Connection conn = null;
- List<Integer> returnInfo = new ArrayList<Integer>();
- try {
- conn = getConnection();
- if (null == conn) {
- return null;
- }
- semaphoreAcquire();
- if (null == tableName || tableName.length() < 1) {
- System.out.println("tableName is null");
- return null;
- }
-
- query = String
- .format("select time, rid, seqnumber from %s where time = (select max(time) from %s where time <= %s",//$NON-NLS-1$
- tableName, tableName, Long.toString(startTime)
- + ")");
- if (!option.equals(CommonConstants.EMPTY)) {
- query += " and " + option;//$NON-NLS-1$
- }
- stat = conn.createStatement();
- if (isQueryPrint) {
- System.out.println("query : " + query);
- }
- rs = stat.executeQuery(query);
- if (null == rs) {
- return null;
- }
- while (rs.next()) {
- returnInfo.add(rs.getInt(1));
- returnInfo.add(rs.getInt(2));
- returnInfo.add(rs.getInt(3));
- return returnInfo;
- }
- } catch (SQLException e) {
- do {
- System.out.println("query: " + query);
- System.out.println("Message: " + e.getMessage());
- System.out.println("SQL state: " + e.getSQLState());
- System.out.println("Vendor code: " + e.getErrorCode());
- e.printStackTrace();
- } while ((e = e.getNextException()) != null);
- } finally {
- AnalyzerUtil.tryClose(stat, rs);
- if (null != conn) {
- semaphoreRelease();
- }
- }
- return null;
- }
-
public synchronized long getSelectionTime(String tableName, long startTime,
String option) {
String query = null;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.Map.Entry;
import java.util.Set;
+import java.util.Map.Entry;
import org.eclipse.nebula.widgets.grid.Grid;
import org.eclipse.nebula.widgets.grid.GridItem;
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.common.DASelectionData;
import org.tizen.dynamicanalyzer.model.TableInput;
-import org.tizen.dynamicanalyzer.sql.SqlManager;
import org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants;
import org.tizen.dynamicanalyzer.swap.channel.data.ProcessInfoPackage;
import org.tizen.dynamicanalyzer.swap.model.data.LogData;
+import org.tizen.dynamicanalyzer.swap.model.data.LogDataFactory;
import org.tizen.dynamicanalyzer.swap.model.data.ProfileData;
import org.tizen.dynamicanalyzer.swap.model.data.UserFunctionData;
import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
import org.tizen.dynamicanalyzer.utils.Formatter;
public class CallTraceTable extends DAWindowingTableComposite {
- private String selectOptionQuery = " messageid = " + DataChannelConstants.MSG_FUNCTION_ENTRY;//$NON-NLS-1$
-
public CallTraceTable(Composite parent, int compStyle, int tableStyle) {
super(parent, compStyle, tableStyle);
setRangePopup();
return input;
}
- protected int getTableLogId() {
- return DataChannelConstants.MSG_FUNCTION_ENTRY;
+ protected String getDBTableName() {
+ return LogDataFactory.getLogFormatById(
+ DataChannelConstants.MSG_FUNCTION_ENTRY).getName();
}
- protected int getItemCount() {
- if (AnalyzerManager.isRunning()) { // trace
- setDbInsetedItemCount(getItemCountByPid());
- } else {
- if (getDbInsetedItemCount() == 0) { // open
- setDbInsetedItemCount(SqlManager.getInstance()
- .getTableItemCount(getDBTableName(),
- getSelectQueryCountOption()));
- } else if (getItemCountByPid() > 0) { // stop
- setDbInsetedItemCount(getItemCountByPid());
- }
- }
- return getDbInsetedItemCount();
+ protected List<String> getDBTableColumnNames() {
+ return LogDataFactory.getLogFormatById(
+ DataChannelConstants.MSG_FUNCTION_ENTRY).getDBColumnNames();
}
- private int getItemCountByPid() {
+ public int getItemCountByPid() {
if (null == AnalyzerManager.getProject()) {
return 0;
}
return itemCount;
}
- public void setSelectionByTime(long startTime, long endTime) {
- selectionStartTime = SqlManager.getInstance().getSelectionTime(
- getDBTableName(), startTime, getSelectQueryCountOption());
- if (startTime == endTime) {
- selectionEndTime = selectionStartTime;
- } else {
- selectionEndTime = endTime;
- }
- int selectionIndex = SqlManager.getInstance().getSelectionIndex(
- getDBTableName(), selectionStartTime,
- getSelectQueryCountOption());
- getScrollBar().setSelection(selectionIndex - 1);
- }
-
protected String getSelectQueryOption() {
- String query = selectOptionQuery;
+ String query = " messageid = " + DataChannelConstants.MSG_FUNCTION_ENTRY;//$NON-NLS-1$
int selectedPid = ToolbarArea.getInstance().getSelectedPid();
if (selectedPid != 0) {
query += " and pid =" + selectedPid;//$NON-NLS-1$
}
protected String getSelectQueryCountOption() {
- String query = selectOptionQuery;
+ String query = " messageid = " + DataChannelConstants.MSG_FUNCTION_ENTRY;//$NON-NLS-1$
int selectedPid = ToolbarArea.getInstance().getSelectedPid();
if (selectedPid != 0) {
query += " and pid =" + selectedPid;//$NON-NLS-1$
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.ScrollBar;
import org.eclipse.swt.widgets.Shell;
+import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.common.CommonConstants;
import org.tizen.dynamicanalyzer.listeners.TableTooltipListener;
import org.tizen.dynamicanalyzer.model.FindProperty;
import org.tizen.dynamicanalyzer.resources.FontResources;
import org.tizen.dynamicanalyzer.sql.SqlManager;
import org.tizen.dynamicanalyzer.swap.model.data.LogData;
-import org.tizen.dynamicanalyzer.swap.model.data.LogDataFactory;
import org.tizen.dynamicanalyzer.ui.common.PopupAnalysisMenuItemClickListener;
import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
import org.tizen.dynamicanalyzer.ui.widgets.DAGrid;
} else if (e.keyCode == SWT.PAGE_UP) {
int nowScrollBar = scrollbar.getSelection();
int pageChagneInde = getTableLenght();
- scrollbar.setSelection(nowScrollBar - pageChagneInde+1);
+ scrollbar.setSelection(nowScrollBar - pageChagneInde + 1);
setTableSeqNumber(0);
} else if (e.keyCode == SWT.PAGE_DOWN) {
int nowScrollBar = scrollbar.getSelection();
int pageChagneInde = getTableLenght() - 1;
scrollbar.setSelection(nowScrollBar + pageChagneInde);
- setTableSeqNumber(getTableLenght()-1);
+ setTableSeqNumber(getTableLenght() - 1);
}
}
});
protected abstract List<TableInput> makeTableInput(List<LogData> userLog);
- protected abstract int getItemCount();
+ protected abstract int getItemCountByPid();
- protected abstract int getTableLogId();
+ protected abstract List<String> getDBTableColumnNames();
+
+ protected abstract String getDBTableName();
protected abstract String getSelectQueryOption();
+ protected abstract String getSelectQueryCountOption();
+
public void clean() {
getTable().removeAll();
scrollbar.setMaximum(0);
scrollEndSelection = scrollSelection + additionalSelectCount;
}
List<LogData> outputList = SqlManager.getInstance().selectTableData(
- getTableLogId(), scrollStartSelection, scrollEndSelection + 1,
+ getDBTableName(), getDBTableColumnNames(),
+ scrollStartSelection, scrollEndSelection + 1,
getSelectQueryOption());
return outputList;
}
private List<LogData> getItemListFromDB() {
int scrollSelection = scrollbar.getSelection();
- if(scrollSelection > getItemCount()){ // change PID
+ if (scrollSelection > getItemCount()) { // change PID
scrollSelection = 0;
}
int selectedEndIndex = getTableLenght() + 1;
selectedEndIndex = getItemCount();
}
List<LogData> outputList = SqlManager.getInstance().selectTableData(
- getTableLogId(), scrollSelection, selectedEndIndex + 1,
- getSelectQueryOption());
+ getDBTableName(), getDBTableColumnNames(), scrollSelection,
+ selectedEndIndex + 1, getSelectQueryOption());
return outputList;
}
/ (itemHeight + 1);
}
- public String getDBTableName() {
- return LogDataFactory.getLogFormatById(getTableLogId()).getName();
+ protected int getItemCount() {
+ if (AnalyzerManager.isRunning()) { // trace
+ setDbInsetedItemCount(getItemCountByPid());
+ } else {
+ if (getDbInsetedItemCount() == 0) { // open
+ setDbInsetedItemCount(SqlManager.getInstance()
+ .getTableItemCount(getDBTableName(),
+ getSelectQueryCountOption()));
+ } else if (getItemCountByPid() > 0) { // stop
+ setDbInsetedItemCount(getItemCountByPid());
+ }
+ }
+ return getDbInsetedItemCount();
+ }
+
+ public void setSelectionByTime(long startTime, long endTime) {
+ selectionStartTime = SqlManager.getInstance().getSelectionTime(
+ getDBTableName(), startTime, getSelectQueryCountOption());
+ if (startTime == endTime) {
+ selectionEndTime = selectionStartTime;
+ } else {
+ selectionEndTime = endTime;
+ }
+ int selectionIndex = SqlManager.getInstance().getSelectionIndex(
+ getDBTableName(), selectionStartTime,
+ getSelectQueryCountOption());
+ getScrollBar().setSelection(selectionIndex - 1);
}
public void updateTable() {
if (null != comparator && null != sortTypes) {
final int type = sortTypes[i];
- // final int sourceColumn = sourceColumns[i];
final int columnIndex = i;
column.addSelectionListener(new SelectionAdapter() {