timer.h

来自「我的红黑树的c++实现。主要特点是可以用dot工具把红黑树画出来」· C头文件 代码 · 共 44 行

H
44
字号
// 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 + =
减小字号Ctrl + -
显示快捷键?