public static final String DACOMMAND_RUN_EVENT = "da runevent";
public static final String DACOMMAND_FIND_UNITTEST = "da findunittest";
public static final String DACOMMAND_FIND_IME = "/usr/bin/pkginfo --arg-flt 10 http://tizen.org/category/ime";
- public static final String DACOMMAND_CHECK_VERSION = "da checkversion";
+ public static final String DACOMMAND_CHECK_VERSION = "da getversion";
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$
package org.tizen.dynamicanalyzer.communicator;
-import static org.tizen.sdblib.service.SyncServiceConstants.RESULT_OK;
import static org.tizen.sdblib.util.DeviceUtil.isOnline;
import static org.tizen.sdblib.util.IOUtil.tryClose;
public class CommunicatorUtils {
private static List<String> uploadDataResult = new ArrayList<String>();
private static boolean isArch = false;
- private static final int PORT_WAIT_TIME = 5;
+ private static final int PORT_WAIT_TIME = 5 * 1000 * 2; //ms
private static List<String> portLines = new ArrayList<String>();
public static final int LOCAL_PORT = 8000;
String targetPath) {
HostResult ret = HostResult.SUCCESS;
SyncResult result = push(device, source, targetPath);
- if (null == result || RESULT_OK != result.getCode()) {
+ if (null == result || !result.isOk()) {
System.out.println("upload to" + targetPath + " is failed! "); //$NON-NLS-1$ //$NON-NLS-2$
if (null != result) {
ret = HostResult.ERR_UPLOAD_FILE_FAILED;
}
count++;
System.out.print("wait for port..");
- Thread.sleep(1000);
+ Thread.sleep(1);
} catch (InterruptedException e) {
e.printStackTrace();
break;
import static org.tizen.dynamicanalyzer.common.AnalyzerConstants.DAEMONLOG_PREFIX;
import static org.tizen.dynamicanalyzer.common.AnalyzerConstants.DA_VERSION_OLD;
import static org.tizen.dynamicanalyzer.common.AnalyzerConstants.DA_VERSION_SWAP;
-import static org.tizen.sdblib.service.SyncServiceConstants.RESULT_OK;
import static org.tizen.sdblib.util.DeviceUtil.isOnline;
import java.io.BufferedReader;
public class DACommunicator {
public static int MSG_TYPE_CONFIG = 0;
public static int MSG_TYPE_SWAP_INST = 1;
+ public static int READ_BUFFER_SIZE = 1024;
private static BaseCommunicator communicator = null;
final String to = PathManager.getLogPath() + File.separator
+ DAEMONLOG_PREFIX + PathManager.getLogPostFix();//$NON-NLS-1$
SyncResult res = CommunicatorUtils.pull(from, to);
- if (null != res && RESULT_OK == res.getCode()) {
+ if (null != res && res.isOk()) {
System.out.println("daemon log copying success!!");//$NON-NLS-1$
} else {
System.out.println("Failed to get " + from); //$NON-NLS-1$
*/
package org.tizen.dynamicanalyzer.logparser;
-import static org.tizen.sdblib.service.SyncServiceConstants.RESULT_OK;
-
import java.io.File;
import java.util.List;
import org.tizen.dynamicanalyzer.nl.InformationViewLabels;
import org.tizen.dynamicanalyzer.project.Project;
import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
-import org.tizen.dynamicanalyzer.swap.model.DATime;
import org.tizen.dynamicanalyzer.swap.model.data.ApiNameManager;
import org.tizen.dynamicanalyzer.swap.model.data.BasicDataMessage;
import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
public void run() {
while (true && count < 5) {
SyncResult res = CommunicatorUtils.pull(from, to);
- if (null != res && RESULT_OK == res.getCode()) {
+ if (null != res && res.isOk()) {
/* image resizing */
String smallImagePath = AnalyzerManager.getProject()
.getSavePath()
import static org.tizen.dynamicanalyzer.common.AnalyzerConstants.MSG_TARGET_INFO_ACK;
import static org.tizen.dynamicanalyzer.common.CommonConstants.INT_SIZE;
import static org.tizen.dynamicanalyzer.common.CommonConstants.LONG_SIZE;
-import static org.tizen.sdblib.service.SyncServiceConstants.RESULT_OK;
import java.io.BufferedReader;
import java.io.File;
import java.util.List;
import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
-import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.common.AnalyzerPaths;
import org.tizen.dynamicanalyzer.common.AnalyzerShellCommands;
import org.tizen.dynamicanalyzer.common.CommonConstants;
devices.removeAll(removeList);
removeList.clear();
}
+ // port get failed popup
// create control socket
for (DeviceInfo devInfo : devices) {
result = createDataSocket(devInfo);
if (!result.isSuccess()) {
System.out.println(result.toString());
+ // add control socket close
removeList.add(devInfo);
}
}
}
// heart beat thread start
-
// Thread heartBeat = new Thread(null, new HeartBeatThread(),
// AnalyzerConstants.HEART_BEAT_THREAD);
// heartBeat.start();
-
+ //
return HostResult.SUCCESS;
}
}
// 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(), getUserSpaceInst().getByteValue(),
- replayEvent);
+ rt.getByteValue(), 0,0);
int length = rear.length;
byte[] ret = ByteUtils.getByte(AnalyzerConstants.MSG_START_SWAP,
String name = selectedApp.getInfo(AppInfo.LABEL_INDEX);
binaryPath = AnalyzerPaths.TEMP_FOLDER_PATH + File.separator + name;
SyncResult res = CommunicatorUtils.pull(targetPath, binaryPath);
- if (null != res && RESULT_OK == res.getCode()) {
+ if (null != res && res.isOk()) {
System.out.println("binary copy success!!");//$NON-NLS-1$
} else {
System.out.println("Failed to get " + targetPath); //$NON-NLS-1$
if (!targetHashCode.equals(localHashCode)) {
SyncResult res = CommunicatorUtils.pull(targetPath,
AnalyzerPaths.TEMP_FOLDER_PATH);
- if (null != res && RESULT_OK == res.getCode()) {
+ 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$
System.out.println("wait for ack... [send message : " + message
+ " ]");
int readsize = -1;
- // while (readsize < 0) {
- byte[] cbuf = new byte[64];
+ // read buffer size is sufficient??
+ byte[] cbuf = new byte[DACommunicator.READ_BUFFER_SIZE * 2];
blocked = true;
readsize = controlSock.getInputStream().read(cbuf);
blocked = false;
import static org.tizen.dynamicanalyzer.common.CommonConstants.INT_SIZE;
import static org.tizen.dynamicanalyzer.common.CommonConstants.LONG_SIZE;
-import static org.tizen.sdblib.service.SyncServiceConstants.RESULT_OK;
import java.io.File;
import java.io.IOException;
import org.tizen.dynamicanalyzer.handlers.ReplayTraceHandler;
import org.tizen.dynamicanalyzer.handlers.StopHandler;
import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
-import org.tizen.dynamicanalyzer.services.RecordStateSourceProvider;
import org.tizen.dynamicanalyzer.swap.model.ByteUtils;
import org.tizen.dynamicanalyzer.swap.model.DATime;
import org.tizen.dynamicanalyzer.swap.model.LogContainer;
@Override
public void run() {
SyncResult res = CommunicatorUtils.pull(from, to);
- if (null != res && RESULT_OK == res.getCode()) {
+ if (null != res && res.isOk()) {
DACommunicator.removeCommand(from);
} else {
System.out.println("Failed to get '" + from + "' file"); //$NON-NLS-1$ //$NON-NLS-2$
DACommunicator.setRunning(false);
}
- public void testParsing(byte[] input) {
- byte[] buf = input;
- BasicDataMessage dataMessage = null;
- if (null == dataMessage) {
- dataMessage = new BasicDataMessage();
- buf = dataMessage.makeData(buf);
- }
- // else {
- // buf = dataMessage.addData(buf);
- // }
-
- while (dataMessage.isComplete()) {
- // dataMessage push to queue
- processMessage(dataMessage);
- dataMessage = new BasicDataMessage();
- buf = dataMessage.makeData(buf);
- }
-
- // System.arraycopy(empty, 0, buf, 0, empty.length);
- }
-
public void startMessageParsing(Socket dataSocket) {
- // byte[] empty = new byte[1024];
byte[] buf = new byte[1024 * 10];
InputStream inputStream = null;
if (readSize <= 0) {
continue;
} else {
- System.out.println("read size : " + readSize);
+// System.out.println("read size : " + readSize);
readBuf = new byte[readSize];
System.arraycopy(buf, 0, readBuf, 0, readSize);
}
while (null != dataMessage && dataMessage.isComplete()
&& DACommunicator.isRunning()) {
// dataMessage push to queue
- System.out.println("dataMessage seq "
- + dataMessage.getSeq());
processMessage(dataMessage);
dataMessage = null;
if (readBuf.length > 0) {
}
private void processMessage(BasicDataMessage data) {
+ data.printMessage();
int messageId = data.getId();
LogData log = null;
+
switch (messageId) {
case DataChannelConstants.MSG_PROCESS_INFO:
// setting process info
*/
package org.tizen.dynamicanalyzer.swap.logparser;
-import static org.tizen.sdblib.service.SyncServiceConstants.RESULT_OK;
-
import java.io.File;
import java.util.List;
public void run() {
while (true && count < 5) {
SyncResult res = CommunicatorUtils.pull(from, to);
- if (null != res && RESULT_OK == res.getCode()) {
+ if (null != res && res.isOk()) {
DACommunicator.removeCommand(from);
/* image resizing */
String smallImagePath = AnalyzerManager.getProject()
public class RunTimeConfiguration implements SWAPModel {
private long features = 0;
+ private long preFeatures = 0;
private int systemTraceInterval = 1000;
- private int dataMessageInterval = 1000;
+ private int dataMessageInterval = 10;
+
+ public long getPreFeatures() {
+ return preFeatures;
+ }
+
+ public void setPreFeatures(long preFeatures) {
+ this.preFeatures = preFeatures;
+ }
public long getFeatures() {
return features;
@Override
public byte[] getByteValue() {
- return ByteUtils.getByte(features, systemTraceInterval,
+ return ByteUtils.getByte(preFeatures, features, systemTraceInterval,
dataMessageInterval);
}
reqSize = 0;
}
// parsing header
-// ByteUtils.printByteArray(headerBuffer);
+ // ByteUtils.printByteArray(headerBuffer);
id = ByteUtils.toInt(headerBuffer);
- if (id < 0) {
- System.out.println("debug");
- }
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);
-// System.out.println("time " + sec + " nano " + nano);
long startSec = AnalyzerManager.getProject().getStartTime()
.getSec();
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);
+// 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;
payloadSize = payload.length;
}
+ // for lower version
private static int mappingId(int oldId) {
int newId = -1;
switch (oldId) {
public String getCallstack() {
return callstackLog;
}
+
+ public void printMessage() {
+ String strId = String.format("%4x", id);
+ System.out.println("Message [id : " + strId + "] [seq :" + seq
+ + "] [ Time : " + time + " ms]");
+ ByteUtils.printByteArray(payload);
+ }
}
int processCount = ByteUtils.toInt(payload, index);
index += INT_SIZE;
- // String processLoad = parseLoad(index, payload);
- // index += (processCount * (INT_SIZE + FLOAT_SIZE));
- //
- // int diskReadSize = ByteUtils.toInt(payload, index);
- // index += INT_SIZE;
- //
- // int diskWriteSize = ByteUtils.toInt(payload, index);
- // index += INT_SIZE;
- //
- // int networkSendSize = ByteUtils.toInt(payload, index);
- // index += INT_SIZE;
- //
- // int networkReceiveSize = ByteUtils.toInt(payload, index);
+ String processLoad = parseLoad(index, payload);
+ index += (processCount * (INT_SIZE + FLOAT_SIZE));
+
+ int diskReadSize = ByteUtils.toInt(payload, index);
+ index += INT_SIZE;
+
+ int diskWriteSize = ByteUtils.toInt(payload, index);
+ index += INT_SIZE;
+
+ int networkSendSize = ByteUtils.toInt(payload, index);
+ index += INT_SIZE;
+
+ int networkReceiveSize = ByteUtils.toInt(payload, index);
data.setEnergy(energy);
data.setWifi(wifi);
data.setThreadCount(threadCount);
data.setThreadLoad(threadLoad);
data.setProcessCount(processCount);
- // data.setProcessLoad(processLoad);
- // data.setDiskReadSize(diskReadSize);
- // data.setDiskWriteSize(diskWriteSize);
- // data.setNetworkSendSize(networkSendSize);
- // data.setNetworkReceiveSize(networkReceiveSize);
+ data.setProcessLoad(processLoad);
+ data.setDiskReadSize(diskReadSize);
+ data.setDiskWriteSize(diskWriteSize);
+ data.setNetworkSendSize(networkSendSize);
+ data.setNetworkReceiveSize(networkReceiveSize);
}
private static void createProfileData(LogData log, byte[] payload) {
package org.tizen.dynamicanalyzer.swap.model.probe2;
-import org.tizen.dynamicanalyzer.common.CommonConstants;
import org.tizen.dynamicanalyzer.communicator.DACommunicator;
-import org.tizen.dynamicanalyzer.swap.model.DATime;
import org.tizen.dynamicanalyzer.swap.model.data.BasicDataMessage;
public class LogData {
private void doApply() {
ConfigurationDialogValues.getInstance().applySettingValueToConfigFile();
- DACommunicator.sendRuntimeMessage(DACommunicator.MSG_TYPE_CONFIG, null);
+
+ if (DACommunicator.isRunning()) {
+ DACommunicator.sendRuntimeMessage(DACommunicator.MSG_TYPE_CONFIG,
+ null);
+ }
}
private void doBack() {
package org.tizen.dynamicanalyzer.utils;
-import static org.tizen.sdblib.service.SyncServiceConstants.RESULT_OK;
-
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.File;
public class AnalyzerUtil {
private static IWorkbenchWindow window = null;
-// private static String recordState = RecordStateSourceProvider.RECORD_READY;
+ // private static String recordState =
+ // RecordStateSourceProvider.RECORD_READY;
private static final int ENLARGED_LENGTH = 12;
// FIXME start
return CommonConstants.EMPTY;
}
-// public static String getRecordState() {
-// return recordState;
-// }
+ // public static String getRecordState() {
+ // return recordState;
+ // }
public static ViewPart getViewPart(String id) {
IWorkbenchPage page = getWorkbenchWindow().getActivePage();
});
}
-// public static void setRecordState(final String state) {
-// recordState = state;
-// }
+ // public static void setRecordState(final String state) {
+ // recordState = state;
+ // }
public static int getTableItemHeight(Grid table) {
GC gc = new GC(table);
+ AnalyzerConstants.API_NAME_FILE_NAME;
SyncResult res = CommunicatorUtils.pull(device,
AnalyzerPaths.DA_API_MAP_PATH, apiFilePath);
- if (null != res && RESULT_OK == res.getCode()) {
+ if (null != res && res.isOk()) {
System.out.println("api map copying success!!");//$NON-NLS-1$
} else {
System.out.println("Failed to get " + apiFilePath); //$NON-NLS-1$