Skip to content

Instantly share code, notes, and snippets.

@methane
Created February 17, 2017 12:25
Show Gist options
  • Save methane/1f1fe4385dad84f03eb429359f0f917b to your computer and use it in GitHub Desktop.
Save methane/1f1fe4385dad84f03eb429359f0f917b to your computer and use it in GitHub Desktop.
inada-n@rinrin:~$ cat > x.py
import site
site.main()
inada-n@rinrin:~$ local/cpython/bin/python3 -S -m cProfile -scumtime x.py | head -n30
2648 function calls (2637 primitive calls) in 0.004 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
5/1 0.000 0.000 0.004 0.004 {built-in method builtins.exec}
1 0.000 0.000 0.004 0.004 x.py:1(<module>)
1 0.000 0.000 0.004 0.004 site.py:517(main)
6/5 0.000 0.000 0.002 0.000 <frozen importlib._bootstrap>:958(_find_and_load)
6/5 0.000 0.000 0.002 0.000 <frozen importlib._bootstrap>:931(_find_and_load_unlocked)
1 0.000 0.000 0.002 0.002 site.py:274(addusersitepackages)
1 0.000 0.000 0.002 0.002 site.py:251(getusersitepackages)
1 0.000 0.000 0.001 0.001 site.py:237(getuserbase)
4/3 0.000 0.000 0.001 0.000 <frozen importlib._bootstrap>:641(_load_unlocked)
4/3 0.000 0.000 0.001 0.000 <frozen importlib._bootstrap_external>:673(exec_module)
1 0.000 0.000 0.001 0.001 site.py:99(abs_paths)
110 0.000 0.000 0.001 0.000 posixpath.py:367(abspath)
1 0.000 0.000 0.001 0.001 sysconfig.py:592(get_config_var)
3/2 0.000 0.000 0.001 0.000 sysconfig.py:515(get_config_vars)
6 0.000 0.000 0.001 0.000 <frozen importlib._bootstrap>:861(_find_spec)
4 0.000 0.000 0.001 0.000 <frozen importlib._bootstrap_external>:744(get_code)
6 0.000 0.000 0.001 0.000 <frozen importlib._bootstrap_external>:1150(find_spec)
6 0.000 0.000 0.001 0.000 <frozen importlib._bootstrap_external>:1118(_get_spec)
129 0.001 0.000 0.001 0.000 posixpath.py:329(normpath)
20 0.000 0.000 0.001 0.000 <frozen importlib._bootstrap_external>:1234(find_spec)
1 0.000 0.000 0.001 0.001 sysconfig.py:417(_init_posix)
4/3 0.000 0.000 0.001 0.000 <frozen importlib._bootstrap>:197(_call_with_frames_removed)
4 0.000 0.000 0.001 0.000 <frozen importlib._bootstrap_external>:486(_compile_bytecode)
1 0.000 0.000 0.001 0.001 {built-in method builtins.__import__}
4 0.001 0.000 0.001 0.000 {built-in method marshal.loads}
inada-n@rinrin:~$ local/cpython/bin/python3 -S -m cProfile -scalls x.py | head -n50
2668 function calls (2657 primitive calls) in 0.007 seconds
Ordered by: call count
ncalls tottime percall cumtime percall filename:lineno(function)
433 0.000 0.000 0.000 0.000 {built-in method posix.fspath}
350 0.000 0.000 0.000 0.000 {built-in method builtins.isinstance}
172 0.000 0.000 0.000 0.000 {built-in method builtins.getattr}
157 0.000 0.000 0.000 0.000 posixpath.py:39(_get_sep)
129 0.001 0.000 0.001 0.000 posixpath.py:329(normpath)
113 0.000 0.000 0.000 0.000 posixpath.py:62(isabs)
110 0.000 0.000 0.001 0.000 posixpath.py:367(abspath)
110 0.000 0.000 0.000 0.000 <frozen importlib._bootstrap>:208(_verbose_message)
104 0.000 0.000 0.000 0.000 <frozen importlib._bootstrap_external>:59(<listcomp>)
104 0.000 0.000 0.000 0.000 <frozen importlib._bootstrap_external>:57(_path_join)
39 0.000 0.000 0.000 0.000 {built-in method builtins.hasattr}
38 0.000 0.000 0.000 0.000 {built-in method posix.stat}
38 0.000 0.000 0.000 0.000 posixpath.py:73(join)
32 0.000 0.000 0.000 0.000 <frozen importlib._bootstrap_external>:75(_path_stat)
26 0.000 0.000 0.000 0.000 <frozen importlib._bootstrap_external>:1081(_path_importer_cache)
24 0.000 0.000 0.000 0.000 {built-in method _imp.release_lock}
23 0.000 0.000 0.000 0.000 {built-in method builtins.len}
20 0.000 0.000 0.001 0.000 <frozen importlib._bootstrap_external>:1234(find_spec)
20 0.000 0.000 0.000 0.000 <frozen importlib._bootstrap_external>:41(_relax_case)
18 0.000 0.000 0.000 0.000 {built-in method _imp.acquire_lock}
18 0.000 0.000 0.000 0.000 <frozen importlib._bootstrap>:834(__enter__)
18 0.000 0.000 0.000 0.000 <frozen importlib._bootstrap>:838(__exit__)
16 0.000 0.000 0.000 0.000 {method 'format' of 'str' objects}
16 0.000 0.000 0.000 0.000 posixpath.py:230(expanduser)
16 0.000 0.000 0.000 0.000 <frozen importlib._bootstrap_external>:1203(<genexpr>)
16 0.000 0.000 0.000 0.000 <frozen importlib._bootstrap>:307(<genexpr>)
15 0.000 0.000 0.000 0.000 sysconfig.py:143(_subst_vars)
14 0.000 0.000 0.000 0.000 {built-in method posix.lstat}
14 0.000 0.000 0.000 0.000 {built-in method _stat.S_ISLNK}
14 0.000 0.000 0.000 0.000 posixpath.py:166(islink)
12 0.000 0.000 0.000 0.000 {built-in method _thread.allocate_lock}
12 0.000 0.000 0.000 0.000 {built-in method _thread.get_ident}
9 0.000 0.000 0.000 0.000 <frozen importlib._bootstrap_external>:63(_path_split)
8 0.000 0.000 0.000 0.000 posixpath.py:50(normcase)
8 0.000 0.000 0.000 0.000 site.py:90(makepath)
8 0.000 0.000 0.000 0.000 <frozen importlib._bootstrap>:389(cached)
8 0.000 0.000 0.000 0.000 <frozen importlib._bootstrap_external>:264(cache_from_source)
7 0.000 0.000 0.000 0.000 {built-in method from_bytes}
7 0.000 0.000 0.000 0.000 <frozen importlib._bootstrap_external>:52(_r_long)
7 0.000 0.000 0.000 0.000 <frozen importlib._bootstrap_external>:85(_path_is_mode_type)
6 0.000 0.000 0.000 0.000 {built-in method _imp.is_builtin}
6 0.000 0.000 0.000 0.000 {built-in method _imp.is_frozen}
6 0.000 0.000 0.000 0.000 {built-in method posix.getcwd}
6 0.000 0.000 0.001 0.000 <frozen importlib._bootstrap_external>:1118(_get_spec)
6 0.000 0.000 0.001 0.000 <frozen importlib._bootstrap_external>:1150(find_spec)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment