Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit88cf37d

Browse files
committed
Add some temporary code to record stack usage at server process exit.
This patch is meant to gather information from the buildfarm members, andwill be reverted in a day or so. The idea is to try to find out thehigh-water stack consumption while running the regression tests,particularly on IA64 which is suspected to use much more stack than otherarchitectures. On machines with pmap, we can use that; but the IA64 farmmembers are running HPUX, so also include some bespoke code for HPUX.(I've tested the latter on HPUX 10/HPPA; not entirely sure it will workon HPUX 11/IA64, but we'll soon find out.)Discussion: <CAM-w4HMwwcwaVvYcAH0_FGtG5GeXdYVRfvG81pXnSJWHnCfosQ@mail.gmail.com>
1 parente8bde9e commit88cf37d

File tree

1 file changed

+47
-0
lines changed
  • src/backend/storage/ipc

1 file changed

+47
-0
lines changed

‎src/backend/storage/ipc/ipc.c

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222
#include<signal.h>
2323
#include<unistd.h>
2424
#include<sys/stat.h>
25+
#if defined(__hpux)
26+
#include<sys/param.h>
27+
#include<sys/pstat.h>
28+
#endif
2529

2630
#include"miscadmin.h"
2731
#ifdefPROFILE_PID_DIR
@@ -80,6 +84,46 @@ static inton_proc_exit_index,
8084
before_shmem_exit_index;
8185

8286

87+
/* Report process's stack consumption to stderr */
88+
staticvoid
89+
report_stack_size(void)
90+
{
91+
#if defined(__hpux)
92+
/* HPUX: examine process's memory map with pstat_getprocvm() */
93+
inttargetpid=getpid();
94+
structpst_vm_statusbuf;
95+
intres;
96+
intndx;
97+
98+
for (ndx=0;;ndx++)
99+
{
100+
res=pstat_getprocvm(&buf,sizeof(buf),targetpid,ndx);
101+
if (res<0)
102+
{
103+
perror("getprocvm");
104+
break;
105+
}
106+
if (res!=1)
107+
break;
108+
if (buf.pst_type!=PS_STACK)
109+
continue;
110+
fprintf(stderr,"%d: stack addr 0x%lx, length %ld, physical pages %ld\n",
111+
targetpid,
112+
buf.pst_vaddr,
113+
buf.pst_length,
114+
buf.pst_phys_pages);
115+
}
116+
#else/* non HPUX */
117+
/* Otherwise: try to use pmap. No error if that doesn't work. */
118+
charsysbuf[128];
119+
120+
snprintf(sysbuf,sizeof(sysbuf),"pmap -x %d | grep -i stack 1>&2",
121+
(int)getpid());
122+
(void)system(sysbuf);
123+
#endif
124+
}
125+
126+
83127
/* ----------------------------------------------------------------
84128
*proc_exit
85129
*
@@ -101,6 +145,9 @@ proc_exit(int code)
101145
/* Clean up everything that must be cleaned up */
102146
proc_exit_prepare(code);
103147

148+
/* report stack size to stderr */
149+
report_stack_size();
150+
104151
#ifdefPROFILE_PID_DIR
105152
{
106153
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp