Commit 9e0bc7c
committed
Track spinlock delay in microsecond granularity.
On many platforms the OS will round the sleep time to millisecond
resolution, but there is no reason for us to pre-emptively round the
argument to pg_usleep.
When the delay was measured in milliseconds and started from 1 ms, it
sometimes took many attempts until the logic that increases the delay by
multiplying with a random value between 1 and 2 actually managed to bump it
from 1 ms to 2 ms. That lead to a sequence of 1 ms waits until the delay
started to increase. This wasn't really a problem but it looked odd if you
observed the waits. There is no measurable difference in performance, but
it's more readable this way.
Jeff Janes1 parent 9db4ad4 commit 9e0bc7c
1 file changed
+6
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | 84 | | |
90 | 85 | | |
91 | 86 | | |
92 | 87 | | |
93 | | - | |
94 | | - | |
| 88 | + | |
| 89 | + | |
95 | 90 | | |
96 | 91 | | |
97 | 92 | | |
| |||
109 | 104 | | |
110 | 105 | | |
111 | 106 | | |
112 | | - | |
| 107 | + | |
113 | 108 | | |
114 | | - | |
| 109 | + | |
115 | 110 | | |
116 | 111 | | |
117 | 112 | | |
| |||
122 | 117 | | |
123 | 118 | | |
124 | 119 | | |
125 | | - | |
126 | | - | |
| 120 | + | |
| 121 | + | |
127 | 122 | | |
128 | 123 | | |
129 | 124 | | |
| |||
0 commit comments