博客地址:http://home.cnblogs.com/u/zengjianrong/

google benchmark

最小用例:https://github.com/google/benchmark?tab=readme-ov-file#usage

排除干扰:https://github.com/google/benchmark/blob/main/docs/reducing_variance.md

1. benmark编译为release版本:-DCMAKE_BUILD_TYPE=Release

2. 禁止cpu频率调节:sudo cpupower frequency-set --governor performance

3. 禁止cpu超频:echo 0 | sudo tee /sys/devices/system/cpu/cpufreq/boost

4. 【可选】绑核:taskset -c 0 ./mybenchmark

 

 

查看参数

benchmark --help
benchmark [--benchmark_list_tests={true|false}]
[--benchmark_filter=<regex>]
[--benchmark_min_time=<min_time>]   比较常用,设置测试的时间长度
[--benchmark_repetitions=<num_repetitions>]  比较常用,可用于增加测试次数,以及计算方差等
[--benchmark_enable_random_interleaving={true|false}]
[--benchmark_report_aggregates_only={true|false}]
[--benchmark_display_aggregates_only={true|false}]
[--benchmark_format=<console|json|csv>]  输出格式,默认是console
[--benchmark_out=<filename>]
[--benchmark_out_format=<json|console|csv>]
[--benchmark_color={auto|true|false}]
[--benchmark_counters_tabular={true|false}]
[--benchmark_context=<key>=<value>,...]
[--benchmark_time_unit={ns|us|ms|s}]
[--v=<verbosity>]

 

posted @ 2024-03-05 15:37  black_man  阅读(13)  评论(0编辑  收藏  举报