Lines 318-326
Link Here
|
318 |
String funcName = rs.getString(2); |
318 |
String funcName = rs.getString(2); |
319 |
String fileName = rs.getString(5); |
319 |
String fileName = rs.getString(5); |
320 |
long line_number = rs.getLong(6); |
320 |
long line_number = rs.getLong(6); |
|
|
321 |
long context_id = rs.getLong(7); |
321 |
String createdFullName = funcName + |
322 |
String createdFullName = funcName + |
322 |
(fileName != null ? ":" + fileName + ":" + line_number : "");//NOI18N |
323 |
(fileName != null ? ":" + fileName + ":" + line_number : "");//NOI18N |
323 |
result.add(new FunctionCallImpl(new FunctionImpl(rs.getInt(1), funcName, |
324 |
result.add(new FunctionCallImpl(new FunctionImpl(rs.getInt(1), context_id, funcName, |
324 |
createdFullName, fileName), metrics)); |
325 |
createdFullName, fileName), metrics)); |
325 |
} |
326 |
} |
326 |
} finally { |
327 |
} finally { |
Lines 347-355
Link Here
|
347 |
String funcName = rs.getString(2); |
348 |
String funcName = rs.getString(2); |
348 |
String fileName = rs.getString(5); |
349 |
String fileName = rs.getString(5); |
349 |
long line_number = rs.getLong(6); |
350 |
long line_number = rs.getLong(6); |
|
|
351 |
long context_id = rs.getLong(7); |
350 |
String createdFullName = funcName + |
352 |
String createdFullName = funcName + |
351 |
(fileName != null ? ":" + fileName + ":" + line_number : "");//NOI18N |
353 |
(fileName != null ? ":" + fileName + ":" + line_number : "");//NOI18N |
352 |
result.add(new FunctionCallImpl(new FunctionImpl(rs.getInt(1), funcName, |
354 |
result.add(new FunctionCallImpl(new FunctionImpl(rs.getInt(1), context_id, funcName, |
353 |
createdFullName, fileName), metrics)); |
355 |
createdFullName, fileName), metrics)); |
354 |
} |
356 |
} |
355 |
} finally { |
357 |
} finally { |
Lines 370-376
Link Here
|
370 |
TimeIntervalDataFilter timeFilter = Util.firstInstanceOf(TimeIntervalDataFilter.class, filters); |
372 |
TimeIntervalDataFilter timeFilter = Util.firstInstanceOf(TimeIntervalDataFilter.class, filters); |
371 |
PreparedStatement select = stmtCache.getPreparedStatement( |
373 |
PreparedStatement select = stmtCache.getPreparedStatement( |
372 |
"SELECT Func.func_id, Func.func_name, SUM(FuncMetricAggr.time_incl) AS time_incl, " //NOI18N |
374 |
"SELECT Func.func_id, Func.func_name, SUM(FuncMetricAggr.time_incl) AS time_incl, " //NOI18N |
373 |
+ "SUM(FuncMetricAggr.time_excl) AS time_excl, SourceFiles.source_file, Func.line_number " + //NOI18N |
375 |
+ "SUM(FuncMetricAggr.time_excl) AS time_excl, SourceFiles.source_file, Func.line_number, Func.context_id " + //NOI18N |
374 |
" FROM Func LEFT JOIN FuncMetricAggr ON Func.func_id = FuncMetricAggr.func_id " + // NOI18N |
376 |
" FROM Func LEFT JOIN FuncMetricAggr ON Func.func_id = FuncMetricAggr.func_id " + // NOI18N |
375 |
" LEFT JOIN SourceFiles ON Func.func_source_file_id = SourceFiles.id " + // NOI18N |
377 |
" LEFT JOIN SourceFiles ON Func.func_source_file_id = SourceFiles.id " + // NOI18N |
376 |
(timeFilter != null ? "WHERE ? <= FuncMetricAggr.bucket_id AND FuncMetricAggr.bucket_id < ? " : "") + // NOI18N |
378 |
(timeFilter != null ? "WHERE ? <= FuncMetricAggr.bucket_id AND FuncMetricAggr.bucket_id < ? " : "") + // NOI18N |
Lines 391-399
Link Here
|
391 |
String name = rs.getString(2); |
393 |
String name = rs.getString(2); |
392 |
String fileName = rs.getString(5); |
394 |
String fileName = rs.getString(5); |
393 |
long line_number = rs.getLong(6); |
395 |
long line_number = rs.getLong(6); |
|
|
396 |
long context_id = rs.getLong(7); |
394 |
String createdFullName = name + |
397 |
String createdFullName = name + |
395 |
(fileName != null ? ":" + fileName + ":" + line_number : "");//NOI18N |
398 |
(fileName != null ? ":" + fileName + ":" + line_number : "");//NOI18N |
396 |
funcList.add(new FunctionCallImpl(new FunctionImpl(rs.getInt(1), name, |
399 |
funcList.add(new FunctionCallImpl(new FunctionImpl(rs.getInt(1), context_id, name, |
397 |
createdFullName, fileName), metrics)); |
400 |
createdFullName, fileName), metrics)); |
398 |
} |
401 |
} |
399 |
} finally { |
402 |
} finally { |
Lines 448-454
Link Here
|
448 |
} |
451 |
} |
449 |
} |
452 |
} |
450 |
String funcName = rs.getString(functionColumnName); |
453 |
String funcName = rs.getString(functionColumnName); |
451 |
funcList.add(new FunctionCallImpl(new FunctionImpl(rs.getInt(functionUniqueID), |
454 |
//TODO: right no will place -1 here |
|
|
455 |
//in next release FunctionDatatableDescription API should be extended to |
456 |
//handle Function_context _id |
457 |
funcList.add(new FunctionCallImpl(new FunctionImpl(rs.getInt(functionUniqueID), -1, |
452 |
funcName, funcName), offesetColumnName != null ? rs.getLong(offesetColumnName) : -1, metricValues)); |
458 |
funcName, funcName), offesetColumnName != null ? rs.getLong(offesetColumnName) : -1, metricValues)); |
453 |
} |
459 |
} |
454 |
} finally { |
460 |
} finally { |
Lines 556-565
Link Here
|
556 |
} |
562 |
} |
557 |
|
563 |
|
558 |
synchronized (funcCache) { |
564 |
synchronized (funcCache) { |
559 |
Long funcId = funcCache.get(funcName); |
565 |
Long funcId = funcCache.get("_"+ context_id + "" + funcName); |
560 |
if (funcId == null) { |
566 |
if (funcId == null) { |
561 |
funcId = ++funcIdSequence; |
567 |
funcId = ++funcIdSequence; |
562 |
AddFunctionRequest cmd = requestsProvider.addFunction(funcId, funcName, source_file_index, line_number); |
568 |
AddFunctionRequest cmd = requestsProvider.addFunction(funcId, funcName, source_file_index, line_number, context_id); |
563 |
requestsProcessor.queueRequest(cmd); |
569 |
requestsProcessor.queueRequest(cmd); |
564 |
funcCache.put(funcName, funcId); |
570 |
funcCache.put(funcName, funcId); |
565 |
} |
571 |
} |
Lines 593-599
Link Here
|
593 |
int size = path.size(); |
599 |
int size = path.size(); |
594 |
|
600 |
|
595 |
buf.append(" SELECT F.func_id, F.func_name, SUM(N.time_incl), SUM(N.time_excl), " //NOI18N |
601 |
buf.append(" SELECT F.func_id, F.func_name, SUM(N.time_incl), SUM(N.time_excl), " //NOI18N |
596 |
+ " S.source_file, N.line_number FROM Node AS N "); //NOI18N |
602 |
+ " S.source_file, N.line_number, F.context_id FROM Node AS N "); //NOI18N |
597 |
buf.append(" LEFT JOIN Func AS F ON N.func_id = F.func_id "); //NOI18N |
603 |
buf.append(" LEFT JOIN Func AS F ON N.func_id = F.func_id "); //NOI18N |
598 |
buf.append(" LEFT JOIN SourceFiles AS S ON F.func_source_file_id = S.id "); //NOI18N |
604 |
buf.append(" LEFT JOIN SourceFiles AS S ON F.func_source_file_id = S.id "); //NOI18N |
599 |
buf.append(" INNER JOIN Node N1 ON N.node_id = N1.caller_id "); //NOI18N |
605 |
buf.append(" INNER JOIN Node N1 ON N.node_id = N1.caller_id "); //NOI18N |
Lines 610-616
Link Here
|
610 |
buf.append("N").append(i + 1).append(".func_id = "); //NOI18N |
616 |
buf.append("N").append(i + 1).append(".func_id = "); //NOI18N |
611 |
buf.append(((FunctionImpl) path.get(i).getFunction()).getId()); |
617 |
buf.append(((FunctionImpl) path.get(i).getFunction()).getId()); |
612 |
} |
618 |
} |
613 |
buf.append(" GROUP BY F.func_id, F.func_name, S.source_file, N.line_number"); //NOI18N |
619 |
buf.append(" GROUP BY F.func_id, F.func_name, S.source_file, N.line_number, F.context_id"); //NOI18N |
614 |
return buf.toString(); |
620 |
return buf.toString(); |
615 |
} |
621 |
} |
616 |
|
622 |
|
Lines 619-625
Link Here
|
619 |
int size = path.size(); |
625 |
int size = path.size(); |
620 |
|
626 |
|
621 |
buf.append("SELECT F.func_id, F.func_name, SUM(N.time_incl), SUM(N.time_excl), " //NOI18N |
627 |
buf.append("SELECT F.func_id, F.func_name, SUM(N.time_incl), SUM(N.time_excl), " //NOI18N |
622 |
+ " S.source_file, N1.line_number FROM Node AS N1 "); //NOI18N |
628 |
+ " S.source_file, N1.line_number, F.context_id FROM Node AS N1 "); //NOI18N |
623 |
for (int i = 1; i < size; ++i) { |
629 |
for (int i = 1; i < size; ++i) { |
624 |
buf.append(" INNER JOIN Node AS N").append(i + 1); //NOI18N |
630 |
buf.append(" INNER JOIN Node AS N").append(i + 1); //NOI18N |
625 |
buf.append(" ON N").append(i).append(".node_id = N").append(i + 1).append(".caller_id "); //NOI18N |
631 |
buf.append(" ON N").append(i).append(".node_id = N").append(i + 1).append(".caller_id "); //NOI18N |
Lines 635-641
Link Here
|
635 |
buf.append(" N").append(i + 1).append(".func_id = "); //NOI18N |
641 |
buf.append(" N").append(i + 1).append(".func_id = "); //NOI18N |
636 |
buf.append(((FunctionImpl) path.get(i).getFunction()).getId()); |
642 |
buf.append(((FunctionImpl) path.get(i).getFunction()).getId()); |
637 |
} |
643 |
} |
638 |
buf.append(" GROUP BY F.func_id, F.func_name, S.source_file, N1.line_number"); //NOI18N |
644 |
buf.append(" GROUP BY F.func_id, F.func_name, S.source_file, N1.line_number, F.context_id"); //NOI18N |
639 |
return buf.toString(); |
645 |
return buf.toString(); |
640 |
} |
646 |
} |
641 |
|
647 |
|
Lines 902-908
Link Here
|
902 |
PreparedStatement ps = stmtCache.getPreparedStatement( |
908 |
PreparedStatement ps = stmtCache.getPreparedStatement( |
903 |
"SELECT Node.node_id, Node.caller_id, Node.func_id, Node.offset, Node.line_number, " //NOI18N |
909 |
"SELECT Node.node_id, Node.caller_id, Node.func_id, Node.offset, Node.line_number, " //NOI18N |
904 |
+ "Func.func_name, "//NOI18N |
910 |
+ "Func.func_name, "//NOI18N |
905 |
+ " SourceFiles.source_file " + // NOI18N |
911 |
+ " SourceFiles.source_file, Func.context_id " + // NOI18N |
906 |
"FROM Node LEFT JOIN Func ON Node.func_id = Func.func_id LEFT JOIN SourceFiles ON Func.func_source_file_id = SourceFiles.id " + // NOI18N |
912 |
"FROM Node LEFT JOIN Func ON Node.func_id = Func.func_id LEFT JOIN SourceFiles ON Func.func_source_file_id = SourceFiles.id " + // NOI18N |
907 |
"WHERE node_id = ?"); // NOI18N |
913 |
"WHERE node_id = ?"); // NOI18N |
908 |
ps.setLong(1, nodeID); |
914 |
ps.setLong(1, nodeID); |
Lines 914-921
Link Here
|
914 |
long line_number = rs.getLong(5); |
920 |
long line_number = rs.getLong(5); |
915 |
String fileName = rs.getString(7); |
921 |
String fileName = rs.getString(7); |
916 |
final long offset = rs.getLong(4); |
922 |
final long offset = rs.getLong(4); |
|
|
923 |
long context_id = rs.getLong(8); |
917 |
String fullFuncName = funcName + "+0x" + Long.toHexString(offset) + (fileName != null ? ":" + fileName + ":" + line_number : "");//NOI18N |
924 |
String fullFuncName = funcName + "+0x" + Long.toHexString(offset) + (fileName != null ? ":" + fileName + ":" + line_number : "");//NOI18N |
918 |
FunctionImpl func = new FunctionImpl(rs.getInt(3), funcName, fullFuncName, fileName); |
925 |
FunctionImpl func = new FunctionImpl(rs.getInt(3), context_id, funcName, fullFuncName, fileName); |
919 |
result.add(new FunctionCallImpl(func, offset, new HashMap<FunctionMetric, Object>())); |
926 |
result.add(new FunctionCallImpl(func, offset, new HashMap<FunctionMetric, Object>())); |
920 |
nodeID = rs.getInt(2); |
927 |
nodeID = rs.getInt(2); |
921 |
} else { |
928 |
} else { |
Lines 992-1015
Link Here
|
992 |
private final String module_offset; |
999 |
private final String module_offset; |
993 |
private final String source_file; |
1000 |
private final String source_file; |
994 |
|
1001 |
|
995 |
public FunctionImpl(long id, String name, String qualifiedName) { |
1002 |
public FunctionImpl(long id, long context_id, String name, String qualifiedName) { |
996 |
this(id, name, qualifiedName, FunctionNameUtils.getFunctionModule(qualifiedName), FunctionNameUtils.getFunctionModuleOffset(qualifiedName), |
1003 |
this(id, context_id, name, qualifiedName, FunctionNameUtils.getFunctionModule(qualifiedName), FunctionNameUtils.getFunctionModuleOffset(qualifiedName), |
997 |
FunctionNameUtils.getSourceFileInfo(qualifiedName) == null ? null : FunctionNameUtils.getSourceFileInfo(qualifiedName).getFileName()); |
1004 |
FunctionNameUtils.getSourceFileInfo(qualifiedName) == null ? null : FunctionNameUtils.getSourceFileInfo(qualifiedName).getFileName()); |
998 |
} |
1005 |
} |
999 |
|
1006 |
|
1000 |
public FunctionImpl(long id, String name, String qualifiedName, String source_file) { |
1007 |
public FunctionImpl(long id, long context_id, String name, String qualifiedName, String source_file) { |
1001 |
this(id, name, qualifiedName, FunctionNameUtils.getFunctionModule(qualifiedName), |
1008 |
this(id, context_id, name, qualifiedName, FunctionNameUtils.getFunctionModule(qualifiedName), |
1002 |
FunctionNameUtils.getFunctionModuleOffset(qualifiedName), source_file); |
1009 |
FunctionNameUtils.getFunctionModuleOffset(qualifiedName), source_file); |
1003 |
} |
1010 |
} |
1004 |
|
1011 |
|
1005 |
public FunctionImpl(long id, String name, String qualifiedName, String module_name, String module_offset, String source_file) { |
1012 |
public FunctionImpl(long id, long context_id, String name, String qualifiedName, String module_name, String module_offset, String source_file) { |
1006 |
this.id = id; |
1013 |
this.id = id; |
1007 |
this.name = name; |
1014 |
this.name = name; |
1008 |
this.quilifiedName = qualifiedName; |
1015 |
this.quilifiedName = qualifiedName; |
1009 |
this.module_name = module_name; |
1016 |
this.module_name = module_name; |
1010 |
this.module_offset = module_offset; |
1017 |
this.module_offset = module_offset; |
1011 |
this.source_file = source_file; |
1018 |
this.source_file = source_file; |
1012 |
this.context_id = -1; |
1019 |
this.context_id = context_id; |
1013 |
} |
1020 |
} |
1014 |
|
1021 |
|
1015 |
@Override |
1022 |
@Override |