![](/img/trans.png)
[英]Is there a way to get Application CPU usage with Android 7 (nougat)
[英]CPU usage per application in android
我是android編程的新手。如何在android中獲得每個應用程序的CPU使用率? 你的幫助會更有幫助
使用adb命令:
adb shell top -m 10
Linux的:
adb shell top -m 10 | grep packagename
視窗:
adb shell top -m 10 | FINDSTR 包名
轉到Settings -> Developer Tools -> Show CPU Usage
然后運行應用程序
編輯:這必須在應用程序中完成。 如果您在2019年閱讀此內容,請使用CPU Profiler
兩種方法:
adb shell "top -n 1"
adb shell dumpsys cpuinfo
有幾種方法。
第一個是在Jelly Bean開發人員選項中打開CPU使用率。
第二個選項是在Windows Android SDK文件夾中運行adb shell top -m 10
函數,或在Mac / Linux中運行./adb shell top -m 10
。
使用新的Android Studio 3.0探查器,您可以獲得有關您的APP的CPU使用率和CPU檢查的更高信息。
這讓你以更加頂級的方式進行監控
watch -n 0.5 adb shell top -n 1
0.5
是輪詢間隔
您可以使用app訪問這些類型的信息。 如簡單系統監視器 , 簡單系統監視器 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.