1# Benchmark Test
2
3Benchmarking is an activity of measuring and evaluating software performance indicators, which can establish a known
4performance level (called a baseline) at a certain time through benchmarking.
5When the software and hardware environment of the system changes, another benchmarking is conducted to determine the
6impact of those changes on performance. This is the most common use of benchmark testing, with other uses including
7determining performance limits at certain load levels, managing changes in systems or environments,
8and identifying conditions that may cause performance issues.
9
10## 目录结构
11
12```
13commonlibrary/c_utils/base/test
14├─ benchmarktest
15│   ├── ashemem_benchmark_test                      # Anonymous Shared Memory API test
16│   ├── datetime_benchmark_test                     # datetime API test
17│   ├── directory_benchmark_test                    # directory API test
18│   ├── event_benchmark_test                        # event API test
19│   ├── file_benchmark_test                         # file API test
20│   ├── mapped_benchmark_test                       # mapped API test
21│   ├── observer_benchmark_test                     # observer API test
22│   ├── parcel_benchmark_test                       # parcel API test
23│   ├── refbase_benchmark_test                      # refbase API test
24│   ├── rwlock_benchmark_test                       # rwlock API test
25│   ├── safe_block_queue_benchmark_test             # safe blocke queue API test
26│   ├── safe_block_queue_tracking_benchmark_test
27│   ├── safe_map_benchmark_test                     # safe map API test
28│   ├── safe_queue_benchmark_test                   # safe queue API test
29│   ├── singleton_benchmark_test                    # singleton API test
30│   ├── sorted_vector_benchmark_test                # sortedvector API test
31│   ├── string_benchmark_test                       # string API test
32│   ├── thread_benchmark_test                       # thread API test
33│   ├── thread_pool_benchmark_test                  # threadpool API test
34│   ├── timer_benchmark_test                        # timer API test
35│   ├── unique_fd_benchmark_test                    # uniquefd API test
36│   ├── benchmark_assert.h
37│   ├── BUILD.gn
38│   └── benchmark_log.h
39```
40
41## Build
42### Build Component
43```
44./build.sh --product-name rk3568 --build-target c_utils
45```
46
47### Build testsuits
48```
49./build.sh --product-name rk3568 --build-target commonlibrary/c_utils/base/test/benchmarktest/
50```
51
52### output
53```
54/out/rk3568/tests/benchmark
55```
56
57## Test environment setup(windows)
58### Test dir
59
60```
61
62Test
63├── developer_test                # test framework(git clone https://gitee.com/openharmony/testfwk_developer_test.git)
64│   ├── aw
65│   ├── config
66│   │   ├── framework_config.xml  #config the benchmark timeout field to "900"
67│   │   └── user_config.xml       # The SN field needs to be configured with the development board serial numbe
68                                    test_cases field needs to be configured with the compiled test case directory
69│   ├── examples
70│   ├── src
71│   ├── third_party
72│   ├── reports                   #test result
73│   ├── BUILD.gn
74│   ├── start.bat                 # Windwos
75│   └── start.sh                  # Linux
76├── testcase                      # cp -r /out/rk3568/tests/benchmark/ XXX/testcase/
77└── xdevice                       # (git clone https://gitee.com/openharmony/testfwk_xdevice.git)
78
79```
80## Execute test cases(windows)
81### start test framework
82	start.bat
83
84### Select product type
85	default : rk3568
86
87
88### Execute(eg:parcel)
89	eg:run -t BENCHMARK -ts ParcelTest
90
91  	Instructions for executing command parameters:
92    ```
93    -t [TESTTYPE]: Specify test case type,such as UT,MST,ST,PERF,FUZZ,BENCHMARK。(Required parameters)
94    -ts [TESTSUITE]: Specify test suilts,can be used independently。
95    ```
96
97### Test report log
98After executing the test instructions, the console will automatically generate test results.
99If you need a detailed test report, you can search in the corresponding data document.
100
101#### Test results
102The root path of the test result output is as follows:
103```
104Test/developer_test/reports/xxxx_xx_xx_xx_xx_xx
105
106