Mercurial > vim
diff src/profiler.c @ 23976:03819ebd3e6d v8.2.2530
patch 8.2.2530: Vim9: not enough testing for profiling
Commit: https://github.com/vim/vim/commit/12d265315fac9e4f3436c38a87f6d9a23b9e7e2b
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Feb 19 19:13:21 2021 +0100
patch 8.2.2530: Vim9: not enough testing for profiling
Problem: Vim9: not enough testing for profiling.
Solution: Add a test with nested functions and a lambda. Fix profiling
for calling a compiled function.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 19 Feb 2021 19:15:03 +0100 |
parents | e3720756acdc |
children | 0082503ff2ff |
line wrap: on
line diff
--- a/src/profiler.c +++ b/src/profiler.c @@ -558,24 +558,20 @@ func_do_profile(ufunc_T *fp) * When calling a function: may initialize for profiling. */ void -profile_may_start_func(profinfo_T *info, ufunc_T *fp, funccall_T *fc) +profile_may_start_func(profinfo_T *info, ufunc_T *fp, ufunc_T *caller) { - if (do_profiling == PROF_YES) + if (!fp->uf_profiling && has_profiling(FALSE, fp->uf_name, NULL)) { - if (!fp->uf_profiling && has_profiling(FALSE, fp->uf_name, NULL)) - { - info->pi_started_profiling = TRUE; - func_do_profile(fp); - } - if (fp->uf_profiling - || (fc->caller != NULL && fc->caller->func->uf_profiling)) - { - ++fp->uf_tm_count; - profile_start(&info->pi_call_start); - profile_zero(&fp->uf_tm_children); - } - script_prof_save(&info->pi_wait_start); + info->pi_started_profiling = TRUE; + func_do_profile(fp); } + if (fp->uf_profiling || (caller != NULL && caller->uf_profiling)) + { + ++fp->uf_tm_count; + profile_start(&info->pi_call_start); + profile_zero(&fp->uf_tm_children); + } + script_prof_save(&info->pi_wait_start); } /* @@ -583,16 +579,16 @@ profile_may_start_func(profinfo_T *info, * must have been called previously. */ void -profile_may_end_func(profinfo_T *info, ufunc_T *fp, funccall_T *fc) +profile_may_end_func(profinfo_T *info, ufunc_T *fp, ufunc_T *caller) { profile_end(&info->pi_call_start); profile_sub_wait(&info->pi_wait_start, &info->pi_call_start); profile_add(&fp->uf_tm_total, &info->pi_call_start); profile_self(&fp->uf_tm_self, &info->pi_call_start, &fp->uf_tm_children); - if (fc->caller != NULL && fc->caller->func->uf_profiling) + if (caller != NULL && caller->uf_profiling) { - profile_add(&fc->caller->func->uf_tm_children, &info->pi_call_start); - profile_add(&fc->caller->func->uf_tml_children, &info->pi_call_start); + profile_add(&caller->uf_tm_children, &info->pi_call_start); + profile_add(&caller->uf_tml_children, &info->pi_call_start); } if (info->pi_started_profiling) // make a ":profdel func" stop profiling the function