简体   繁体   中英

Globally set time unit and use wall-clock time when using google benchmark library?

I'm using google benchmark library for my own program time cost measuring.

I found my program time cost is milliseconds level, but benchmark's default time unit is nanosecond.

Also, many of them are with multi-thread inside so I prefer real-time (wall-clock time) instead of the default one, the main thread's CPU time.

For one specific benchmark test, I can write it as:

BENCHMARK_REGISTER_F(AreaResizeFast_Fixture, tv)->Unit(benchmark::kMillisecond)->UseRealTime();

Question: is it possible globally using milliseconds and real-time, ie config them once and use it always?

It's possible to set the time unit globally now according to this PR .

The latest version of the user guide may help.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM