Using Python to invoke the ADB command to test the app's performance (6-1)

Source: Internet
Author: User
Tags get ip
In the previous article about what the ADB is, as well as the commonly used commands, let's take a look at the ADB to look at the performance parameters in mobile devices, first of all to see the APK package name and the default activity name there are several ways, the following description of 2 

First Kind

  1 Open cmd  Toggle directory D:\tool\android-sdk_r24.4.1-windows\android-sdk-windows\build-tools\25.0.3
 // Get APK PackageName and classname
2 aapt dump badging F:\360Downloads\Apk\aa.apk > F:/logs.txt

In the SDK build-tools\25.0.3 directory (25.0.3 whatever version is available) and view f:/ Logs.txt file information, find the corresponding package name and activity name, many people may not understand why to find this information, because the Andorid system in the application has a unique package name, you can through the DDMS, or Andorid Studio development tools to see , we need to look at the ratio of the application in the system to the CPU, and the memory, and definitely need to know the package name.

Second Kind
1 open cmd input adb shell (must be configured with ADB environment variable)
2 Then Logcat | grep START to view APK package name and activity name
This way is to monitor the app startup log information with the latest APK to see the package name

The above is the way to get the package name, we recommend that you go to the experiment, get apk corresponding package name.

With the APK package name, we can get to the ADB command first.

========= Start Time ============

1 Cold start (first boot) hot start (No exit, second Open) command adb shell am start-w-n com.qihoo.appstore/.home. Mainactivity

2 Stop App Command (cold start) adb shell am force-stop com.qihoo.appstore
(Hot start mode exit) adb shell input KeyEvent 3

==============cpu=================
Viewing CPU data
adb Shell Dumpsys Cpuinfo | grep Com.qihoo.appstore
Note that the grep must be replaced with findstr in window

================== Memory =========================
First Kind
adb shell Dumpsys meminfo com.qihoo.appstore

=============== Flow ===================
1 Get IP PS for current process | grep Com.qihoo.appstore
ADB Shell Cat/proc/pid/net/dev

================= Electricity ======================
Execute command to get charge adb shell Dumpsys battery
Set mobile into a non-charged state adb shell Dumpsys battery Set Status 1

Now it's up to the command to view the power, flow, startup time, CPU, memory, but how to call the ADB via Python, then capture the relevant information in the APK file, and then generate a report based on that data, which is detailed in the next article. Thank you..

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.