自 2025 年 3 月 27 日起,我们建议您使用 android-latest-release
而非 aosp-main
构建 AOSP 并为其做出贡献。如需了解详情,请参阅 AOSP 的变更。
指标测试
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
指标测试通常用于调用硬件抽象层 (HAL) 或直接与底层系统服务交互。要利用持续测试服务,应使用 google-benchmark 框架构建指标测试。
示例
请参阅位于 bionic/benchmarks/bionic-benchmarks 的示例指标测试模块设置
步骤总结
- 测试模块配置文件应使用
BUILD_NATIVE_BENCHMARK
构建规则,以便自动包含 google-benchmark 依赖项。
使用 make 命令构建测试模块:
make -j40 bionic-benchmarks
使用 Trade Federation 自动化测试框架自动安装和运行:
make tradefed-all -j
tradefed.sh run template/local_min --template:map test=bionic-benchmarks
手动安装并运行,如下所示:
将生成的测试二进制文件推送到设备:
adb push ${OUT}/data/benchmarktest/bionic-benchmarks/bionic-benchmarks32 \
/data/benchmarktest/bionic-benchmarks/bionic-benchmarks32
通过在设备上调用测试二进制文件执行测试:
adb shell /data/benchmarktest/bionic-benchmarks/bionic-benchmarks32
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-03-26。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-03-26。"],[],[],null,["# Metric tests are typically used for exercising hardware abstraction\nlayers (HALs) or interacting directly with lower-level system services. To\nleverage continuous testing service, metric tests should be built with\nthe [google-benchmark](https://github.com/google/benchmark)\nframework.\n\nExample\n-------\n\nSee a sample metric test module setup at:\n[bionic/benchmarks/bionic-benchmarks](https://android.googlesource.com/platform/bionic/+/android16-release/benchmarks/bionic_benchmarks.cpp)\n\nSummary of steps\n----------------\n\n1. Test module configuration file should use the `BUILD_NATIVE_BENCHMARK` build rule so that google-benchmark dependencies are included automatically.\n2. Build the test module with make:\n\n make -j40 bionic-benchmarks\n\n3. Automatic installation and run with the Trade Federation test harness:\n\n make tradefed-all -j\n tradefed.sh run template/local_min --template:map test=bionic-benchmarks\n\n4. Manually install and run like so:\n\n 1. Push the generated test binary onto device:\n\n adb push ${OUT}/data/benchmarktest/bionic-benchmarks/bionic-benchmarks32 \\\n /data/benchmarktest/bionic-benchmarks/bionic-benchmarks32\n\n 2. Execute the test by invoking test binary on device:\n\n adb shell /data/benchmarktest/bionic-benchmarks/bionic-benchmarks32"]]