📄 celapsed.h
字号:
#include "Winbase.h"
class celapsed
{
public :
celapsed(){
// get the frequency of the counter
initialized = QueryPerformanceFrequency( (LARGE_INTEGER *)&frequency );
};
bool begin(){
if( ! initialized )
return 0; // error - couldn't get frequency
// get the starting counter value
return QueryPerformanceCounter( (LARGE_INTEGER *)&begintime );
}; // start timing
double end(){
if( ! initialized )
return 0.0; // error - couldn't get frequency
// get the ending counter value
__int64 endtime;
QueryPerformanceCounter( (LARGE_INTEGER *)&endtime );
// determine the elapsed counts
__int64 elapsed = endtime - begintime;
// convert counts to time in seconds and return it
return (double)elapsed / (double)frequency;
}; // stop timing and get elapsed time in seconds
private :
int initialized;
__int64 frequency;
__int64 begintime;
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -