Add a separate --profile-startup option to profile startup

This goes to a separate file because that makes option parsing easier
and allows profiling both at the same time.

The "normal" profile now contains only the profile data of the actual
run, which is much more useful - you can now profile a function by
running

   fish -C 'source /path/to/thing' --profile /tmp/thefunction.prof -c 'thefunction'

and won't need to filter out extraneous information.
This commit is contained in:
Fabian Homborg
2021-01-08 17:25:00 +01:00
parent cf800db10a
commit 594d51e7eb
6 changed files with 56 additions and 3 deletions

View File

@@ -31,7 +31,9 @@ The following options are available:
- ``-n`` or ``--no-execute`` do not execute any commands, only perform syntax checking
- ``-p`` or ``--profile=PROFILE_FILE`` when fish exits, output timing information on all executed commands to the specified file
- ``-p`` or ``--profile=PROFILE_FILE`` when fish exits, output timing information on all executed commands to the specified file. This excludes time spent starting up and reading the configuration.
- ``--profile-startup=PROFILE_FILE`` will write timing information for fish's startup to the specified file. This is useful to profile your configuration.
- ``-P`` or ``--private`` enables :ref:`private mode <private-mode>`, so fish will not access old or store new history.