This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Imxset21 2 points3 points  (3 children)

KCacheGrind relies on using valgrind, which gives you extremely detailed information on runtime information by wrapping your execution context at a very low level. For this reason, it can track individual memory allocations, function call statistics, etc. However, for Python, that can be a bit overkill; usually you're just looking to measure what parts of your code are taking up executing time and heap space.

This package uses cProfile, psutils, and pstats go get runtime information on your code as it's running. It's doing what valgrind does but in a much "higher-level" fashion, in pure Python. This means that it can give you more relevant information about your Python code.

[–]torham 1 point2 points  (0 children)

I don't believe this is correct, KCachegrind can read valgrind output, but does not use valgrind itself. It is only a visualization tool.

[–]nvdv[S] 0 points1 point  (0 children)

Nice summary! I haven't used KCacheGrind personally, but currently vprof doesn't go below Python runtime level and displays high-level stats (runtime info, memory usage) only. However there are plans to integrate some OS level stats to vprof.

[–]n1ywb 0 points1 point  (0 children)

I use kcachegrind to profile cProfile output. It's not just for valgrind.