[6.2.0][技术优化] 优化记录消息实体获取(读写锁)获取逻辑

This commit is contained in:
renwj
2023-11-24 14:37:49 +08:00
parent 11b43efd27
commit 8c3acb64c3
3 changed files with 10 additions and 6 deletions

View File

@@ -131,7 +131,7 @@ public class HookInvokerImpl implements IHookInvoker {
builder
.append(type)
.append("#")
.append(caller == null ? "caller is null" : caller.getClass().getSimpleName())
.append(caller == null ? "caller is null" : caller.getClass().getName())
.append("#")
.append(methodName);
if (args.length > 0) {
@@ -141,7 +141,7 @@ public class HookInvokerImpl implements IHookInvoker {
if (o == null) {
continue;
}
builder.append(o.getClass().getSimpleName())
builder.append(o.getClass().getName())
.append(",");
}
@@ -151,10 +151,11 @@ public class HookInvokerImpl implements IHookInvoker {
}
builder.append("#").append(cost);
boolean flag = false;
if (extra != null && extra.length() > 0) {
builder.append("#");
builder.append(extra);
extra.setLength(0);
flag = true;
}
// dump堆栈阈值
long dumpStackThreshold = 20;
@@ -168,6 +169,9 @@ public class HookInvokerImpl implements IHookInvoker {
}
Log.w("HookHandler", "Junk Detected:" + builder);
linkedLog(type, builder.toString());
if (flag) {
extra.setLength(0);
}
}
}

View File

@@ -228,7 +228,7 @@ ext {
passport_secret : "com.zhidaoauto:sdk-java:1.0.5-SNAPSHOT",
// 主线程卡顿监测
block_detector : "com.mogo.eagle.core.block:runtime:10.90.0",
block_detector : "com.mogo.eagle.core.block:runtime:10.90.10",
//======================== google auto-service ===============
google_auto_service : "com.google.auto.service:auto-service:1.0-rc7",

View File

@@ -57,8 +57,8 @@ internal class MoGoBlockProviderImpl: IMoGoBlockProvider, IBlockListener {
val processUsage = cpu.remove("ProcessUsage")
if (mainThreadUsage != null && processUsage != null) {
map["cpu"] = ArrayList<String>().also {
it.add("MainThread: ${ "%.2f".format(mainThreadUsage * 1.0f * 100 / processUsage) }% ($mainThreadUsage, $processUsage)")
cpu.entries.sortedByDescending { e ->
it.add("main-thread: ${ "%.2f".format(mainThreadUsage * 1.0f * 100 / processUsage) }% ($mainThreadUsage, $processUsage)")
for (e in cpu.entries.sortedByDescending { e -> e.value }) {
it.add("${e.key}: ${ "%.2f".format(e.value * 1.0f * 100 / processUsage) }% (${e.value}, $processUsage)")
}
}