Skip to main content

Aggregate profiling for WSGI requests

Project description

This package provides a WSGI middleware component which aggregates profiling data across all requests to the WSGI application. It provides a web GUI for viewing profiling data.

Installation

Install using setuptools, e.g. (within a virtualenv):

$ easy_install repoze.profile

Configuration via Python

Wire up the middleware in your application:

from repoze.profile.profiler import AccumulatingProfileMiddleware
middleware = AccumulatingProfileMiddleware(
               app,
               log_filename='/foo/bar.log',
               cachegrind_filename='/foo/cachegrind.out.bar',
               discard_first_request=True,
               flush_at_shutdown=True,
               path='/__profile__'
              )

The configuration options are as follows:

- ``log_filename`` is the name of the file to which the accumulated
  profiler statistics are logged.

- ``cachegrind_filename`` is the optional name of the file to which
  the accumulated profiler statistics are logged in the KCachegrind
  format.

- If ``discard_first_request`` to true (the default), then the
  middleware discards the statistics for the first request:  the
  rationale is that there are a bunch of lazy / "first time"
  initializations which distort measurement of the application's
  normal performance.

- If ``flush_at_shutdown`` is true (the default), profiling data will
  be deleted when the middleware instance disappears (via its
  __del__).  If it's false, profiling data will not be deleted.

- ``path`` is the URL path to the profiler UI.  It defaults to
  ``/__profile__``.

Once you have some profiling data, you can visit path in your browser to see a user interface displaying profiling statistics (e.g. http://localhost:8080/__profile__).

Configuration via Paste

Wire the middleware into a pipeline in your Paste configuration, for example:

[filter:profile]
use = egg:repoze.profile#profile
log_filename = myapp.profile
cachegrind_filename = cachegrind.out.myapp
discard_first_request = true
path = /__profile__
flush_at_shutdown = true
...

[pipeline:main]
pipeline = egg:Paste#cgitb
           egg:Paste#httpexceptions
           profile
           myapp

Once you have some profiling data, you can visit path in your browser to see a user interface displaying profiling statistics.

Reporting Bugs / Development Versions

Visit http://bugs.repoze.org to report bugs. Visit http://svn.repoze.org to download development or tagged versions.

repoze.profile 0.8 (2009-02-25)

  • Added optional support for directly writing out the profiling data in the KCacheGrind format.

  • Avoid a dependency on elementtree when used with Python 2.5 and later. In those Python versions we used the built-in xml.etree support.

repoze.profile 0.7 (2009-02-08)

  • discard_first_request = true did not work!

  • Added tests for discard_first_request and flush_at_shutdown.

  • Converted CHANGES.txt to ReST.

  • Bump ez_setup.py version.

repoze.profile 0.6 (2008-08-21)

  • discard_first_request = false did not work.

  • Clearing the profile data from the user interface did not properly

    discard profiler state.

repoze.profile 0.5 (2008-06-11)

  • Initial PyPI release.

repoze.profile 0.4 (2008-05-07)

  • Remove dependency-link to http://dist.repoze.org to prevent easy_install from adding that to its search path.

  • Incorporated a patch from Alec Flett <alecf@metaweb.com> to uses cProfile, if available, rather than pure Python profile.

  • Bump ez_setup.py version.

repoze.profile 0.3 (2008-02-20)

  • Added compatibility with Python 2.5.

  • Made setup.py depend explicitly on ElementTree 1.2.6: meld needs it but meld isn’t a setuptools package.

repoze.profile 0.2 (2008-02-20)

  • Added a browser UI.

  • Added a knob to control discard at shutdown.

repoze.profile 0.1 (2008-02-08)

  • Initial release.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

repoze.profile-0.8.zip (19.3 kB view details)

Uploaded Source

File details

Details for the file repoze.profile-0.8.zip.

File metadata

  • Download URL: repoze.profile-0.8.zip
  • Upload date:
  • Size: 19.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for repoze.profile-0.8.zip
Algorithm Hash digest
SHA256 1f66c9fe8cc9f085a992a69e435e010f35b26489bfd2030fd5fcfdad6bdb7d4a
MD5 a89f65518ffaf61aa7a87e1e8c4cab63
BLAKE2b-256 20ce7a11245766146c8265a82dc13ecde4d946a608023b009dd95cafeb365247

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page