提交 cca8464f authored 作者: Thomas Mueller Graf's avatar Thomas Mueller Graf

Profiler: support for method-level summaries

上级 c7289919
......@@ -37,6 +37,7 @@ public class Profiler implements Runnable {
public int depth = 48;
public boolean paused;
public boolean sumClasses;
public boolean sumMethods;
private int pid;
......@@ -149,7 +150,21 @@ public class Profiler implements Runnable {
}
}
try {
for (String file : args) {
for (String arg : args) {
if (arg.startsWith("-")) {
if ("-classes".equals(arg)) {
sumClasses = true;
} else if ("-methods".equals(arg)) {
sumMethods = true;
} else if ("-packages".equals(args)) {
sumClasses = false;
sumMethods = false;
} else {
throw new IllegalArgumentException(arg);
}
continue;
}
String file = arg;
Reader reader;
LineNumberReader r;
reader = new InputStreamReader(
......@@ -170,7 +185,7 @@ public class Profiler implements Runnable {
processList(readStackTrace(r));
reader.close();
}
System.out.println(getTopTraces(3));
System.out.println(getTopTraces(5));
} catch (IOException e) {
throw new RuntimeException(e);
}
......@@ -383,6 +398,10 @@ public class Profiler implements Runnable {
int m = el.indexOf('.', index + 1);
index = m >= 0 ? m : index;
}
if (sumMethods) {
int m = el.indexOf('(', index + 1);
index = m >= 0 ? m : index;
}
String groupName = el.substring(0, index);
increment(summary, groupName, 0);
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论