Saturday, September 10, 2011

Re: [android-developers] Is there some APIs to monitor the RAM/CPU utilized by another app?

On Sat, Sep 10, 2011 at 2:47 PM, Jim Graham <spooky130u@gmail.com> wrote:
> So when
> developing a live wallpaper, for example, and getting advice to check
> its usage of RAM, CPU, and battery, there is no valid way of doing so,
> and the advice is therefore equally invalid?  Or is even an approximate
> number on those valid?

Your previous question asked how other apps that report this data do
it. That is only loosely tied to how you as a developer testing your
own app on your own equipment would do it. What is workable for a
developer in a lab is not necessarily something that is
production-grade and should be foisted upon unsuspecting users.
Unfortunately, there are too many lousy engineers who can't tell the
difference, or their ego is yapping too loudly in their ears to just
go use those techniques anyway, risks be damned.

With respect to RAM, Ms. Hackborn's post on SO that I linked to
previously will help you measure this, and much of her post is about
developer tools (e.g., using adb).

With respect to CPU, for any single device that you are holding in
your hand, if you can run top or can get raw stuff out of /proc/,
those should be valid.

With respect to battery... well, that's a pain to measure. If you
don't show up on the "battery blame screen" (usually off of Settings >
About) after you've been running for many hours, users probably will
not complain about your battery consumption. For more details than
that, you either gotta shell out for a Qualcomm MDP (around $1,400),
or try to get PowerTutor or the equivalent to work for you, or tear
apart a phone and figure out where to hook up leads for a wattmeter,
or something.

--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to *Advanced* Android Development_ Version 2.0
Available!

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment