监控CPU信息代码有点问题
来源:

人在塔在_0001
2016-12-31
python语言不太熟悉,不知道怎么弄吧,请教一下
#单次测试过程
def testprocess(self):
result = os.popen("adb shell dumpsys cpuinfo | grep com.aoshang.exception")
for line in result.readlines():
cpuvalue = line.split("%")[0]
currenttime = self.getCurrentTime()
self.alldata.append((currenttime, cpuvalue))
参数范围,cpuvalue 在for循环里面,append的时候找不到它报错
2.我在上面代码的基础上打印了cpuvalue ,for没执行
写回答
2回答
-
毫末
2017-01-03
good
00 -
人在塔在_0001
提问者
2016-12-31
问题原因找到了,window下面应该使用
'adb shell "dumpsys cpuinfo | grep com.aoshang.exception"'
222018-01-06
相似问题