return false;
}
- public static void setAppInfoArrived(boolean arrived) {
+ public static void setProcessInfoArrived(boolean arrived) {
appInfoArrived = arrived;
}
- public static boolean isAppInfoArrived() {
+ public static boolean isProcessInfoArrived() {
return appInfoArrived;
}
}
public boolean makeSymbol(String path) {
+ if (null == path || path.isEmpty()) {
+ return false;
+ }
+
this.sourcePath = path;
if (null != symbolMap) {
symbolMap.clear();
symbolMap.clear();
symbolMap = null;
}
+
+ if (null != addrSymbolPairs) {
+ addrSymbolPairs.clear();
+ addrSymbolPairs = null;
+ }
}
public List<AddrSymbolPair> getAddrSymbolPairs() {
switch (messageIndex) {
case AnalyzerConstants.MSG_APP_INFO: /* app info : 1 */
- if (!AnalyzerManager.isAppInfoArrived()) {
+ if (!AnalyzerManager.isProcessInfoArrived()) {
processAppInfo(messages[MSG_PAYLOAD_INDEX]);
- AnalyzerManager.setAppInfoArrived(true);
+ AnalyzerManager.setProcessInfoArrived(true);
}
break;
case AnalyzerConstants.MSG_USER_PROFILING_SAMPLE: /* sample : 3 */
}
public List<AddrSymbolPair> getSymbols() {
+ if (null == binInfo) {
+ return null;
+ }
+ symbolExtractor.clear();
+ symbolExtractor.makeSymbol(binInfo.getPath());
return symbolExtractor.getAddrSymbolPairs();
}
}
}
// 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,
List<AddrSymbolPair> symbols = selectedApp.getSymbols();
List<FunctionInst> functionInstList = appInst.getFunctionInstList();
- int size = symbols.size();
+ int size = (symbols == null)? 0 : symbols.size();
appInst.setFunctionCount(size);
for (int i = 0; i < size; i++) {
AddrSymbolPair addrSymbol = symbols.get(i);
index += LONG_SIZE;
highAddr = ByteUtils.toLong(payload, index);
index += LONG_SIZE;
- appType = ByteUtils.toInt(payload, index);
- index += INT_SIZE;
+// appType = ByteUtils.toInt(payload, index);
+// index += INT_SIZE;
binaryType = ByteUtils.toInt(payload, index);
index += INT_SIZE;
binaryPath = ByteUtils.getString(payload, index);
// pInfo.setStartTime(startTime);
pInfo.setLowestAddress(lowAddr);
pInfo.setHighestAddress(highAddr);
- pInfo.setAppType(appType);
+// pInfo.setAppType(appType);
pInfo.setBinaryType(binaryType);
pInfo.setBinaryPath(binaryPath);
pInfo.setDepLibCount(dependantLibCount);
- AnalyzerManager.setAppInfoArrived(true);
+ AnalyzerManager.setProcessInfoArrived(true);
}
private String getImageName(String fullPath) {
import org.tizen.dynamicanalyzer.swap.model.LogContainer;
import org.tizen.dynamicanalyzer.swap.model.data.ApiNameManager;
import org.tizen.dynamicanalyzer.swap.model.data.BasicDataMessage;
+import org.tizen.dynamicanalyzer.swap.model.probe2.ContextSwitchData;
import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
import org.tizen.dynamicanalyzer.swap.model.probe2.ProbeCommonData;
import org.tizen.dynamicanalyzer.swap.model.probe2.ProfileData;
}
pushLog(log, msg, logPack);
} else if (log instanceof ProfileData) {
+ if (!AnalyzerManager.isProcessInfoArrived()) {
+ continue;
+ }
ProfileData pData = (ProfileData) log;
String apiName = pData.getApiName();
if (null == apiName || apiName.isEmpty()
setFuncName(pData);
}
- if (LogParser.isDrapCallTraceLog()) {
+ if (!isDrapCallTraceLog()) {
apiName = pData.getApiName();
if (!apiName.equals(OSP_MAIN)) {
continue;
pData)) {
continue;
}
- // pushLog(log, msg, logPack);
+ pushLog(log, msg, logPack);
/* user callstack create by entry and exit */
AnalyzerManager.getCallstackManager().makeUserCallstack(
pData,
FunctionUsageProfiler.getInstance()
.getProfileDataMaker());
- } else if (log instanceof ReplayData) {
+ } else if (log instanceof ReplayData
+ || log instanceof ContextSwitchData) {
pushLog(log, msg, logPack);
} else {
if (log instanceof ScreenShotData) {
String baseAddr = Long.toString(AnalyzerManager.getProject()
.getBaseAddress());
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);
logPack.setLogs(logData.getId(), logData);
logPack.setMessages(msg.getId(), msg);
}
-
}
--- /dev/null
+package org.tizen.dynamicanalyzer.swap.model.probe2;
+
+import org.tizen.dynamicanalyzer.swap.model.data.BasicDataMessage;
+
+public class ContextSwitchData extends LogData {
+
+ long pcAddr = 0;
+ int pid = 0;
+ int tid = 0;
+ int cpuNum = 0;
+
+ public ContextSwitchData(BasicDataMessage data) {
+ super(data);
+ // TODO Auto-generated constructor stub
+ }
+
+ public long getPcAddr() {
+ return pcAddr;
+ }
+
+ public void setPcAddr(long pcAddr) {
+ this.pcAddr = pcAddr;
+ }
+
+ public int getPid() {
+ return pid;
+ }
+
+ public void setPid(int pid) {
+ this.pid = pid;
+ }
+
+ public int getTid() {
+ return tid;
+ }
+
+ public void setTid(int tid) {
+ this.tid = tid;
+ }
+
+ public int getCpuNum() {
+ return cpuNum;
+ }
+
+ public void setCpuNum(int cpuNum) {
+ this.cpuNum = cpuNum;
+ }
+}
case MSG_RECORD:
createRecordData(data, paylaod);
break;
+ case MSG_CONTEXT_SWITCH_ENTRY:
+ case MSG_CONTEXT_SWITCH_EXIT:
+ createContextSwitchData(data, paylaod);
+ break;
case LogCenterConstants.LOG_USER_FUNCTION:
createUserFunctionData(data, paylaod);
break;
index += LONG_SIZE;
long fdValue = ByteUtils.toLong(payload, index);
index += LONG_SIZE;
- int fdType = ByteUtils.toInt(payload, index);
- index += INT_SIZE;
int fdApiType = ByteUtils.toInt(payload, index);
index += INT_SIZE;
long fileSize = ByteUtils.toLong(payload, index);
data.setSize(size);
data.setFdValue(fdValue);
- data.setFdType(fdType);
data.setFdApiType(fdApiType);
data.setFileSize(fileSize);
data.setFilePath(filePath);
index += length;
long formPointer = ByteUtils.toLong(payload, index);
+ index += LONG_SIZE;
length = LogDataUtils.getStringLength(index, payload);
temp = new byte[length];
createCommonData(log, payload);
ThreadData data = (ThreadData) log;
-// long pThreadId = ByteUtils.toLong(payload, index);
-// index += LONG_SIZE;
-// long ospThreadId = ByteUtils.toLong(payload, index);
-// index += LONG_SIZE;
- int pThreadId = ByteUtils.toInt(payload, index);
- index += INT_SIZE;
- int ospThreadId = ByteUtils.toInt(payload, index);
- index += INT_SIZE;
+ long pThreadId = ByteUtils.toLong(payload, index);
+ index += LONG_SIZE;
+ long ospThreadId = ByteUtils.toLong(payload, index);
+ index += LONG_SIZE;
int threadType = ByteUtils.toInt(payload, index);
index += INT_SIZE;
int apiType = ByteUtils.toInt(payload, index);
int coreCount = DACommunicator.getSelectedDevice().getTargetInfo()
.getCpuCount();
-
float appCpuUsage = ByteUtils.toFloat(payload, index);
index += FLOAT_SIZE;
-
+
String cpuFrequency = parseCpu(index, payload);
index += (FLOAT_SIZE * coreCount);
-
+
String cpuLoad = parseCpu(index, payload);
index += (FLOAT_SIZE * coreCount);
-
+
int threadCount = ByteUtils.toInt(payload, index);
index += INT_SIZE;
String processLoad = parseLoad(index, payload);
index += (processCount * (INT_SIZE + FLOAT_SIZE));
-
+
int virtualMemory = ByteUtils.toInt(payload, index);
index += INT_SIZE;
int totalUsedDrive = ByteUtils.toInt(payload, index);
index += INT_SIZE;
-
+
int diskReadSize = ByteUtils.toInt(payload, index);
index += INT_SIZE;
int diskSectorsWritten = ByteUtils.toInt(payload, index);
index += INT_SIZE;
-
+
int networkSendSize = ByteUtils.toInt(payload, index);
index += INT_SIZE;
int networkReceiveSize = ByteUtils.toInt(payload, index);
index += INT_SIZE;
-
+
int wifi = ByteUtils.toInt(payload, index);
index += INT_SIZE;
int dnet = ByteUtils.toInt(payload, index);
index += INT_SIZE;
-
-
+
int energy = ByteUtils.toInt(payload, index);
data.setEnergy(energy);
long callerPcAddr = ByteUtils.toLong(payload, index);
index += LONG_SIZE;
- int probeType = ByteUtils.toInt(payload, index);
- index += INT_SIZE;
- int probeSubType = ByteUtils.toInt(payload, index);
- index += INT_SIZE;
+ byte[] temp = new byte[4];
+ System.arraycopy(payload, index, temp, 0, 2);
+ int probeType = ByteUtils.toInt(temp, 0);
+ index += 2;
+
+ System.arraycopy(payload, index, temp, 0, 2);
+ int probeSubType = ByteUtils.toInt(temp, 0);
+ index += 2;
+
pid = ByteUtils.toInt(payload, index);
index += INT_SIZE;
tid = ByteUtils.toInt(payload, index);
}
}
+ private static void createContextSwitchData(LogData log, byte[] payload) {
+ ContextSwitchData data = (ContextSwitchData) log;
+
+ long pcAddr = 0; // profiling common
+ int pid = 0; // profiling common
+ int tid = 0; // profiling common
+ int cpuNum = 0; // profiling common
+
+ pcAddr = ByteUtils.toLong(payload, index);
+ index += LONG_SIZE;
+ pid = ByteUtils.toInt(payload, index);
+ index += INT_SIZE;
+ tid = ByteUtils.toInt(payload, index);
+ index += INT_SIZE;
+ cpuNum = ByteUtils.toInt(payload, index);
+
+ data.setPcAddr(pcAddr);
+ data.setPid(pid);
+ data.setTid(tid);
+ data.setCpuNum(cpuNum);
+
+ }
+
private static void createRecordData(LogData log, byte[] payload) {
ReplayData data = (ReplayData) log;
long size = 0;
long fdValue = 0;
- int fdType = 0; // TODO: short
int fdApiType = 0; // TODO: short
long fileSize = 0;
String filePath = null;
this.fdValue = fdValue;
}
- public int getFdType() {
- return fdType;
- }
-
- public void setFdType(int fdType) {
- this.fdType = fdType;
- }
-
public int getFdApiType() {
return fdApiType;
}
output = new UserFunctionData(input);
break;
case MSG_DATA_SAMPLE:
+ case MSG_FUNCTION_ENTRY:
+ case MSG_FUNCTION_EXIT:
// profiling sample log
output = new ProfileData(input);
((ProfileData) output).setCallstack(input.getCallstack());
// replay log
output = new ReplayData(input);
break;
+ case MSG_CONTEXT_SWITCH_ENTRY:
+ case MSG_CONTEXT_SWITCH_EXIT:
+ output = new ContextSwitchData(input);
+ break;
default:
return null;
}
import org.tizen.dynamicanalyzer.common.DASelectionData;
import org.tizen.dynamicanalyzer.model.TableInput;
import org.tizen.dynamicanalyzer.swap.model.probe2.LogData;
+import org.tizen.dynamicanalyzer.swap.model.probe2.ProfileData;
import org.tizen.dynamicanalyzer.swap.model.probe2.UserFunctionData;
import org.tizen.dynamicanalyzer.ui.common.UICommonConstants;
import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
List<TableInput> input = new ArrayList<TableInput>();
int size = userLog.size();
for (int i = 0; i < size; i++) {
- // create text
- UserFunctionData data = (UserFunctionData) userLog.get(i);
+ LogData logData = userLog.get(i);
List<String> text = new ArrayList<String>();
- String time = Formatter.toTimeFormat(data.getTime());
- text.add(time);
- text.add(Integer.toString(data.getTid()));
- text.add(data.getApiName());
-
+ if (logData instanceof UserFunctionData) {
+ // create text
+ UserFunctionData data = (UserFunctionData) logData;
+ String time = Formatter.toTimeFormat(data.getTime());
+ text.add(time);
+ text.add(Integer.toString(data.getTid()));
+ text.add(data.getApiName());
+ } else if (logData instanceof ProfileData) {
+ ProfileData data = (ProfileData) logData;
+ String time = Formatter.toTimeFormat(data.getTime());
+ text.add(time);
+ text.add(Integer.toString(data.getTid()));
+ text.add(data.getApiName());
+ } else {
+ System.out.println("wrong log data in calltrace view");
+ continue;
+ }
// create images
// create DATableDataFormat
- DATableDataFormat tableData = new DATableDataFormat(data.getSeq());
- tableData.setLogData(data);
+ DATableDataFormat tableData = new DATableDataFormat(
+ logData.getSeq());
+ tableData.setLogData(logData);
TableInput tableInput = new TableInput();
tableInput.setText(text);
input.add(tableInput);
if (RangeDataManager.getInstance().isBeingAnalyzed()) {
- long logTime = data.getTime();
+ long logTime = logData.getTime();
long analysisStartTime = RangeDataManager.getInstance()
.getAnalysisStartTime();
long analysisEndTime = RangeDataManager.getInstance()
// }
}
}
-
+
public void setSelectionByTime(long startTime, long endTime) {
GridItem[] items = table.getItems();
int size = items.length;
@Override
public void run() {
count = 10;
- System.out.println("appinfo : " + AnalyzerManager.isAppInfoArrived()
+ System.out.println("appinfo : " + AnalyzerManager.isProcessInfoArrived()
+ "is exit :" + AnalyzerManager.isExit());
while (!AnalyzerManager.isExit()) {
if (AnalyzerManager.isRunning()
- && AnalyzerManager.isAppInfoArrived()) {
+ && AnalyzerManager.isProcessInfoArrived()) {
break;
}
count += 2;
import org.eclipse.swt.widgets.Shell;
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
-import org.tizen.dynamicanalyzer.services.RecordStateSourceProvider;
import org.tizen.dynamicanalyzer.shortcut.ShortCutManager;
import org.tizen.dynamicanalyzer.ui.summary.SummaryPage;
import org.tizen.dynamicanalyzer.ui.widgets.ProgressDialog;
@Override
public void handleClickEvent(DACustomButton button) {
// TODO : use for test code...
-
// String path = "/home/casval/work/testApp/DATizenTestApp/Dynamic Analyzer/DATizenTestApp.exe";
// ElfSymbolExtractManager.getInstance().makeSymbol(path);
// Long[] result = ElfSymbolExtractManager.getInstance()