public class Communicator30 extends BaseCommunicator {
private static final DALogger DA_LOG = DALogger.getInstance();
-
+
static final boolean PRINT_CONTROL_LOG_TOFILE = true;
private PrintWriter printWriter = null;
length, rear);
DA_LOG.debug("print start message");
-// ByteUtils.printByteArrayForStart(ret);
-
- if(PRINT_CONTROL_LOG_TOFILE) {
+ // ByteUtils.printByteArrayForStart(ret);
+
+ if (PRINT_CONTROL_LOG_TOFILE) {
File logPath = new File(
PathManager.DA_DEBUG_CONTROL_CHANNEL_LOG_FILE);
if (logPath.exists()) {
}
try {
- printWriter = new PrintWriter(new BufferedWriter(new FileWriter(logPath)), true);
+ printWriter = new PrintWriter(new BufferedWriter(
+ new FileWriter(logPath)), true);
} catch (IOException e) {
e.printStackTrace();
}
}
-
+
// data receive thread create and start
Thread dataThread = new Thread(null, new DataChannelThread(),
AnalyzerConstants.COMMUNICATOR_RECEIVE_THREAD);
// FIX
if (!StartProcessManager.getInstance().isCancelled()) {
- //StartProcessManager.getInstance().setCancelDisable();
+ // StartProcessManager.getInstance().setCancelDisable();
StartProcessManager.getInstance().setValue(100);
}
-
+
if (result.isSuccess()) {
if (!isCorrectAck(MSG_START_ACK, result)) {
HostResult failResult = HostResult.ERR_MSG_START_FAIL;
DACommunicator.setRunning(false);
dataThread = null;
return failResult;
+ } else { // right ack for start
+ byte[] data = result.getRet();
+ int index = 0;
+ index += INT_SIZE; // message id
+ index += INT_SIZE; // payload length
+ index += INT_SIZE; // return id
+ int sec = ByteUtils.toInt(data, index);
+ index += INT_SIZE;
+ int nano = ByteUtils.toInt(data, index);
+
+ AnalyzerManager.getProject().setProfileStartTime(new DATime(sec, nano));
}
} else {
DACommunicator.setRunning(false);
index += INT_SIZE;
profilingStartTime.setSec(sec);
profilingStartTime.setNano(nano);
-
+
UIRecorderTool.getInstance().startRecorder();
DA_LOG.performance("TEST", "Start Trace", "Start recoding thread");
ToolbarArea.getInstance().startTimer();
DA_LOG.performance("TEST", "Start Trace", "Start Timer");
SWAPLogParser.startLogParser();
- DA_LOG.performance("TEST", "Start Trace", "Start SWAP log parser thread");
+ DA_LOG.performance("TEST", "Start Trace",
+ "Start SWAP log parser thread");
// start registered data manager thread
DataManagerRegistry.startThreads();
DA_LOG.performance("TEST", "Start Trace", "Start DataManager threads");
String appType = app.getInfo(AppInfo.APPTYPE_INDEX);
if (appType.contains(AppInfo.APPTYPE_CPP)) {
appInst.setApplicationType(ApplicationInfo.APPTYPE_TIZEN);
- } else if(appType.contains(AppInfo.APPTYPE_WEB)) {
+ } else if (appType.contains(AppInfo.APPTYPE_WEB)) {
appInst.setApplicationType(ApplicationInfo.APPTYPE_WEB);
} else {
appInst.setApplicationType(ApplicationInfo.APPTYPE_COMMON_EXEC);
functionInstList.add(functionInst);
// for debug
-// System.out.print("DEBUG : addr ");
-// AnalyzerUtil.printHexdecimal(addrSymbol.getAddr());
-// System.out.print(" symbol " + addrSymbol.getSymbol()
-// + " args ");
-// ByteUtils.printByteArray(functionInst.getArgs());
-// System.out.println();
+ // System.out.print("DEBUG : addr ");
+ // AnalyzerUtil.printHexdecimal(addrSymbol.getAddr());
+ // System.out.print(" symbol " + addrSymbol.getSymbol()
+ // + " args ");
+ // ByteUtils.printByteArray(functionInst.getArgs());
+ // System.out.println();
}
appInst.setFunctionCount(size - exSize);
// appInst.setFunctionCount(0);
private HostResult pullTheFile(String from, String to) {
try {
- DACommunicator.getSelectedDevice().getIDevice().becomeSuperUser(true);
+ DACommunicator.getSelectedDevice().getIDevice()
+ .becomeSuperUser(true);
} catch (TimeoutException e) {
e.printStackTrace();
} catch (SdbCommandRejectedException e) {
int length = rtByte.length;
byte[] msg = ByteUtils.getByte(config, length, rtByte);
-// ByteUtils.printByteArrayForStart(msg);
+ // ByteUtils.printByteArrayForStart(msg);
HostResult result = handleControlMessage(devInfo, msg);
try {
if (null != controlSock && !controlSock.isClosed()) {
- if(PRINT_CONTROL_LOG_TOFILE && printWriter != null) {
+ if (PRINT_CONTROL_LOG_TOFILE && printWriter != null) {
printWriter.printf("send :");
- for(int k = 0; k < message.length; k++)
+ for (int k = 0; k < message.length; k++)
printWriter.printf("%02x ", message[k]);
printWriter.printf("\n");
}
}
int msgId = ByteUtils.toInt(message);
- DA_LOG.debug("wait for ack... [send message : " + msgId
- + " ]");
+ DA_LOG.debug("wait for ack... [send message : " + msgId + " ]");
int readsize = -1;
// read buffer size is sufficient??
DA_LOG.debug("blocked");
readsize = controlSock.getInputStream().read(cbuf);
blocked = false;
- if(PRINT_CONTROL_LOG_TOFILE && printWriter != null) {
+ if (PRINT_CONTROL_LOG_TOFILE && printWriter != null) {
printWriter.printf("recv :");
- for(int k = 0; k < readsize; k++)
+ for (int k = 0; k < readsize; k++)
printWriter.printf("%02x ", cbuf[k]);
printWriter.printf("\n");
}
functionInstList.add(functionInst);
// for debug
-// System.out.print("LIB : addr ");
-// AnalyzerUtil.printHexdecimal(addrSymbol.getAddr());
-// System.out.print(" symbol " + addrSymbol.getSymbol()
-// + " args ");
-// ByteUtils.printByteArray(functionInst.getArgs());
-// System.out.println();
+ // System.out.print("LIB : addr ");
+ // AnalyzerUtil.printHexdecimal(addrSymbol.getAddr());
+ // System.out.print(" symbol " + addrSymbol.getSymbol()
+ // + " args ");
+ // ByteUtils.printByteArray(functionInst.getArgs());
+ // System.out.println();
}
size = size - exSize;
libInst = ByteUtils.getByte(libInst, binaryPath, size);
int length = libInst.length;
msg = ByteUtils.getByte(msg, length, libInst);
-// ByteUtils.printByteArrayForStart(msg);
+ // ByteUtils.printByteArrayForStart(msg);
HostResult result = handleControlMessage(
DACommunicator.getSelectedDevice(), msg);