当前位置:网站首页>timer使用备注
timer使用备注
2022-06-24 06:44:00 【雾散睛明】
timer使用备注
windows 平台:
CreateWaitableTimer
SetWaitableTimer
boost库:
timer
progress_timer
progress_display
timer相当于一个计时器(毫秒级),同时提供相关的操作函数供程序员使用。
//引入头文件,.hpp为.h+cpp,这样的文件不需要预先编译
#include<boost/timer.hpp>
#include<iostream>
using namespace std;
//使用boost命名空间
using namespace boost;
int main()
{
timer t;//定义一个计时器,从定义出开始计时
//计时器最大计时时间
cout << "max timespan:" << t.elapsed_max() / 3600 << "h" << endl;
//计时器最小计时时间
cout << "min timespan:" << t.elapsed_min() << "s" << endl;
//输出计时器当前的计时时间
cout << "now time elapsed" << t.elapsed() << "s" << endl;
}
timer还有一个常用的方法如下:
//重新计时
void restart(){_start_time = std::clock();}
progress_timer 在析构的时候 自动调用elspsed()
同时progress_timer还可以配合stringstream来使用,可以将信息输出在stringstream中
stringstream s;
{
progress_timer t(s);//出作用域后会将信息输入在s中,而不是打印出来
}
cout << s.str()<< endl;//可以通过s将t的计时信息进行打印
progress_display 具有一个显示的功能
可参考:https://blog.csdn.net/qq_42214953/article/details/105841155
边栏推荐
- New ways to play web security [6] preventing repeated use of graphic verification codes
- Selector (>, ~, +, [])
- Hubei College Upgraded to undergraduate - Hushi family planning department
- 10 common malware detection and analysis platforms
- Deploy L2TP in VPN (medium)
- get_started_3dsctf_2016
- UE常用控制臺命令
- How can win11 set the CPU performance to be fully turned on? How does win11cpu set high performance mode?
- [pointnet] matlab simulation of 3D point cloud target classification and recognition based on pointnet
- [learn FPGA programming from scratch -42]: Vision - technological evolution of chip design in the "post Moorish era" - 1 - current situation
猜你喜欢
![[OGeek2019]babyrop](/img/74/5f93dcee9ea5a562a7fba5c17aab76.png)
[OGeek2019]babyrop
![[WUSTCTF2020]爬](/img/b6/4a0582144c3125e7a0666bbbbfe29d.png)
[WUSTCTF2020]爬

How to delete / select an input method on your computer

Shader 常用函数

Blue Bridge Cup seven segment code (dfs/ shape pressing + parallel search)

Alibaba cloud full link data governance

图形技术之坐标转换

What are the dazzling skills of spot gold?
![buuctf misc [UTCTF2020]docx](/img/e4/e160f704d6aa754e85056840e14bd2.png)
buuctf misc [UTCTF2020]docx

get_started_3dsctf_2016
随机推荐
《canvas》之第3章 曲线图形
Deploy L2TP in VPN (medium)
Buuctf misc grab from the doll
C code writing specification
[image feature extraction] image feature extraction based on pulse coupled neural network (PCNN) including Matlab source code
How to turn on win11 notebook power saving mode? How to open win11 computer power saving mode
湖北专升本-湖师计科
图形技术之坐标转换
什么是CC攻击?如何判断网站是否被CC攻击? CC攻击怎么防御?
What is automated testing? What software projects are suitable for automated testing?
[image segmentation] retinal vessel segmentation based on morphology with matlab code
(cve-2020-11978) command injection vulnerability recurrence in airflow DAG [vulhub range]
When MFC uses the console, the project path cannot have spaces or Chinese, otherwise an error will be reported. Lnk1342 fails to save the backup copy of the binary file to be edited, etc
Global and Chinese market of inline drip irrigation 2022-2028: Research Report on technology, participants, trends, market size and share
Description of module data serial number positioning area code positioning refers to GBK code
How to select a third-party software testing company? 2022 ranking of domestic software testing institutions
What is a CC attack? How to judge whether a website is attacked by CC? How to defend against CC attacks?
Obtain the package name, application name, icon, etc. of the uninstalled APK through packagemanager. There is a small message
相機標定(標定目的、原理)
[image fusion] multi focus and multi spectral image fusion based on pixel saliency and wavelet transform with matlab code