mirror of
https://github.com/postgres/postgres.git
synced 2025-05-11 05:41:32 +03:00
Use MemSet() rather than a loop to do blank-padding on PS_USE_CLOBBER_ARGV
machines. I have just been observing some scenarios where set_ps_display accounts for more than 10% of the backend CPU, and this loop has to be the reason.
This commit is contained in:
parent
db667614ef
commit
12d17deb4f
@ -5,7 +5,7 @@
|
|||||||
* to contain some useful information. Mechanism differs wildly across
|
* to contain some useful information. Mechanism differs wildly across
|
||||||
* platforms.
|
* platforms.
|
||||||
*
|
*
|
||||||
* $Header: /cvsroot/pgsql/src/backend/utils/misc/ps_status.c,v 1.11 2001/11/06 01:15:29 tgl Exp $
|
* $Header: /cvsroot/pgsql/src/backend/utils/misc/ps_status.c,v 1.12 2001/12/21 15:22:09 tgl Exp $
|
||||||
*
|
*
|
||||||
* Copyright 2000 by PostgreSQL Global Development Group
|
* Copyright 2000 by PostgreSQL Global Development Group
|
||||||
* various details abducted from various places
|
* various details abducted from various places
|
||||||
@ -265,13 +265,11 @@ set_ps_display(const char *activity)
|
|||||||
|
|
||||||
#ifdef PS_USE_CLOBBER_ARGV
|
#ifdef PS_USE_CLOBBER_ARGV
|
||||||
{
|
{
|
||||||
char *cp;
|
int buflen;
|
||||||
|
|
||||||
/* pad unused memory */
|
/* pad unused memory */
|
||||||
for (cp = ps_buffer + strlen(ps_buffer);
|
buflen = strlen(ps_buffer);
|
||||||
cp < ps_buffer + ps_buffer_size;
|
MemSet(ps_buffer + buflen, PS_PADDING, ps_buffer_size - buflen);
|
||||||
cp++)
|
|
||||||
*cp = PS_PADDING;
|
|
||||||
}
|
}
|
||||||
#endif /* PS_USE_CLOBBER_ARGV */
|
#endif /* PS_USE_CLOBBER_ARGV */
|
||||||
#endif /* not PS_USE_NONE */
|
#endif /* not PS_USE_NONE */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user