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