Commit 96112ee7 authored by Tom Lane's avatar Tom Lane

Revert "Add some temporary code to record stack usage at server process exit."

This reverts commit 88cf37d2 as well
as follow-on commits ea9c4a16 and
c5756272.  We've learned about as much
as we can from the buildfarm.
parent 30b2731b
...@@ -22,10 +22,6 @@ ...@@ -22,10 +22,6 @@
#include <signal.h> #include <signal.h>
#include <unistd.h> #include <unistd.h>
#include <sys/stat.h> #include <sys/stat.h>
#if defined(__hpux)
#include <sys/param.h>
#include <sys/pstat.h>
#endif
#include "miscadmin.h" #include "miscadmin.h"
#ifdef PROFILE_PID_DIR #ifdef PROFILE_PID_DIR
...@@ -35,9 +31,6 @@ ...@@ -35,9 +31,6 @@
#include "storage/ipc.h" #include "storage/ipc.h"
#include "tcop/tcopprot.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, * This flag is set during proc_exit() to change ereport()'s behavior,
...@@ -87,69 +80,6 @@ static int on_proc_exit_index, ...@@ -87,69 +80,6 @@ static int on_proc_exit_index,
before_shmem_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 * proc_exit
* *
...@@ -171,9 +101,6 @@ proc_exit(int code) ...@@ -171,9 +101,6 @@ proc_exit(int code)
/* Clean up everything that must be cleaned up */ /* Clean up everything that must be cleaned up */
proc_exit_prepare(code); proc_exit_prepare(code);
/* report stack size to stderr */
report_stack_size();
#ifdef PROFILE_PID_DIR #ifdef PROFILE_PID_DIR
{ {
/* /*
......
...@@ -96,9 +96,6 @@ int max_stack_depth = 100; ...@@ -96,9 +96,6 @@ int max_stack_depth = 100;
/* wait N seconds to allow attach from a debugger */ /* wait N seconds to allow attach from a debugger */
int PostAuthDelay = 0; 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) ...@@ -3140,11 +3137,6 @@ stack_is_too_deep(void)
if (stack_depth < 0) if (stack_depth < 0)
stack_depth = -stack_depth; 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? * Trouble?
* *
...@@ -3168,10 +3160,6 @@ stack_is_too_deep(void) ...@@ -3168,10 +3160,6 @@ stack_is_too_deep(void)
#if defined(__ia64__) || defined(__ia64) #if defined(__ia64__) || defined(__ia64)
stack_depth = (long) (ia64_get_bsp() - register_stack_base_ptr); 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 && if (stack_depth > max_stack_depth_bytes &&
register_stack_base_ptr != NULL) register_stack_base_ptr != NULL)
return true; return true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment