简体   繁体   English

什么是Boost CPU计时器的std等效项

[英]What is std equivalent of boost cpu timer

I would like to migrate boost::timer::cpu_timer in my code to standard library solution. 我想将代码中的boost :: timer :: cpu_timer迁移到标准库解决方案。 I only found std::chrono::steady_clock but it doesn't offer the same functionality as boost variant. 我只找到了std :: chrono :: steady_clock,但它没有提供与boost变体相同的功能。 What I basically need is wall and system time output, eg 我基本上需要的是墙壁和系统时间输出,例如

5.713010s wall, 5.709637s user + 0.000000s system = 5.709637s CPU (99.9%)

Is there anything like this in standard library ? 标准库中是否有类似的东西?

No, there is nothing in C++ standard library which would measure system and user time. 不,C ++标准库中没有任何东西可以衡量系统和用户时间。 You can only get wall time with std::chrono:: functions (of which steady_clock would be the most approriate to measure time intervals). 您只能使用std::chrono:: steady_clock std::chrono::函数获取挂墙时间(其中steady_clock是最适合测量时间间隔的时间)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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