4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
11 Problem: When a function is used recursively the profiling information is
12 invalid. (Mikolaj Machowski)
13 Solution: Put the start time on the stack instead of in the function.
17 *** ../vim-7.0.156/src/eval.c Wed Nov 1 15:31:02 2006
18 --- src/eval.c Wed Nov 1 13:39:52 2006
21 int uf_tm_count; /* nr of calls */
22 proftime_T uf_tm_total; /* time spend in function + children */
23 proftime_T uf_tm_self; /* time spend in function itself */
24 - proftime_T uf_tm_start; /* time at function call */
25 proftime_T uf_tm_children; /* time spent in children this call */
26 /* profiling the function per line */
27 int *uf_tml_count; /* nr of times line was executed */
34 proftime_T wait_start;
35 + proftime_T call_start;
38 /* If depth of calling is getting too high, don't execute the function */
41 || (fc.caller != NULL && &fc.caller->func->uf_profiling))
44 ! profile_start(&fp->uf_tm_start);
45 profile_zero(&fp->uf_tm_children);
47 script_prof_save(&wait_start);
49 || (fc.caller != NULL && &fc.caller->func->uf_profiling))
52 ! profile_start(&call_start);
53 profile_zero(&fp->uf_tm_children);
55 script_prof_save(&wait_start);
58 if (do_profiling == PROF_YES && (fp->uf_profiling
59 || (fc.caller != NULL && &fc.caller->func->uf_profiling)))
61 ! profile_end(&fp->uf_tm_start);
62 ! profile_sub_wait(&wait_start, &fp->uf_tm_start);
63 ! profile_add(&fp->uf_tm_total, &fp->uf_tm_start);
64 ! profile_self(&fp->uf_tm_self, &fp->uf_tm_start, &fp->uf_tm_children);
65 if (fc.caller != NULL && &fc.caller->func->uf_profiling)
67 ! profile_add(&fc.caller->func->uf_tm_children, &fp->uf_tm_start);
68 ! profile_add(&fc.caller->func->uf_tml_children, &fp->uf_tm_start);
73 if (do_profiling == PROF_YES && (fp->uf_profiling
74 || (fc.caller != NULL && &fc.caller->func->uf_profiling)))
76 ! profile_end(&call_start);
77 ! profile_sub_wait(&wait_start, &call_start);
78 ! profile_add(&fp->uf_tm_total, &call_start);
79 ! profile_self(&fp->uf_tm_self, &call_start, &fp->uf_tm_children);
80 if (fc.caller != NULL && &fc.caller->func->uf_profiling)
82 ! profile_add(&fc.caller->func->uf_tm_children, &call_start);
83 ! profile_add(&fc.caller->func->uf_tml_children, &call_start);
87 *** ../vim-7.0.156/src/version.c Wed Nov 1 18:10:36 2006
88 --- src/version.c Wed Nov 1 18:32:42 2006
92 { /* Add new patch number below this line */
98 hundred-and-one symptoms of being an internet addict:
99 140. You'd rather catch a score on the web than watch the game as
100 it is being played on tv.
102 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
103 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
104 \\\ download, build and distribute -- http://www.A-A-P.org ///
105 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///