Skip to content

mirecl/pprof

Folders and files

NameName
Last commit message
Last commit date
Dec 6, 2023
Apr 7, 2022
Apr 17, 2023
Apr 7, 2022
Apr 5, 2022
Oct 10, 2022
Mar 29, 2022
Apr 17, 2023
Apr 5, 2022
Mar 10, 2023
Apr 9, 2023

Repository files navigation

pprof

PyPi PePy Black License Test Test
PyPi OS


Installing

pip install pprof

or

poetry add pprof

A Simple Example

from time import sleep
from typing import List
from pprof import cpu

cpu.auto_report()

def foo():
    sleep(1.01)
    return 3

@cpu
def run(arr: List) -> float:
    tmp = []
    cnt = foo()

    # comment action #1
    for row in arr:
        # comment action #2 row 1
        # comment action #2 row 2
        if row % cnt == 0:
            tmp.append(row)
    result = (sum(tmp * 200) + len(arr)) / len(tmp)  # comment action #3
    return result

run(list(range(250000)))
(venv) python run.py

Links