1
1
#include "../fd_tango.h"
2
+ #include "../../util/math/fd_stat.h"
2
3
3
4
#if FD_HAS_DOUBLE
4
5
@@ -24,10 +25,10 @@ fd_tempo_wallclock_model( double * opt_tau ) {
24
25
jitter. */
25
26
26
27
ulong iter = 0UL ;
27
- for (;;) {
28
+ for (;;) {
28
29
# define TRIAL_CNT 512UL
29
30
# define TRIM_CNT 64UL
30
- double trial [ TRIAL_CNT ];
31
+ double trial [ TRIAL_CNT ];
31
32
for ( ulong trial_idx = 0UL ; trial_idx < TRIAL_CNT ; trial_idx ++ ) {
32
33
FD_COMPILER_MFENCE ();
33
34
long tic = fd_log_wallclock ();
@@ -67,10 +68,10 @@ fd_tempo_tickcount_model( double * opt_tau ) {
67
68
/* Same as the above but for fd_tickcount(). */
68
69
69
70
ulong iter = 0UL ;
70
- for (;;) {
71
+ for (;;) {
71
72
# define TRIAL_CNT 512UL
72
73
# define TRIM_CNT 64UL
73
- double trial [ TRIAL_CNT ];
74
+ double trial [ TRIAL_CNT ];
74
75
for ( ulong trial_idx = 0UL ; trial_idx < TRIAL_CNT ; trial_idx ++ ) {
75
76
FD_COMPILER_MFENCE ();
76
77
long tic = fd_tickcount ();
@@ -131,10 +132,10 @@ fd_tempo_tick_per_ns( double * opt_sigma ) {
131
132
well modeled as normal. */
132
133
133
134
ulong iter = 0UL ;
134
- for (;;) {
135
+ for (;;) {
135
136
# define TRIAL_CNT 32UL
136
137
# define TRIM_CNT 4UL
137
- double trial [ TRIAL_CNT ];
138
+ double trial [ TRIAL_CNT ];
138
139
for ( ulong trial_idx = 0UL ; trial_idx < TRIAL_CNT ; trial_idx ++ ) {
139
140
long then ; long toc ; fd_tempo_observe_pair ( & then , & toc );
140
141
fd_log_sleep ( 16777216L ); /* ~16.8 ms */
@@ -199,7 +200,7 @@ fd_tempo_observe_pair( long * opt_now,
199
200
tickcount because that is typically the lower overhead, more
200
201
deterministic one and less likely to get jerked around behind our
201
202
back.
202
-
203
+
203
204
Theoretically, this exploits how the minimum of a shifted
204
205
exponential random variable converges. Since the time to read
205
206
the various clocks is expected to be reasonably modeled as a
0 commit comments