Skip to content

Instantly share code, notes, and snippets.

@djv
djv / line_profiler_decorator.py
Created October 9, 2018 20:17 — forked from pavelpatrin/line_profiler_decorator.py
Python line profiler decorator
def profile(func):
from functools import wraps
@wraps(func)
def wrapper(*args, **kwargs):
from line_profiler import LineProfiler
prof = LineProfiler()
try:
return prof(func)(*args, **kwargs)
finally: