Karsten Hopp 0dd1dc
To: vim-dev@vim.org
Karsten Hopp 0dd1dc
Subject: Patch 7.0.157
Karsten Hopp 0dd1dc
Fcc: outbox
Karsten Hopp 0dd1dc
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 0dd1dc
Mime-Version: 1.0
Karsten Hopp 0dd1dc
Content-Type: text/plain; charset=ISO-8859-1
Karsten Hopp 0dd1dc
Content-Transfer-Encoding: 8bit
Karsten Hopp 0dd1dc
------------
Karsten Hopp 0dd1dc
Karsten Hopp 0dd1dc
Patch 7.0.157
Karsten Hopp 0dd1dc
Problem:    When a function is used recursively the profiling information is
Karsten Hopp 0dd1dc
	    invalid. (Mikolaj Machowski)
Karsten Hopp 0dd1dc
Solution:   Put the start time on the stack instead of in the function.
Karsten Hopp 0dd1dc
Files:	    src/eval.c
Karsten Hopp 0dd1dc
Karsten Hopp 0dd1dc
Karsten Hopp 0dd1dc
*** ../vim-7.0.156/src/eval.c	Wed Nov  1 15:31:02 2006
Karsten Hopp 0dd1dc
--- src/eval.c	Wed Nov  1 13:39:52 2006
Karsten Hopp 0dd1dc
***************
Karsten Hopp 0dd1dc
*** 166,172 ****
Karsten Hopp 0dd1dc
      int		uf_tm_count;	/* nr of calls */
Karsten Hopp 0dd1dc
      proftime_T	uf_tm_total;	/* time spend in function + children */
Karsten Hopp 0dd1dc
      proftime_T	uf_tm_self;	/* time spend in function itself */
Karsten Hopp 0dd1dc
-     proftime_T	uf_tm_start;	/* time at function call */
Karsten Hopp 0dd1dc
      proftime_T	uf_tm_children;	/* time spent in children this call */
Karsten Hopp 0dd1dc
      /* profiling the function per line */
Karsten Hopp 0dd1dc
      int		*uf_tml_count;	/* nr of times line was executed */
Karsten Hopp 0dd1dc
--- 166,171 ----
Karsten Hopp 0dd1dc
***************
Karsten Hopp 0dd1dc
*** 19764,19769 ****
Karsten Hopp 0dd1dc
--- 19763,19769 ----
Karsten Hopp 0dd1dc
      char_u	*name;
Karsten Hopp 0dd1dc
  #ifdef FEAT_PROFILE
Karsten Hopp 0dd1dc
      proftime_T	wait_start;
Karsten Hopp 0dd1dc
+     proftime_T	call_start;
Karsten Hopp 0dd1dc
  #endif
Karsten Hopp 0dd1dc
  
Karsten Hopp 0dd1dc
      /* If depth of calling is getting too high, don't execute the function */
Karsten Hopp 0dd1dc
***************
Karsten Hopp 0dd1dc
*** 19943,19949 ****
Karsten Hopp 0dd1dc
  		       || (fc.caller != NULL && &fc.caller->func->uf_profiling))
Karsten Hopp 0dd1dc
  	{
Karsten Hopp 0dd1dc
  	    ++fp->uf_tm_count;
Karsten Hopp 0dd1dc
! 	    profile_start(&fp->uf_tm_start);
Karsten Hopp 0dd1dc
  	    profile_zero(&fp->uf_tm_children);
Karsten Hopp 0dd1dc
  	}
Karsten Hopp 0dd1dc
  	script_prof_save(&wait_start);
Karsten Hopp 0dd1dc
--- 19943,19949 ----
Karsten Hopp 0dd1dc
  		       || (fc.caller != NULL && &fc.caller->func->uf_profiling))
Karsten Hopp 0dd1dc
  	{
Karsten Hopp 0dd1dc
  	    ++fp->uf_tm_count;
Karsten Hopp 0dd1dc
! 	    profile_start(&call_start);
Karsten Hopp 0dd1dc
  	    profile_zero(&fp->uf_tm_children);
Karsten Hopp 0dd1dc
  	}
Karsten Hopp 0dd1dc
  	script_prof_save(&wait_start);
Karsten Hopp 0dd1dc
***************
Karsten Hopp 0dd1dc
*** 19973,19986 ****
Karsten Hopp 0dd1dc
      if (do_profiling == PROF_YES && (fp->uf_profiling
Karsten Hopp 0dd1dc
  		    || (fc.caller != NULL && &fc.caller->func->uf_profiling)))
Karsten Hopp 0dd1dc
      {
Karsten Hopp 0dd1dc
! 	profile_end(&fp->uf_tm_start);
Karsten Hopp 0dd1dc
! 	profile_sub_wait(&wait_start, &fp->uf_tm_start);
Karsten Hopp 0dd1dc
! 	profile_add(&fp->uf_tm_total, &fp->uf_tm_start);
Karsten Hopp 0dd1dc
! 	profile_self(&fp->uf_tm_self, &fp->uf_tm_start, &fp->uf_tm_children);
Karsten Hopp 0dd1dc
  	if (fc.caller != NULL && &fc.caller->func->uf_profiling)
Karsten Hopp 0dd1dc
  	{
Karsten Hopp 0dd1dc
! 	    profile_add(&fc.caller->func->uf_tm_children, &fp->uf_tm_start);
Karsten Hopp 0dd1dc
! 	    profile_add(&fc.caller->func->uf_tml_children, &fp->uf_tm_start);
Karsten Hopp 0dd1dc
  	}
Karsten Hopp 0dd1dc
      }
Karsten Hopp 0dd1dc
  #endif
Karsten Hopp 0dd1dc
--- 19973,19986 ----
Karsten Hopp 0dd1dc
      if (do_profiling == PROF_YES && (fp->uf_profiling
Karsten Hopp 0dd1dc
  		    || (fc.caller != NULL && &fc.caller->func->uf_profiling)))
Karsten Hopp 0dd1dc
      {
Karsten Hopp 0dd1dc
! 	profile_end(&call_start);
Karsten Hopp 0dd1dc
! 	profile_sub_wait(&wait_start, &call_start);
Karsten Hopp 0dd1dc
! 	profile_add(&fp->uf_tm_total, &call_start);
Karsten Hopp 0dd1dc
! 	profile_self(&fp->uf_tm_self, &call_start, &fp->uf_tm_children);
Karsten Hopp 0dd1dc
  	if (fc.caller != NULL && &fc.caller->func->uf_profiling)
Karsten Hopp 0dd1dc
  	{
Karsten Hopp 0dd1dc
! 	    profile_add(&fc.caller->func->uf_tm_children, &call_start);
Karsten Hopp 0dd1dc
! 	    profile_add(&fc.caller->func->uf_tml_children, &call_start);
Karsten Hopp 0dd1dc
  	}
Karsten Hopp 0dd1dc
      }
Karsten Hopp 0dd1dc
  #endif
Karsten Hopp 0dd1dc
*** ../vim-7.0.156/src/version.c	Wed Nov  1 18:10:36 2006
Karsten Hopp 0dd1dc
--- src/version.c	Wed Nov  1 18:32:42 2006
Karsten Hopp 0dd1dc
***************
Karsten Hopp 0dd1dc
*** 668,669 ****
Karsten Hopp 0dd1dc
--- 668,671 ----
Karsten Hopp 0dd1dc
  {   /* Add new patch number below this line */
Karsten Hopp 0dd1dc
+ /**/
Karsten Hopp 0dd1dc
+     157,
Karsten Hopp 0dd1dc
  /**/
Karsten Hopp 0dd1dc
Karsten Hopp 0dd1dc
-- 
Karsten Hopp 0dd1dc
hundred-and-one symptoms of being an internet addict:
Karsten Hopp 0dd1dc
140. You'd rather catch a score on the web than watch the game as
Karsten Hopp 0dd1dc
     it is being played on tv.
Karsten Hopp 0dd1dc
Karsten Hopp 0dd1dc
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 0dd1dc
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 0dd1dc
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp 0dd1dc
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///