Skip to main content

Profiler utility for python

install

pip install pyprofiler

profile code in source

profiler = start_profile()
meth1()
meth2()
meth3()
meth4()
end_profile(profiler)
# sample
python run_graph_main.py

$ total time
         42 function calls (39 primitive calls) in 2.018 seconds

   Ordered by: internal time
   List reduced from 22 to 20 due to restriction <20>

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
        8    2.016    0.252    2.016    0.252 {time.sleep}
        1    0.001    0.001    0.002    0.002 pyprofiler.py:16(end_profile)
        1    0.000    0.000    0.000    0.000 functools.py:2(<module>)
        1    0.000    0.000    0.001    0.001 pstats.py:1(<module>)
        2    0.000    0.000    0.504    0.252 main_profile.py:32(meth2)
        2    0.000    0.000    0.205    0.103 main_profile.py:22(meth1)
        2    0.000    0.000    0.908    0.454 main_profile.py:42(meth3)
      8/5    0.000    0.000    0.604    0.121 main_profile.py:10(call_next)
        2    0.000    0.000    1.406    0.703 main_profile.py:52(meth4)
        1    0.000    0.000    1.006    1.006 main_profile.py:62(aggregate)

graphical representation, needs and graphviz

# requirements
pip install gprof2dot
brew install graphviz
# sample program
python main_graph.py
from pyprofiler import graph_profile_program
graph_profile_program("main_graph.py")
screenshot

screenshot

callgraph, needs wxpython and runsnakerun

# requirements
brew install wxPython
pip install runsnakerun
# sample
python run_graph_main.py
#implementation, call method aggregate
runsnake_profile_method("aggregate", globals(), locals())
screenshot

screenshot

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyprofiler-29.tar.gz (2.6 kB view details)

Uploaded Source

File details

Details for the file pyprofiler-29.tar.gz.

File metadata

  • Download URL: pyprofiler-29.tar.gz
  • Upload date:
  • Size: 2.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pyprofiler-29.tar.gz
Algorithm Hash digest
SHA256 cd72e573e860f369c8fae5e4a189190618d7431beb9e92e531fcac27bb83d43e
MD5 98a45a60959aa80086bb9d8c91aa2943
BLAKE2b-256 04dbbf3219f7f89ce887268f2836cfd7027137a983c1cbbfdd7a99e18768e849

See more details on using hashes here.

Release history Release notifications | RSS feed

69

1 file

66

1 file

65

1 file

64

1 file

63

1 file

62

1 file

61

1 file

60

1 file

59

1 file

57

1 file

56

1 file

55

1 file

54

1 file

53

1 file

52

1 file

50

1 file

49

1 file

48

1 file

47

1 file

46

1 file

45

1 file

44

1 file

43

1 file

42

1 file

41

1 file

40

1 file

39

1 file

38

1 file

37

1 file

36

1 file

35

1 file

33

1 file

32

1 file

31

1 file

30

1 file

This release

29 This release

1 file

28

1 file

27

1 file

26

1 file

25

1 file

24

1 file

23

1 file

22

1 file

21

1 file

20

1 file

12

1 file

11

1 file

10

1 file

9

1 file

7

1 file

6

1 file

5

1 file

4

1 file

3

1 file

2

1 file

1

1 file

0.3.2

1 file

0.3.1

1 file

0.2

1 file

0.1

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page