dgaudet 98/01/21 14:14:20
Modified: src CHANGES
src/main http_main.c
Log:
Add GPROF define to fine tune profiling... and to make it work period under
linux.
Reviewed by: Jim Jagielski
Revision Changes Path
1.578 +4 -0 apachen/src/CHANGES
Index: CHANGES
===================================================================
RCS file: /export/home/cvs/apachen/src/CHANGES,v
retrieving revision 1.577
retrieving revision 1.578
diff -u -r1.577 -r1.578
--- CHANGES 1998/01/21 22:10:59 1.577
+++ CHANGES 1998/01/21 22:14:11 1.578
@@ -1,5 +1,9 @@
Changes with Apache 1.3b4
+ *) Defining GPROF will disable profiling in the parent and enable it
+ in the children. If you're profiling under Linux this is pretty much
+ necessary because SIGPROF is lost across a fork(). [Dean Gaudet]
+
*) htdigest and htpasswd needed slight tweaks to work on OS/2 and WIN32.
[Brian Havard]
1.269 +22 -1 apachen/src/main/http_main.c
Index: http_main.c
===================================================================
RCS file: /export/home/cvs/apachen/src/main/http_main.c,v
retrieving revision 1.268
retrieving revision 1.269
diff -u -r1.268 -r1.269
--- http_main.c 1998/01/13 23:11:11 1.268
+++ http_main.c 1998/01/21 22:14:14 1.269
@@ -167,6 +167,20 @@
DEF_Explain
+/* Defining GPROF when compiling uses the moncontrol() function to
+ * disable gprof profiling in the parent, and enable it only for
+ * request processing in children (or in one_process mode). It's
+ * absolutely required to get useful gprof results under linux
+ * because the profile itimers and such are disabled across a
+ * fork(). It's probably useful elsewhere as well.
+ */
+#ifdef GPROF
+extern void moncontrol(int);
+#define MONCONTROL(x) moncontrol(x)
+#else
+#define MONCONTROL(x)
+#endif
+
#ifndef MULTITHREAD
/* this just need to be anything non-NULL */
void *dummy_mutex = &dummy_mutex;
@@ -3201,6 +3215,7 @@
if (!pid) {
RAISE_SIGSTOP(MAKE_CHILD);
+ MONCONTROL(1);
/* Disable the restart signal handlers and enable the just_die stuff.
* Note that since restart() just notes that a restart has been
* requested there's no race condition here.
@@ -3396,8 +3411,12 @@
is_graceful = 0;
++generation;
- if (!one_process)
+ if (!one_process) {
detach();
+ }
+ else {
+ MONCONTROL(1);
+ }
my_pid = getpid();
@@ -3607,6 +3626,8 @@
int main(int argc, char *argv[])
{
int c;
+
+ MONCONTROL(0);
#ifdef AUX
(void) set42sig();