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