⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ivp_performancecounter.hxx

📁 hl2 source code. Do not use it illegal.
💻 HXX
字号:
// Copyright (C) Ipion Software GmbH 1999-2000. All rights reserved.

// IVP_EXPORT_PUBLIC

/********************************************************************************
 *  Filename:	    ivp_performancecounter.hxx
 *  Description:    This file provides you with an abstract class to count 
 *					the performance of the physics engine
 ********************************************************************************/

#ifndef IVP_PERFROMANCECOUNTER_INCLUDED
#define IVP_PERFROMANCECOUNTER_INCLUDED

#ifndef WIN32
#	pragma interface
#endif


#define IVP_ENABLE_PERFORMANCE_COUNTER 

enum IVP_PERFORMANCE_ELEMENT {
	IVP_PE_PSI_START = 0,   // not used by pcount
	
	IVP_PE_PSI_UNIVERSE,
	IVP_PE_PSI_CONTROLLERS,
	IVP_PE_PSI_INTEGRATORS,
	IVP_PE_PSI_HULL,
	IVP_PE_PSI_SHORT_MINDISTS,
	IVP_PE_PSI_CRITICAL_MINDISTS,
	IVP_PE_PSI_END,

	IVP_PE_AT_INIT,
	IVP_PE_AT_COLLISION,
	IVP_PE_AT_INTEGRATORS,
	IVP_PE_AT_HULL,
	IVP_PE_AT_SHORT_MINDISTS,
	IVP_PE_AT_CRITICAL_MINDISTS,
	IVP_PE_AT_END,

	IVP_PE_USR1,
	IVP_PE_USR2,

	IVP_PE_MAX
};

class IVP_PerformanceCounter {
public:
	virtual void start_pcount() = 0;
	virtual void pcount( IVP_PERFORMANCE_ELEMENT ) = 0;
	virtual void stop_pcount() = 0;


	virtual void environment_is_going_to_be_deleted(IVP_Environment *) = 0;
	virtual void reset_and_print_performance_counters(IVP_Time current_time) = 0;
	IVP_PerformanceCounter(){;};
	virtual ~IVP_PerformanceCounter(){;};
};


/********************************************************************************
 *	Name:	       	a simple implementation 
 ********************************************************************************/
class IVP_PerformanceCounter_Simple : public IVP_PerformanceCounter {
public:
    union {
        int ref_counter[2];
#ifdef WIN32
      __int64 ref_counter64;
#endif

    };

    IVP_PERFORMANCE_ELEMENT counting;
	int count_PSIs;

	int counter[IVP_PE_MAX][2]; // counting seconds
	IVP_Time time_of_last_reset;


	void reset_and_print_performance_counters(IVP_Time current_time);

	virtual void start_pcount();
	virtual void pcount( IVP_PERFORMANCE_ELEMENT );
	virtual void stop_pcount();

	virtual void environment_is_going_to_be_deleted(IVP_Environment *);

	IVP_PerformanceCounter_Simple();
	virtual ~IVP_PerformanceCounter_Simple();
};





#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -