Skip to main content


codepulse: Measure Execution Time for Each Line of Code

Package PyPI Latest Release PyPI Downloads
Meta Powered by codepulse License - MIT

What is codepulse?

codepulse is a Python package designed to provide detailed insights into the execution time of your code at a granular level, line by line. By meticulously tracking the execution time of each line of code, codepulse helps you identify bottlenecks, optimize performance, and gain a deeper understanding of your code's behavior.

Table of Contents

Main Features

  • Precisely measures the execution time of each line of code within a function.
  • Generates informative visualizations that highlight performance hotspots.
  • Supports integration with popular Python development environments.
  • Designed for ease of use and seamless integration into existing projects.

Where to get it

The source code is currently hosted on GitHub at: https://github.com/ar8372/codepulse

Binary installers for the latest released version are available at the Python Package Index (PyPI).

Installation

You can install codepulse using pip:

pip install codepulse

Usage

Import the Tracker module from the codepulse package, create an instance of it by passing the function you want to track as a parameter, and then utilize this instance to invoke the tracked function. When you create an instance using Tracker(fun1), it generates a wrapper around fun1 that effectively measures and records the execution time line by line.

from codepulse import Tracker

def fun1(x,y):
    m = 1
    for i in range(x*100):
        m = m * 3 
        for j in range(x*30):
            m = m + 4 
    return m 

t = Tracker(fun1)
t(3,5)

output:

  ===========================================================================================
  |> Function Name: fun1, #iter: 3, mean_time(in ms): 46.856, std_time(in_ms): 0.019
  ===========================================================================================
  | LineNo     | line                              | mean_time(in ms)     | std_time(in ms) |
  ===========================================================================================
  | 0          |     m = 1                         | 0.0                  | 0.0
  | 1          |     for i in range(x*100):        | 46.856               | 0.024
  | 2          |         m = m * 3                 | 0.0                  | 0.0
  | 3          |         for j in range(x*30):     | 15.673               | 0.003
  | 4          |             m = m + 4             | 15.611               | 0.052
  | 5          |     return m                      | nan                  | nan
  -------------------------------------------------------------------------------------------

License

This project is licensed under the MIT License

Metadata

Release files for codepulse 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for codepulse 1.0.2
File Size Uploaded Provenance Actions
codepulse-1.0.2.tar.gz 10.3 kB Without provenance Details for codepulse-1.0.2.tar.gz

Release files / codepulse-1.0.2.tar.gz

Download URL codepulse-1.0.2.tar.gz
Size 10.3 kB
Tags Source
SHA-256 checksum
How to use checksums
8d14925c2b4be792e6adaaad0d980af6b608df800954e29dd2650191b58c6233
BLAKE2b-256 checksum
How to use checksums
07985decb1ed7479ffc73ecea6f782550eabafb5829110a55eb4c6a466385458
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.5

Security for codepulse 1.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.2 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page