Fichier source en cours : FW - CPUTimer.h






Voici le code source cpp :




	#ifndef CPU_TIMER_H
#define CPU_TIMER_H

#pragma comment(lib, "pdh.lib")

namespace fw
{
	class CPUTimer
	{
	public:
		CPUTimer();

		virtual ~CPUTimer();

		void Initialize();
		void Frame();

		uint32 GetCpuTotalPercentage();
		uint32 GetCpuProcessPercentage();

	private:

		/* Consommation CPU total du système */
		HQUERY m_queryHandle;
		HCOUNTER m_counterHandle;
		uint64 m_lastSampleTime;
		double m_cpuTotalUsage;
		double m_cpuProcessUsage;

		/* Consommation CPU de l'application */
		ULARGE_INTEGER lastCPU, lastSysCPU, lastUserCPU;
		uint32 numProcessors;
		HANDLE self;
	};
}

#endif