#1238 - Refactor MetaInfoManager - collect query plan stats, fix collection of stats on UpdateQuery

This commit is contained in:
Rob Bygrave
2018-01-19 01:07:37 +13:00
parent b9ae76d465
commit 07cdf64ece
27 changed files with 355 additions and 108 deletions
@@ -13,6 +13,8 @@ class DProfileLocation implements ProfileLocation {
private String location;
private String shortDescription;
private final int lineNumber;
DProfileLocation() {
@@ -31,10 +33,16 @@ class DProfileLocation implements ProfileLocation {
// atomic assignment so happy with this
if (location == null) {
location = create();
shortDescription = shortDesc(location);
}
return location;
}
@Override
public String shortDescription() {
return shortDescription;
}
private String create() {
StackTraceElement[] trace = Thread.currentThread().getStackTrace();
for (int i = 3; i < trace.length; i++) {
@@ -52,4 +60,20 @@ class DProfileLocation implements ProfileLocation {
return traceLine.substring(0, traceLine.length() - 1) + ":" + lineNumber + ")";
}
}
private String shortDesc(String location) {
int pos = location.lastIndexOf('(');
if (pos == -1) {
pos = location.length();
}
pos = location.lastIndexOf('.', pos);
if (pos > -1) {
pos = location.lastIndexOf('.', pos - 1);
if (pos > -1) {
return location.substring(pos + 1);
}
}
return location;
}
}