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. start logcat service by change init.rc

hi, dear all

I want to record the log info into a file in sdcard when the device is running.
And the file name will be unique so that there will be a new file for each time.

add end of init.rc with following code:

service logcat /system/bin/logcat -r 1000 -v long -f
/mnt/sdcard/log_$(date +%b_%d_%H_%M_%S).txt

However, I can see "log_$(date" file under /mnt/sdcard. And this file
will be flushed when logcat service restart.
It seem that init process does not interpreter "$(date
+%b_%d_%H_%M_%S)" as shell command when parse init.rc.

When I do "adb shell", and run following command.
/system/bin/logcat -r 1000 -v long -f /mnt/sdcard/log_$(date

A file like log_Apr_08_14_04_06.txt will be saved in /mnt/sdcard.
Because the android shell can parse $(date +%b_%d_%H_%M_%S).

How can I do this in init.rc?
Anyone can help me out? Thank you very much!

Best Regards!


2. Logging for system components


I have added my own service+manager into the android framework. I'm
just in debugging, but I can't see any logcat messages which are sent
from my manager.

My manager is locatet at frameworks/base/core/java/android/os/

And my test application can get an instance of it (the reference is
not null) but I can't see any logcat messages from this component?!

Does it perhaps come because I build my Android as
TARGET_BUILD_TYPE=release  - so if I had choosen TYPE=debug then I
could see all messages?


3. chmod by init.rc

4. ssh to htc development phones

5. /libc6/ version `GLIBC_2.11' not found (required by /usr/lib/

6. Android InetAddress.isReachable always returns False

7. VOOT: Tablet apa yang dipakai anggota DPR ini?