how to get cpu usage from system api

by daniel » Wed, 10 Jun 2009 03:37:14 GMT


Sponsored Links
 Dear all,
     I saw emulator can show cpu usage, and now i want to get the cpu
usage by code. How can i do? can you help me?

--~--~---------~--~----~------------~-------~--~----~



how to get cpu usage from system api

by lbcoder » Wed, 10 Jun 2009 21:20:14 GMT


 install busybox, run "top".



--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Other Threads

1. IA Bring-up in the master branch: Instructions

I have uploaded the required changes to bring up IA in the master
branch as well as the virtual box installer image. The changes are in
queue and will likely take a little time to get into the master branch
(no doubt, some will be re-factored along the way).

The script below will pull in the required commits (20 uploaded by me,
2 by android-x86).
BE CAREFUL with this script... it will wack any changes that you have
in the directories that are getting cherry picks.

After getting a clean set of 22 cherry picks... you can do a build in
the usual way:
  Build and install your kernel (prebuilt/android-x86/kernel/)
  source build/envsetup.sh
  lunch full_x86-eng
  make -j$JFACTOR installer_vdi

-Bruce

[bjbe...@bjbeare-svr ~]$ cat AOSP_IA_cherrypick.sh
#!/bin/bash

echo "Change TOP and YOUR_IDENTITY in $0 to be correct for your trees
and rerun."
echo "Note: you may need to 'git reset --hard' your branches... but if
you do that"
echo "      you will lose any local changes. Proceed with care.".
exit 1

# Change these as needed
TOP=`pwd`
BASE_BRANCH=korg/master
BR=aosp_master_ia
LOGFILE=$TOP/`basename $0`.log

# Be sure to change this next line.
YOUR_IDENTITY="<your_email>@review.source.android.com:29418"
YOUR_IDENTITY="bruce.j.be...@review.source.android.com:29418"


aosp_java ()
{
    # You may need to change this to reflect the correct path to your
java
    export JAVA_HOME=/usr;
    export JAVA_FONTS=/usr/share/fonts/truetype;
    export ANT_HOME=/usr/share/ant;
    export PATH=$JAVA_HOME/bin:$ANT_HOME/bin:$PATH;
    export CLASSPATH=.
}

#
# Careful... running setup on a project will blow out any uncommitted
changes
#
setup() {
  cd $1
  pwd

  # This blows away any extra files in the branch
  git clean -d -f -x >> $LOGFILE 2>&1

  # If you do a "git reset --hard" you will lose any changes in your
tree
  git reset --hard >> $LOGFILE 2>&1

  # This blows away the old label and makes a new one
  git checkout $BASE_BRANCH >> $LOGFILE 2>&1
  git branch -D $BR >> $LOGFILE 2>&1
  repo start $BR .
}

project() {
  setup $TOP/$1
}

cherry_pick() {
    $@ >> $LOGFILE 2>&1
    if [ $? -ne 0 ]; then
        echo >&2 Cherry pick failed.
        cat $LOGFILE
        exit 1
    fi
    git cherry-pick FETCH_HEAD >> $LOGFILE 2>&1
    if [ $? -ne 0 ]; then
        echo >&2 Cherry pick failed.
        cat $LOGFILE
        exit 1
    fi
}

check_log()
{
    PICKS=`grep 'Finished one cherry-pick' $LOGFILE | wc -l`
    echo "$PICKS cherry picks succeeded"
}

aosp_java

project system/core
cherry_pick git fetch ssh://$YOUR_IDENTITY/platform/system/core refs/
changes/13/16213/5

project bionic
cherry_pick git fetch ssh://$YOUR_IDENTITY/platform/bionic refs/
changes/46/20046/1
cherry_pick git fetch ssh://$YOUR_IDENTITY/platform/bionic refs/
changes/47/20047/1
cherry_pick git fetch ssh://$YOUR_IDENTITY/platform/bionic refs/
changes/48/20048/1
cherry_pick git fetch ssh://$YOUR_IDENTITY/platform/bionic refs/
changes/85/19485/4
cherry_pick git fetch ssh://$YOUR_IDENTITY/platform/bionic refs/
changes/86/19486/5

project external/libnfc-nxp/
cherry_pick git fetch ssh://$YOUR_IDENTITY/platform/external/libnfc-nxp
refs/changes/49/20049/1

project external/stlport
cherry_pick git fetch ssh://$YOUR_IDENTITY/platform/external/stlport
refs/changes/50/20050/1

project system/media
cherry_pick git fetch ssh://$YOUR_IDENTITY/platform/system/media refs/
changes/51/20051/1

project packages/inputmethods/LatinIME
cherry_pick git fetch 
ssh://$YOUR_IDENTITY/platform/packages/inputmethods/LatinIME
refs/changes/52/20052/1

project build
cherry_pick git fetch ssh://$YOUR_IDENTITY/platform/build refs/changes/
53/20053/1
cherry_pick git fetch ssh://$YOUR_IDENTITY/platform/build refs/changes/
54/20054/2
cherry_pick git fetch ssh://$YOUR_IDENTITY/platform/build refs/changes/
59/20059/2

project external/grub
cherry_pick git fetch ssh://$YOUR_IDENTITY/platform/external/grub refs/
changes/55/20055/1

project bootable/diskinstaller
cherry_pick git fetch ssh://$YOUR_IDENTITY/platform/bootable/diskinstaller
refs/changes/56/20056/1
cherry_pick git fetch ssh://$YOUR_IDENTITY/platform/bootable/diskinstaller
refs/changes/57/20057/1
cherry_pick git fetch ssh://$YOUR_IDENTITY/platform/bootable/diskinstaller
refs/changes/58/20058/2

project system/extras
cherry_pick git fetch ssh://$YOUR_IDENTITY/platform/system/extras refs/
changes/60/20060/1

project prebuilt
cherry_pick git fetch ssh://$YOUR_IDENTITY/platform/prebuilt refs/
changes/61/20061/1

project external/bluetooth/bluez
cherry_pick git fetch ssh://$YOUR_IDENTITY/platform/external/bluetooth/bluez
refs/changes/71/17771/1

project system/core
cherry_pick git fetch ssh://$YOUR_IDENTITY/platform/system/core refs/
changes/64/18364/1
cherry_pick git fetch ssh://$YOUR_IDENTITY/platform/system/core refs/
changes/64/20064/1

check_log

-- 

2. Updated WTI: JawsMIUI-RC2 2412#1c

Full ROM JawsMIUI-RC2 2412#1c

http://www.multiupload.com/I7FUQW9J2H (95.56mb)

- data.img 1gb
- hastarin kernel R8.6_eb_oldcam by tytung
- based on MIUI build 24 December.

Extract jadi folder "JawsMIUI-2412" copy ke sdcard lalu boot via EBL...

Enjoy the ROM.

--rc
JawsMIUI RC2-2412#1c
kernel: hastarin R8.6_eb.oldcam

-- 
===============
"

3. Memori Penuh

4. Proguard configuration question

5. RelativeLayout problems

6. Testi RayEfraim (tadinya mo Paging, subjek berubah di tengah penulisan) (was WTS Nexus one with/without acc)

7. Did sensor orientation change in SDK 2.3?