private List<TreeNode> getDataRec(Map<String, AMinMaxAvgData> map, int level, double jdbcTimeInParent, double totalJdbcTime, int totalNumCallsInContext) {
final List<TreeNode> result = new ArrayList<TreeNode>();
for(Map.Entry<String, AMinMaxAvgData> entry: getSorted(map, level == 0)) {
final AMinMaxAvgData inputData = entry.getValue();
final double jdbcTimeHere = (level == 0) ? inputData.getTotalNanos() : jdbcTimeInParent * inputData.getTotalNumInContext() / totalNumCallsInContext;
final double timeFracLocal = jdbcTimeHere / jdbcTimeInParent;
final double timeFracGlobal = jdbcTimeHere / totalJdbcTime;
final long[] dataRaw = new long[] {
(long)(timeFracGlobal * 100 * 10),
(long)(timeFracLocal * 100 * 10),
inputData.getTotalNumInContext(),
inputData.getAvgNanos() / MILLION,
inputData.getMinNanos() / MILLION,
inputData.getMaxNanos() / MILLION
};
int totalChildCalls = 0;
for(AMinMaxAvgData childData: inputData.getChildren().values()) {
totalChildCalls += childData.getTotalNumInContext();
}
result.add(new TreeNode(entry.getKey(), inputData.isSerial(), dataRaw, getDataRec(inputData.getChildren(), level+1, jdbcTimeHere, totalJdbcTime, totalChildCalls)));
}
return result;
}