cvs commit: ALFS/nALFS/src/include nALFS.h

kpfleming at linuxfromscratch.org kpfleming at linuxfromscratch.org
Sat Feb 7 21:57:23 PST 2004


kpfleming    04/02/07 22:57:23

  Modified:    nALFS/src nalfs.c
               nALFS/src/handlers package.c
               nALFS/src/include nALFS.h
  Log:
  add timer_pause/timer_resume functions for execution timer
  call timer_pause/timer_resume in <package> handler so end_logging_element tasks (including file change searches) aren't included in execution time
  
  Revision  Changes    Path
  1.40      +21 -2     ALFS/nALFS/src/nalfs.c
  
  Index: nalfs.c
  ===================================================================
  RCS file: /home/cvsroot/ALFS/nALFS/src/nalfs.c,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- nalfs.c	7 Nov 2003 03:55:56 -0000	1.39
  +++ nalfs.c	8 Feb 2004 05:57:23 -0000	1.40
  @@ -45,6 +45,7 @@
   #include <config.h>
   #endif
   
  +#include "nALFS.h"
   #include "bufsize.h"
   #include "utility.h"
   #include "parser.h"
  @@ -88,9 +89,11 @@
   
   static struct timer {
   	time_t backend_started;
  +	time_t timer_paused;
   
   	double current_executing;
   	double total_executing;
  +	double current_paused;
   
   } timer;
   
  @@ -2330,7 +2333,7 @@
   
   static double timer_display(int backend_running)
   {
  -	double curr = difftime(time(NULL), timer.backend_started);
  +	double curr = (difftime(time(NULL), timer.backend_started) - timer.current_paused);
   
   
   	if (! backend_running) {
  @@ -2357,8 +2360,11 @@
   {
   	double last = timer_display(backend_running);
   
  +	timer.timer_paused = 0;
  +
   	timer.current_executing = last;
   	timer.total_executing += last;
  +	timer.current_paused = 0;
   }
   
   static INLINE void timer_begin(void)
  @@ -2369,9 +2375,22 @@
   static INLINE void timer_reset(void)
   {
   	timer.backend_started = time(NULL);
  +	timer.timer_paused = 0;
   
   	timer.current_executing = 0;
   	timer.total_executing = 0;
  +	timer.current_paused = 0;
  +}
  +
  +void timer_pause(void)
  +{
  +	timer.timer_paused = time(NULL);
  +}
  +
  +void timer_resume(void)
  +{
  +	timer.current_paused += difftime(time(NULL), timer.timer_paused);
  +	timer.timer_paused = 0;
   }
   
   static void draw_timer(void)
  @@ -2386,7 +2405,7 @@
   
   
   		if (Backend_exists) {
  -			curr = difftime(time(NULL), timer.backend_started);
  +			curr = difftime(time(NULL), timer.backend_started) - timer.current_paused;
   			total = timer.total_executing + curr;
   		} else {
   			curr = timer.current_executing;
  
  
  
  1.15      +5 -1      ALFS/nALFS/src/handlers/package.c
  
  Index: package.c
  ===================================================================
  RCS file: /home/cvsroot/ALFS/nALFS/src/handlers/package.c,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- package.c	6 Feb 2004 05:54:36 -0000	1.14
  +++ package.c	8 Feb 2004 05:57:23 -0000	1.15
  @@ -55,7 +55,9 @@
   	i = execute_children(el);
   
   	log_end_time(el, i);
  +	timer_pause();
   	end_logging_element(el, i);
  +	timer_resume();
   
   	return i;
   }
  @@ -248,8 +250,10 @@
   		status = execute_children(el);
   	}
   
  -	log_end_time(el, status);
  +	log_end_time(el, status);	
  +	timer_pause();
   	end_logging_element(el, status);
  +	timer_resume();
   
   	return status;
   }
  
  
  
  1.4       +6 -0      ALFS/nALFS/src/include/nALFS.h
  
  Index: nALFS.h
  ===================================================================
  RCS file: /home/cvsroot/ALFS/nALFS/src/include/nALFS.h,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- nALFS.h	30 Oct 2003 17:58:12 -0000	1.3
  +++ nALFS.h	8 Feb 2004 05:57:23 -0000	1.4
  @@ -59,6 +59,12 @@
   extern char *alloc_unpack_command(archive_format_e format);
   
   
  +/* functions to pause and resume the execution timer */
  +
  +void timer_pause(void);
  +void timer_resume(void);
  +
  +
   /* macro to prefix handler symbols to match libtool expectations for when
      handlers are linked into the main binary (in a static build)
   */
  
  
  



More information about the alfs-log mailing list