zoukankan      html  css  js  c++  java
  • 精确的计时类

    class MyTimeCount
    {
    public:
    	MyTimeCount()
    	{
    		QueryPerformanceFrequency(&fr);
    	}
    	~MyTimeCount()
    	{
    
    	}
    	void Start()
    	{
    		QueryPerformanceCounter(&bg);
    		ed = bg;
    		fTime = 0.0f;
    	}
    	float Stop()
    	{
    		QueryPerformanceCounter(&ed);
    
    		fTime = 1000.0f*(ed.QuadPart-bg.QuadPart)/fr.QuadPart;
    		return fTime;
    	}
    	float GetTime()
    	{
    		return fTime;
    	}
    private:
    	LARGE_INTEGER	bg;
    	LARGE_INTEGER	ed;
    	LARGE_INTEGER	fr;
    	float			fTime;
    
    };

    版权声明:本文博主原创文章,博客,未经同意不得转载。

  • 相关阅读:
    2021/3/12
    2021/3/11
    2021/3/10
    2021/3/9
    2021/3/8
    2021/3/5
    2021/3/4
    2021/3/3
    2021/3/2
    2021/3/1
  • 原文地址:https://www.cnblogs.com/lcchuguo/p/4776963.html
Copyright © 2011-2022 走看看