笔者昨晚在OggpenHarmony主干中benchmark基础上,移植了benchmark原生库中测试用例到OpenHarmony。主干上三方库benchmark不能合并入测试用例相关BUILD.gn代码。笔者将成果开源至如下仓库
- 开源地址:https://gitee.com/from-north-to-north/OpenHarmony_benchmark
- 编译好的可执行文件
- 32 位: https://gitee.com/from-north-to-north/OpenHarmony_benchmark/tree/master/%E7%BC%96%E8%AF%91%E5%A5%BD%E7%9A%84%E5%8F%AF%E6%89%A7%E8%A1%8C%E7%9A%84benchmark%E6%B5%8B%E8%AF%95%E7%94%A8%E4%BE%8B%EF%BC%88arm32%EF%BC%89
- 64位:https://gitee.com/from-north-to-north/OpenHarmony_benchmark/tree/master/%E7%BC%96%E8%AF%91%E5%A5%BD%E7%9A%84%E5%8F%AF%E6%89%A7%E8%A1%8C%E7%9A%84benchmark%E6%B5%8B%E8%AF%95%E7%94%A8%E4%BE%8B%EF%BC%88arm64%EF%BC%89
- 编译好的可执行文件
1.benchmark介绍
Benchmark这个库是用来进行性能基准测试的。性能基准测试是一种评估计算机系统或软件性能的方法,通过运行一系列测试来测量和比较不同实现方案的性能表现。benchmark原生库仓库地址 https://github.com/google/benchmark/releases/tag/v1.6.1
2.移植相关代码讲解
1.具体请查看
- https://gitee.com/from-north-to-north/OpenHarmony_benchmark/blob/master/%E7%A7%BB%E6%A4%8D%E5%A5%BD%E7%9A%84%E6%B5%8B%E8%AF%95%E7%94%A8%E4%BE%8BBUILD.gn%E6%9E%84%E5%BB%BA%E8%84%9A%E6%9C%AC%E7%9A%84benchmark%EF%BC%881.6.1%E7%89%88%E6%9C%AC%EF%BC%89/benchmark/BUILD.gn
- https://gitee.com/from-north-to-north/OpenHarmony_benchmark/blob/master/%E7%A7%BB%E6%A4%8D%E5%A5%BD%E7%9A%84%E6%B5%8B%E8%AF%95%E7%94%A8%E4%BE%8BBUILD.gn%E6%9E%84%E5%BB%BA%E8%84%9A%E6%9C%AC%E7%9A%84benchmark%EF%BC%881.6.1%E7%89%88%E6%9C%AC%EF%BC%89/benchmark/bundle.json
2.如何编译?
- 将此BUILD.gn合入third_party/benchmark/BUILD.gn。
- 在bundle.json中添加"//third_party/benchmark:benchmark_tests",如下
- 编译命令./build.sh --product-name rk3568 --ccache --build-target=benchmark_tests --target-cpu arm --disable-post-build --disable-package-image --gn-args enable_notice_collection=false --gn-args skip_generate_module_list_file=true --gn-args load_test_config=false
- 编译结果,生成如下测试用例
-
将测试用例推送到开发板执行,如下
-
3.用benchmark对DAYU200(rk3568)和Purple Pi OH(rk3566)进行性能测试
两块富设备开发板均为64位3.2R
1.进行args_product_test测试
- DAYU200
- Purple Pi OH
2.进行map_test测试
- DAYU200
Purple Pi OH