From c0fcf4ea7705949be5c2c0e442c7624c57d15aee Mon Sep 17 00:00:00 2001 From: jooyoul_lee Date: Sat, 31 Aug 2013 14:16:22 +0900 Subject: [PATCH] [Title] minor up [Desc.] - [Issue] - --- .../common/AnalyzerShellCommands.java | 5 +- .../dynamicanalyzer/common/CommonConstants.java | 1 + .../dynamicanalyzer/common/ElfSymbolExtracter.java | 5 +- .../tizen/dynamicanalyzer/logparser/LogParser.java | 4 +- .../org/tizen/dynamicanalyzer/project/AppInfo.java | 11 ++ .../org/tizen/dynamicanalyzer/sql/SqlManager.java | 19 +++- .../swap/communicator/Communicator30.java | 107 ++++++++++++------ .../swap/logparser/MessageParser.java | 24 ++-- .../swap/logparser/SWAPLogParser.java | 8 +- .../swap/model/data/BasicDataMessage.java | 125 +-------------------- .../swap/model/probe/CommonColumns.java | 27 +++-- .../swap/model/probe/CustomChartLogFormat.java | 2 +- .../swap/model/probe/FileLogFormat.java | 8 +- .../swap/model/probe/HeaderColumns.java | 63 +++++++++++ .../swap/model/probe/MemoryLogFormat.java | 2 +- .../swap/model/probe/SyncLogFormat.java | 4 +- .../swap/model/probe/ThreadLogFormat.java | 4 +- .../swap/model/probe/UIEventLogFormat.java | 4 +- .../swap/model/probe2/DataFactory.java | 19 +++- .../ui/info/snapshot/SnapshotView.java | 2 +- 20 files changed, 237 insertions(+), 207 deletions(-) create mode 100644 org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/probe/HeaderColumns.java diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/AnalyzerShellCommands.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/AnalyzerShellCommands.java index ba87f1f..d05bb20 100755 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/AnalyzerShellCommands.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/AnalyzerShellCommands.java @@ -45,6 +45,7 @@ public class AnalyzerShellCommands { public static final String CMD_IS_ARM_ARCH = "uname -m"; //$NON-NLS-1$ public static final String CMD_CAT_PORT_FILE = "cat /tmp/port.da"; //$NON-NLS-1$ - - public static final String CMD_MD_5_SUM = "/usr/bin/md5sum "; //$NON-NLS-1$ + + public static final String CMD_DA_MD_5_SUM = "da md5sum "; //$NON-NLS-1$ + public static final String CMD_MD_5_SUM = "/usr/bin/md5sum"; //$NON-NLS-1$ } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/CommonConstants.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/CommonConstants.java index 18067ba..273cbaf 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/CommonConstants.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/CommonConstants.java @@ -72,6 +72,7 @@ public class CommonConstants { public static final String EXTENSION_JPG_IMAGE = ".jpg"; //$NON-NLS-1$ public static final String EXTENSION_PNG_IMAGE = ".png"; //$NON-NLS-1$ public static final String EXTENSION_GIF_IMAGE = ".gif"; //$NON-NLS-1$ + public static final String EXTENSION_EXEC_FILE = ".exe"; //$NON-NLS-1$ /* Arch */ public static final String ARM_ARCH = "arm"; //$NON-NLS-1$ diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/ElfSymbolExtracter.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/ElfSymbolExtracter.java index 2d1ede1..0e2e4d1 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/ElfSymbolExtracter.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/ElfSymbolExtracter.java @@ -72,6 +72,7 @@ public class ElfSymbolExtracter { } long addr = symbol.st_value.getValue().longValue(); String symbolStr = symbol.toString(); + symbolStr = SymbolManager.demanglingFunctionName(symbolStr); symbolMap.put(addr, symbolStr); addrSymbolPairs.add(new AddrSymbolPair(addr, symbolStr)); } @@ -89,7 +90,7 @@ public class ElfSymbolExtracter { return ret; } - public HashMap symbolMap() { + public HashMap getSymbolMap() { return symbolMap; } @@ -105,12 +106,10 @@ public class ElfSymbolExtracter { sourcePath = null; if (null != symbolMap) { symbolMap.clear(); - symbolMap = null; } if (null != addrSymbolPairs) { addrSymbolPairs.clear(); - addrSymbolPairs = null; } } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/logparser/LogParser.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/logparser/LogParser.java index 8eadfaf..5f784a0 100755 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/logparser/LogParser.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/logparser/LogParser.java @@ -33,6 +33,7 @@ import org.tizen.dynamicanalyzer.common.AnalyzerManager; import org.tizen.dynamicanalyzer.common.CommonConstants; import org.tizen.dynamicanalyzer.common.SymbolManager; import org.tizen.dynamicanalyzer.communicator.CommunicatorUtils; +import org.tizen.dynamicanalyzer.communicator.DACommunicator; import org.tizen.dynamicanalyzer.model.ImageInfo; import org.tizen.dynamicanalyzer.nl.InformationViewLabels; import org.tizen.dynamicanalyzer.project.Project; @@ -420,7 +421,8 @@ public class LogParser implements Runnable { boolean isPieBuild = AnalyzerManager.getProject().isPieBuild(); String baseAddr = Long.toString(AnalyzerManager.getProject() .getBaseAddress()); - String path = AnalyzerManager.getProject().getBinaryPath(); +// String path = AnalyzerManager.getProject().getBinaryPath(); + String path = DACommunicator.getSelectedApp().getBinInfo().getPath(); String pcAddr = Long.toString(input.getPcAddr()); String functionName = SymbolManager.addr2func(path, pcAddr, isPieBuild, baseAddr); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/project/AppInfo.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/project/AppInfo.java index 224e005..28be99f 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/project/AppInfo.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/project/AppInfo.java @@ -57,6 +57,7 @@ public class AppInfo { private BinaryInfo binInfo = null; private String installTime = null; + private String execFileName = null; private ElfSymbolExtracter symbolExtractor = new ElfSymbolExtracter(); @@ -100,4 +101,14 @@ public class AppInfo { symbolExtractor.makeSymbol(binInfo.getPath()); return symbolExtractor.getAddrSymbolPairs(); } + + public String getExecFileName() { + if (null == execFileName) { + String execPath = appInfo.get(EXEC_INDEX); + String[] splitPath = execPath.split(CommonConstants.SLASH); + execFileName = splitPath[splitPath.length - 1] + + CommonConstants.EXTENSION_EXEC_FILE; + } + return execFileName; + } } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/sql/SqlManager.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/sql/SqlManager.java index da94194..dc70e1b 100755 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/sql/SqlManager.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/sql/SqlManager.java @@ -50,6 +50,7 @@ import org.tizen.dynamicanalyzer.common.CommonConstants; import org.tizen.dynamicanalyzer.logparser.LogCenterConstants; import org.tizen.dynamicanalyzer.model.LogCenter; import org.tizen.dynamicanalyzer.project.Project; +import org.tizen.dynamicanalyzer.swap.model.ByteUtils; import org.tizen.dynamicanalyzer.swap.model.control.TargetInfo; import org.tizen.dynamicanalyzer.swap.model.data.ApiNameManager; import org.tizen.dynamicanalyzer.swap.model.data.BasicDataMessage; @@ -275,6 +276,7 @@ public class SqlManager { public boolean insertLogQuery(int id, String query, List input) { PreparedStatement prep = null; + BasicDataMessage msg = null; try { Connection conn = getConnection(); if (null == conn || null == query || null == input) { @@ -285,8 +287,14 @@ public class SqlManager { prep = conn.prepareStatement(query); int dataRowSize = input.size(); for (int i = 0; i < dataRowSize; i++) { - BasicDataMessage msg = input.get(i); + msg = input.get(i); int logNum = LogDataFactory.getLogCountById(id); + if (id == 0x2007) { + System.out.println("[!!!]insert to system : " + msg.getId() + + " " + msg.getSeq() + " " + msg.getTime() + + " size :" + msg.getPayload().length); + ByteUtils.printByteArray(msg.getPayload()); + } prep.setInt(1, logNum); prep.setInt(2, msg.getId()); prep.setInt(3, msg.getSeq()); @@ -298,6 +306,8 @@ public class SqlManager { prep.executeBatch(); conn.setAutoCommit(true); } catch (SQLException e) { + System.out.println("[Error insert] id = " + msg.getId() + + " seq : " + msg.getSeq()); e.printStackTrace(); } finally { if (null != prep) { @@ -442,7 +452,7 @@ public class SqlManager { String tableName = LogDataFactory.getTableNamebyId(logId); String insertQuery = "insert into " + tableName + " values( ?, ?, ?, ?, ?);"; -// System.out.println("inser query : " + insertQuery); + // System.out.println("inser query : " + insertQuery); insertLogQuery(logId, insertQuery, input); } @@ -852,6 +862,11 @@ public class SqlManager { bdm.setPayload(rs.getBytes(5)); LogData log = LogDataFactory.createInstance(bdm); logs.add(log); + if (bdm.getId() == 0x2007) { + System.out.println("read system data seq = " + + bdm.getSeq()); + ByteUtils.printByteArray(bdm.getPayload()); + } } } catch (SQLException e) { System.out.println("SQLException - selecte : " + query); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/communicator/Communicator30.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/communicator/Communicator30.java index 662da70..25f6871 100755 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/communicator/Communicator30.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/communicator/Communicator30.java @@ -175,7 +175,7 @@ public class Communicator30 extends BaseCommunicator { appInfo.setAppType(ApplicationInfo.APPTYPE_COMMON_EXEC); } appInfo.setAppId(selectedApp.getInfo(AppInfo.APPID_INDEX)); - appInfo.setExecPath(selectedApp.getInfo(AppInfo.EXEC_INDEX)); + appInfo.setExecPath(selectedApp.getInfo(AppInfo.EXEC_INDEX) + ".exe"); RunTimeConfiguration rt = new RunTimeConfiguration(); rt.setFeatures(ConfigureManager.getInstance().getConfiguration()); @@ -203,11 +203,11 @@ public class Communicator30 extends BaseCommunicator { } // TODO: app inst , replay info added!! - byte[] rear = ByteUtils.getByte(appInfo.getByteValue(), - rt.getByteValue(), getUserSpaceInst().getByteValue(), - replayEvent); // byte[] rear = ByteUtils.getByte(appInfo.getByteValue(), - // rt.getByteValue(), 0,0); + // rt.getByteValue(), getUserSpaceInst().getByteValue(), + // replayEvent); + byte[] rear = ByteUtils.getByte(appInfo.getByteValue(), + rt.getByteValue(), 0, 0); int length = rear.length; byte[] ret = ByteUtils.getByte(AnalyzerConstants.MSG_START_SWAP, @@ -271,6 +271,9 @@ public class Communicator30 extends BaseCommunicator { FunctionInst functionInst = new FunctionInst(); functionInst.setAddr(addrSymbol.getAddr()); functionInst.setArgs(getFunctionArgs(addrSymbol.getSymbol())); + System.out.println("DEBUG : addr " + addrSymbol.getAddr() + + " symbol " + addrSymbol.getSymbol() + " args "); + ByteUtils.printByteArray(functionInst.getArgs()); functionInstList.add(functionInst); } @@ -312,11 +315,17 @@ public class Communicator30 extends BaseCommunicator { int binaryType = ByteUtils.toInt(payload, 0); String targetPath = selectedApp.getInfo(AppInfo.EXEC_INDEX); - String binaryPath = ByteUtils.getString(payload, INT_SIZE); - if (null == binaryPath) { + String binaryDir = ByteUtils.getString(payload, INT_SIZE).trim(); + String binaryPath = null; + if (null == binaryDir) { // return HostResult.ERR_BIN_INFO_GET_FAIL; binaryPath = CommonConstants.EMPTY; } + + StringBuffer strBuf = new StringBuffer(); + strBuf.append(binaryDir).append(File.separator) + .append(selectedApp.getExecFileName()); + binaryPath = strBuf.toString(); binInfo.setType(binaryType); // host has no binary file - pull binary file from target @@ -338,8 +347,9 @@ public class Communicator30 extends BaseCommunicator { } // host has binary then compare binary hash target and local - String command = AnalyzerShellCommands.CMD_MD_5_SUM + targetPath; - CommunicatorUtils.execShellCommand(command, new MultiLineReceiver() { + String command = AnalyzerShellCommands.CMD_DA_MD_5_SUM + targetPath; + // + CommonConstants.EXTENSION_EXEC_FILE; + CommunicatorUtils.execHostCommand(command, new MultiLineReceiver() { @Override public void processNewLines(String[] appLines) { binaryHashMultiLines.clear(); @@ -354,37 +364,58 @@ public class Communicator30 extends BaseCommunicator { .split(CommonConstants.SPACE); String targetHashCode = new String(splitResult[0]); String localHashCode = null; - command = AnalyzerShellCommands.CMD_MD_5_SUM + binaryPath; + // command = AnalyzerShellCommands.CMD_MD_5_SUM + "\"" + binaryPath + + // "\""; try { - Process process = Runtime.getRuntime().exec(command); + Runtime rt = Runtime.getRuntime(); + // Process process = rt.exec(command); + Process process = rt.exec(new String[] { + AnalyzerShellCommands.CMD_MD_5_SUM, binaryPath }); + process.waitFor(); BufferedReader reader = new BufferedReader(new InputStreamReader( process.getInputStream())); + BufferedReader error = new BufferedReader(new InputStreamReader( + process.getErrorStream())); String line = reader.readLine(); + String errorStr = error.readLine(); + if (null == line) { + System.out.println("host md5sum get failed : " + errorStr); + return HostResult.ERR_BIN_INFO_GET_FAIL; + } splitResult = line.trim().split(CommonConstants.SPACE); localHashCode = new String(splitResult[0]); } catch (IOException e) { e.printStackTrace(); return HostResult.ERR_BIN_INFO_GET_FAIL; + } catch (InterruptedException e) { + e.printStackTrace(); } // hash code is not same - get binary from target // change binary file path of host - if (!targetHashCode.equals(localHashCode)) { - SyncResult res = CommunicatorUtils.pull(targetPath, - AnalyzerPaths.TEMP_FOLDER_PATH); - if (null != res && res.isOk()) { - System.out.println("binary copy success!!");//$NON-NLS-1$ - } else { - System.out.println("Failed to get " + targetPath + " step 2"); //$NON-NLS-1$ - return HostResult.ERR_BIN_INFO_GET_FAIL; - } - String[] splitName = binaryPath.split(CommonConstants.SLASH); - binaryPath = AnalyzerPaths.TEMP_FOLDER_PATH + File.separator - + new String(splitName[splitName.length - 1]); - binInfo.setPath(binaryPath); - // selectedApp.setBinInfo(binInfo); - } + + // FIXME: permission denied problem + + // if (!targetHashCode.equals(localHashCode)) { + // String name = selectedApp.getInfo(AppInfo.LABEL_INDEX); + // String destFilePath = AnalyzerPaths.TEMP_FOLDER_PATH + // + File.separator + name + // + CommonConstants.EXTENSION_EXEC_FILE; + // SyncResult res = CommunicatorUtils.pull(targetPath, + // destFilePath); + // if (null != res && res.isOk()) { + // System.out.println("binary copy success!!");//$NON-NLS-1$ + // } else { + // System.out.println("Failed to get " + targetPath + " step 2"); //$NON-NLS-1$ + // return HostResult.ERR_BIN_INFO_GET_FAIL; + // } + // String[] splitName = binaryPath.split(CommonConstants.SLASH); + // binaryPath = AnalyzerPaths.TEMP_FOLDER_PATH + File.separator + // + new String(splitName[splitName.length - 1]); + // binInfo.setPath(binaryPath); + // // selectedApp.setBinInfo(binInfo); + // } binInfo.setPath(binaryPath); // selectedApp.setBinInfo(binInfo); @@ -541,10 +572,10 @@ public class Communicator30 extends BaseCommunicator { dataSock.setSoTimeout(AnalyzerConstants.SOCKET_TIMEOUT); dataSock.setReuseAddress(true); dataSock.setTcpNoDelay(true); - -// byte[] testBuffer = new byte[1024]; -// dataSock.getInputStream().read(testBuffer); -// ByteUtils.printByteArray(testBuffer); + + // byte[] testBuffer = new byte[1024]; + // dataSock.getInputStream().read(testBuffer); + // ByteUtils.printByteArray(testBuffer); } catch (UnknownHostException e) { result = HostResult.ERR_EXCEPTION_OCCURRED; result.setMessage(e.getMessage()); @@ -699,16 +730,24 @@ public class Communicator30 extends BaseCommunicator { int start = symbol.indexOf(CommonConstants.OPEN_BRACKET); int end = symbol.indexOf(CommonConstants.CLOSE_BRACKET); - String argStr = symbol.substring(start, end).trim(); + byte[] emptyRet = new byte[1]; + emptyRet[0] = 0; + if (start < 0 || end < 0) { + return emptyRet; + } + String argStr = symbol.substring(start + 1, end).trim(); if (argStr.isEmpty()) { - return new byte[0]; + return emptyRet; } String[] args = argStr.split(CommonConstants.COMMA); - byte[] ret = new byte[args.length]; + byte[] ret = new byte[args.length + 1]; + ret[args.length] = 0; for (int i = 0; i < args.length; i++) { String arg = args[i]; int index = arg.indexOf(CommonConstants.SPACE); - arg = arg.substring(0, index - 1); + if (index > 0) { + arg = arg.substring(0, index - 1); + } ret[i] = (byte) getArgType(arg); } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/logparser/MessageParser.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/logparser/MessageParser.java index bda5c9f..ca46526 100755 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/logparser/MessageParser.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/logparser/MessageParser.java @@ -73,7 +73,7 @@ public class MessageParser { final int MSG_SPLIT_SIZE = 3; /* Message Buffer max length */ - final int MSG_BUFFER_MAX = 100; + final int MSG_BUFFER_MAX = 1000; final int MSG_BUFFER_TIMER_DELAY = 5; final int MSG_BUFFER_TIMER_PERIOD = 1000; // 1 second final int WAITING_TIME = 100; @@ -259,12 +259,12 @@ public class MessageParser { byte[] payload = null; while (true) { -// int available = inputStream.available(); -// if (available < 20) { -// System.out.println("not available : " + available); -// continue; -// } -// System.out.println(" Available size : " + available); + // int available = inputStream.available(); + // if (available < 20) { + // System.out.println("not available : " + available); + // continue; + // } + // System.out.println(" Available size : " + available); int readSize = inputStream.read(header); if (!DACommunicator.isRunning() && readSize == -1) { // manager socket closed!! @@ -273,7 +273,13 @@ public class MessageParser { if (readSize <= 0) { continue; } else { -// ByteUtils.printByteArray(header); + ByteUtils.printByteArray(header); + + // for (int i = 0; i < 100; i++) { + // System.out.print(" "); + // } + // System.out.println(); + int id = ByteUtils.toInt(header, 0); int seq = ByteUtils.toInt(header, 4); @@ -418,7 +424,7 @@ public class MessageParser { break; } - if (MSG_BUFFER_MAX < messageCount) { + if (MSG_BUFFER_MAX <= messageCount) { addBufferToList(); messageCount = 0; } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/logparser/SWAPLogParser.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/logparser/SWAPLogParser.java index 1641951..98182b0 100755 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/logparser/SWAPLogParser.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/logparser/SWAPLogParser.java @@ -239,7 +239,7 @@ public class SWAPLogParser implements Runnable { AnalyzerManager.getProject().setLastLogNum(seqNum, id); } - System.out.println("update logs"); +// System.out.println("update logs"); updateLog(logPack); } @@ -317,10 +317,12 @@ public class SWAPLogParser implements Runnable { } private void setFuncName(ProfileData input) { - boolean isPieBuild = AnalyzerManager.getProject().isPieBuild(); +// boolean isPieBuild = AnalyzerManager.getProject().isPieBuild(); + boolean isPieBuild = (DACommunicator.getSelectedApp().getBinInfo().getType() == 1)?true:false; String baseAddr = Long.toString(AnalyzerManager.getProject() .getBaseAddress()); - String path = AnalyzerManager.getProject().getBinaryPath(); +// String path = AnalyzerManager.getProject().getBinaryPath(); + String path = DACommunicator.getSelectedApp().getBinInfo().getPath(); // String path = DACommunicator.getSelectedApp().getBinInfo().getPath(); String pcAddr = Long.toString(input.getPcAddr()); String functionName = SymbolManager.addr2func(path, pcAddr, isPieBuild, diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/data/BasicDataMessage.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/data/BasicDataMessage.java index e9afc5b..0eeef98 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/data/BasicDataMessage.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/data/BasicDataMessage.java @@ -19,7 +19,7 @@ public class BasicDataMessage { public static final int HEADER_SIZE = ID_SIZE + SEQ_SIZE + TIME_SIZE + PAYLOAD_LENGTH_SIZE; - private boolean PRINT_DATA = true; + private boolean PRINT_DATA = false; protected int id = -1; protected int seq = -1; @@ -29,120 +29,6 @@ public class BasicDataMessage { protected boolean complete = false; protected String callstackLog = null; - private int reqSize = 0; - private byte[] headerBuffer = new byte[HEADER_SIZE]; - private byte[] emptyHeaderBuffer = new byte[HEADER_SIZE]; - - // private byte[] emptyBuffer = null; - private int bufferStart = 0; - -// public byte[] makeData(byte[] input) { - -// if (null == input || input.length <= 0) { -// return input; -// } -// bufferStart = 0; -// // header is parsing? -// if (id < 0) { // header is not parsing -// if (reqSize == 0) { -// reqSize = HEADER_SIZE; -// } -// -// int copySize = (reqSize < input.length) ? reqSize : input.length; -// System.arraycopy(input, 0, headerBuffer, HEADER_SIZE - reqSize, -// copySize); -// if (input.length < reqSize) { -// reqSize = reqSize - input.length; -// return new byte[0]; -// } else { -// bufferStart = reqSize; -// reqSize = 0; -// } -// // parsing header -// // ByteUtils.printByteArray(headerBuffer); -// id = ByteUtils.toInt(headerBuffer); -// seq = ByteUtils.toInt(headerBuffer, ID_SIZE); -// long sec = ByteUtils.toInt(headerBuffer, ID_SIZE + SEQ_SIZE); -// long nano = ByteUtils.toInt(headerBuffer, ID_SIZE + SEQ_SIZE -// + INT_SIZE); -// -// DATime startTime = AnalyzerManager.getProject().getStartTime(); -// long startSec = startTime.getSec(); -// long startNano = startTime.getNano(); -// -// // if (0 == startSec && 0 == startNano) { -// // startTime.setSec(sec); -// // startTime.setNano(nano); -// // AnalyzerManager.getProject().setStartTime(startTime); -// // startSec = sec; -// // startNano = nano; -// // } -// -// long resultSec = sec - startSec; -// long resultNano = nano - startNano; -// -// time = resultSec * 1000000 + resultNano / 1000; -// -// payloadSize = ByteUtils.toInt(headerBuffer, ID_SIZE + SEQ_SIZE -// + TIME_SIZE); -// // clear headerBuffer -// System.arraycopy(emptyHeaderBuffer, 0, headerBuffer, 0, HEADER_SIZE); -// // input - headerBuffer = buffer -// payload = new byte[payloadSize]; -// // System.out.println("DEBUG - id :" + String.format("%4x", id) -// // + " seq :" + seq + " time :" + time -// // + " payload size : " + payloadSize + " request size :" -// // + reqSize + " input length :" + input.length); -// } -// -// reqSize = (0 == reqSize) ? payloadSize : reqSize; -// -// int cpSize = (input.length - bufferStart > reqSize) ? reqSize -// : input.length - bufferStart; -// System.arraycopy(input, bufferStart, payload, payloadSize - reqSize, -// cpSize); -// if (reqSize > cpSize) { -// reqSize = reqSize - cpSize; -// return new byte[0]; -// } else { -// int retIndex = bufferStart + reqSize; -// byte[] ret = new byte[input.length - retIndex]; -// System.arraycopy(input, retIndex, ret, 0, input.length - retIndex); -// complete = true; -// return ret; -// } - - -// } - -// public byte[] addData(byte[] input) { -// // int remainSize = (payloadSize - payload.length > 0) ? payloadSize -// // - payload.length : DataChannelConstants.BUFFER_SIZE; -// -// int cpSize = (reqSize > input.length) ? input.length : reqSize; -// int cpIndex = payloadSize - reqSize; -// -// System.arraycopy(input, 0, payload, cpIndex, cpSize); -// -// byte[] ret = new byte[0]; -// if (reqSize > input.length) { -// reqSize = reqSize - input.length; -// } else { -// ret = new byte[input.length - reqSize]; -// System.arraycopy(input, reqSize, ret, 0, ret.length); -// complete = true; -// } -// -// // byte[] ret = (remainSize == DataChannelConstants.BUFFER_SIZE) ? null -// // : new byte[input.length - remainSize]; -// // if (null != ret) { -// // System.arraycopy(input, remainSize, ret, 0, input.length -// // - remainSize); -// // } -// // complete = (payloadSize == payload.length) ? true : false; -// return ret; -// } - public int getId() { return id; } @@ -167,14 +53,6 @@ public class BasicDataMessage { this.time = time; } -// public int getPayloadSize() { -// return payloadSize; -// } - -// public void setPayloadSize(int payloadSize) { -// this.payloadSize = payloadSize; -// } - public byte[] getPayload() { return payload; } @@ -230,7 +108,6 @@ public class BasicDataMessage { System.arraycopy(input, 0, newInput, 0, input.length); input = null; payload = AnalyzerUtil.makeByteArray(id, newInput); -// payloadSize = payload.length; } // for lower version diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/probe/CommonColumns.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/probe/CommonColumns.java index 802923b..145d53f 100755 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/probe/CommonColumns.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/probe/CommonColumns.java @@ -3,7 +3,6 @@ package org.tizen.dynamicanalyzer.swap.model.probe; import static org.tizen.dynamicanalyzer.swap.model.probe.LogFormat.I; import static org.tizen.dynamicanalyzer.swap.model.probe.LogFormat.L; import static org.tizen.dynamicanalyzer.swap.model.probe.LogFormat.T; -import static org.tizen.dynamicanalyzer.swap.model.probe.LogFormat.A; import java.util.ArrayList; import java.util.Arrays; @@ -11,13 +10,12 @@ import java.util.List; public class CommonColumns { - private static String[] dcn = { "RID", "APPID", "PID", "TID", "args", - "Return", "PCAddr", "Errno", "InternalCall", "CallerPCAddr", - "Reserved", "Reserved" }; - private static Integer[] dct = { I, I, I, I, T, T, I, I, T, I, I, I, I }; + private static String[] dcn = { "APPID", "PID", "TID", "args", "Return", + "Errno", "InternalCall", "CallerPCAddr", "Reserved", "Reserved" }; + private static Integer[] dct = { I, I, I, T, T, T, I, T, I, I, I, I }; private static String[] tcn = { "App ID", "PID", "TID", "Args", "Return", - "Errno", "Internal Call", "Caller PCAddr","Reserved", "Reserved" }; - private static Integer[] logTypes = { I, I, I, A, L, I, I, L, I, I }; + "Errno", "Internal Call", "Caller PCAddr", "Reserved", "Reserved" }; + private static Integer[] logTypes = { I, I, I, T, L, I, I, L, I, I }; private static List dbColumnNames = null; private static List dbColumnTypes = null; @@ -27,9 +25,9 @@ public class CommonColumns { public static List getDBColumnNames() { if (null == dbColumnNames) { dbColumnNames = new ArrayList(); - dbColumnNames = Arrays.asList(dcn); + dbColumnNames.addAll(HeaderColumns.getDBColumnNames()); + dbColumnNames.addAll(Arrays.asList(dcn)); } - ArrayList ret = new ArrayList(); ret.addAll(dbColumnNames); @@ -38,7 +36,9 @@ public class CommonColumns { public static List getDBColumntypes() { if (null == dbColumnTypes) { - dbColumnTypes = Arrays.asList(dct); + dbColumnTypes = new ArrayList(); + dbColumnTypes.addAll(HeaderColumns.getDBColumntypes()); + dbColumnTypes.addAll(Arrays.asList(dct)); } ArrayList ret = new ArrayList(); @@ -49,7 +49,8 @@ public class CommonColumns { public static List getTableColumnNames() { if (null == tableColumnNames) { tableColumnNames = new ArrayList(); - tableColumnNames = Arrays.asList(tcn); + tableColumnNames.addAll(HeaderColumns.getTableColumnNames()); + tableColumnNames.addAll(Arrays.asList(tcn)); } ArrayList ret = new ArrayList(); ret.addAll(tableColumnNames); @@ -58,7 +59,9 @@ public class CommonColumns { public static List getLogColumnTypes() { if (null == types) { - types = Arrays.asList(logTypes); + types = new ArrayList(); + types.addAll(HeaderColumns.getLogColumnTypes()); + types.addAll(Arrays.asList(logTypes)); } ArrayList ret = new ArrayList(); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/probe/CustomChartLogFormat.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/probe/CustomChartLogFormat.java index 20d3549..e00d92a 100755 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/probe/CustomChartLogFormat.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/probe/CustomChartLogFormat.java @@ -31,7 +31,7 @@ public class CustomChartLogFormat extends LogFormat { tableColumnNames = CommonColumns.getTableColumnNames(); tableColumnNames.addAll(Arrays.asList(tcn)); - Integer[] types = { I, I, S, I, F }; + Integer[] types = { I, I, S, I, D }; logColumnTypes = CommonColumns.getLogColumnTypes(); logColumnTypes.addAll(Arrays.asList(types)); } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/probe/FileLogFormat.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/probe/FileLogFormat.java index bcbbef6..16ba80d 100755 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/probe/FileLogFormat.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/probe/FileLogFormat.java @@ -19,21 +19,21 @@ public class FileLogFormat extends LogFormat { setId(ID); setName(NAME); - String[] dcn = { "Size", "FDValue", "FDType", "FDApiType", "FileSize", + String[] dcn = { "Size", "FDValue", "FDApiType", "FileSize", "FilePath" }; dbColumnNames = CommonColumns.getDBColumnNames(); dbColumnNames.addAll(Arrays.asList(dcn)); - Integer[] dct = { I, I, I, I, I, T }; + Integer[] dct = { T, T, I, T, T }; dbColumnTypes = CommonColumns.getDBColumntypes(); dbColumnTypes.addAll(Arrays.asList(dct)); - String[] tcn = { "Size", "FD Value", "FD Type", "FD Api Type", + String[] tcn = { "Size", "FD Value", "FD Api Type", "File Size", "FilePath" }; tableColumnNames = CommonColumns.getTableColumnNames(); tableColumnNames.addAll(Arrays.asList(tcn)); - Integer[] types = { I, I, I, I, I, S }; + Integer[] types = { L, L, I, L, S }; logColumnTypes = CommonColumns.getLogColumnTypes(); logColumnTypes.addAll(Arrays.asList(types)); } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/probe/HeaderColumns.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/probe/HeaderColumns.java new file mode 100644 index 0000000..6760f2e --- /dev/null +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/probe/HeaderColumns.java @@ -0,0 +1,63 @@ +package org.tizen.dynamicanalyzer.swap.model.probe; + +import static org.tizen.dynamicanalyzer.swap.model.probe.LogFormat.I; +import static org.tizen.dynamicanalyzer.swap.model.probe.LogFormat.L; +import static org.tizen.dynamicanalyzer.swap.model.probe.LogFormat.T; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +public class HeaderColumns { + private static String[] dcn = { "RID", "MessageId", "Seq", "Time" }; + private static Integer[] dct = { I, I, I, T }; + private static String[] tcn = { "Message ID", "Sequence", "Time" }; + private static Integer[] logTypes = { I, I, L }; + + private static List dbColumnNames = null; + private static List dbColumnTypes = null; + private static List tableColumnNames = null; + private static List types = null; + + public static List getDBColumnNames() { + if (null == dbColumnNames) { + dbColumnNames = new ArrayList(); + dbColumnNames = Arrays.asList(dcn); + } + + ArrayList ret = new ArrayList(); + ret.addAll(dbColumnNames); + + return ret; + } + + public static List getDBColumntypes() { + if (null == dbColumnTypes) { + dbColumnTypes = Arrays.asList(dct); + } + + ArrayList ret = new ArrayList(); + ret.addAll(dbColumnTypes); + return ret; + } + + public static List getTableColumnNames() { + if (null == tableColumnNames) { + tableColumnNames = new ArrayList(); + tableColumnNames = Arrays.asList(tcn); + } + ArrayList ret = new ArrayList(); + ret.addAll(tableColumnNames); + return ret; + } + + public static List getLogColumnTypes() { + if (null == types) { + types = Arrays.asList(logTypes); + } + + ArrayList ret = new ArrayList(); + ret.addAll(types); + return ret; + } +} diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/probe/MemoryLogFormat.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/probe/MemoryLogFormat.java index df09f81..f449d44 100755 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/probe/MemoryLogFormat.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/probe/MemoryLogFormat.java @@ -26,7 +26,7 @@ public class MemoryLogFormat extends LogFormat { } // dbColumnNames.addAll(Arrays.asList(dcn)); - Integer[] dct = { I, I, T }; + Integer[] dct = { T, I, T }; dbColumnTypes = CommonColumns.getDBColumntypes(); dbColumnTypes.addAll(Arrays.asList(dct)); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/probe/SyncLogFormat.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/probe/SyncLogFormat.java index 2b2d5c1..ecc9115 100755 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/probe/SyncLogFormat.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/probe/SyncLogFormat.java @@ -23,7 +23,7 @@ public class SyncLogFormat extends LogFormat { dbColumnNames = CommonColumns.getDBColumnNames(); dbColumnNames.addAll(Arrays.asList(dcn)); - Integer[] dct = { I, I, I }; + Integer[] dct = { T, I, I }; dbColumnTypes = CommonColumns.getDBColumntypes(); dbColumnTypes.addAll(Arrays.asList(dct)); @@ -31,7 +31,7 @@ public class SyncLogFormat extends LogFormat { tableColumnNames = CommonColumns.getTableColumnNames(); tableColumnNames.addAll(Arrays.asList(tcn)); - Integer[] types = { I, I, I }; + Integer[] types = { L, I, I }; logColumnTypes = CommonColumns.getLogColumnTypes(); logColumnTypes.addAll(Arrays.asList(types)); } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/probe/ThreadLogFormat.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/probe/ThreadLogFormat.java index bd82ef9..c6283f4 100755 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/probe/ThreadLogFormat.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/probe/ThreadLogFormat.java @@ -23,7 +23,7 @@ public class ThreadLogFormat extends LogFormat { dbColumnNames = CommonColumns.getDBColumnNames(); dbColumnNames.addAll(Arrays.asList(dcn)); - Integer[] dct = { I, I, I, I }; + Integer[] dct = { T, T, I, I }; dbColumnTypes = CommonColumns.getDBColumntypes(); dbColumnTypes.addAll(Arrays.asList(dct)); @@ -32,7 +32,7 @@ public class ThreadLogFormat extends LogFormat { tableColumnNames = CommonColumns.getTableColumnNames(); tableColumnNames.addAll(Arrays.asList(tcn)); - Integer[] types = { I, I, I, I }; + Integer[] types = { L, L, I, I }; logColumnTypes = CommonColumns.getLogColumnTypes(); logColumnTypes.addAll(Arrays.asList(types)); } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/probe/UIEventLogFormat.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/probe/UIEventLogFormat.java index c406104..dc210b4 100755 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/probe/UIEventLogFormat.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/probe/UIEventLogFormat.java @@ -23,7 +23,7 @@ public class UIEventLogFormat extends LogFormat { dbColumnNames = CommonColumns.getDBColumnNames(); dbColumnNames.addAll(Arrays.asList(dcn)); - Integer[] dct = { I, I, I, I, I, I }; + Integer[] dct = { I, I, I, I, T, T }; dbColumnTypes = CommonColumns.getDBColumntypes(); dbColumnTypes.addAll(Arrays.asList(dct)); @@ -32,7 +32,7 @@ public class UIEventLogFormat extends LogFormat { tableColumnNames = CommonColumns.getTableColumnNames(); tableColumnNames.addAll(Arrays.asList(tcn)); - Integer[] types = { I, I, I, I, I, I }; + Integer[] types = { I, I, I, I, S, S }; logColumnTypes = CommonColumns.getLogColumnTypes(); logColumnTypes.addAll(Arrays.asList(types)); } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/probe2/DataFactory.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/probe2/DataFactory.java index ac33e76..ce17eb5 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/probe2/DataFactory.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/probe2/DataFactory.java @@ -696,19 +696,30 @@ public class DataFactory { } private static String parseLoad(int start, byte[] payload) { + int pos = start; int backPos = start - INT_SIZE; int count = ByteUtils.toInt(payload, backPos); StringBuffer outBuf = new StringBuffer(); for (int ii = 0; ii < count; ii++) { - int tid = ByteUtils.toInt(payload, start); - start += INT_SIZE; + try{ + if (pos == 180) + { + System.out.println(); + } + int tid = ByteUtils.toInt(payload, pos); + pos += INT_SIZE; outBuf.append(tid).append(CommonConstants.COMMA); - float f = ByteUtils.toFloat(payload, start); + float f = ByteUtils.toFloat(payload, pos); outBuf.append(f); - start += FLOAT_SIZE; + pos += FLOAT_SIZE; if (ii + 1 != count) { outBuf.append(','); } + }catch(ArrayIndexOutOfBoundsException e) + { + e.printStackTrace(); + break; + } } return outBuf.toString(); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/info/snapshot/SnapshotView.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/info/snapshot/SnapshotView.java index ae8de8a..2420c21 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/info/snapshot/SnapshotView.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/info/snapshot/SnapshotView.java @@ -333,7 +333,7 @@ public class SnapshotView extends DAView { } else if (latestButton.isButtonEnabled()) { setStartTime(selectTime); } - computeData(); +// computeData(); Display.getDefault().syncExec(new Runnable() { @Override public void run() { -- 2.7.4