Debugging power management - how to determine cpu state?

by Tom » Mon, 30 Aug 2010 06:01:33 GMT

Sponsored Links
 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)?



Debugging power management - how to determine cpu state?

by Dianne Hackborn » Mon, 30 Aug 2010 14:05:40 GMT

 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.


Sponsored Links

Other Threads

1. Work out which activity is on top

Hi all,

Is there a way for a receiver or service to know which activity is
currently visible to the user so that you can change behavior?
Similarly, is there a way to know if the screen is off (perhaps this
should be a function of the wakelock service)?



2. Android Terminal Hardware

Has anyone seen a hardware device based on Android that has no phone,
ala iTouch

Expandable memory with memory slot
Otherwise like an  iTouch



3. emulator: ERROR: you must provide the name of a virtual machine to start the emulator.

4. two tables and sqlite

5. Problems w/starting explicit intent

6. WebView Demo

7. Application Startup Animation