File: //opt/saltstack/salt/lib/python3.10/site-packages/cherrypy/lib/__pycache__/profiler.cpython-310.pyc
o
�N�g� � @ s� d Z ddlZddlZddlZddlZddlZddlZzddlZddlZdd� Z e e_
W n
ey8 dZdZY nw daG dd� de
�ZG dd� de�ZG d d
� d
�Zddd
�Zedkrheeejdd� �� dS dS )ai Profiler tools for CherryPy.
CherryPy users
==============
You can profile any of your pages as follows::
from cherrypy.lib import profiler
class Root:
p = profiler.Profiler("/path/to/profile/dir")
@cherrypy.expose
def index(self):
self.p.run(self._index)
def _index(self):
return "Hello, world!"
cherrypy.tree.mount(Root())
You can also turn on profiling for all requests
using the ``make_app`` function as WSGI middleware.
CherryPy developers
===================
This module can be used whenever you make changes to CherryPy,
to get a quick sanity-check on overall CP performance. Use the
``--profile`` flag when running the test suite. Then, use the ``serve()``
function to browse the results in a web browser. If you run this
module from the command line, it will call ``serve()`` for you.
� Nc C sL | \}}}|� d�rtj�|dd� �|dd� ||fS tj�|�||fS )zQMake profiler output more readable by adding `__init__` modules' parents
z__init__.pyNi�)�endswith�os�path�basename)Z func_name�filename�line�name� r �I/opt/saltstack/salt/lib/python3.10/site-packages/cherrypy/lib/profiler.py�new_func_strip_path1 s
�r c @ sZ e Zd Zddd�Zdd� Zdd� Zdd d
�Zejdd� �Z ejd
d� �Z
ejdd� �ZdS )�ProfilerNc C s>