#! python3 #coding=utf-8 import sys, os, re print(sys.path) sys.path.append('.') from public import publicfunction as util PATH = lambda p: os.path.abspath(p) #获取当前应用包名 package_name = util.get_current_packagename() # print('本次测试APP为:%s' %(package_name)) #获取men cpu 占用情况 def top(): print('Starting get mem cpu information...') pid = get_pid() print(pid) top_info = util.shell("top -n 1 | grep %d" % (int(pid))).stdout.readlines() for x in top_info: temp_list = x.split() #print(temp_list[8]) cpu = float(temp_list[8]) #cpu.append(float(temp_list[8])) #print(temp_list[9]) mem = float(temp_list[9]) #mem.append(float(temp_list[9])) print(cpu) print(mem)
def __init__(self): self._devicesName = info.getDevicesName() self._pkg_name = util.get_current_packagename() self._CurrentCpuUseRate = "" self._CurrentMemUse = ""