postgresql/src/include/utils
David Rowley 2cb82e2acf Speedup and increase usability of set proc title functions
The setting of the process title could be seen on profiles of very
fast-to-execute queries.  In many locations where we call
set_ps_display() we pass along a string constant, the length of which is
known during compilation.  Here we effectively rename set_ps_display() to
set_ps_display_with_len() and then add a static inline function named
set_ps_display() which calls strlen() on the given string.  This allows
the compiler to optimize away the strlen() call when dealing with
call sites passing a string constant.  We can then also use memcpy()
instead of strlcpy() to copy the string into the destination buffer.
That's significantly faster than strlcpy's byte-at-a-time way of
copying.

Here we also take measures to improve some code which was adjusting the
process title to add a " waiting" suffix to it.  Call sites which require
this can now just call set_ps_display_suffix() to add or adjust the suffix
and call set_ps_display_remove_suffix() to remove it again.

Reviewed-by: Andres Freund
Discussion: https://postgr.es/m/CAApHDvocBvvk-0gWNA2Gohe+sv9fMcv+fK_G+siBKJrgDG4O7g@mail.gmail.com
2023-02-20 16:18:27 +13:00
..
.gitignore Revert "Add gitignore entries for jsonpath_gram.h" 2019-03-23 00:19:34 +01:00
acl.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
aclchk_internal.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
array.h Allow parallel aggregate on string_agg and array_agg 2023-01-23 17:35:01 +13:00
arrayaccess.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
ascii.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
attoptcache.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
backend_progress.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
backend_status.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
builtins.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
bytea.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
cash.h Convert *GetDatum() and DatumGet*() macros to inline functions 2022-09-27 20:50:21 +02:00
catcache.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
combocid.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
conffiles.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
date.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
datetime.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
datum.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
dsa.h Avoid type cheats for invalid dsa_handles and dshash_table_handles. 2023-01-25 11:48:38 -05:00
dynahash.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
elog.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
evtcache.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
expandeddatum.h New header varatt.h split off from postgres.h 2023-01-10 05:54:36 +01:00
expandedrecord.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
float.h Doc: improve commentary about providing our own definitions of M_PI. 2023-01-08 16:25:33 -05:00
fmgrtab.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
formatting.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
freepage.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
geo_decls.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
guc.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
guc_hooks.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
guc_tables.h Minor GUC code refactoring. 2023-01-27 12:13:41 -05:00
help_config.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
hsearch.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
index_selfuncs.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
inet.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
inval.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
json.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
jsonb.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
jsonfuncs.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
jsonpath.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
logtape.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
lsyscache.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
memdebug.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
memutils.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
memutils_internal.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
memutils_memorychunk.h Fix typo in memutils_memorychunk.h 2023-01-04 09:23:19 +13:00
meson.build Update copyright for 2023 2023-01-02 15:00:37 -05:00
multirangetypes.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
numeric.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
old_snapshot.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
palloc.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
partcache.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_crc.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_locale.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_lsn.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_rusage.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pgstat_internal.h pgstat: Infrastructure for more detailed IO statistics 2023-02-08 20:53:42 -08:00
pidfile.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
plancache.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
portal.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
ps_status.h Speedup and increase usability of set proc title functions 2023-02-20 16:18:27 +13:00
queryenvironment.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
rangetypes.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
regproc.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
rel.h Mark more nodes with attribute no_query_jumble 2023-02-13 09:07:33 +09:00
relcache.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
relfilenumbermap.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
relmapper.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
relptr.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
reltrigger.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
resowner.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
resowner_private.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
rls.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
ruleutils.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
sampling.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
selfuncs.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
sharedtuplestore.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
snapmgr.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
snapshot.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
sortsupport.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
spccache.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
syscache.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
timeout.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
timestamp.h Code review for commit 05a7be935. 2023-01-26 12:51:00 -05:00
tuplesort.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
tuplestore.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
typcache.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
tzparser.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
uuid.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
varbit.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
varlena.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
wait_event.h Add a new wait state and use it when sending data in the apply worker. 2023-02-16 07:46:31 +05:30
xid8.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
xml.h Update copyright for 2023 2023-01-02 15:00:37 -05:00