简体   繁体   中英

customized android dumpsys meminfo

How can I write my own code to use the "meminfo" system service? Or how can I add my own system service? My goal is to sample memory usage data automatically as the app runs, and analyze the data postmortem.

How can I write my own code to use the "meminfo" system service?

There is no "meminfo" system service, per se. To access the code that generates all the "meminfo" output, you would need to write a customized version of the Android OS that contains your code (and modifications to Android as needed).

That being said, some of the "meminfo" data is from ActivityManager and getProcessMemoryInfo() . Dianne Hackborn has an epic SO answer on this topic .

Or how can I add my own system service?

See above.

My goal is to sample memory usage data automatically as the app runs, and analyze the data postmortem.

Assuming getProcessMemoryInfo() has what you need, you should be able to do this from an ordinary SDK application.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM