if (size == 0) {
userCallstack.add(new CallStackItem(selfCallstackUnit, time));
} else {
- if (!AnalyzerManager.isInBinaryRange(callerAddr)) {
+ if (!AnalyzerUtil.isAddrInBinaryRange(log.getPid(), log.getTime(), callerAddr)) {
CallStackUnit callbackApi = new CallStackUnit(
LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR,
LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_SYMBOL,
LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR,
defaultCallstackUnit);
}
- } else if (callerCallstackUnit.getFunctionName().contains(
- AnalyzerConstants.VIRTUAL_THUNK)) {
- CallStackUnit callbackApi = new CallStackUnit(
- LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR,
- LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_SYMBOL,
- log);
- userCallstack.add(new CallStackItem(callbackApi));
- if (addrMap
- .get(LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR) == null) {
- CallStackUnit defaultCallstackUnit = new CallStackUnit(
- LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR,
- LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_SYMBOL,
- log);
- addrMap.put(
- LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR,
- defaultCallstackUnit);
- }
- userCallstack.add(new CallStackItem(callerCallstackUnit));
+// } else if (callerCallstackUnit.getFunctionName().contains(
+// AnalyzerConstants.VIRTUAL_THUNK)) {
+// CallStackUnit callbackApi = new CallStackUnit(
+// LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR,
+// LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_SYMBOL,
+// log);
+// userCallstack.add(new CallStackItem(callbackApi));
+// if (addrMap
+// .get(LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR) == null) {
+// CallStackUnit defaultCallstackUnit = new CallStackUnit(
+// LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR,
+// LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_SYMBOL,
+// log);
+// addrMap.put(
+// LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR,
+// defaultCallstackUnit);
+// }
+// userCallstack.add(new CallStackItem(callerCallstackUnit));
} else {
CallStackUnit callerCsa = addrMap.get(callerAddr);
if (null == callerCsa) {
if (selfCallstackUnit.getFunctionName().equals(
removeCallStackUnit.getFunctionName())) {
userCallstack.remove(size - 1);
- if (size - 2 > 0) {
- if (callerCallstackUnit.getFunctionName().contains(
- AnalyzerConstants.VIRTUAL_THUNK)) {
- if (callerCallstackUnit.getFunctionName().equals(
- userCallstack.get(size - 2).getCallStackUnit().getFunctionName())) {
- userCallstack.remove(size - 2);
- } else {
- System.out
- .println("makeUserCallstack : [virtual thunk] EXIT caller is not the same"
- + "as top of user callstack after remove EXIT self");
- }
- }
- }
+// if (size - 2 > 0) {
+// if (callerCallstackUnit.getFunctionName().contains(
+// AnalyzerConstants.VIRTUAL_THUNK)) {
+// if (callerCallstackUnit.getFunctionName().equals(
+// userCallstack.get(size - 2).getCallStackUnit().getFunctionName())) {
+// userCallstack.remove(size - 2);
+// } else {
+// System.out
+// .println("makeUserCallstack : [virtual thunk] EXIT caller is not the same"
+// + "as top of user callstack after remove EXIT self");
+// }
+// }
+// }
size = userCallstack.size();
if (size - 1 > 0) {
CallStackUnit checkCallStackUnit = userCallstack
CallStackData callstackData = new CallStackData(seq);
- if ((size == 0) || (!AnalyzerManager.isInBinaryRange(callerAddr))) {
+ if ((size == 0) ||
+ (!AnalyzerUtil.isAddrInBinaryRange(log.getPid(), log.getTime(), callerAddr))) {
CallStackUnit callbackApi = new CallStackUnit(
LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR,
LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_SYMBOL, inputData);
}
}
- private CallstackTree current = null;
+ private HashMap<Integer, CallstackTree> callstackTreeByTidMap = new HashMap<Integer, CallstackTree>();
private int totalSampleCount = 0;
private BaseCallstackManager callstackManager = null;
return symbolSeqHash;
}
+ public CallstackTree getCurrentCallstackTree(int tid) {
+ CallstackTree current = callstackTreeByTidMap.get(tid);
+ return current;
+ }
+
+ public void putCurrentCallstackTree(int tid, CallstackTree current) {
+ callstackTreeByTidMap.put(tid, current);
+ return;
+ }
+
public String getCpuRate(ProfilingData data, boolean exclusive) {
int count = 0;
double rate = 0.;
}
// calculate internal time
+ CallstackTree current = getCurrentCallstackTree(tid);
if (type == LogCenterConstants.USER_FUNCTION_EVENT_TYPE_EXIT) {
if (null == current) {
// bug
.getLastElapsedTime());
}
child.addExclusiveElapsedTime(current.getInclusiveExeTime());
- current = current.getParent();
+ putCurrentCallstackTree(tid, current.getParent());
}
} else {
if (null == current) {
CallstackTree ct = new CallstackTree(child, null);
- current = ct;
+ putCurrentCallstackTree(tid, ct);
} else {
CallstackTree ct = new CallstackTree(child, current);
current.addChild(ct);
- current = ct;
+ putCurrentCallstackTree(tid, ct);
}
}
}
}
// calculate internal time
+ CallstackTree current = getCurrentCallstackTree(tid);
if (type == MSG_FUNCTION_EXIT) {
if (null == current) {
// bug
.getLastElapsedTime());
}
child.addExclusiveElapsedTime(current.getInclusiveExeTime());
- current = current.getParent();
+ putCurrentCallstackTree(tid, current.getParent());
}
} else {
if (null == current) {
CallstackTree ct = new CallstackTree(child, null);
- current = ct;
+ putCurrentCallstackTree(tid, ct);
} else {
CallstackTree ct = new CallstackTree(child, current);
current.addChild(ct);
- current = ct;
+ putCurrentCallstackTree(tid, ct);
}
}
}