You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CHANGELOG.rst
Edited entry
kernprof.py
__doc__
Updated
main()
- Updated function used to find name of the Python executable to
be more lenient in abbreviating the name, requiring file
identity (via `os.path.samefile()`) instead of string-path
equality
- Added new option `-c`, which causes the positional argument
to be interpreted as an inline script (as with `python -c`)
instead of the path to a script file
- Added special case for `script = -` to read the script to
profile from stdin
Copy file name to clipboardExpand all lines: CHANGELOG.rst
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,8 @@ Changes
10
10
* ENH: Added CLI argument ``-m`` to ``kernprof`` for running a library module as a script; also made it possible for profiling targets to be supplied across multiple ``-p`` flags
11
11
* FIX: Fixed explicit profiling of class methods; added handling for profiling static, bound, and partial methods, ``functools.partial`` objects, (cached) properties, and async generator functions
12
12
* FIX: Fixed namespace bug when running ``kernprof -m`` on certain modules (e.g. ``calendar`` on Python 3.12+).
13
+
* ENH: Added CLI arguments ``-c`` to ``kernprof`` for (auto-)profiling module/package/inline-script execution instead of that of script files; passing ``'-'`` as the script-file name now also reads from and profiles ``stdin``
The python script file, module, or literal code to run
60
62
args Optional script arguments
61
63
62
64
options:
63
65
-h, --help show this help message and exit
64
66
-V, --version show program's version number and exit
65
67
-l, --line-by-line Use the line-by-line profiler instead of cProfile. Implies --builtin.
66
68
-b, --builtin Put 'profile' in the builtins. Use 'profile.enable()'/'.disable()', '@profile' to decorate functions, or 'with profile:' to profile a section of code.
67
-
-o OUTFILE, --outfile OUTFILE
69
+
-o, --outfile OUTFILE
68
70
Save stats to <outfile> (default: 'scriptname.lprof' with --line-by-line, 'scriptname.prof' without)
69
-
-s SETUP, --setup SETUP
70
-
Code to execute before the code to profile
71
+
-s, --setup SETUP Code to execute before the code to profile
71
72
-v, --view View the results of the profile in addition to saving it
72
73
-r, --rich Use rich formatting if viewing output
73
-
-u UNIT, --unit UNIT Output unit (in seconds) in which the timing info is displayed (default: 1e-6)
74
+
-u, --unit UNIT Output unit (in seconds) in which the timing info is displayed (default: 1e-6)
74
75
-z, --skip-zero Hide functions which have not been called
Enables outputting of cumulative profiling results to file every n seconds. Uses the threading module. Minimum value is 1 (second). Defaults to disabled.
76
+
-i, --output-interval [OUTPUT_INTERVAL]
77
+
Enables outputting of cumulative profiling results to file every n seconds. Uses the threading module. Minimum value is 1 (second). Defaults to
78
+
disabled.
77
79
-p, --prof-mod PROF_MOD
78
80
List of modules, functions and/or classes to profile specified by their name or path. List is comma separated, adding the current script path profiles
79
81
the full script. Multiple copies of this flag can be supplied and the.list is extended. Only works with line_profiler -l, --line-by-line
@@ -216,12 +218,10 @@ def _python_command():
216
218
Return a command that corresponds to :py:obj:`sys.executable`.
0 commit comments