Skip to content

Latest commit

 

History

History
90 lines (67 loc) · 2.28 KB

README.md

File metadata and controls

90 lines (67 loc) · 2.28 KB
Actions Status GitHub issues GitHub stars GitHub license Downloads

akarsu is the New Generation Profiler based on PEP 669. The name of the project, comes from the surname of a minstrel named Muhlis Akarsu, which means stream.

Installation

akarsu can be installed by running pip install akarsu. It requires Python 3.12.0+ to run.

Usage

cat example.py

Output:

def foo():
    x = 1
    isinstance(x, int)
    return x


def bar():
    foo()


bar()

akarsu -f example.py

Output:

     Count     Event Type     Filename(function)
         1      PY_CALL       example.py(bar)
         1      PY_START      example.py(bar)
         1      PY_CALL       example.py(foo)
         1      PY_START      example.py(foo)
         1       C_CALL       example.py(<built-in function isinstance>)
         1      C_RETURN      example.py(foo)
         1     PY_RETURN      example.py(foo)
         1     PY_RETURN      example.py(bar)

Total number of events: 8
  PY_CALL = 2
  PY_START = 2
  PY_RETURN = 2
  C_CALL = 1
  C_RETURN = 1

If you want to show only the function calls in the output, you can use the -c or --calls argument.

akarsu -c -f example.py

Output:

     Count     Event Type     Filename(function)
         1      PY_CALL       example.py(bar)
         1      PY_CALL       example.py(foo)
         1       C_CALL       example.py(<built-in function isinstance>)

Total number of events: 3
  PY_CALL = 2
  C_CALL = 1