当前位置:网站首页>Appium automation test foundation - ADB shell command
Appium automation test foundation - ADB shell command
2022-06-30 09:57:00 【Test - Eight Precepts】
Android The system is based on Linux Kernel , in other words Android The bottom layer of the system is Linux System . therefore Linux Many of the commands in Android There are the same or similar implementations in the system , stay adb shell You can call . The previous part has been used adb shell command , Let's add that yes adb shell Command awareness .
Tips : To be in Android On the phone adb shell command , You need to root mobile phone , Virtual machines are direct root Of Android System , So it can be used directly on the virtual machine adb shell command .
1、 Check the process
command :
adb shell psOutput example :
USER PID PPID VSIZE RSS WCHAN PC NAME
root 1 0 8904 788 ffffffff 00000000 S /init
root 2 0 0 0 ffffffff 00000000 S kthreadd
...
u0_a71 7779 5926 1538748 48896 ffffffff 00000000 S com.sohu.inputmethod.sogou:classic
u0_a58 7963 5926 1561916 59568 ffffffff 00000000 S org.mazhuang.boottimemeasure
...
shell 8750 217 10640 740 00000000 b6f28340 R psThe meaning of each column :
| Name | meaning |
|---|---|
| USER | Users |
| PID | process ID |
| PPID | The parent process ID |
| NAME | Process name |
2、 View real-time resource usage
command :
adb shell topOutput example :
User 0%, System 6%, IOW 0%, IRQ 0%
User 3 + Nice 0 + Sys 21 + Idle 280 + IOW 0 + IRQ 0 + SIRQ 3 = 307
PID PR CPU% S #THR VSS RSS PCY UID Name
8763 0 3% R 1 10640K 1064K fg shell top
131 0 3% S 1 0K 0K fg root dhd_dpc
6144 0 0% S 115 1682004K 115916K fg system system_server
132 0 0% S 1 0K 0K fg root dhd_rxf
1731 0 0% S 6 20288K 788K fg root /system/bin/mpdecision
217 0 0% S 6 18008K 356K fg shell /sbin/adbd
...
7779 2 0% S 19 1538748K 48896K bg u0_a71 com.sohu.inputmethod.sogou:classic
7963 0 0% S 18 1561916K 59568K fg u0_a58 org.mazhuang.boottimemeasure
...The meaning of each column :
| Name | meaning |
|---|---|
| PID | process ID |
| PR | priority |
| CPU% | The present moment takes up CPU percentage |
| S | Process status (R= function ,S= sleep ,T= track / stop it ,Z= Zombie process ) |
| #THR | Number of threads |
| VSS | Virtual Set Size Virtual memory consumption ( Contains the memory used by the shared library ) |
| RSS | Resident Set Size Actually using physical memory ( Contains the memory used by the shared library ) |
| PCY | Scheduling policy priority ,SP_BACKGROUND/SPFOREGROUND |
| UID | The user of the process owner ID |
| NAME | Process name |
top The command also supports some command line parameters , The detailed usage is as follows :
Usage: top [ -m max_procs ] [ -n iterations ] [ -d delay ] [ -s sort_column ] [ -t ] [ -h ]
-m num Show at most how many processes
-n num Refresh how many times and exit
-d num Refresh interval ( Unit second , The default value is 5)
-s col Sort by a column ( You can use col value :cpu, vss, rss, thr)
-t Show thread information
-h Show help documents 3、 Check the process UID
There are two options :
adb shell dumpsys package <packagename> | grep userId=
Such as :
$ adb shell dumpsys package org.mazhuang.guanggoo | grep userId=
userId=103942、 adopt ps Command to find the pid after adb shell cat /proc/<pid>/status | grep Uid
Such as :
$ adb shell
gemini:/ $ ps | grep org.mazhuang.guanggoo
u0_a394 28635 770 1795812 78736 SyS_epoll_ 0000000000 S org.mazhuang.guanggoo
gemini:/ $ cat /proc/28635/status | grep Uid
Uid: 10394 10394 10394 10394
gemini:/ $4、 Other adb shell command
Here is a brief description of other common commands , The orders that have been specially mentioned above will not be explained additionally :
| command | function |
|---|---|
| cat | Display file contents |
| cd | Toggle directory |
| chmod | Change the access mode of files / Access right |
| df | View disk space usage |
| grep | Filter output |
| kill | Kill designated PID The process of |
| ls | List the contents of the catalog |
| mount | View and manage the mount Directory |
| mv | Move or rename files |
| ps | View running processes |
| rm | Delete file |
| top | Check the resource usage of the process |
and Linux The commands in the system are basically the same .
a key : Supporting learning materials and video teaching
So here I have carefully prepared the detailed information of the above outline in The link below is as follows


边栏推荐
- Torch learning summary
- JVM tuning tool introduction and constant pool explanation
- Pytorch graduate warm LR installation
- ABAP time function
- 布隆过滤器
- Slf4j: failed to load class "org.slf4j.impl.staticloggerbinder"
- 目标检测yolov5开源项目调试
- Task summary in NLP
- P. Summary of NP, NPC, NP hard and other issues
- [ubuntu-mysql 8 installation and master-slave replication]
猜你喜欢

Bloom filter

Design of mfc+mysql document data management system based on VS2010

将小程序容器技术应用到物联网IoT生态建设中

无人机项目跟踪记录八十三---pcb图完成

单片机 MCU 固件打包脚本软件

【AGC】构建服务3-认证服务示例

Machine learning note 9: prediction model optimization (to prevent under fitting and over fitting problems)

Self service terminal handwritten Chinese character recognition input method library tjfink introduction

Notes on masking and padding in tensorflow keras

IDC released the report on China's software defined storage and hyper convergence market in the fourth quarter of 2020, and smartx hyper convergence software ranked first in the financial industry
随机推荐
Theme Studio(主题工作室)
JUL简介
二极管如何工作?
Bluetooth BT RF test (forwarding)
qmlplugindump executable not found. It is required to generate the qmltypes file for VTK Qml
JWT expiration processing - single token scheme
Pytorch graduate warm LR installation
Horrible bug records
目标检测yolov5开源项目调试
JVM garbage collector G1 & ZGC details
JVM memory common parameter configuration set
Appium自动化测试基础 — 12.APPium自动化测试框架介绍
Torch learning summary
文章内容无法复制复制不了
Flume learning 1
[new book recommendation] mongodb performance tuning
JVM notes (III): analysis of JVM object creation and memory allocation mechanism
utils session&rpc
JVM tuning tool commands (notes)
9.缓存优化