zoukankan      html  css  js  c++  java
  • 性能测试方法总结

    1.查看某个应用的流量使用情况

    adb shell cat /proc/net/xt_qtaguid/stats | findstr (uid#)

    如:adb shell cat /proc/net/xt_qtaguid/stats | findstr 10063 (10063为微信uid)

    26 wlan0 0x0 10063 0 454072 1151 93233 1713 454072 1151 0 0 0 0 93233 1713 0 0 0 0
    27 wlan0 0x0 10063 1 8672660 6156 396296 5302 8672660 6156 0 0 0 0 396296 5302 0 0 0 0

    其中第6和8列为 rx_bytes(接收数据)和tx_bytes(传输数据)包含tcp,udp等所有网络流量传输的统计。

    备注:查看应用uid的方法

    adb shell dumpsys package com.example.myapp | findstr userId=

    2.发送命令模拟手机低电环境:

    adb shell am broadcast -a android.intent.action.BATTERY_CHANGED --ei "level" 3 --ei "scale" 100

    备注:引申~恢复出厂设置的方法

    adb shell am broadcast -a android.intent.action.MASTER_CLEAR

    拨打电话 :adb shell am start -a android.intent.action.CALL -d tel:10086

    发送短信:adb shell am start -a android.intent.action.SENDTO -d sms:10086

    启动一个activity:adb shell am start -n com.lt.am/.MyAMActivity

    adb shell am start -a (Action)

    adb shell am start -n(包名+Activity)

    上面两者都是启动

    adb shell am broadcast <INTENT> 发送广播

    3.查看进程的内存使用情况

    查看所有:adb shell  procrank 

      PID       Vss      Rss      Pss      Uss  cmdline
     1436   979252K  109740K   72693K   65632K  com.android.systemui
     3202  1096096K   80936K   47636K   44448K  com.wandoujia.phoenix2
     1655   930596K   72472K   45215K   42200K  com.aurora.launcher
     1074  1020368K   61144K   33842K   31128K  system_server

    查看单个:adb shell procrank com.android.contacts

    备注:1.我们一般观察Uss来反映一个Process的内存使用情况,Uss 的大小代表了只属于本进程正在使用的内存大小,这些内存在此Process被杀掉之后,会被完整的回收掉

              2.从/proc/pid/maps中读取信息来进行统计

    4. cpu和内存消耗

    adb shell top -n 400 | grep <your package name>Cpu_MemoryFile.txt

  • 相关阅读:
    Lua与C++的一些交互
    图片叠加文字
    VS智能提示消失的解决方法
    VS2008包加载失败的真正解决方法
    WINDOWS下操作注册表 REG_EXPAND_SZ与REG_SZ的区别
    lua支持中文变量名
    SCROLLVIEW设置初始滚动条位置
    WINDOWS XP 自动关机
    C#通过WMI操作远程机器
    [InstallShield]如何在不同的Script文件之间共享全局变量
  • 原文地址:https://www.cnblogs.com/penghong2014/p/4308311.html
Copyright © 2011-2022 走看看