Revert "Add some temporary code to record stack usage at server process exit."
authorTom Lane
Sun, 10 Jul 2016 16:44:20 +0000 (12:44 -0400)
committerTom Lane
Sun, 10 Jul 2016 16:44:20 +0000 (12:44 -0400)
This reverts commit 88cf37d2a86d5b66380003d7c3384530e3f91e40 as well
as follow-on commits ea9c4a16d5ad88a1d28d43ef458e3209b53eb106 and
c57562725d219c4249b82f4a4fb5aaeee3ae0d53.  We've learned about as much
as we can from the buildfarm.

src/backend/storage/ipc/ipc.c
src/backend/tcop/postgres.c

index 9dda93f0bd6439e1e512feb275596631248c8160..cc36b80699b4997cd46baaaef49aa23b5bca3d24 100644 (file)
 #include 
 #include 
 #include 
-#if defined(__hpux)
-#include 
-#include 
-#endif
 
 #include "miscadmin.h"
 #ifdef PROFILE_PID_DIR
@@ -35,9 +31,6 @@
 #include "storage/ipc.h"
 #include "tcop/tcopprot.h"
 
-extern long max_measured_stack_depth;
-extern long max_measured_register_stack_depth;
-
 
 /*
  * This flag is set during proc_exit() to change ereport()'s behavior,
@@ -87,69 +80,6 @@ static int   on_proc_exit_index,
            before_shmem_exit_index;
 
 
-/* Report process's stack consumption to stderr */
-static void
-report_stack_size(void)
-{
-#if defined(__hpux)
-   /* HPUX: examine process's memory map with pstat_getprocvm() */
-   int         targetpid = getpid();
-   int         ndx;
-
-   for (ndx = 0;; ndx++)
-   {
-       struct pst_vm_status buf;
-       const char *pagetype;
-       int         res;
-
-       res = pstat_getprocvm(&buf, sizeof(buf), targetpid, ndx);
-       if (res < 0)
-       {
-           perror("getprocvm");
-           break;
-       }
-       if (res != 1)
-           break;
-       switch (buf.pst_type)
-       {
-           case PS_STACK:
-               pagetype = "STACK";
-               break;
-#ifdef PS_RSESTACK
-           case PS_RSESTACK:
-               pagetype = "REGSTACK";
-               break;
-#endif
-           default:
-               continue;
-       }
-       fprintf(stderr, "%d: stack addr 0x%lx, length %ld, physical pages %ld, type %s\n",
-               targetpid,
-               buf.pst_vaddr,
-               buf.pst_length,
-               buf.pst_phys_pages,
-               pagetype);
-   }
-#else                          /* non HPUX */
-   /* Otherwise: try to use pmap.  No error if that doesn't work. */
-   char        sysbuf[128];
-
-   snprintf(sysbuf, sizeof(sysbuf), "pmap -x %d | grep -i stack 1>&2",
-            (int) getpid());
-   (void) system(sysbuf);
-#endif
-
-#if defined(__ia64__) || defined(__ia64)
-   fprintf(stderr, "max measured stack depths %ldkB, %ldkB\n",
-           (max_measured_stack_depth + 1023) / 1024,
-           (max_measured_register_stack_depth + 1023) / 1024);
-#else
-   fprintf(stderr, "max measured stack depth %ldkB\n",
-           (max_measured_stack_depth + 1023) / 1024);
-#endif
-}
-
-
 /* ----------------------------------------------------------------
  *     proc_exit
  *
@@ -171,9 +101,6 @@ proc_exit(int code)
    /* Clean up everything that must be cleaned up */
    proc_exit_prepare(code);
 
-   /* report stack size to stderr */
-   report_stack_size();
-
 #ifdef PROFILE_PID_DIR
    {
        /*
index 38cabf650a1a464c90d70475ec1c13ad56abeb93..b185c1b5eb69fba2654b65a8b80bfe74f03ff600 100644 (file)
@@ -96,9 +96,6 @@ int           max_stack_depth = 100;
 /* wait N seconds to allow attach from a debugger */
 int            PostAuthDelay = 0;
 
-/* Exported for use by proc_exit */
-long       max_measured_stack_depth = 0;
-long       max_measured_register_stack_depth = 0;
 
 
 /* ----------------
@@ -3140,11 +3137,6 @@ stack_is_too_deep(void)
    if (stack_depth < 0)
        stack_depth = -stack_depth;
 
-   /* Track max measured depth for reporting by proc_exit */
-   if (stack_depth > max_measured_stack_depth &&
-       stack_base_ptr != NULL)
-       max_measured_stack_depth = stack_depth;
-
    /*
     * Trouble?
     *
@@ -3168,10 +3160,6 @@ stack_is_too_deep(void)
 #if defined(__ia64__) || defined(__ia64)
    stack_depth = (long) (ia64_get_bsp() - register_stack_base_ptr);
 
-   if (stack_depth > max_measured_register_stack_depth &&
-       register_stack_base_ptr != NULL)
-       max_measured_register_stack_depth = stack_depth;
-
    if (stack_depth > max_stack_depth_bytes &&
        register_stack_base_ptr != NULL)
        return true;