public void startTimer() {
timer = new Timer();
- timer.scheduleAtFixedRate(new AddBufferTimerTask(),
- MSG_BUFFER_TIMER_DELAY, MSG_BUFFER_TIMER_PERIOD);
+ timer.scheduleAtFixedRate(new AddBufferTimerTask(), MSG_BUFFER_TIMER_DELAY,
+ MSG_BUFFER_TIMER_PERIOD);
}
public void stopTimer() {
pinfo.setDropLog(true);
}
- ProcessMemoryMap pMap = new ProcessMemoryMap(pinfo.getPid(),
- subTime.getLongTime());
+ ProcessMemoryMap pMap = new ProcessMemoryMap(pinfo.getPid(), subTime.getLongTime());
pinfo.addProcessMemoryMap(pMap);
for (int i = 0; i < dependantLibCount; i++) {
index += LONG_SIZE;
String libPath = ByteUtil.getString(data, index);
- LibraryObject libObj = new LibraryObject(project
- .getDeviceStatusInfo().getBinaryInfo(libPath).getID(),
- lowestAddr, highestAddr);
+ LibraryObject libObj = new LibraryObject(project.getDeviceStatusInfo()
+ .getBinaryInfo(libPath).getID(), lowestAddr, highestAddr);
index += ByteUtil.getStringLength(data, index);
pMap.addLibraryMap(libObj);
}
- Logger.debug("process info start time : " + capturedTime.getSec()
- + " " + capturedTime.getNano());
+ Logger.debug("process info start time : " + capturedTime.getSec() + " "
+ + capturedTime.getNano());
pMap.setMainBinary(new LibraryObject(project.getDeviceStatusInfo()
.getBinaryInfo(targetBinaryPath).getID(), lowAddr, highAddr));
AnalyzerManager.setProcessInfoArrived(true);
- ThreadChartManager.getInstance().getThreadDataManager()
- .createMainThreadItem(pid);
+ ThreadChartManager.getInstance().getThreadDataManager().createMainThreadItem(pid);
}
private void memoryMapChanged(byte[] data) {
DATime subTime = changeTime.subtract(profileStartTime);
ProcessMemoryMap lastMap = pinfo.getLastProcessMemoryMap();
- ProcessMemoryMap newMap = new ProcessMemoryMap(pinfo.getPid(),
- subTime.getLongTime());
+ ProcessMemoryMap newMap = new ProcessMemoryMap(pinfo.getPid(), subTime.getLongTime());
pinfo.addProcessMemoryMap(newMap);
newMap.copy(lastMap);
String libPath = LogDataUtils.getString(index, data);
index += LogDataUtils.getStringLength(index, data);
- BinaryInfo bininfo = project.getDeviceStatusInfo().getBinaryInfo(
- libPath);
- LibraryObject libObj = new LibraryObject(bininfo.getID(), lowAddr,
- highAddr);
+ BinaryInfo bininfo = project.getDeviceStatusInfo().getBinaryInfo(libPath);
+ LibraryObject libObj = new LibraryObject(bininfo.getID(), lowAddr, highAddr);
newMap.addLibraryMap(libObj);
} else {
newMap.removeLibrary(lowAddr, highAddr);
}
try {
- printWriter = new PrintWriter(new BufferedWriter(
- new FileWriter(logPath)), true);
+ printWriter = new PrintWriter(new BufferedWriter(new FileWriter(logPath)), true);
} catch (IOException e) {
e.printStackTrace();
}
try {
byte[] header = new byte[MSG_HEADER_SIZE];
+ dataSocket.setSoTimeout(5000);
inputStream = dataSocket.getInputStream();
while (true) {
int readSize = 0;
int toRead = MSG_HEADER_SIZE;
while (toRead > 0) {
- readSize = inputStream.read(header, MSG_HEADER_SIZE
- - toRead, toRead);
+ readSize = inputStream.read(header, MSG_HEADER_SIZE - toRead, toRead);
toRead -= readSize;
if (!DACommunicator.isRunning() && readSize == -1) {
// manager socket closed!!
// AnalyzerUtil.printHexdecimal(id);
// System.out.println();
- int payloadSize = ByteUtil
- .toInt(header, MSG_PAYLOAD_SIZE_INDEX);
+ int payloadSize = ByteUtil.toInt(header, MSG_PAYLOAD_SIZE_INDEX);
byte[] payload = null;
try {
toRead = payloadSize;
while (toRead > 0) {
- readSize = inputStream.read(payload, payloadSize - toRead,
- toRead);
+ readSize = inputStream.read(payload, payloadSize - toRead, toRead);
toRead -= readSize;
if (!DACommunicator.isRunning() && readSize == -1) {
// manager socket closed!!
byte[] buffer = new byte[MSG_HEADER_SIZE + payloadSize];
System.arraycopy(header, 0, buffer, 0, MSG_HEADER_SIZE);
- System.arraycopy(payload, 0, buffer, MSG_HEADER_SIZE,
- payloadSize);
+ System.arraycopy(payload, 0, buffer, MSG_HEADER_SIZE, payloadSize);
if (PRINT_DATA_LOG_TOFILE && printWriter != null) {
- printWriter.printf("%d %d %d %d %d :", id,
- ByteUtil.toInt(header, 4),
- ByteUtil.toInt(header, 8),
- ByteUtil.toInt(header, 12), payloadSize);
+ printWriter.printf("%d %d %d %d %d :", id, ByteUtil.toInt(header, 4),
+ ByteUtil.toInt(header, 8), ByteUtil.toInt(header, 12), payloadSize);
for (int k = 0; k < payloadSize; k++)
printWriter.printf("%02x ", payload[k]);
printWriter.printf("\n");
processMessage(buffer);
if (id == DataChannelConstants.MSG_DATA_TERMINATE) {
Logger.debug("message data terminate arrived!!!");
- Logger.performance("TEST", "While tracing",
- "Terminate Application");
+ Logger.performance("TEST", "While tracing", "Terminate Application");
if (AnalyzerManager.getProcessCount() == 0) {
break;
}
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
- StopProcessManager
- .getInstance()
- .stopProcessStart(
- AnalyzerLabels.STOP_PROCESS_DLG_SUMMARIZING_DATA); // socket
+ StopProcessManager.getInstance().stopProcessStart(
+ AnalyzerLabels.STOP_PROCESS_DLG_SUMMARIZING_DATA); // socket
// timeout
}
});
} catch (IOException e) {
Logger.debug("### socket timeout - TODO: show this as a dialog."); //$NON-NLS-1$
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- StopProcessManager
- .getInstance()
- .stopProcessStart(
- AnalyzerLabels.STOP_PROCESS_DLG_DEVICE_DISCONNECTED); // socket
- // timeout
- }
- });
+ if (AnalyzerManager.isRunning()) {
+ Display.getDefault().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ StopProcessManager.getInstance().stopProcessStart(
+ AnalyzerLabels.STOP_PROCESS_DLG_DEVICE_DISCONNECTED); // socket
+ // timeout
+ }
+ });
+ }
endingSteps();
} finally {
if (printWriter != null) {
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
- ToolbarArea.getInstance().setToolbarState(
- ToolbarArea.TOOLBAR_STATE_READY);
+ ToolbarArea.getInstance().setToolbarState(ToolbarArea.TOOLBAR_STATE_READY);
}
});
stopTimer();
case DataChannelConstants.MSG_DATA_SYSTEM:
Runtime runtime = Runtime.getRuntime();
- if ((runtime.totalMemory() - runtime.freeMemory()) >= runtime
- .maxMemory() * 0.8) {
+ if ((runtime.totalMemory() - runtime.freeMemory()) >= runtime.maxMemory() * 0.8) {
ToolbarArea.getInstance().stopTrace();
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
- final Shell shell = WorkbenchUtil.getWorkbenchWindow()
- .getShell();
- DADialog dialog = new DADialog(shell, SWT.NONE, 550,
- 153);
+ final Shell shell = WorkbenchUtil.getWorkbenchWindow().getShell();
+ DADialog dialog = new DADialog(shell, SWT.NONE, 550, 153);
dialog.setIcon(ImageResources.DIALOG_WARNING_ICON);
dialog.setMessage(AnalyzerLabels.HEAP_MEMORY_WARNING_PRE
+ PathManager.DA_INSTALL_PATH
String name = ByteUtil.getString(data, index);
index += ByteUtil.getStringLength(data, index);
- ProcessInformation process = AnalyzerManager.getProject()
- .getProcessInformation(pid);
+ ProcessInformation process = AnalyzerManager.getProject().getProcessInformation(pid);
if (null != process) {
process.setProcessName(name);
}
break;
default: // MSG_PROBE
- if (AnalyzerManager.isProcessInfoArrived() && id > 0x0100
- && id < 0x0200) {
+ if (AnalyzerManager.isProcessInfoArrived() && id > 0x0100 && id < 0x0200) {
log = LogDataFactory.createInstance(data);
if (null != log) {
buffer.add(log);