性能优化

67 阅读1分钟

前言

目前CPU都是多核,大核的频率比小核高,如果核心线程固定运行在大核上,应用性能会有所提升。

核心线程:UI线程、RenderThread线程。他们直接影响用户的感受。在项目中其他特定线程,如语音处理等是可以列为核心线程的。

查看大小核

/sys/devices/system/cpu目录下获取各个核的频率

image.png

获取GC次数

Debug.getRuntimeStat("art.gc.gc-count") // gc 次数
Debug.getRuntimeStat("art.gc.gc-time")  // gc 耗时
Debug.getRuntimeStat("art.gc.blocking-gc-count") // 阻塞 gc 次数
Debug.getRuntimeStat("art.gc.blocking-gc-time") // 阻塞 gc 耗时