V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
pc10201
V2EX  ›  Python

如何统计 tornado 的 AsyncHTTPClient 的总的执行时间?

  •  
  •   pc10201 · 2014-07-16 21:59:42 +08:00 · 3496 次点击
    这是一个创建于 3583 天前的主题,其中的信息可能已经有所发展或是发生改变。
    感觉异步很难理解啊
    比如我用tornado的异步HTTP客户端,采集百度首页100次
    怎么用python time模块统计全部执行完这100次采集所耗的时间?
    4 条回复    2014-07-17 09:55:28 +08:00
    77421
        1
    77421  
       2014-07-16 22:32:14 +08:00   ❤️ 1
    代码头部: begin = time.time()

    尾部 : time.time() - begin

    输出
    ChiChou
        2
    ChiChou  
       2014-07-16 23:00:03 +08:00
    @77421 他说的是异步调用
    hoogle
        3
    hoogle  
       2014-07-17 03:24:04 +08:00 via iPhone
    一楼的时间取最大值
    chjuheng
        4
    chjuheng  
       2014-07-17 09:55:28 +08:00
    tornado.gen + yield
    这样时间你想怎么统计都行了。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1289 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 23:17 · PVG 07:17 · LAX 16:17 · JFK 19:17
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.