Battery-Metrics
Battery-Metrics copied to clipboard
Support non-battery metrics
Finding this library useful. It would be nice to be able to monitor some other non-battery, or perhaps tangentially related to battery metrics:
- Memory usage
- Number of threads
Heh, thanks! We'd been discussing adding memory usage internally, number of threads also makes a lot of sense.
I'd be very interested in this too. I'm working on an app which has a persistent foreground service that is often killed onTrimMemory, so tracking memory usage would be very useful to us.
What would also be really useful is tracking usages of the LocationManager / FusedLocation API's, as well as the accelerators and gyroscopes. It's currently very hard for us to tell how much battery usage is caused by usage of these sensors.
@HughIngram, @cameocoder what kind of collection would expect a memory collector to maintain: automatically reading memory values at regular intervals and maintaining a histogram or just current values whenever called (which would basically just be a wrapper around https://developer.android.com/reference/android/os/Debug.MemoryInfo.html)? I'm curious because memory would be a bit different from cpu/network use.
We have a currently not super reliable collector for location that I'll be cleaning up and releasing within a month or so; but you still have to hook things up by hand =/.
Outside of healthstats (that's coming sooner than location!) I don't know of any way to access sensor usage: or model the cost at the moment. Would you have any pointers to that information?
@kunalb thanks for the response. I'll get back to you when I've got a better understanding of what we actually want in our project.
At this time I don't think we need detailed memory info. Just a current value for app memory usage is what I would look for.
We currently have automation that just does a 'ps' or 'top' between tests to log app memory usage and number of threads to see if they increase.
Ah, that makes sense: I was thinking about it some more and I think that makes the most sense – have basic base metrics collectors that return current values, and at some point in the future we can write something that takes snapshots automatically at a given interval and uses them.
@cameocoder Till I can get something done here (which will take some time)– or if you have some time to implement this for battery metrics, you might find it valuable to use https://developer.android.com/reference/android/os/Debug.html#getMemoryInfo(android.os.Debug.MemoryInfo) which is what the library would end up using anyways.