码迷,mamicode.com
首页 > 编程语言 > 详细

Python小工具-查看内存和CPU

时间:2019-07-05 00:22:04      阅读:236      评论:0      收藏:0      [点我收藏+]

标签:com   pack   bsp   stderr   inf   pos   工具   txt   cas   

 

import subprocess
from time import sleep

package = com.wangpos.by.cashier3
memory_name = adb shell dumpsys meminfo {} | findstr "Pss".format(package)
memory = adb shell dumpsys meminfo {} | findstr "Pss".format(package)
log_name = open(log.txt, w)
for i in range(100000):
    subprocess.Popen(memory, stderr=log_name, stdout=subprocess.PIPE,shell=True)
    sleep(5)


cpu = adb shell top -n 1 | findstr "PID"
cpu_exec = adb shell top -n 1 | findstr {package}.format(package=package) 

for i in range(10000):
    subprocess.Popen(cpu_exec, stderr=log_name,stdout=subprocess.PIPE)

 

Python小工具-查看内存和CPU

标签:com   pack   bsp   stderr   inf   pos   工具   txt   cas   

原文地址:https://www.cnblogs.com/jiablogs/p/11135588.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!