OpenHarmony之进程优化小技巧
一丶环境信息 源码版本:openharmony-4.1-Release板子型号:开发者手机 二丶优化思路 在openharmony系统中,如果两个独立的进程所需要的资源肯定比一个独立进程的资源消耗大,而在openharmony恰好有一个foundation进程,foundation进程中又有19个独立的进程,可以使
一丶环境信息
源码版本:openharmony-4.1-Release
板子型号:开发者手机
二丶优化思路
在openharmony系统中,如果对性能有严格要求的话,可以尝试合并进程来优化,因为系统在运行进程时,在创建进程资源时很多前提条件是相同的,而在openharmony有一个foundation进程,它就是由很多进程合并的核心进程。foundation进程中有19个独立的进程,可以使用命令hdc shell 进入终端进行查看
# cat /system/profile/foundation.json
{
"process": "foundation",
"systemability": [
{
"name": 401,
"libpath": "libbms.z.so",
"run-on-create": true,
"depend_time_out": 60000,
"distributed": false,
"bootphase": "CoreStartPhase",
"dump_level": 1,
"depend": [
3503
]
},
{
"name": 4606,
"libpath": "libwms.z.so",
"run-on-create": true,
"distributed": false,
"bootphase": "CoreStartPhase",
"dump_level": 1
},
{
"name": 4607,
"libpath": "libwms.z.so",
"run-on-create": true,
"distributed": false,
"bootphase": "CoreStartPhase",
"dump_level": 1
},
{
"name": 3299,
"libpath": "libcesfwk_services.z.so",
"run-on-create": true,
"distributed": false,
"dump_level": 1
},
{
"name": 3203,
"libpath": "libans.z.so",
"run-on-create": true,
"depend": [
3299
],
"depend_time_out": 60000,
"distributed": false,
"dump_level": 1
},
{
"name": 3302,
"libpath": "libbatteryservice.z.so",
"run-on-create": true,
"distributed": false,
"dump_level": 1
},
{
"name": 3304,
"libpath": "libbatterystats_service.z.so",
"run-on-create": true,
"distributed": false,
"dump_level": 1
},
{
"name": 3308,
"libpath": "libdisplaymgrservice.z.so",
"run-on-create": true,
"distributed": false,
"dump_level": 1
},
{
"name": 3301,
"libpath": "libpowermgrservice.z.so",
"run-on-create": true,
"distributed": false,
"dump_level": 1
},
{
"name": 3303,
"libpath": "libthermalservice.z.so",
"run-on-create": true,
"distributed": false,
"dump_level": 1
},
{
"name": 4005,
"libpath": "libtel_call_manager.z.so",
"run-on-create": true,
"distributed": false,
"dump_level": 1
},
{
"name": 4009,
"libpath": "libtel_state_registry.z.so",
"run-on-create": true,
"distributed": false,
"dump_level": 1
},
{
"name": 3704,
"libpath": "libscreenlock_server.z.so",
"run-on-create": true,
"distributed": false,
"dump_level": 1
},
{
"name": 180,
"libpath": "libabilityms.z.so",
"run-on-create": true,
"distributed": false,
"dump_level": 1
},
{
"name": 182,
"libpath": "libdataobsms.z.so",
"run-on-create": true,
"distributed": false,
"dump_level": 1
},
{
"name": 183,
"libpath": "libupms.z.so",
"run-on-create": false,
"distributed": false,
"dump_level": 1
},
{
"name": 501,
"libpath": "libappms.z.so",
"run-on-create": true,
"distributed": false,
"dump_level": 1
},
{
"name": 1404,
"libpath": "libdistributed_ability_manager_svr.z.so",
"run-on-create": true,
"distributed": false
},
{
"name": 403,
"libpath": "libfms.z.so",
"run-on-create": true,
"distributed": false,
"dump_level": 1
}
]
}#
三丶操作步骤
我们今天来举个例子,把time_service这个进程合并到foundation进程中,来看看是不是占用的内存会变小:
我们使用hidumper --mem命令查看原始内存情况:
Total Pss by OOM adjustment:
System: 0 kB
Persistent: 0 kB
Foreground: 0 kB
Suspend-delay: 0 kB
Perceived: 0 kB
Background: 0 kB
Undefined: 798085 kB
com.ohos.launcher(pid=1672): 116104 kB
com.ohos.systemui(pid=1648): 89484 kB
media_service(pid=797): 73642 kB
foundation(pid=787): 44851 kB
appspawn(pid=345): 43655 kB
camera_host(pid=765): 24025 kB
render_service(pid=784): 23895 kB
com.laval.bi(pid=1637): 19822 kB
hiview(pid=339): 18357 kB
nnrt_host(pid=750): 17475 kB
telephony(pid=628): 16878 kB
cp_diskserver.bin(pid=620): 16234 kB
resource_schedu(pid=450): 14666 kB
com.kika.hmos.inputmethod:inputMethod(pid=1722): 13822 kB
audio_server(pid=526): 13561 kB
wifi_manager_se(pid=1223): 13038 kB
multimodalinput(pid=589): 12480 kB
msdp(pid=714): 11345 kB
accessibility(pid=600): 11291 kB
distributeddata(pid=782): 11077 kB
inputmethod_ser(pid=934): 10834 kB
softbus_server(pid=793): 9792 kB
bluetooth_servi(pid=448): 8889 kB
av_session(pid=775): 8427 kB
camera_service(pid=786): 8343 kB
bgtaskmgr_servi(pid=713): 6968 kB
hidumper_servic(pid=7691): 6872 kB
usb_service(pid=1346): 6523 kB
storage_manager(pid=346): 5852 kB
netmanager(pid=632): 5613 kB
wallpaper_servi(pid=627): 5506 kB
accountmgr(pid=338): 5130 kB
wifi_hal_service(pid=1645): 4959 kB
device_usage_st(pid=611): 4544 kB
samgr(pid=342): 3903 kB
useriam(pid=343): 3821 kB
huks_service(pid=552): 3726 kB
memmgrservice(pid=461): 3637 kB
accesstoken_ser(pid=344): 3554 kB
hilogd(pid=318): 3517 kB
riladapter_host(pid=763): 3310 kB
asset_service(pid=565): 3162 kB
nwebspawn(pid=551): 3116 kB
audio_host(pid=766): 3056 kB
storage_daemon(pid=340): 2917 kB
composer_host(pid=774): 2828 kB
deviceauth_service(pid=460): 2779 kB
sensors(pid=792): 2739 kB
av_codec_servic(pid=794): 2627 kB
device_manager(pid=341): 2503 kB
netsysnative(pid=808): 2489 kB
time_service(pid=712): 2335 kB
ecologicalRuleM(pid=791): 2209 kB
pinauth(pid=1303): 2094 kB
privacy_service(pid=935): 2070 kB
power_host(pid=770): 2061 kB
pin_auth_host(pid=754): 2027 kB
user_auth_host(pid=753): 2020 kB
ui_service(pid=796): 1874 kB
drm_service(pid=789): 1840 kB
hdcd(pid=1057): 1652 kB
concurrent_task(pid=497): 1595 kB
param_watcher(pid=347): 1485 kB
hidumper(pid=7688): 1480 kB
allocator_host(pid=773): 1465 kB
init(pid=1): 1454 kB
usb_host(pid=771): 1427 kB
codec_host(pid=758): 1208 kB
face_auth_host(pid=756): 934 kB
sensor_host(pid=762): 902 kB
wifi_host(pid=767): 890 kB
fingerprint_auth_host(pid=752): 863 kB
vibrator_host(pid=760): 838 kB
hdf_devmgr(pid=337): 835 kB
light_host(pid=759): 777 kB
blue_host(pid=772): 774 kB
uinput_inject(pid=586): 658 kB
sh(pid=7549): 658 kB
modem_control.bin(pid=618): 584 kB
input_user_host(pid=764): 555 kB
wifi_hal_service(pid=358): 524 kB
faultloggerd(pid=785): 359 kB
Total Pss by Category:
File-backed Page(471507 kB):
396888 kB : .so
53071 kB : dev
13720 kB : other
7508 kB : .ttf
320 kB : .db
0 kB : dmabuf
Anonymous Page(318223 kB):
253220 kB : native heap
29663 kB : ark ts heap
24348 kB : other
10992 kB : stack
0 kB : guard
GPU(0 kB):
0 kB : GL
Graph(0 kB):
0 kB : Graph
DMA(0 kB):
0 kB : Dma
Total RAM:7502432 kB
Free RAM:5930136 kB (429144 cached + 5500992 free)
Used RAM:1358426 kB (789730 total pss + 568696 kernel)
Lost RAM:213870 kB
Total RAM by Category:
Hardware Usage:999488 kB
CMA Usage:7458 kB
Kernel Usage:533384 kB
Processes Usage:789730 kB
Total Purgeable:
Total PurgSum:1096763301776 kB
Total PurgPin:548381650888 kB
可以看到 foundation(pid=787): 44851 kB 和 time_service(pid=712): 2335 kB 。
接下来我们来合并。
第一步:
我们先把对应的配置文件导出来:
hdc_std file recv /system/etc/init/foundation.cfg ./
hdc_std file recv /system/profile/foundation.json ./
hdc_std file recv /system/profile/foundation_trust.json ./
hdc_std file recv /system/etc/init/timeservice.cfg ./
hdc_std file recv /system/profile/time_service.json ./
合并主要是SA服务的cfg和json配置文件的合并。我们参考其他的SA服务在foundation进程一样的写法,把timeservice服务加入foundation进程的配置文件中,首先将timeservice的cfg文件进行合并,timeservice服务的cfg配置也就只有jobs和service。job阶段是服务启动的一些前提条件,这个必须要合并到foundation.cfg中的jobs字段,然后services字段选择性合并,一般只关注permission和uid字段。(如果当前自己的服务在service有特殊的字段,也可以加入foundation.cfg的service字段中)如果foundation的permission字段包含了timeservice的permission,那么就只需要添加gid字段了。如果不太清楚做了哪些修改,也可以拿修改后的对比一下修改前的,这样修改点就很明了。参考如下:
foundation.cfg修改如下:
{
"jobs" : [{
"name" : "services:foundation",
"cmds" : [
"mkdir /data/service/el1/public/AbilityManagerService 0711 foundation system",
"mkdir /data/storage/el1/bundle 0711 system system",
"mkdir /data/storage/el2/base 0711 system system",
"mkdir /data/storage/el2/database 0711 system system",
"mkdir /data/service/el1/public/notification 0711 foundation system",
"mkdir /data/service/el1/public/database 0711 ddms ddms",
"mkdir /data/service/el1/public/database/bundle_manager_service 02770 foundation ddms",
"mkdir /data/service/el1/public/database/notification_service 02770 foundation ddms",
"mkdir /data/service/el1/public/database/form_storage 02770 foundation ddms",
"mkdir /data/service/el0/stats 0711 foundation system",
"mkdir /data/service/el0/thermal 0755 foundation foundation",
"mkdir /data/service/el0/thermal/config 0711 foundation foundation",
"chmod 0664 /sys/power/wakeup_count",
"mkdir /data/service/el1/public/window 0711 foundation foundation",
"mkdir /data/service/el1/public/database/common_event_service 02770 foundation ddms",
"mkdir /data/service/el1/public/database/auto_startup_service 02770 foundation ddms",
"mkdir /data/service/el1/public/database/app_exit_reason 02770 foundation ddms"
]
} , {
"name" : "services:restartfoundation",
"cmds" : [
"reset appspawn",
"reset accountmgr",
"reset bgtaskmgr_service",
"reset resource_schedule_service",
"reset device_usage_stats_service",
"stop dlp_permission_service",
"start bootanimation"
]
} , {
"name" : "boot",
"cmds" : [
"mkdir /data/service/el1/public/time 0770 time time",
"syncexec /system/bin/chown -R time:time /data/service/el1/public/time",
"start time_service"
]
}
],
"services" : [{
"name" : "foundation",
"path" : ["/system/bin/sa_main", "/system/profile/foundation.json"],
"critical" : [1, 4, 240],
"importance" : -20,
"uid" : "foundation",
"permission" : [
"ohos.permission.INPUT_MONITORING",
"ohos.permission.PERMISSION_USED_STATS",
"ohos.permission.DISTRIBUTED_SOFTBUS_CENTER",
"ohos.permission.DISTRIBUTED_DATASYNC",
"ohos.permission.MANAGE_AUDIO_CONFIG",
"ohos.permission.WRITE_CALL_LOG",
"ohos.permission.READ_CONTACTS",
"ohos.permission.READ_DFX_SYSEVENT",
"ohos.permission.GRANT_SENSITIVE_PERMISSIONS",
"ohos.permission.REVOKE_SENSITIVE_PERMISSIONS",
"ohos.permission.MANAGE_SECURE_SETTINGS",
"ohos.permission.START_ABILITIES_FROM_BACKGROUND",
"ohos.permission.ACCESS_SERVICE_DM",
"ohos.permission.STORAGE_MANAGER",
"ohos.permission.PROXY_AUTHORIZATION_URI",
"ohos.permission.ABILITY_BACKGROUND_COMMUNICATION",
"ohos.permission.USE_USER_IDM",
"ohos.permission.MANAGE_LOCAL_ACCOUNTS",
"ohos.permission.LISTEN_BUNDLE_CHANGE",
"ohos.permission.GET_TELEPHONY_STATE",
"ohos.permission.SEND_MESSAGES",
"ohos.permission.CONNECT_CELLULAR_CALL_SERVICE",
"ohos.permission.SET_TELEPHONY_STATE",
"ohos.permission.VIBRATE",
"ohos.permission.SYSTEM_LIGHT_CONTROL",
"ohos.permission.MANAGE_HAP_TOKENID",
"ohos.permission.WRITE_WHOLE_CALENDAR",
"ohos.permission.UPDATE_CONFIGURATION",
"ohos.permission.REPORT_RESOURCE_SCHEDULE_EVENT",
"ohos.permission.START_INVISIBLE_ABILITY",
"ohos.permission.GET_BUNDLE_INFO",
"ohos.permission.GET_SUSPEND_STATE",
"ohos.permission.PUBLISH_SYSTEM_COMMON_EVENT",
"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
"ohos.permission.GET_SENSITIVE_PERMISSIONS",
"ohos.permission.CLEAN_APPLICATION_DATA",
"ohos.permission.REMOVE_CACHE_FILES",
"ohos.permission.INSTALL_SANDBOX_BUNDLE",
"ohos.permission.USE_BLUETOOTH",
"ohos.permission.CONNECTIVITY_INTERNAL",
"ohos.permission.GET_RUNNING_INFO",
"ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS",
"ohos.permission.ACCESS_BLUETOOTH",
"ohos.permission.RUNNING_STATE_OBSERVER"
],
"permission_acls":[
"ohos.permission.MANAGE_HAP_TOKENID",
"ohos.permission.GRANT_SENSITIVE_PERMISSIONS",
"ohos.permission.INPUT_MONITORING",
"ohos.permission.REVOKE_SENSITIVE_PERMISSIONS",
"ohos.permission.START_INVISIBLE_ABILITY",
"ohos.permission.INSTALL_SANDBOX_BUNDLE",
"ohos.permission.GET_NETWORK_INFO"
],
"gid" : ["system", "appspawn", "update", "time", "shell", "netsys_socket"],
"caps" : ["SYS_PTRACE", "KILL"],
"bootevents": [
"bootevent.appfwk.ready"
],
"jobs" : {
"on-start" : "services:foundation",
"on-restart" : "services:restartfoundation"
},
"secon" : "u:r:foundation:s0",
"start-mode" : "boot"
}
]
}
接下来,修改foundation.json文件,直接将timeservice.json文件的 "systemability"字段内容加入foundation.json中。参考如下
{
"process": "foundation",
"systemability": [
{
"name": 401,
"libpath": "libbms.z.so",
"run-on-create": true,
"depend_time_out": 60000,
"distributed": false,
"bootphase": "CoreStartPhase",
"dump_level": 1,
"depend": [
3503
]
},
{
"name": 4606,
"libpath": "libwms.z.so",
"run-on-create": true,
"distributed": false,
"bootphase": "CoreStartPhase",
"dump_level": 1
},
{
"name": 4607,
"libpath": "libwms.z.so",
"run-on-create": true,
"distributed": false,
"bootphase": "CoreStartPhase",
"dump_level": 1
},
{
"name": 3299,
"libpath": "libcesfwk_services.z.so",
"run-on-create": true,
"distributed": false,
"dump_level": 1
},
{
"name": 3203,
"libpath": "libans.z.so",
"run-on-create": true,
"depend": [
3299
],
"depend_time_out": 60000,
"distributed": false,
"dump_level": 1
},
{
"name": 3302,
"libpath": "libbatteryservice.z.so",
"run-on-create": true,
"distributed": false,
"dump_level": 1
},
{
"name": 3304,
"libpath": "libbatterystats_service.z.so",
"run-on-create": true,
"distributed": false,
"dump_level": 1
},
{
"name": 3308,
"libpath": "libdisplaymgrservice.z.so",
"run-on-create": true,
"distributed": false,
"dump_level": 1
},
{
"name": 3301,
"libpath": "libpowermgrservice.z.so",
"run-on-create": true,
"distributed": false,
"dump_level": 1
},
{
"name": 3303,
"libpath": "libthermalservice.z.so",
"run-on-create": true,
"distributed": false,
"dump_level": 1
},
{
"name": 4005,
"libpath": "libtel_call_manager.z.so",
"run-on-create": true,
"distributed": false,
"dump_level": 1
},
{
"name": 4009,
"libpath": "libtel_state_registry.z.so",
"run-on-create": true,
"distributed": false,
"dump_level": 1
},
{
"name": 3704,
"libpath": "libscreenlock_server.z.so",
"run-on-create": true,
"distributed": false,
"dump_level": 1
},
{
"name": 180,
"libpath": "libabilityms.z.so",
"run-on-create": true,
"distributed": false,
"dump_level": 1
},
{
"name": 182,
"libpath": "libdataobsms.z.so",
"run-on-create": true,
"distributed": false,
"dump_level": 1
},
{
"name": 183,
"libpath": "libupms.z.so",
"run-on-create": false,
"distributed": false,
"dump_level": 1
},
{
"name": 501,
"libpath": "libappms.z.so",
"run-on-create": true,
"distributed": false,
"dump_level": 1
},
{
"name": 1404,
"libpath": "libdistributed_ability_manager_svr.z.so",
"run-on-create": true,
"distributed": false
},
{
"name": 403,
"libpath": "libfms.z.so",
"run-on-create": true,
"distributed": false,
"dump_level": 1
},
{
"name": 3702,
"libpath": "libtime_system_ability.z.so",
"run-on-create": true,
"distributed": false,
"dump_level": 1
}
]
}
接下来继续修改foundation_trust.json,需要将timeservice.json的name字段,加入foundation_trust.json中的said
{
"process": "foundation",
"said": [
180,
182,
183,
401,
403,
501,
1404,
3203,
3299,
3301,
3302,
3303,
3304,
3308,
3501,
3704,
4005,
4009,
4606,
4607,
3702
]
}
这样配置文件就修改好了:
在把修改好的foundation配置文件推进去
hdc_std shell mount -o remount,rw /
hdc_std file send ./foundation.cfg /system/etc/init/
hdc_std file send ./foundation.json /system/profile/
hdc_std file send ./foundation_trust.json /system/profile/
然后删除timeservice的配置文件:
rm -rf /system/etc/init/timeservice.cfg
rm -rf /system/profile/time_service.json
Total Pss by OOM adjustment:
System: 0 kB
Persistent: 0 kB
Foreground: 0 kB
Suspend-delay: 0 kB
Perceived: 0 kB
Background: 0 kB
Undefined: 819127 kB
com.ohos.launcher(pid=1634): 115222 kB
com.ohos.systemui(pid=1649): 84457 kB
media_service(pid=871): 73564 kB
foundation(pid=791): 44967 kB
appspawn(pid=351): 40593 kB
camera_host(pid=768): 24003 kB
render_service(pid=786): 23730 kB
nnrt_host(pid=734): 17470 kB
telephony(pid=638): 16697 kB
cp_diskserver.bin(pid=588): 16230 kB
com.laval.bi(pid=1581): 15461 kB
resource_schedu(pid=448): 14425 kB
com.ohos.settingsdata(pid=1641): 14332 kB
audio_server(pid=537): 13192 kB
com.kika.hmos.inputmethod:inputMethod(pid=1676): 12603 kB
multimodalinput(pid=573): 12328 kB
hiview(pid=342): 12058 kB
msdp(pid=713): 11196 kB
accessibility(pid=578): 11113 kB
cloudfileservic(pid=1935): 11010 kB
wifi_manager_se(pid=1248): 10835 kB
inputmethod_ser(pid=884): 10702 kB
distributeddata(pid=784): 9885 kB
softbus_server(pid=836): 8889 kB
bluetooth_servi(pid=447): 8841 kB
camera_service(pid=789): 8261 kB
av_session(pid=783): 8259 kB
bgtaskmgr_servi(pid=702): 6875 kB
hidumper_servic(pid=2014): 6798 kB
updater_sa(pid=720): 6780 kB
usb_service(pid=1226): 6418 kB
storage_manager(pid=352): 5548 kB
deviceprofile(pid=1983): 5465 kB
netmanager(pid=654): 5441 kB
wallpaper_servi(pid=624): 5437 kB
accountmgr(pid=341): 4925 kB
wifi_hal_service(pid=1760): 4835 kB
locationhub(pid=1909): 4770 kB
device_usage_st(pid=582): 4389 kB
dlp_permission_(pid=1776): 3856 kB
useriam(pid=349): 3791 kB
huks_service(pid=540): 3675 kB
samgr(pid=348): 3640 kB
memmgrservice(pid=471): 3582 kB
accesstoken_ser(pid=350): 3541 kB
riladapter_host(pid=764): 3304 kB
asset_service(pid=550): 3098 kB
audio_host(pid=772): 3048 kB
installs(pid=1305): 2984 kB
hilogd(pid=321): 2923 kB
storage_daemon(pid=343): 2905 kB
nwebspawn(pid=571): 2826 kB
deviceauth_service(pid=460): 2720 kB
sensors(pid=814): 2711 kB
composer_host(pid=782): 2701 kB
device_manager(pid=347): 2651 kB
av_codec_servic(pid=841): 2610 kB
netsysnative(pid=872): 2434 kB
ecologicalRuleM(pid=813): 2175 kB
pinauth(pid=1052): 2075 kB
privacy_service(pid=887): 2056 kB
power_host(pid=775): 2040 kB
local_code_sign(pid=639): 2033 kB
pin_auth_host(pid=737): 1998 kB
user_auth_host(pid=736): 1988 kB
ui_service(pid=854): 1853 kB
drm_service(pid=796): 1834 kB
hdcd(pid=892): 1656 kB
concurrent_task(pid=498): 1577 kB
allocator_host(pid=781): 1498 kB
hidumper(pid=2011): 1473 kB
deviceinfoservi(pid=1826): 1464 kB
param_watcher(pid=353): 1460 kB
usb_host(pid=777): 1397 kB
codec_host(pid=740): 1204 kB
init(pid=1): 963 kB
face_auth_host(pid=739): 928 kB
init(pid=307): 906 kB
sensor_host(pid=762): 891 kB
wifi_host(pid=773): 884 kB
fingerprint_auth_host(pid=735): 858 kB
hdf_devmgr(pid=340): 832 kB
vibrator_host(pid=743): 829 kB
light_host(pid=742): 773 kB
blue_host(pid=779): 766 kB
uinput_inject(pid=572): 652 kB
sh(pid=1980): 649 kB
modem_control.bin(pid=586): 576 kB
input_user_host(pid=766): 547 kB
wifi_hal_service(pid=354): 529 kB
ueventd(pid=296): 405 kB
faultloggerd(pid=787): 354 kB
Total Pss by Category:
File-backed Page(494569 kB):
419851 kB : .so
52918 kB : dev
13880 kB : other
7376 kB : .ttf
544 kB : .db
0 kB : dmabuf
Anonymous Page(321777 kB):
254919 kB : native heap
27469 kB : ark ts heap
27185 kB : other
12204 kB : stack
0 kB : guard
GPU(0 kB):
0 kB : GL
Graph(0 kB):
0 kB : Graph
DMA(0 kB):
0 kB : Dma
Total RAM:7502432 kB
Free RAM:6058676 kB (358900 cached + 5699776 free)
Used RAM:1170030 kB (816346 total pss + 353684 kernel)
Lost RAM:273726 kB
Total RAM by Category:
Hardware Usage:999488 kB
CMA Usage:7458 kB
Kernel Usage:317064 kB
Processes Usage:816346 kB
Total Purgeable:
Total PurgSum:1097253658384 kB
Total PurgPin:548626829192 kB
这样 foundation(pid=791): 44967 kB 增加了,但是整体的内存减少了。
##五丶注意事项
成功将timeservice合入了foundation进程后,由于timeservice服务的uid和pid都已经变化了,如果部分代码在获取uid的时候,可能会获取不到。
四丶添加编译参数
参考base/inputmethod/imf/interfaces/inner_api/inputmethod_controller/BUILD.gn:
cflags = [
"-fdata-sections",
"-ffunction-sections",
"-fvisibility=hidden",
"-Os",
]
cflags 和cflags_cc 的区别是,cflags对C代码和C++代码都有效,cflags_cc只对C++的代码生效,如果cflags_cc和cflags编译参数有冲突,按cflags_cc的生效
更多推荐
所有评论(0)