1

In running cProfile on anything (for example a mergeSort) I'm getting all 000's in the runtimes, and key lines/vars/methods not listed/tested in the process. Only seems to test under methods, internals. Please advise.

below are my results for a mergeSort, I've tried running the python -m cProfile [mergeSort(lst)] w/ and w/out brackets--saw both in documentation. Only version I can get to work is the: import cProfile cProfile.run(mergeSort(lst))

or the enable() disable() method shown.

formatting doesn't turn out well, so attached image. cProfile Results

results:

''' [17, 20, 26, 31, 44, 54, 55, 77, 93] 127 function calls (111 primitive calls) in 0.000 seconds

Ordered by: standard name

ncalls tottime percall cumtime percall filename:lineno(function) 17/1 0.000 0.000 0.000 0.000 :1(mergeSort) 1 0.000 0.000 0.000 0.000 :36() 1 0.000 0.000 0.000 0.000 :37() 2 0.000 0.000 0.000 0.000 codeop.py:132(call) 2 0.000 0.000 0.000 0.000 hooks.py:142(call) 2 0.000 0.000 0.000 0.000 hooks.py:207(pre_run_code_hook) 2 0.000 0.000 0.000 0.000 interactiveshell.py:1104(user_global_ns) 2 0.000 0.000 0.000 0.000 interactiveshell.py:2933(run_code) 2 0.000 0.000 0.000 0.000 ipstruct.py:125(getattr) 2 0.000 0.000 0.000 0.000 {built-in method builtins.compile} 2 0.000 0.000 0.000 0.000 {built-in method builtins.exec} 91 0.000 0.000 0.000 0.000 {built-in method builtins.len} 1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}

'''

Zach Oakes
  • 185
  • 14

0 Answers0