如何使抓取的各类profile生效

本文详细介绍了如何在Android系统中使各类profile生效,包括system_server系统的profile、bootimage上层所有进程的profile以及系统预置应用的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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值