[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

@@ -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)")
}
}