【问题标题】:Where does uWSGI put its profiler file?uWSGI 将其分析器文件放在哪里?
【发布时间】:2015-06-22 09:54:32
【问题描述】:

我使用 uWSGI 并打开了“--profiler”标志,但我似乎找不到输出文件(如果有的话),并且(就像 uWSGI 中的许多东西一样)这没有正确记录.

【问题讨论】:

  • 看起来分析器报告正在获取logged
  • @dhke 谢谢,但我在那里看不到任何打印件。如果它使用 cProfile 它应该输出一个二进制文件,不是吗?
  • uwsgi 的源代码中的任何地方都没有提到cProfile。据我所知,支持--profiler=pycall 和--profiler=pyline。指定不同的参数似乎是silently ignored。
  • 谢谢。你两次都是对的。不幸的是,这不是我一直在寻找的那种分析:(那里没有与内存相关的信息
  • 你能进一步了解这个吗?在 uWSGI 下使用 cprofile 运行 python 的可能解决方法?

标签: python uwsgi cprofile


【解决方案1】:

一个有用的技巧是使用 uWSGIs 记录器将分析器日志过滤到自己的文件中:

uwsgi \
    << other uwsgi options >> \
    --logger profiler file:/path/to/profile.log \
    --log-route profiler uWSGI Python profiler

【讨论】:

    【解决方案2】:

    我今天刚遇到这个问题。这里有一个不错的项目,可以使用:https://github.com/what-studio/profiling

    我从我的代码中使用它,像这样:

    from profiling.tracing import TracingProfiler
    
    profiler = TracingProfiler()
    profiler.start()
    # ... run your program...
    profiler.stop()
    # save profile data to file
    profiler.dump('path/to/file')
    

    【讨论】:

      猜你喜欢
      • 2013-05-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-01-01
      • 1970-01-01
      • 2023-04-10
      • 2015-02-28
      • 1970-01-01
      相关资源
      最近更新 更多