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

Commitea9c4a1

Browse files
committed
Add more temporary code to record stack usage at server process exit.
After a look at preliminary results from commit88cf37d,I realized it'd be a good idea to spew out the maximum depth measurementseen by check_stack_depth. So add some quick-n-dirty code to do that.Like the previous commit, this will be reverted once we've gathereda set of buildfarm runs with it.
1 parent769159f commitea9c4a1

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@
3535
#include"storage/ipc.h"
3636
#include"tcop/tcopprot.h"
3737

38+
externlongmax_measured_stack_depth;
39+
externlongmax_measured_register_stack_depth;
40+
3841

3942
/*
4043
* This flag is set during proc_exit() to change ereport()'s behavior,
@@ -121,6 +124,15 @@ report_stack_size(void)
121124
(int)getpid());
122125
(void)system(sysbuf);
123126
#endif
127+
128+
#if defined(__ia64__)|| defined(__ia64)
129+
fprintf(stderr,"max measured stack depths %ldkB, %ldkB\n",
130+
(max_measured_stack_depth+1023) /1024,
131+
(max_measured_register_stack_depth+1023) /1024);
132+
#else
133+
fprintf(stderr,"max measured stack depth %ldkB\n",
134+
(max_measured_stack_depth+1023) /1024);
135+
#endif
124136
}
125137

126138

‎src/backend/tcop/postgres.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ intmax_stack_depth = 100;
9696
/* wait N seconds to allow attach from a debugger */
9797
intPostAuthDelay=0;
9898

99+
/* Exported for use by proc_exit */
100+
longmax_measured_stack_depth=0;
101+
longmax_measured_register_stack_depth=0;
99102

100103

101104
/* ----------------
@@ -3137,6 +3140,11 @@ stack_is_too_deep(void)
31373140
if (stack_depth<0)
31383141
stack_depth=-stack_depth;
31393142

3143+
/* Track max measured depth for reporting by proc_exit */
3144+
if (stack_depth>max_measured_stack_depth&&
3145+
stack_base_ptr!=NULL)
3146+
max_measured_stack_depth=stack_depth;
3147+
31403148
/*
31413149
* Trouble?
31423150
*
@@ -3160,6 +3168,10 @@ stack_is_too_deep(void)
31603168
#if defined(__ia64__)|| defined(__ia64)
31613169
stack_depth= (long) (ia64_get_bsp()-register_stack_base_ptr);
31623170

3171+
if (stack_depth>max_measured_register_stack_depth&&
3172+
register_stack_base_ptr!=NULL)
3173+
max_measured_register_stack_depth=stack_depth;
3174+
31633175
if (stack_depth>max_stack_depth_bytes&&
31643176
register_stack_base_ptr!=NULL)
31653177
return true;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp