Commit 95ca976
huangjun
[bvar] fix sampler interval after switch to cpuwide_time_ns
Commit 12fb539 ("Use monotonic time instead of wall time", #3268)
switched the three time-source calls in SamplerCollector::run() from
gettimeofday_us() to cpuwide_time_ns(), but the surrounding code still
treats the timestamps as microseconds:
- abstime += 1000000L now represents 1 ms (not 1 s), causing the
sampler to spin at ~1 kHz instead of 1 Hz;
- usleep(abstime - now) receives a nanosecond delta, which usleep()
interprets as microseconds.
Use cpuwide_time_us() instead, which preserves the monotonic behavior
from #3268 while keeping the existing microsecond-based arithmetic
correct.
Fixes #3277.1 parent 35682ff commit 95ca976
1 file changed
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
158 | | - | |
| 158 | + | |
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
| |||
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
179 | | - | |
| 179 | + | |
180 | 180 | | |
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
185 | | - | |
| 185 | + | |
186 | 186 | | |
187 | 187 | | |
188 | 188 | | |
| |||
0 commit comments