Skip to main content

A Better PROFiler

Project description

bprof

A Better PROFiler

Introduction

The reason bprof exists is that the major Python profiling packages simply don't profile robustly. They use timestamps and ad-hoc methods for keeping track of how time passes. For example, one approach is to timestamp when a function starts and when it stops, and then count this as the function time. This includes time spent in the profiling hooks.

The approach taken here is to integrate all of the time between hooks and add it to the appropriate records. By registering for all hooks except for opcodes, the time spent out of the profiler is directly measured. The time is measured right after entering bprof, and right before exiting. This allows for as rigorous time measurement as possible. Then, stacks are used to track the current contexts and record detailed profiling information.

Example

Code:

import bprof._bprof as bp
import time


def f():
    time.sleep(1)


bp.start()
f()
bp.stop()
bp.dump("")

Results:

Name: f, 1.2142e-05
1.00074(6.21e-07/1.00074):     time.sleep(1)
Name: <built-in function stop>, 0
Name: <built-in function sleep>, 1.00074

Future

There is a lot of future work. This is just a first pass.

  • Save statistics

History

0.1.0 (2019-10-10)

  • First release on PyPI.

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

bprof-0.5.2.tar.gz (13.7 kB view details)

Uploaded Source

Built Distribution

bprof-0.5.2-cp37-cp37m-macosx_10_14_x86_64.whl (24.4 kB view details)

Uploaded CPython 3.7m macOS 10.14+ x86-64

File details

Details for the file bprof-0.5.2.tar.gz.

File metadata

  • Download URL: bprof-0.5.2.tar.gz
  • Upload date:
  • Size: 13.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.4

File hashes

Hashes for bprof-0.5.2.tar.gz
Algorithm Hash digest
SHA256 65e836dc5ad4427fa98ae6673a01301379331f8298a4e3c0cf80861c9577b772
MD5 68a5fb99faadafb903134814924490f8
BLAKE2b-256 c17cb06c60054dbe74221203c52a670b4d37b2c842dd7283e69165e0120c512f

See more details on using hashes here.

File details

Details for the file bprof-0.5.2-cp37-cp37m-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: bprof-0.5.2-cp37-cp37m-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 24.4 kB
  • Tags: CPython 3.7m, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.4

File hashes

Hashes for bprof-0.5.2-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 be0209504e95c9caaa91740a174260ead3e608f1d5ac15046e979c54cd9742fb
MD5 4cb3a0052a713ffc732f605cf7ae3b61
BLAKE2b-256 8d70410e81248261187eb1782f650f38a5233f49359daaf7668cb7eb6d610cef

See more details on using hashes here.

Supported by

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