Commit 12d17deb authored by Tom Lane's avatar Tom Lane

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.
parent db667614
...@@ -5,7 +5,7 @@ ...@@ -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) ...@@ -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 */
......
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