summaryrefslogtreecommitdiff
path: root/src/profiler.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-02-19 19:13:21 +0100
committerBram Moolenaar <Bram@vim.org>2021-02-19 19:13:21 +0100
commit12d265315fac9e4f3436c38a87f6d9a23b9e7e2b (patch)
tree55d04fd2ba3c7f12f32ff24f43b448292fdf7a05 /src/profiler.c
parentd3f8a9ee65b249d073343e43e423bc3348dd09d0 (diff)
downloadvim-git-12d265315fac9e4f3436c38a87f6d9a23b9e7e2b.tar.gz
patch 8.2.2530: Vim9: not enough testing for profilingv8.2.2530
Problem: Vim9: not enough testing for profiling. Solution: Add a test with nested functions and a lambda. Fix profiling for calling a compiled function.
Diffstat (limited to 'src/profiler.c')
-rw-r--r--src/profiler.c34
1 files changed, 15 insertions, 19 deletions
diff --git a/src/profiler.c b/src/profiler.c
index 46ab3e305..6f2f2d0a8 100644
--- 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, ufunc_T *fp, funccall_T *fc)
* 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