X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=docs%2FAPI%2Fcommon_8hpp.html;fp=docs%2FAPI%2Fcommon_8hpp.html;h=0000000000000000000000000000000000000000;hb=bdbd414e8038630c154ee3c6b8bc9b3aeb954be6;hp=4be2d32b3a0962c300c1de3e16e7065d36826271;hpb=e9403c457453dba780e64af7de9462fad7217aa3;p=o-du%2Fphy.git diff --git a/docs/API/common_8hpp.html b/docs/API/common_8hpp.html deleted file mode 100644 index 4be2d32..0000000 --- a/docs/API/common_8hpp.html +++ /dev/null @@ -1,1194 +0,0 @@ - - -
- - - - -
- o-du/phy
-
- Intel O-RAN/X-RAN Generated Doxygen Documentation
- |
-
#include <exception>
#include <random>
#include <string>
#include <utility>
#include <vector>
#include <immintrin.h>
#include <malloc.h>
#include <rte_config.h>
#include <rte_malloc.h>
#include "gtest/gtest.h"
#include "common_typedef_xran.h"
#include "json.hpp"
Go to the source code of this file.
--Data Structures | |
struct | BenchmarkParameters |
struct | missing_config_file_exception |
struct | reading_input_file_exception |
class | KernelTests |
-Macros | |
#define | _BBLIB_DPDK_ |
#define | ASSERT_ARRAY_NEAR(reference, actual, size, precision) assert_array_near(reference, actual, size, precision) |
#define | ASSERT_ARRAY_EQ(reference, actual, size) assert_array_eq(reference, actual, size) |
#define | ASSERT_AVG_GREATER_COMPLEX(reference, actual, size, precision) assert_avg_greater_complex(reference, actual, size, precision) |
-Typedefs | |
using | json = nlohmann::json |
-Functions | |
int | bind_to_cpu (const unsigned cpu) |
Attach current process to the selected core. More... | |
std::pair< double, double > | calculate_statistics (const std::vector< long > values) |
Calculate the mean and variance from the result of the run_benchmark. More... | |
std::vector< unsigned > | get_sequence (const unsigned number) |
For a given number return sequence of number from 0 to number - 1. More... | |
json | read_json_from_file (const std::string &filename) |
Read JSON from the given file. More... | |
char * | read_data_to_aligned_array (const std::string &filename) |
Read binary data from the file. More... | |
unsigned long | tsc_recovery () |
Measure the TSC on the machine. More... | |
unsigned long | tsc_tick () |
Return the current value of the TSC. More... | |
template<typename F , typename ... Args> | |
std::pair< double, double > | run_benchmark (F function, Args ... args) |
Run the given function and return the mean run time and stddev. More... | |
template<typename T > | |
void | assert_array_eq (const T *reference, const T *actual, const int size) |
Assert elements of two arrays. It calls ASSERT_EQ for each element of the array. More... | |
template<typename T > | |
void | assert_array_near (const T *reference, const T *actual, const int size, const double precision) |
Assert elements of two arrays. It calls ASSERT_NEAR for each element of the array. More... | |
template<> | |
void | assert_array_near< complex_float > (const complex_float *reference, const complex_float *actual, const int size, const double precision) |
template<typename T > | |
void | assert_avg_greater_complex (const T *reference, const T *actual, const int size, const double precision) |
Assert average diff of two arrays. It calls ASSERT_GT to check the average. More... | |
template<typename T > | |
T * | aligned_malloc (const int size, const unsigned alignment) |
Allocates memory of the given size. More... | |
template<typename T > | |
void | aligned_free (T *ptr) |
Frees memory pointed by the given pointer. More... | |
template<typename T , typename U > | |
T * | generate_random_numbers (const long size, const unsigned alignment, U &distribution) |
generate random numbers. More... | |
template<typename T > | |
T * | generate_random_data (const long size, const unsigned alignment) |
generate random data. More... | |
template<typename T > | |
T * | generate_random_int_numbers (const long size, const unsigned alignment, const T lo_range, const T up_range) |
generate integer random numbers. More... | |
template<typename T > | |
T * | generate_random_real_numbers (const long size, const unsigned alignment, const T lo_range, const T up_range) |
generate real random numbers. More... | |
#define _BBLIB_DPDK_ | -
Definition at line 40 of file common.hpp.
- -#define ASSERT_ARRAY_EQ | -( | -- | reference, | -
- | - | - | actual, | -
- | - | - | size | -
- | ) | -assert_array_eq(reference, actual, size) | -
Definition at line 58 of file common.hpp.
- -#define ASSERT_ARRAY_NEAR | -( | -- | reference, | -
- | - | - | actual, | -
- | - | - | size, | -
- | - | - | precision | -
- | ) | -assert_array_near(reference, actual, size, precision) | -
Definition at line 55 of file common.hpp.
- -#define ASSERT_AVG_GREATER_COMPLEX | -( | -- | reference, | -
- | - | - | actual, | -
- | - | - | size, | -
- | - | - | precision | -
- | ) | -assert_avg_greater_complex(reference, actual, size, precision) | -
Definition at line 61 of file common.hpp.
- -using json = nlohmann::json | -
Definition at line 53 of file common.hpp.
- -void aligned_free | -( | -T * | -ptr | ) | -- |
Frees memory pointed by the given pointer.
-aligned_free is a wrapper for functions that free memory allocated by aligned_malloc: 'rte_free' from DPDK if hugepages are defined and 'free' otherwise.
-[in] | ptr | Pointer to the allocated memory. |
Definition at line 566 of file common.hpp.
- -T* aligned_malloc | -( | -const int | -size, | -
- | - | const unsigned | -alignment | -
- | ) | -- |
Allocates memory of the given size.
-aligned_malloc is wrapper to functions that allocate memory: 'rte_malloc' from DPDK if hugepages are defined, 'memalign' otherwise. Size is defined as a number of variables of given type e.g. floats, rather than bytes. It hides sizeof(T) multiplication and cast hence makes things cleaner.
-[in] | size | Size of the memory to allocate. |
[in] | alignment | Bytes alignment of the allocated memory. If 0, the return is a pointer that is suitably aligned for any kind of variable (in the same manner as malloc()). Otherwise, the return is a pointer that is a multiple of align. In this case, it must be a power of two. (Minimum alignment is the cacheline size, i.e. 64-bytes) |
Definition at line 544 of file common.hpp.
- -void assert_array_eq | -( | -const T * | -reference, | -
- | - | const T * | -actual, | -
- | - | const int | -size | -
- | ) | -- |
Assert elements of two arrays. It calls ASSERT_EQ for each element of the array.
-[in] | reference | Array with reference values. |
[in] | actual | Array with the actual output. |
[in] | size | Size of the array. |
Definition at line 448 of file common.hpp.
- -void assert_array_near | -( | -const T * | -reference, | -
- | - | const T * | -actual, | -
- | - | const int | -size, | -
- | - | const double | -precision | -
- | ) | -- |
Assert elements of two arrays. It calls ASSERT_NEAR for each element of the array.
-[in] | reference | Array with reference values. |
[in] | actual | Array with the actual output. |
[in] | size | Size of the array. |
[in] | precision | Precision fo the comparision used by ASSERT_NEAR. |
Definition at line 465 of file common.hpp.
- -void assert_array_near< complex_float > | -( | -const complex_float * | -reference, | -
- | - | const complex_float * | -actual, | -
- | - | const int | -size, | -
- | - | const double | -precision | -
- | ) | -- |
Definition at line 475 of file common.hpp.
- -void assert_avg_greater_complex | -( | -const T * | -reference, | -
- | - | const T * | -actual, | -
- | - | const int | -size, | -
- | - | const double | -precision | -
- | ) | -- |
Assert average diff of two arrays. It calls ASSERT_GT to check the average.
-[in] | reference | Array with reference values, interleaved IQ inputs. |
[in] | actual | Array with the actual output, interleaved IQ inputs. |
[in] | size | Size of the array, based on complex inputs. |
[in] | precision | Precision for the comparison used by ASSERT_GT. |
Definition at line 494 of file common.hpp.
- -int bind_to_cpu | -( | -const unsigned | -cpu | ) | -- |
Attach current process to the selected core.
-[in] | cpu | Core number. |
Definition at line 47 of file common.cpp.
-std::pair<double, double> calculate_statistics | -( | -const std::vector< long > | -values | ) | -- |
Calculate the mean and variance from the result of the run_benchmark.
-[in] | values | Vector with result values. |
Definition at line 60 of file common.cpp.
-T* generate_random_data | -( | -const long | -size, | -
- | - | const unsigned | -alignment | -
- | ) | -- |
generate random data.
-It allocates memory and populate it with random data using C++11 default engine and uniform integer distribution (bytes not floats are uniformly distributed). Don't forget to free allocated memory!
-[in] | size | Size of the memory to be filled with random data. |
[in] | alignment | Bytes alignment of the memory. |
Definition at line 618 of file common.hpp.
- -T* generate_random_int_numbers | -( | -const long | -size, | -
- | - | const unsigned | -alignment, | -
- | - | const T | -lo_range, | -
- | - | const T | -up_range | -
- | ) | -- |
generate integer random numbers.
-It allocates memory and populate it with random numbers using C++11 default engine and uniform integer distribution (where lo_range <= x < up_range). Don't forget to free allocated memory! The result type generated by the generator should be one of int types.
-[in] | size | Size of the memory to be filled with random data. |
[in] | alignment | Bytes alignment of the memory. |
[in] | lo_range | Lower bound of range of values returned by random generator. |
[in] | up_range | Upper bound of range of values returned by random generator. |
Definition at line 640 of file common.hpp.
- -T* generate_random_numbers | -( | -const long | -size, | -
- | - | const unsigned | -alignment, | -
- | - | U & | -distribution | -
- | ) | -- |
generate random numbers.
-It allocates memory and populate it with random numbers using C++11 default engine and uniform real / int distribution (where lo_range <= x <up_range). Don't forget to free allocated memory!
-[in] | size | Size of the memory to be filled with random data. |
[in] | alignment | Bytes alignment of the memory. |
[in] | distribution | Distribuiton for random generator. |
Definition at line 593 of file common.hpp.
- -T* generate_random_real_numbers | -( | -const long | -size, | -
- | - | const unsigned | -alignment, | -
- | - | const T | -lo_range, | -
- | - | const T | -up_range | -
- | ) | -- |
generate real random numbers.
-It allocates memory and populate it with random numbers using C++11 default engine and uniform real distribution (where lo_range <= x <up_range). Don't forget to free allocated memory! The result type generated by the generator should be one of real types: float, double or long double.
-[in] | size | Size of the memory to be filled with random data. |
[in] | alignment | Bytes alignment of the memory. |
[in] | lo_range | Lower bound of range of values returned by random generator. |
[in] | up_range | Upper bound of range of values returned by random generator. |
Definition at line 663 of file common.hpp.
- -std::vector<unsigned> get_sequence | -( | -const unsigned | -number | ) | -- |
For a given number return sequence of number from 0 to number - 1.
-[in] | number | Positive integer value. |
Definition at line 78 of file common.cpp.
-char* read_data_to_aligned_array | -( | -const std::string & | -filename | ) | -- |
Read binary data from the file.
-[in] | filename | name of the binary file. |
std::runtime_error | when memory cannot be allocated. |
Definition at line 86 of file common.cpp.
-json read_json_from_file | -( | -const std::string & | -filename | ) | -- |
Read JSON from the given file.
-[in] | filename | name of the .json file. |
missing_config_file_exception | when file cannot be opened. |
Definition at line 106 of file common.cpp.
-std::pair<double, double> run_benchmark | -( | -F | -function, | -
- | - | Args ... | -args | -
- | ) | -- |
Run the given function and return the mean run time and stddev.
-[in] | function | Function to benchmark. |
[in] | args | Function's arguments. |
Definition at line 425 of file common.hpp.
-unsigned long tsc_recovery | -( | -) | -- |
Measure the TSC on the machine.
-Definition at line 119 of file common.cpp.
-unsigned long tsc_tick | -( | -) | -- |
Return the current value of the TSC.
-Definition at line 162 of file common.cpp.
-