mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-03-25 04:17:42 +00:00
MINOR: pools: use cheaper randoms for fault injections
ha_random() is quite heavy and uses atomic ops or even a lock on some architectures. Here we don't seek good randoms, just statistical ones, so let's use the statistical prng instead.
This commit is contained in:
parent
84ebfabf7f
commit
20f88abad5
@ -498,9 +498,7 @@ int mem_should_fail(const struct pool_head *pool)
|
||||
int ret = 0;
|
||||
|
||||
if (mem_fail_rate > 0 && !(global.mode & MODE_STARTING)) {
|
||||
int randnb = ha_random() % 100;
|
||||
|
||||
if (mem_fail_rate > randnb)
|
||||
if (mem_fail_rate > statistical_prng_range(100))
|
||||
ret = 1;
|
||||
else
|
||||
ret = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user