Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 使用dowser分析CherryPy应用程序_Python_Profiling_Cherrypy - Fatal编程技术网

Python 使用dowser分析CherryPy应用程序

Python 使用dowser分析CherryPy应用程序,python,profiling,cherrypy,Python,Profiling,Cherrypy,我有一个关于道瑟用法的问题。 我基于CherryPy创建了自己的网站,有一个内存泄漏,但我不知道它在哪里。在搜索了有关我的问题的信息后,我了解到dowser是一个很好的工具,它可以告诉内存泄漏发生在哪里 因此,在中有一些步骤可以帮助将dowser集成到现有的CherryPy应用程序中,但我不知道在哪里可以看到内存使用的结果?我应该如何使用跟踪和图表变量 谢谢 不,如果您已将dowser应用程序正确安装到您的樱桃树上,则不应触摸trace和chart。可能是这样的。运行,等待一分钟,并在/dows

我有一个关于道瑟用法的问题。 我基于CherryPy创建了自己的网站,有一个内存泄漏,但我不知道它在哪里。在搜索了有关我的问题的信息后,我了解到dowser是一个很好的工具,它可以告诉内存泄漏发生在哪里

因此,在中有一些步骤可以帮助将dowser集成到现有的CherryPy应用程序中,但我不知道在哪里可以看到内存使用的结果?我应该如何使用跟踪和图表变量


谢谢

不,如果您已将
dowser
应用程序正确安装到您的樱桃树上,则不应触摸
trace
chart
。可能是这样的。运行,等待一分钟,并在/dowser上找到漏洞(psst,查看实例计数图表)


从您链接的教程来看,它似乎将/dowser、/trace和/chart装载到您的应用程序。您在浏览器中访问过这些URL吗?
#!/usr/bin/env python
# -*- coding: utf-8 -*-


import os
import threading
import time

import cherrypy
import dowser


config = {
  'global' : {
    'server.socket_host' : '127.0.0.1',
    'server.socket_port' : 8080,
    'server.thread_pool' : 4
  }
}


class DowserToShow:
  pass


class App:

  issueIsMe = []
  exited    = False
  thread    = None


  def __init__(self):
    self.thread = threading.Thread(target = self.leak)
    self.thread.start()

    cherrypy.engine.subscribe('exit', self.exit)

  def exit(self):
    self.exited = True
    self.thread.join()

  def leak(self):
    while not self.exited:
      for i in range(100):
        self.issueIsMe.append(DowserToShow())
      time.sleep(1)

  @cherrypy.expose
  def index(self):
    return 'Leaked instances, {0}'.format(len(self.issueIsMe))


if __name__ == '__main__':
  cherrypy.tree.mount(dowser.Root(), '/dowser')
  cherrypy.quickstart(App(), '/', config)