[issue31415] Add -X option to show import time
INADA Naoki
report at bugs.python.org
Sun Sep 24 22:23:02 EDT 2017
INADA Naoki added the comment:
I don't have any good idea for it.
I usually run `python -X importtime -c 'import functools'` several times to ensure pyc files are created and it is cached by OS.
On Linux, `strace -c` and `time` command can be used.
But I don't know cross platform way to do it.
$ strace -c python -c 'import asyncio'
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
0.00 0.000000 0 244 read
0.00 0.000000 0 160 2 open
0.00 0.000000 0 161 close
0.00 0.000000 0 527 46 stat
0.00 0.000000 0 266 fstat
0.00 0.000000 0 16 lstat
0.00 0.000000 0 114 6 lseek
0.00 0.000000 0 109 mmap
$ /usr/bin/time python -c 'import asyncio'
0.12user 0.00system 0:00.13elapsed 98%CPU (0avgtext+0avgdata 17004maxresident)k
0inputs+0outputs (0major+2613minor)pagefaults 0swaps
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31415>
_______________________________________
More information about the Python-bugs-list
mailing list