【发布时间】:2014-03-02 04:09:52
【问题描述】:
我是 android 新手,我想使用 python 在我的 android 设备上运行简单的网页负载测试。我编写了一个 python 来计算每个给定网页的加载时间。我想在我的 android 设备上为默认浏览器而不是在 chrome 上执行此操作,并在文件中收集时间戳进行 10 次迭代。
这是在我的 Windows 机器上运行的程序。
import urllib
from urllib.request import urlopen
import time
url = ["http://www.msn.com","http://www.cnn.com","http://www.google.com"]
for i in range(0,1):
for x in url:
nf = urlopen(x)
start = time.time()
page = nf.read()
end = time.time()
lt = (end - start)
print (x,round(lt,2))
nf.close()
谢谢
【问题讨论】: