App performance test metrics and test methods

Source: Internet
Author: User

Common methods of flow

Method One: The Android system comes with statistical functions (total flow value)
Proc/uid_stat/{uid}/tcp_snd and TCP_RCV

    • UID is the unique number assigned during each app installation to identify the app.
    • TCP_SND: Indicates the cumulative size of the sending data, in bytes
    • TCP_RCV: Indicates the cumulative size of the received data.

Specific steps:
(1) Get the PID of the app through the package name;
(2) Re-visit the/proc/{pid}/status file to find the corresponding UID of the app;
(3) Check the incoming and outgoing traffic files by UID number plus number 100,000th

Method Two: Wireshark+tcpdump

./tcpdump-s 0-w./t1.pcap-v

    • -S 0: The default grab fetch length is 68 bytes, plus-s 0 can catch the complete packet.
    • -W XXX: The path to the package to fetch.
    • -V: The number of capture packets displayed during the capture process

Method Three: GT (portable) tool (call the Android API directly):
Trafficstats class is a fluent statistical class provided by Android, which can count the amount of mobile phone power up to the current traffic, also can count one or more processes or applications used traffic, including Wi-Fi and mobile data gprs.
The GT uses Trafficstats.getuidtxbytes (UID) to obtain traffic data (the method claims to get the sum of the sent traffic to the specified UID, but the measured condition is only the TCP layer of traffic).
GT (Carry-on) is the app's carry-on debugging platform, is directly running on the phone idte. You can use GT to quickly test the performance of the app (CPU, memory, traffic, power, frame rate/smoothness, etc.), development log view, Crash Log view, crawl of network packets, debugging of internal parameters of the app, time-consuming statistics of real machine code, etc.

GT Official website

Analysis of Flow test
    • Traffic consumption of domain name: After grasping the packet, using the existing tools to count the traffic consumption under different domain names. Makes it easy to find out if a server is consuming too much traffic.
    • Traffic consumption of the Protocol: it is convenient to find out whether a protocol has excessive traffic consumption or the protocol pulls more frequently.
Electricity

Battery Historian:google provides power analysis tools, Android 5.0 + support

adb shell dumpsys battery //读取电量和温度adb shell dumpsys batterystats --reset //重置电池统计信息adb shell dumpsys batterystats > batterystats.txt // 获取电池统计信息python historian.py batterystats.txt > batterystats.html //生成报告

Reference

Cpu

The/proc file system is a pseudo-file system that only exists in memory and does not occupy external memory space. It provides the interface for the kernel to communicate with the process in a file system manner.
From the proc file can be obtained: the system, process, thread CPU time slice usage, so two times the data acquisition time slice can get the process CPU utilization.

CPU占用率=(进程T2-进程T1)/(系统T2-系统T1)进程总CPU时间 总CPU时间 totalCPUTime=user+nice+system+idle+iowait+irq+softird processCPUTime=utime+stime+cutime+cstime  线程总CPU时间 threadCPUTime=utime+stime+cutime+cstime
    • Utime: The time the task is used for state operation, in Jiffies
    • Stime: The time of the mission to run in the nuclear mentality, in units of jiffies
    • Cutime: The cumulative time that all waited-for processes have been running in the user state, in units of jiffies
    • Cstime: Cumulative of all the waited-for processes of this task ever run in the nuclear mentality, in units of jiffies

Get System CPU Time slice: Read Proc/stat
Get process CPU time slices: proc/pid/stat
Thread Time slice:/proc/pid/task/tid/stat

Memory
    • System memory:
      • System memory:/proc/meminfo
      • System free Memory: Activitymanager
      • System already has memory: total memory-free memory
    • Process Memory:
      • Process memory limit, total memory can be obtained directly using Am.getprocessmemoryinfo (PID)
      • You can also use the top command directly
Smoothness detection

Fluency: The Android system emits a vertical sync signal (VSync signal) (1000MS/60=16.67MS) on every 16.7ms trigger to render the UI. The smooth screen requires 60 frames/s, in order to be able to achieve 60 frames/s, meaning that most of the calculation rendering must be done at 16.7ms.

When the frame interval is more than 16.7ms, the vertical synchronization mechanism allows the display hardware to wait for the GPU to complete the raster rendering operation, and we can say that we dropped the frame at this point, and also caused the user to stutter the senses directly.
The number of vsync signals in 1 seconds is defined as the fluid value, which is SM.

Dayton Classification :

    • Low Flow value interval: The drop frame caused by continuous small lag, that is, the average fluid value is less than 40 frames/s interval.
    • Tanci da Carton: Tanci da Carton caused by the drop frame, that is, two times the frame interval is greater than 70ms, equivalent to lose more than 4 frames of the interval.

The frame drawing process for Android is: CPU main thread image processing->GPU display frames. Most of the time the app has dropped frames is caused by the "CPU main thread image processing" step overload.

Page Start duration

Page Start Duration:

    • Activity start time: Wake activity to activity in the foreground when the first draw, paint frame detection
    • Fragment start-up: Wakes fragment to fragment the completion time of onresume execution.
    • Cold start: page starts from startactivity
    • Hot start: page starts from OnStart or Onresume

App performance test metrics and test methods

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.