当检测到慢函数时,会在后台线程完成慢函数的分析
private final class AnalyseTask implements Runnable {
private final long[] buffer;
private final AnalyseExtraInfo analyseExtraInfo;
private AnalyseTask(long[] buffer, AnalyseExtraInfo analyseExtraInfo) {
this.buffer = buffer;
this.analyseExtraInfo = analyseExtraInfo;
}
private long getTime(long trueId) {
return trueId & 0x7FFFFFFFFFFL;
}
private int getMethodId(long trueId) {
return (int) ((trueId >> 43) & 0xFFFFFL);
}
private boolean isIn(long trueId) {
return ((trueId >> 63) & 0x1) == 1;
}
@Override
public void run() {
analyse(buffer);
}
private void analyse(long[] buffer) {
...
//分析逻辑主要是找出最耗时的方法,可自行阅读