forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit2cb82e2
committed
Speedup and increase usability of set proc title functions
The setting of the process title could be seen on profiles of veryfast-to-execute queries. In many locations where we callset_ps_display() we pass along a string constant, the length of which isknown during compilation. Here we effectively rename set_ps_display() toset_ps_display_with_len() and then add a static inline function namedset_ps_display() which calls strlen() on the given string. This allowsthe compiler to optimize away the strlen() call when dealing withcall 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 ofcopying.Here we also take measures to improve some code which was adjusting theprocess title to add a " waiting" suffix to it. Call sites which requirethis can now just call set_ps_display_suffix() to add or adjust the suffixand call set_ps_display_remove_suffix() to remove it again.Reviewed-by: Andres FreundDiscussion:https://postgr.es/m/CAApHDvocBvvk-0gWNA2Gohe+sv9fMcv+fK_G+siBKJrgDG4O7g@mail.gmail.com1 parentde2aca2 commit2cb82e2
File tree
7 files changed
+199
-95
lines changed- src
- backend
- replication
- storage
- buffer
- ipc
- lmgr
- tcop
- utils/misc
- include/utils
7 files changed
+199
-95
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
151 | | - | |
152 | | - | |
153 | 151 | | |
154 | 152 | | |
155 | 153 | | |
| |||
216 | 214 | | |
217 | 215 | | |
218 | 216 | | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
228 | 221 | | |
229 | 222 | | |
230 | 223 | | |
| |||
322 | 315 | | |
323 | 316 | | |
324 | 317 | | |
325 | | - | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
331 | 321 | | |
332 | 322 | | |
333 | 323 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4302 | 4302 | | |
4303 | 4303 | | |
4304 | 4304 | | |
4305 | | - | |
4306 | 4305 | | |
| 4306 | + | |
4307 | 4307 | | |
4308 | 4308 | | |
4309 | 4309 | | |
| |||
4350 | 4350 | | |
4351 | 4351 | | |
4352 | 4352 | | |
4353 | | - | |
4354 | | - | |
| 4353 | + | |
4355 | 4354 | | |
4356 | | - | |
4357 | | - | |
| 4355 | + | |
| 4356 | + | |
| 4357 | + | |
4358 | 4358 | | |
4359 | 4359 | | |
4360 | 4360 | | |
| |||
4374 | 4374 | | |
4375 | 4375 | | |
4376 | 4376 | | |
4377 | | - | |
4378 | | - | |
| 4377 | + | |
4379 | 4378 | | |
4380 | | - | |
4381 | | - | |
4382 | | - | |
4383 | | - | |
4384 | | - | |
4385 | | - | |
4386 | | - | |
4387 | | - | |
4388 | | - | |
| 4379 | + | |
| 4380 | + | |
| 4381 | + | |
4389 | 4382 | | |
4390 | 4383 | | |
4391 | 4384 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
362 | 362 | | |
363 | 363 | | |
364 | 364 | | |
365 | | - | |
| 365 | + | |
366 | 366 | | |
367 | 367 | | |
368 | 368 | | |
| |||
400 | 400 | | |
401 | 401 | | |
402 | 402 | | |
403 | | - | |
| 403 | + | |
404 | 404 | | |
405 | 405 | | |
406 | 406 | | |
407 | 407 | | |
408 | 408 | | |
409 | 409 | | |
410 | | - | |
| 410 | + | |
411 | 411 | | |
412 | 412 | | |
413 | 413 | | |
| |||
420 | 420 | | |
421 | 421 | | |
422 | 422 | | |
423 | | - | |
424 | | - | |
425 | | - | |
426 | | - | |
427 | | - | |
428 | | - | |
429 | | - | |
430 | | - | |
431 | | - | |
| 423 | + | |
| 424 | + | |
432 | 425 | | |
433 | 426 | | |
434 | 427 | | |
| |||
456 | 449 | | |
457 | 450 | | |
458 | 451 | | |
459 | | - | |
460 | | - | |
461 | | - | |
462 | | - | |
463 | | - | |
464 | | - | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
465 | 456 | | |
466 | 457 | | |
467 | 458 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1810 | 1810 | | |
1811 | 1811 | | |
1812 | 1812 | | |
1813 | | - | |
1814 | 1813 | | |
1815 | 1814 | | |
1816 | 1815 | | |
1817 | 1816 | | |
1818 | | - | |
1819 | | - | |
1820 | | - | |
1821 | | - | |
1822 | | - | |
1823 | | - | |
1824 | | - | |
1825 | | - | |
1826 | | - | |
1827 | | - | |
1828 | | - | |
1829 | | - | |
1830 | | - | |
| 1817 | + | |
| 1818 | + | |
1831 | 1819 | | |
1832 | 1820 | | |
1833 | 1821 | | |
| |||
1874 | 1862 | | |
1875 | 1863 | | |
1876 | 1864 | | |
1877 | | - | |
1878 | | - | |
1879 | | - | |
1880 | | - | |
1881 | | - | |
1882 | | - | |
| 1865 | + | |
| 1866 | + | |
1883 | 1867 | | |
1884 | 1868 | | |
1885 | 1869 | | |
| |||
1888 | 1872 | | |
1889 | 1873 | | |
1890 | 1874 | | |
1891 | | - | |
1892 | | - | |
1893 | | - | |
1894 | | - | |
1895 | | - | |
1896 | | - | |
| 1875 | + | |
| 1876 | + | |
1897 | 1877 | | |
1898 | 1878 | | |
1899 | 1879 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1071 | 1071 | | |
1072 | 1072 | | |
1073 | 1073 | | |
| 1074 | + | |
| 1075 | + | |
1074 | 1076 | | |
1075 | 1077 | | |
1076 | 1078 | | |
| |||
1081 | 1083 | | |
1082 | 1084 | | |
1083 | 1085 | | |
| 1086 | + | |
1084 | 1087 | | |
1085 | | - | |
| 1088 | + | |
1086 | 1089 | | |
1087 | 1090 | | |
1088 | 1091 | | |
| |||
2064 | 2067 | | |
2065 | 2068 | | |
2066 | 2069 | | |
| 2070 | + | |
| 2071 | + | |
2067 | 2072 | | |
2068 | 2073 | | |
2069 | 2074 | | |
| |||
2110 | 2115 | | |
2111 | 2116 | | |
2112 | 2117 | | |
2113 | | - | |
| 2118 | + | |
| 2119 | + | |
| 2120 | + | |
2114 | 2121 | | |
2115 | 2122 | | |
2116 | 2123 | | |
| |||
0 commit comments
Comments
(0)