Home Explore Blog CI



neovim

14th chunk of `runtime/doc/repeat.txt`
23b0e782b70e9de2e5474dba14b67f9296c5a13d069e601d0000000100000910

		Stop profiling until the next `:profile continue` command.
		Can be used when doing something that should not be counted
		(e.g., an external command).  Does not nest.

:prof[ile] continue
		Continue profiling after `:profile pause`.

:prof[ile] func {pattern}
		Profile function that matches the pattern {pattern}.
		See |:debug-name| for how {pattern} is used.

:prof[ile][!] file {pattern}
		Profile script file that matches the pattern {pattern}.
		See |:debug-name| for how {pattern} is used.
		This only profiles the script itself, not the functions
		defined in it.
		When the [!] is added then all functions defined in the script
		will also be profiled.
		Note that profiling only starts when the script is loaded
		after this command.  A :profile command in the script itself
		won't work.

:prof[ile] dump
		Write the current state of profiling to the logfile
		immediately.  After running this command, Vim continues to
		collect the profiling statistics.

:profd[el] ...						*:profd* *:profdel*
		Stop profiling for the arguments specified. See |:breakdel|
		for the arguments. Examples: >
			profdel func MyFunc
			profdel file MyScript.vim
			profdel here

You must always start with a ":profile start fname" command.  The resulting
file is written when Vim exits.  For example, to profile one specific
function: >
	profile start /tmp/vimprofile
	profile func MyFunc

Here is an example of the output, with line
numbers prepended for the explanation:

  1 FUNCTION  Test2() ~
  2 Called 1 time ~
  3 Total time:   0.155251 ~
  4  Self time:   0.002006 ~
  5  ~
  6 count  total (s)   self (s) ~
  7	9	       0.000096   for i in range(8) ~
  8	8   0.153655   0.000410     call Test3() ~
  9	8	       0.000070   endfor ~
 10				  " Ask a question ~
 11	1	       0.001341   echo input("give me an answer: ") ~

The header (lines 1-4) gives the time for the whole function.  The "Total"
time is the time passed while the function was executing.  The "Self" time is
the "Total" time reduced by time spent in:
- other user defined functions
- sourced scripts
- executed autocommands
- external (shell) commands

Lines 7-11 show the time spent in each executed line.  Lines that are not
executed do not count.  Thus a comment line is never counted.

The Count column shows how many times a line was executed.

Title: Profiling Commands and Output Explanation
Summary
This section details various profiling commands in Vim, including `:profile pause` to temporarily halt profiling, `:profile continue` to resume, `:profile func` and `:profile file` to target specific functions or scripts, `:profile dump` to immediately write results to the log, and `:profdel` to stop profiling for specific arguments. It emphasizes the necessity of starting with `:profile start`. It then provides an example of the profiling output format, explaining the meaning of 'Total time,' 'Self time,' 'Count,' and how time is attributed to each executed line, excluding comments and non-executed lines.