Hi,
On Wed, Sep 24, 2025 at 10:41:59AM +0200, Michael Banck via Bug reports for the
GNU Hurd wrote:
> Where as on my Linux Thinkpad host, I see this:
>
> $ LANG=C ./pg_test_timing
> Testing timing overhead for 3 seconds.
> Average loop time including overhead: 13.84 ns
> Histogram of timing durations:
> <= ns % of total running % count
> 0 0.0000 0.0000 0
> 1 0.0000 0.0000 0
> 3 0.0000 0.0000 0
> 7 0.0000 0.0000 0
> 15 97.3170 97.3170 210936922
> 31 2.6288 99.9458 5697932
> 63 0.0505 99.9963 109441
> 127 0.0008 99.9971 1782
> 255 0.0022 99.9992 4674
> 511 0.0004 99.9996 789
> 1023 0.0002 99.9998 448
> 2047 0.0001 99.9999 260
> 4095 0.0000 99.9999 29
> 8191 0.0000 100.0000 28
> 16383 0.0000 100.0000 9
> 32767 0.0000 100.0000 20
> 65535 0.0000 100.0000 71
> 131071 0.0000 100.0000 1
>
> Observed timing durations up to 99.9900%:
> ns % of total running % count
> 12 0.6013 0.6013 1303308
> 13 30.4999 31.1012 66109219
> 14 61.5536 92.6548 133418976
> 15 4.6622 97.3170 10105419
> 16 1.5844 98.9014 3434318
> 17 0.6401 99.5415 1387333
> 18 0.1352 99.6766 292948
> 19 0.1831 99.8597 396853
> 20 0.0499 99.9097 108239
> 21 0.0094 99.9191 20358
> 22 0.0056 99.9247 12191
> 23 0.0065 99.9312 14037
> 24 0.0072 99.9384 15645
> 25 0.0023 99.9407 4988
> 26 0.0008 99.9415 1819
> 27 0.0004 99.9419 863
> 28 0.0008 99.9427 1706
> 29 0.0007 99.9434 1486
> 30 0.0006 99.9440 1296
> 31 0.0018 99.9458 3852
> 32 0.0018 99.9476 3884
> 33 0.0003 99.9479 675
> 34 0.0001 99.9480 180
> 35 0.0001 99.9480 120
> 36 0.0000 99.9480 42
> 37 0.0000 99.9480 38
> 38 0.0000 99.9481 38
> 39 0.0000 99.9481 30
> 40 0.0009 99.9489 1885
> 41 0.0046 99.9536 10039
> 42 0.0137 99.9673 29692
> 43 0.0157 99.9830 34041
> 44 0.0089 99.9918 19219
> ...
> 95775 0.0000 100.0000 1
>
> (I should get a Linux VM running on qemu/kvm and compare timings there)
I did that now, here are the timings:
Testing timing overhead for 3 seconds.
Average loop time including overhead: 27.85 ns
Histogram of timing durations:
<= ns % of total running % count
0 0.0000 0.0000 0
1 0.0000 0.0000 0
3 0.0000 0.0000 0
7 0.0000 0.0000 0
15 0.0000 0.0000 0
31 98.8605 98.8605 106505832
63 0.2545 99.1149 274138
127 0.8823 99.9972 950514
255 0.0003 99.9975 311
511 0.0001 99.9975 63
1023 0.0000 99.9976 36
2047 0.0010 99.9986 1061
4095 0.0003 99.9988 303
8191 0.0011 99.9999 1156
16383 0.0000 100.0000 53
32767 0.0000 100.0000 7
65535 0.0000 100.0000 16
131071 0.0000 100.0000 1
262143 0.0000 100.0000 7
524287 0.0000 100.0000 3
1048575 0.0000 100.0000 1
2097151 0.0000 100.0000 2
Observed timing durations up to 99.9900%:
ns % of total running % count
19 0.0819 0.0819 88181
20 26.9854 27.0672 29072269
21 1.0536 28.1208 1135118
29 0.3030 28.4239 326481
30 66.4685 94.8923 71608799
31 3.9681 98.8605 4274984
39 0.0014 98.8619 1554
40 0.2334 99.0953 251467
41 0.0191 99.1144 20597
49 0.0000 99.1144 4
50 0.0002 99.1147 249
51 0.0000 99.1147 31
60 0.0002 99.1149 211
61 0.0000 99.1149 25
69 0.0005 99.1154 497
70 0.0395 99.1548 42526
71 0.0060 99.1608 6439
79 0.0075 99.1683 8099
80 0.6032 99.7715 649829
81 0.1065 99.8780 114730
89 0.0014 99.8794 1505
90 0.0978 99.9772 105354
91 0.0198 99.9970 21350
...
1430928 0.0000 100.0000 1
So the average loop time is 2.5-3x longer and the minium loop time
increased from 12ns to 19ns.
Michael