Skip to main content

Control callgrind instrumentation from Python.

Project description

valgrind

Usage

Run python3 -m pip install valgrind.

In benchmark.py put:

import valgrind

if __name__ == "__main__":
  some_startup_code()
  valgrind.callgrind_start_instrumentation()
  some_expensive_function()
  valgrind.callgrind_stop_instrumentation()
  valgrind.callgrind_dump_stats("myprofile")

Run valgrind --tool=callgrind --instr-atstart=no python3 benchmark.py.

See profile in myprofile file. Consider opening with KCachegrind or QCachegrind.

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

valgrind-0.0.0.tar.gz (47.2 kB view hashes)

Uploaded Source

Built Distribution

valgrind-0.0.0-cp38-cp38-macosx_10_6_x86_64.whl (4.2 kB view hashes)

Uploaded CPython 3.8 macOS 10.6+ x86-64

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