Reputation: 2552
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.
Upvotes: 2
Views: 721
Reputation: 1007286
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.
Upvotes: 2