@@ -15,7 +15,7 @@ struct fd_pack_pacing_private {
15
15
long t_start ;
16
16
long t_end ;
17
17
/* Number of CUs in the block */
18
- ulong max_cus ;
18
+ float max_cus ;
19
19
20
20
float ticks_per_cu ;
21
21
float remaining_cus ;
@@ -36,15 +36,19 @@ fd_pack_pacing_init( fd_pack_pacing_t * pacer,
36
36
ulong max_cus ) {
37
37
38
38
pacer -> t_start = t_start ;
39
- pacer -> t_end = t_end - (long )((t_end - t_start )/20L ); /* try to finish 95% of the way through */
40
- pacer -> max_cus = max_cus ;
39
+ pacer -> t_end = t_end ;
41
40
42
41
/* Time per CU depends on the hardware, the transaction mix, what
43
42
fraction of the transactions land, etc. It's hard to just come up
44
- with a value, but a small sample says 8 ns/CU is in the right
43
+ with a value, but a small sample says 9 ns/CU is in the right
45
44
ballpark. */
46
- pacer -> ticks_per_cu = 8.0f * ticks_per_ns ;
47
- pacer -> remaining_cus = (float )max_cus ;
45
+ pacer -> ticks_per_cu = 9.0f * ticks_per_ns ;
46
+
47
+ /* Originally, we had all the lines ending 5% before t_end, but the
48
+ better thing to do is to adjust max_cus up so that the 1 bank line
49
+ ends 5% before t_end. */
50
+ pacer -> max_cus = (float )max_cus + 0.05f * (float )(t_end - t_start )/pacer -> ticks_per_cu ;
51
+ pacer -> remaining_cus = pacer -> max_cus ;
48
52
}
49
53
50
54
/* fd_pack_pacing_update_consumed_cus notes that the instantaneous value
@@ -61,7 +65,7 @@ fd_pack_pacing_update_consumed_cus( fd_pack_pacing_t * pacer,
61
65
(void )now ;
62
66
/* It's possible (but unlikely) that consumed_cus can be greater than
63
67
max_cus, so clamp the value at 0 */
64
- pacer -> remaining_cus = ( float )( fd_ulong_max ( pacer -> max_cus , consumed_cus ) - consumed_cus );
68
+ pacer -> remaining_cus = fmaxf ( pacer -> max_cus - ( float ) consumed_cus , 0.0f );
65
69
}
66
70
67
71
@@ -78,10 +82,11 @@ fd_pack_pacing_enabled_bank_cnt( fd_pack_pacing_t const * pacer,
78
82
milliseconds. That way we pass up the best transaction because it
79
83
conflicts with something actively running as infrequently as
80
84
possible. To do that, we draw lines through in the time-CU plane
81
- that pass through (400 milliseconds, 48M CUs) with slope k*(single
82
- bank speed), where k varies between 1 and the number of bank tiles
83
- configured. This splits the plane into several regions, and the
84
- region we are in tells us how many bank tiles to use.
85
+ that pass through approximately (400 milliseconds, 48M CUs) with
86
+ slope k*(single bank speed), where k varies between 1 and the
87
+ number of bank tiles configured. This splits the plane into
88
+ several regions, and the region we are in tells us how many bank
89
+ tiles to use.
85
90
86
91
87
92
48M - / /|
0 commit comments