In show_func function; around line num 202:
if output_unit is None:
output_unit = unit
Change it to:
if output_unit is None:
output_unit = unit*1000000
Secondly, in the function show_text; around line num 254:
if output_unit is not None:
stream.write('Timer unit: %g s\n\n' % output_unit)
else:
stream.write('Timer unit: %g s\n\n' % unit)
Change it to:
if output_unit is not None:
stream.write('Timer unit: %g s\n\n' % output_unit)
else:
stream.write('Timer unit: %g s\n\n' % (unit*1000000))
Use the same factor in both places.
I have made the above changes as I use line commands to run line_profiler and not ipython/jupyter.
The output file looks like following. The time units are so much more readable!
executed
Wrote profile results to test.py.lprof
Timer unit: 0.1 s
Total time: 1.00024 s
File: test.py
Function: testfunc at line 5
Line # Hits Time Per Hit % Time Line Contents
==============================================================
5 @profile
6 def testfunc():
7 1 10.0 10.0 100.0 time.sleep(1)
8 1 0.0 0.0 0.0 print('executed')