如何使抓取的各类profile生效
1. system_server系统的profile
SystemServer.art-profile
1、增量修改源码中的services/art-profile
可以源码中的art-profile做比较,看一下哪些是新增的
frameworks/base/services/art-profile
如果是这样的话,建议“Android S抓取各类profile的方法”中的第三章的第一点,–apk=services.jar 只加入services的
2、对PRODUCT_SYSTEM_SERVER_JARS的其它jar包做profile的优化(普通Android版本默认都是speed,如果加上profile,会多一个appimage的优化;如果是Android go版本则直接是speed-profile优化)
可以在
build/soong/java/dexpreopt.go
build/soong/dexpreopt/dexpreopt.go
这2个文件都可以修改,参考源码(services.jar会跑)的逻辑自行增加isSystemServerJar其它jar的优化
//build/soong/java/dexpreopt.go
isSystemServerJar := global.SystemServerJars.ContainsJar(ctx.ModuleName())
//...
if String(d.dexpreoptProperties.Dex_preopt.Profile) != "" {
profileClassListing = android.OptionalPathForPath(
android.PathForModuleSrc(ctx, String(d.dexpreoptProperties.Dex_preopt.Profile)))
profileBootListing = android.ExistentPathForSource(ctx,
ctx.ModuleDir(), String(d.dexpreoptProperties.Dex_preopt.Profile)+"-boot")
profileIsTextListing = true
}
或者直接在下面增加profile修改(这样就无需转换了,直接用profile),或者GenerateDexpreoptRule直接写入profileClassListing(比上面的方法麻烦,建议在java/dexpreopt.go修改)
build/soong/dexpreop

本文详细介绍了如何在Android系统中使各类profile生效,包括system_server系统的profile、bootimage上层所有进程的profile以及系统预置应用的profile。通过修改源码、配置文件以及编译选项,实现对不同部分的性能优化和预加载类的管理。同时,文中还提及了优化可能带来的开机时间和内存使用变化,提醒开发者注意对比分析。
最低0.47元/天 解锁文章
3005

被折叠的 条评论
为什么被折叠?



