I do not understand why cProfile
reports the usage of some built-in functions and methods, such as calls to len()
or str.count
, but fails to report others such as list()
or range()
:
In [1]: import cProfile
In [2]: cProfile.run("for i in range(10): x = list()")
3 function calls in 0.000 seconds
Ordered by: standard name
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 0.000 0.000 <string>:1(<module>)
1 0.000 0.000 0.000 0.000 {built-in method builtins.exec}
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
Is it possible to modify this behaviour so as to obtain a report that includes those calls?