Skip to content

bpabel/profiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

profiler

Tools to easily profile python code and view results.

Basic usage

import profiler
profiler.profiler().start(True)

Profiling will automatically end when python exits and open the results with the default text editor.

Alternatively, you can perform profiling manually.

import profiler
p = profiler.profiler()
p.start()
print("All code called after start will be profiled")
p.end()

The Profiler can also be used as a context manager.

import profiler
with profiler.profiler():
    print("Code in here will be profiled")

In each example, profile results will automatically be opened in the default text editor when profiling completes.