diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-08-12 12:58:52 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-08-12 13:44:37 +0800 |
commit | c7ca94ba7f7a76caf51ed62b521f04c97c6aeed5 (patch) | |
tree | 88e227c21201ed7ae438a3b011d673ce8e74d7ea /src/nvim/runtime.h | |
parent | 0d9e09bf670724caec9939a7165e25c4abc40291 (diff) | |
download | rneovim-c7ca94ba7f7a76caf51ed62b521f04c97c6aeed5.tar.gz rneovim-c7ca94ba7f7a76caf51ed62b521f04c97c6aeed5.tar.bz2 rneovim-c7ca94ba7f7a76caf51ed62b521f04c97c6aeed5.zip |
vim-patch:8.1.1684: profiling functionality is spread out
Problem: Profiling functionality is spread out.
Solution: Put profiling functionality in profiling.c. (Yegappan Lakshmanan,
closes vim/vim#4666)
https://github.com/vim/vim/commit/fa55cfc69d2b14761e2a8bd85bc1e0d82df770aa
Move proftime_T to types.h for now to avoid recursive #include.
Diffstat (limited to 'src/nvim/runtime.h')
-rw-r--r-- | src/nvim/runtime.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/nvim/runtime.h b/src/nvim/runtime.h index d83ec00185..dae3850e3d 100644 --- a/src/nvim/runtime.h +++ b/src/nvim/runtime.h @@ -5,6 +5,38 @@ #include "nvim/ex_docmd.h" +typedef struct scriptitem_S { + char_u *sn_name; + bool sn_prof_on; ///< true when script is/was profiled + bool sn_pr_force; ///< forceit: profile functions in this script + proftime_T sn_pr_child; ///< time set when going into first child + int sn_pr_nest; ///< nesting for sn_pr_child + // profiling the script as a whole + int sn_pr_count; ///< nr of times sourced + proftime_T sn_pr_total; ///< time spent in script + children + proftime_T sn_pr_self; ///< time spent in script itself + proftime_T sn_pr_start; ///< time at script start + proftime_T sn_pr_children; ///< time in children after script start + // profiling the script per line + garray_T sn_prl_ga; ///< things stored for every line + proftime_T sn_prl_start; ///< start time for current line + proftime_T sn_prl_children; ///< time spent in children for this line + proftime_T sn_prl_wait; ///< wait start time for current line + linenr_T sn_prl_idx; ///< index of line being timed; -1 if none + int sn_prl_execed; ///< line being timed was executed +} scriptitem_T; + +/// Growarray to store info about already sourced scripts. +extern garray_T script_items; +#define SCRIPT_ITEM(id) (((scriptitem_T *)script_items.ga_data)[(id) - 1]) + +/// Struct used in sn_prl_ga for every line of a script. +typedef struct sn_prl_S { + int snp_count; ///< nr of times line was executed + proftime_T sn_prl_total; ///< time spent in a line + children + proftime_T sn_prl_self; ///< time spent in a line itself +} sn_prl_T; + typedef void (*DoInRuntimepathCB)(char *, void *); typedef struct { |