📄 timer.h
字号:
// file timer.h//created by alpha 2008.11.15#ifndef TIMER_H#define TIMER_H#include <windows.h>class Timer{private: int _freq; LARGE_INTEGER _begin; LARGE_INTEGER _end;public: long costTime; // 花费的时间(精确到微秒)public: Timer() { LARGE_INTEGER tmp; QueryPerformanceFrequency(&tmp); _freq = tmp.QuadPart; costTime = 0; } void Start() // 开始计时 { QueryPerformanceCounter(&_begin); } void End() // 结束计时 { QueryPerformanceCounter(&_end); costTime = (long)((_end.QuadPart - _begin.QuadPart) * 1000000 / _freq); } void Reset() // 计时清0 { costTime = 0; }};#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -