简体   繁体   中英

Calling procrank doesn't work on real devices

according to a google io video about getting to know how much memory you app takes , you can use procrank and read the USS value of it.

i've tried it out on emulators (no matter which version i use - from 2.3.x to 4.1) and it works well , but running on an actual device , it didn't work (tested on galaxy s3 with android 4.0.4) . it's as if the command doesn't exist .

how could it be ? is there an alternative to get this USS value?

You can use dumpsys command

Steps:

  1. issue command line: dumpsys meminfo packageName
  2. The Private Dirty column is you wanted.

U can also use

adb shell dumpsys meminfo

or

adb shell dumpsys meminfo  + pid

command

adb shell dumpsys meminfo [pid] (Private Dirty + Private Clean)

is same as

procrank (USS)

procrank and dumpsys meminfo is not the same command, because procrank can show more thread which is killed by accident.

First you shell get procrank, procmem, libpagemap.so from Google

Then do push like :

adb push procrank /system/xbin 
adb push procmem /system/xbin 
adb push libpagemap.so /system/lib

Last :

adb shell chmod 6755 /system/xbin/procrank 
adb shell chmod 6755 /system/xbin/procmem 
adb shell chmod 6755 /system/lib/libpagemap.so

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM