Get Memory-RAM information consumed by an app using shell command

时间:2019-04-08 12:59:01

标签: android linux unix awk android-profiler

I just want to get RAM information consumed by a specific app using shell command, currently i as using ps -x | grep 'packageName' but its results vary with the memory shown by profiler

This is the result of the above command that i am using

u0_a73 7623 4287 3271364 225728 SyS_epoll_ 73289f334c S packageName (u:193963, s:87819)

The bold part is the ram consumed by the app in kB

1 个答案:

答案 0 :(得分:1)

尝试一下:

cur = db["col"].find().sort({"_id": -1}).limit(1):
with cur:
    doc = next(cur, None) # None when we have empty collection.

ps -x|awk '/packageName/{print $5}' 命令从awk输出中提取出第5个单词,该行中有packageName。