1OPENSSL_INSTRUMENT_BUS(3ossl) OpenSSL OPENSSL_INSTRUMENT_BUS(3ossl)
2
3
4
6 OPENSSL_instrument_bus, OPENSSL_instrument_bus2 - instrument references
7 to memory bus
8
10 #ifdef OPENSSL_CPUID_OBJ
11 size_t OPENSSL_instrument_bus(unsigned int *vector, size_t num);
12 size_t OPENSSL_instrument_bus2(unsigned int *vector, size_t num, size_t max);
13 #endif
14
16 It was empirically found that timings of references to primary memory
17 are subject to irregular, apparently non-deterministic variations. The
18 subroutines in question instrument these references for purposes of
19 gathering randomness for random number generator. In order to make it
20 bus-bound a 'flush cache line' instruction is used between probes. In
21 addition probes are added to vector elements in atomic or interlocked
22 manner, which should contribute additional noise on multi-processor
23 systems. This also means that vector[num] should be zeroed upon
24 invocation (if you want to retrieve actual probe values).
25
26 OPENSSL_instrument_bus() performs num probes and records the number of
27 oscillator cycles every probe took.
28
29 OPENSSL_instrument_bus2() on the other hand accumulates consecutive
30 probes with the same value, i.e. in a way it records duration of
31 periods when probe values appeared deterministic. The subroutine
32 performs at most max probes in attempt to fill the vector[num], with
33 max value of 0 meaning "as many as it takes."
34
36 Return value of 0 indicates that CPU is not capable of performing the
37 benchmark, either because oscillator counter or 'flush cache line' is
38 not available on current platform. For reference, on x86 'flush cache
39 line' was introduced with the SSE2 extensions.
40
41 Otherwise number of recorded values is returned.
42
44 Copyright 2011-2021 The OpenSSL Project Authors. All Rights Reserved.
45
46 Licensed under the Apache License 2.0 (the "License"). You may not use
47 this file except in compliance with the License. You can obtain a copy
48 in the file LICENSE in the source distribution or at
49 <https://www.openssl.org/source/license.html>.
50
51
52
533.1.1 2023-08-31 OPENSSL_INSTRUMENT_BUS(3ossl)