Commit 2d92c39
committed
fix(core): Stopwatch::Frequency is the clock's own (#2326, SR-AUD-130)
Frequency was 10,000,000 and GetTimestamp() divided the clock's nanosecond count
by 100. .NET reports the platform's frequency -- 1,000,000,000 on Unix. Landed
under SA-8, option A of the review's two.
THE OLD PAIR WAS SELF-CONSISTENT AND STILL A DEFECT, and that distinction is the
ticket. Every elapsed time it computed was correct; what it could not do was
RESOLVE anything finer than 100 ns, because GetTimestamp() threw the low two
digits away -- two events 30 ns apart got the same timestamp here and different
ones in .NET. A test asserts the resolution directly rather than the constant.
THE VALUE IS DERIVED FROM Clock::period, NOT TRANSCRIBED. .NET's Windows build
returns QueryPerformanceFrequency, but this port samples std::chrono::
steady_clock, so reporting QPC's frequency would be a lie about a different
timer. It also stays constexpr where .NET's is a runtime static readonly, which
is a stronger guarantee, not a weaker one.
THE REVIEW'S WARNING WAS CORRECT AND WAS ACTED ON. Twelve tests across two
suites had to be rescaled, and none was a regression: they are CCF-004's
evidence that the subtraction is DEFINED, which is untouched -- the delta still
wraps to exactly the two's-complement value. What moved is the reported tick
count, and every new expectation is .NET's own (long)((end - start) * 0.01),
hand-computed rather than taken from the implementation, because a test that
mirrors its own formula proves nothing.
Two needed more than a number: SignedSweepAtUnitFrequency and
PrecisionAbovePow2_53IsAPreExistingProperty are about double rounding at unit
scale, and the system provider only HAPPENED to have unit frequency. They now
construct a FixedFrequencyProvider(TicksPerSecond), which is what their names
always claimed.
Instance measurement is completely unaffected -- it never went through
Frequency. Gate 17,306 run, 0 failed. Downstream: zero sites in either consumer.1 parent 76564b1 commit 2d92c39
7 files changed
Lines changed: 311 additions & 61 deletions
File tree
- audit
- docs
- modules
- core
- include/System/Diagnostics
- tests/System/Diagnostics
- threading/tests/System
Large diffs are not rendered by default.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
109 | | - | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
110 | 131 | | |
111 | | - | |
| 132 | + | |
| 133 | + | |
112 | 134 | | |
113 | 135 | | |
114 | 136 | | |
115 | 137 | | |
116 | | - | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
117 | 145 | | |
118 | | - | |
119 | | - | |
| 146 | + | |
120 | 147 | | |
121 | 148 | | |
122 | 149 | | |
| |||
129 | 156 | | |
130 | 157 | | |
131 | 158 | | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
136 | 168 | | |
137 | 169 | | |
138 | 170 | | |
| |||
144 | 176 | | |
145 | 177 | | |
146 | 178 | | |
147 | | - | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
148 | 195 | | |
149 | 196 | | |
150 | 197 | | |
| |||
0 commit comments