
From dgaudet@arctic.org Sat Apr 11 14:06:51 1998
Date: Sat, 11 Apr 1998 13:50:07 -0700 (PDT)
From: Dean Gaudet <dgaudet@arctic.org>
To: new-httpd@apache.org
Subject: [PATCH] updated SHARED_TIME
X-Comment: Visit http://www.arctic.org/~dgaudet/legal for information regarding copyright and disclaimer.
Reply-To: new-httpd@apache.org

time() dealt with by shared scoreboard.  Worth 2.5% performance boost.
Updated for renaming.

Dean

Index: main/http_main.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/main/http_main.c,v
retrieving revision 1.324
diff -u -r1.324 http_main.c
--- http_main.c	1998/04/11 12:00:29	1.324
+++ http_main.c	1998/04/11 20:38:52
@@ -1071,6 +1071,20 @@
     timeout_name = NULL;
 }
 
+#ifdef SHARED_TIME
+#undef time
+time_t ap_shared_time(time_t *t)
+{
+    time_t res;
+
+    if (child_timeouts || ap_scoreboard_image == NULL) {
+	return time(0);
+    }
+    res = ap_scoreboard_image->global.right_now;
+    if (t) *t = res;
+    return res;
+}
+#endif
 
 /*
  * More machine-dependent networking gooo... on some systems,
@@ -3618,6 +3632,10 @@
     idle_count = 0;
     last_non_dead = -1;
     total_non_dead = 0;
+
+#ifdef SHARED_TIME
+    ap_scoreboard_image->global.right_now = now;
+#endif
 
     ap_sync_scoreboard_image();
     for (i = 0; i < ap_daemons_limit; ++i) {
Index: include/httpd.h
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/include/httpd.h,v
retrieving revision 1.202
diff -u -r1.202 httpd.h
--- httpd.h	1998/04/11 12:00:22	1.202
+++ httpd.h	1998/04/11 20:38:58
@@ -970,6 +970,14 @@
 #define OPTIMIZE_TIMEOUTS
 #endif
 
+#ifdef SHARED_TIME
+#ifndef OPTIMIZE_TIMEOUTS
+# error "you need OPTIMIZE_TIMEOUTS for SHARED_TIME"
+#endif
+extern time_t ap_shared_time(time_t *);
+#define time(x) ap_shared_time(x)
+#endif
+
 /* A set of flags which indicate places where the server should raise(SIGSTOP).
  * This is useful for debugging, because you can then attach to that process
  * with gdb and continue.  This is important in cases where one_process
Index: include/scoreboard.h
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/include/scoreboard.h,v
retrieving revision 1.39
diff -u -r1.39 scoreboard.h
--- scoreboard.h	1998/04/11 12:00:23	1.39
+++ scoreboard.h	1998/04/11 20:38:58
@@ -134,6 +134,9 @@
 typedef struct {
     int exit_generation;	/* Set by the main process if a graceful
 				   restart is required */
+#ifdef SHARED_TIME
+    time_t right_now;          /* the current time */
+#endif
 } global_score;
 
 /* stuff which the parent generally writes and the children rarely read */


