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

Supported by

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