diff options
Diffstat (limited to 'spark-common/src/main/java')
-rw-r--r-- | spark-common/src/main/java/me/lucko/spark/profiler/node/AbstractNode.java | 12 | ||||
-rw-r--r-- | spark-common/src/main/java/me/lucko/spark/profiler/node/StackTraceNode.java | 19 |
2 files changed, 12 insertions, 19 deletions
diff --git a/spark-common/src/main/java/me/lucko/spark/profiler/node/AbstractNode.java b/spark-common/src/main/java/me/lucko/spark/profiler/node/AbstractNode.java index 04425c6..4a209b1 100644 --- a/spark-common/src/main/java/me/lucko/spark/profiler/node/AbstractNode.java +++ b/spark-common/src/main/java/me/lucko/spark/profiler/node/AbstractNode.java @@ -50,10 +50,10 @@ public abstract class AbstractNode { return this.totalTime.longValue(); } - private AbstractNode resolveChild(String className, String methodName, int lineNumber) { + private AbstractNode resolveChild(String className, String methodName) { return this.children.computeIfAbsent( - StackTraceNode.generateKey(className, methodName, lineNumber), - name -> new StackTraceNode(className, methodName, lineNumber) + StackTraceNode.generateKey(className, methodName), + name -> new StackTraceNode(className, methodName) ); } @@ -73,7 +73,7 @@ public abstract class AbstractNode { } StackTraceElement bottom = elements[elements.length - (skip + 1)]; - resolveChild(bottom.getClassName(), bottom.getMethodName(), Math.max(0, bottom.getLineNumber())).log(elements, skip + 1, time); + resolveChild(bottom.getClassName(), bottom.getMethodName()).log(elements, skip + 1, time); } private Collection<? extends AbstractNode> getChildren() { @@ -93,12 +93,12 @@ public abstract class AbstractNode { appendMetadata(writer); // include the total time recorded for this node - writer.name("totalTime").value(getTotalTime()); + writer.name("t").value(getTotalTime()); // append child nodes, if any are present Collection<? extends AbstractNode> childNodes = getChildren(); if (!childNodes.isEmpty()) { - writer.name("children").beginArray(); + writer.name("c").beginArray(); for (AbstractNode child : childNodes) { child.serializeTo(writer); } diff --git a/spark-common/src/main/java/me/lucko/spark/profiler/node/StackTraceNode.java b/spark-common/src/main/java/me/lucko/spark/profiler/node/StackTraceNode.java index 706d2e0..7dbeb87 100644 --- a/spark-common/src/main/java/me/lucko/spark/profiler/node/StackTraceNode.java +++ b/spark-common/src/main/java/me/lucko/spark/profiler/node/StackTraceNode.java @@ -32,37 +32,30 @@ public final class StackTraceNode extends AbstractNode implements Comparable<Sta * * @param className the name of the class * @param methodName the name of the method - * @param lineNumber the line number * @return the key */ - static String generateKey(String className, String methodName, int lineNumber) { - return className + "." + methodName + "#" + lineNumber; + static String generateKey(String className, String methodName) { + return className + "." + methodName; } /** The name of the class */ private final String className; /** The name of the method */ private final String methodName; - /** The line number of the call */ - private final int lineNumber; - public StackTraceNode(String className, String methodName, int lineNumber) { + public StackTraceNode(String className, String methodName) { this.className = className; this.methodName = methodName; - this.lineNumber = lineNumber; } @Override protected void appendMetadata(JsonWriter writer) throws IOException { - writer.name("className").value(this.className); - writer.name("methodName").value(this.methodName); - if (this.lineNumber != 0) { - writer.name("lineNumber").value(this.lineNumber); - } + writer.name("cl").value(this.className); + writer.name("m").value(this.methodName); } private String key() { - return generateKey(this.className, this.methodName, this.lineNumber); + return generateKey(this.className, this.methodName); } @Override |