It is difficult, because attaching to USB keeps a wake lock held.

You can use "adb shell dumpsys batteryinfo" to see the current stats about
your app, which includes the time spent holding each wake lock.  (You'll
probably want the last section of output, which is the time since last
unplugged.)  Note that the wake lock times are weighted, so if two wake
locks are being held at the same time they will be accounted as using 50% of
the overall time.

Also, of course, you could log when you acquire and release the wake lock
and then look at the log after plugging in again.  "adb logcat -v time"
gives logs with time stamps.

Hmmmm...  that said, if you just care about what you are doing with your own
wake locks, it doesn't matter if the device is kept awake while plugged in
to USB, and you can use "adb shell dumpsys power" to see what wake locks (if
any) you are currently holding at that point in time.

On Sun, Aug 29, 2010 at 3:01 PM, Tom <orei...@mbari.org> wrote:

> My application acquires and releases WakeLocks. What is the best way
> to test the app - i.e. is there a standard way to determine when the
> cpu is running (e.g. through a debug cable)?
>
> Thanks,
> Tom
>
>
> --
> 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+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to