]> granicus.if.org Git - apache/commitdiff
carry over from 1.3: disable profiling in the parent process #ifdef GPROF
authorDoug MacEachern <dougm@apache.org>
Thu, 29 Nov 2001 04:06:05 +0000 (04:06 +0000)
committerDoug MacEachern <dougm@apache.org>
Thu, 29 Nov 2001 04:06:05 +0000 (04:06 +0000)
PR:
Obtained from:
Submitted by:
Reviewed by:

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@92230 13f79535-47bb-0310-9956-ffa450edef68

include/ap_mpm.h
server/main.c
server/mpm/prefork/prefork.c

index 96c24a890484541cfa93488ad1cb13fa05debf26..bf16e9f982e597af69bf954fea55b2a8e615f2ab 100644 (file)
@@ -183,4 +183,18 @@ AP_DECLARE(apr_status_t) ap_os_create_privileged_process(
  */
 AP_DECLARE(apr_status_t) ap_mpm_query(int query_code, int *result);
 
+/* 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 AP_MONCONTROL(x) moncontrol(x)
+#else
+#define AP_MONCONTROL(x)
+#endif
+
 #endif
index 7bbee310d74a576bd9a796a005424dc552b97c91..677ef0bb734cb79b4caebfe4b967e8c3bb7ffaa5 100644 (file)
@@ -298,6 +298,8 @@ int main(int argc, const char * const argv[])
     module **mod;
     const char *optarg;
 
+    AP_MONCONTROL(0); /* turn of profiling of startup */
+
     apr_initialize();
 
     process = create_process(argc, argv);
index cba8eb7e0090fc08a21f4e774ef4289281fff671..6bba1ef20c67473b3682d0cecd2cdf0f1f4ccc9b 100644 (file)
@@ -759,6 +759,7 @@ static int make_child(server_rec *s, int slot)
        }
 #endif
        RAISE_SIGSTOP(MAKE_CHILD);
+        AP_MONCONTROL(1);
         /* Disable the parent's signal handlers and set up proper handling in
          * the child.
         */
@@ -970,6 +971,10 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s)
 
     set_signals();
 
+    if (one_process) {
+        AP_MONCONTROL(1);
+    }
+
     if (ap_daemons_max_free < ap_daemons_min_free + 1) /* Don't thrash... */
        ap_daemons_max_free = ap_daemons_min_free + 1;