1

It seems that cProfile provides only time consumed for function calls. While this is useful in general, I need to find a way to profile python programs at the statement-level, i.e, how much time does each statement take? How could I do this ?

zell
  • 9,830
  • 10
  • 62
  • 115
  • Use [`line_profiler`](https://pypi.org/project/line-profiler/) – roganjosh Sep 28 '20 at 20:32
  • Interesting! Do you have an example illustrating how it can be used? – zell Sep 28 '20 at 20:36
  • 3
    Does this answer your question? [How can I profile Python code line-by-line?](https://stackoverflow.com/questions/3927628/how-can-i-profile-python-code-line-by-line) – Random Davis Sep 28 '20 at 20:36
  • @roganjosh I did "pip install line-profiler", and then do not see how to use it... In particular, line-profiler is not a recognized command after installing the package. – zell Sep 28 '20 at 20:43
  • Just realize that the name of the command for line-profiler is kernprof, a strange name that helps nobody:-) – zell Sep 28 '20 at 20:47
  • @RandomDavis You are right! Same question. – zell Sep 28 '20 at 20:50

0 Answers0