/** @file trace.h
*	EABaseTypes profiling macros
*	@author Chris Burns (cburns@ea.com)
*
*	EABaseTypes
*	(c) 2011 Electronic Arts Inc.
*/

#ifndef EABASETYPES_PROFILE_H_
#define EABASETYPES_PROFILE_H_

#if defined(EA_PLATFORM_XENON) && (!defined(EA_FINAL) || defined(EA_PROFILE))
#include <xtl.h>

#define EABASETYPES_PROFILE_ENABLED 1
#define EABASETYPES_PROFILE_BEGIN(color, name) PIXBeginNamedEvent(color, name, "")
#define EABASETYPES_PROFILE_END() PIXEndNamedEvent()

namespace EA
{
	namespace Types
	{
		namespace Profile
		{
			class AutoEvent
			{
			public:
				inline AutoEvent(DWORD color, const char* name) { EABASETYPES_PROFILE_BEGIN(color, name); }
				inline ~AutoEvent() { EABASETYPES_PROFILE_END(); }
			};
		}
	}
}

#define EABASETYPES_PROFILE_AUTO(v, color, name) EA::Types::Profile::AutoEvent v(color, name)
#else
#define EABASETYPES_PROFILE_BEGIN(color, name)
#define EABASETYPES_PROFILE_END()
#define EABASETYPES_PROFILE_AUTO(v, color, name)
#endif

#endif /* EABASETYPES_PROFILE_H_ */
