Skip to content
프로젝트

소개

Python용 라인 단위 프로파일링

개발 도구

이 수치를 측정하는 방법

측정된 스타 증가

in 24h
0
in 7 days
+1
in 15 days
+2
in 1 month
+2

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

line_profiler and kernprof

Pypi ReadTheDocs Downloads CircleCI GithubActions Codecov

This is the official line_profiler repository. The most recent version of line-profiler on pypi points to this repo. The original line_profiler package by @rkern is unmaintained. This fork is the official continuation of the project.

Github https://github.com/pyutils/line_profiler
Pypi https://pypi.org/project/line_profiler
ReadTheDocs https://kernprof.readthedocs.io/en/latest/

line_profiler is a module for doing line-by-line profiling of functions. Use it when function-level profiling identifies a slow function, but you need to see which individual source lines account for the time. kernprof is the command-line helper included with the package.

They are available under a BSD license.

Releases of line_profiler can be installed using pip:

$ pip install line_profiler

Current releases require Python 3.10 or newer. Older Python versions require older line_profiler releases.

Installation while ensuring a compatible IPython version can also be installed using pip:

$ pip install line_profiler[ipython]

Source installs may require a C compiler. Git checkouts also require Cython. Wheels are published for common platforms. If no wheel is available for your platform or Python version, installation may build from source.

The recommended way to use line_profiler is to import profile and enable profiling with the LINE_PROFILE environment variable.

To profile a python script:

  • Install line_profiler: pip install line_profiler.

  • In the relevant file(s), import profile and decorate function(s) you want to profile:

    from line_profiler import profile
    
    
    @profile
    def slow_function():
        ...
    
  • Set the environment variable LINE_PROFILE=1 and run your script as normal. When the script ends a summary of profile results, files written to disk, and instructions for inspecting details will be written to stdout.

For more details and a short tutorial see Line Profiler Basic Usage.

The older kernprof -l workflow is still supported, but it is no longer the main README quick start. See Usage Notes and FAQ for the previous README material covering kernprof, IPython, lower-level API usage, related tools, and FAQ entries.

The short version is:

$ kernprof -lv script_to_profile.py

Bugs and pull requests can be submitted on GitHub.

관련 프로젝트 살펴보기

불러오는 중…