X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=docs%2FAPI%2Fcommon_8cpp.html;fp=docs%2FAPI%2Fcommon_8cpp.html;h=b68563efeff3db6cce07281f384393f8839e64bb;hb=870e1b86b0c74169b215c166dee787c7c1a20d06;hp=0000000000000000000000000000000000000000;hpb=298022ce50fa8133cc880507170c4b7120d227b5;p=o-du%2Fphy.git diff --git a/docs/API/common_8cpp.html b/docs/API/common_8cpp.html new file mode 100644 index 0000000..b68563e --- /dev/null +++ b/docs/API/common_8cpp.html @@ -0,0 +1,447 @@ + + + + + + + +o-du/phy: common.cpp File Reference + + + + + + + + + +
+
+ + + + + + +
+
o-du/phy +
+
Intel O-RAN/X-RAN Generated Doxygen Documentation
+
+
+ + + + + + + + +
+
+ + +
+ +
+ + +
+
+
+Macros | +Functions
+
+
common.cpp File Reference
+
+
+
#include <cmath>
+#include <fstream>
+#include <numeric>
+#include <unistd.h>
+#include <sys/syscall.h>
+#include "common.hpp"
+
+Include dependency graph for common.cpp:
+
+
+ + + + + +
+
+

Go to the source code of this file.

+ + + + +

+Macros

#define CPU_ID   4
 
+ + + + + + + + + + + + + + + + + + + + + + +

+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...
 
char * read_data_to_aligned_array (const std::string &filename)
 Read binary data from the file. More...
 
json read_json_from_file (const std::string &filename)
 Read JSON from the given 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...
 
+

Macro Definition Documentation

+ +

◆ CPU_ID

+ +
+
+ + + + +
#define CPU_ID   4
+
+ +

Definition at line 34 of file common.cpp.

+ +
+
+

Function Documentation

+ +

◆ bind_to_cpu()

+ +
+
+ + + + + + + + +
int bind_to_cpu (const unsigned cpu)
+
+ +

Attach current process to the selected core.

+
Parameters
+ + +
[in]cpuCore number.
+
+
+
Returns
0 on success, -1 otherwise.
+ +

Definition at line 47 of file common.cpp.

+
+Here is the caller graph for this function:
+
+
+ + + + + + + +
+ +
+
+ +

◆ calculate_statistics()

+ +
+
+ + + + + + + + +
std::pair<double, double> calculate_statistics (const std::vector< long > values)
+
+ +

Calculate the mean and variance from the result of the run_benchmark.

+
Parameters
+ + +
[in]valuesVector with result values.
+
+
+
Returns
std::pair where the first element is mean and the second one is standard deviation.
+
Note
It's not a general mean/stddev function it only works properly when feed with data from the benchmark function.
+ +

Definition at line 60 of file common.cpp.

+
+Here is the caller graph for this function:
+
+
+ + + + + + + + +
+ +
+
+ +

◆ get_sequence()

+ +
+
+ + + + + + + + +
std::vector<unsigned> get_sequence (const unsigned number)
+
+ +

For a given number return sequence of number from 0 to number - 1.

+
Parameters
+ + +
[in]numberPositive integer value.
+
+
+
Returns
Vector with the sorted integer numbers between 0 and number - 1.
+ +

Definition at line 78 of file common.cpp.

+
+Here is the caller graph for this function:
+
+
+ + + + + + +
+ +
+
+ +

◆ read_data_to_aligned_array()

+ +
+
+ + + + + + + + +
char* read_data_to_aligned_array (const std::string & filename)
+
+ +

Read binary data from the file.

+
Parameters
+ + +
[in]filenamename of the binary file.
+
+
+
Returns
Pointer to the allocated memory with data from the file.
+
Exceptions
+ + +
std::runtime_errorwhen memory cannot be allocated.
+
+
+ +

Definition at line 86 of file common.cpp.

+
+Here is the caller graph for this function:
+
+
+ + + + + + + + + + + + +
+ +
+
+ +

◆ read_json_from_file()

+ +
+
+ + + + + + + + +
json read_json_from_file (const std::string & filename)
+
+ +

Read JSON from the given file.

+
Parameters
+ + +
[in]filenamename of the .json file.
+
+
+
Returns
JSON object with data.
+
Exceptions
+ + +
missing_config_file_exceptionwhen file cannot be opened.
+
+
+ +

Definition at line 106 of file common.cpp.

+
+Here is the caller graph for this function:
+
+
+ + + + + + + + + +
+ +
+
+ +

◆ tsc_recovery()

+ +
+
+ + + + + + + +
unsigned long tsc_recovery ()
+
+ +

Measure the TSC on the machine.

+
Returns
Number of ticks per us
+ +

Definition at line 119 of file common.cpp.

+
+Here is the call graph for this function:
+
+
+ + + +
+
+Here is the caller graph for this function:
+
+
+ + + + + + +
+ +
+
+ +

◆ tsc_tick()

+ +
+
+ + + + + + + +
unsigned long tsc_tick ()
+
+ +

Return the current value of the TSC.

+
Returns
Current TSC value
+ +

Definition at line 162 of file common.cpp.

+
+Here is the caller graph for this function:
+
+
+ + + + + + + +
+ +
+
+
+ + + +