123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- #pragma once
- #include <AK/SoundEngine/Common/AkCommonDefs.h>
- #include <AK/Tools/Common/AkAssert.h>
- namespace AK
- {
- namespace Instrument
- {
- #ifndef AK_OPTIMIZED
- AK_CALLBACK(void*, PushTimerFunc)(
- AkPluginID in_uPluginID,
- const char * in_pszZoneName
- );
- AK_CALLBACK(void, PopTimerFunc)(void* in_pToken);
- AK_CALLBACK(void, PostMarkerFunc)(
- AkPluginID in_uPluginID,
- const char* in_pszMarkerName
- );
- AK_CALLBACK(void, PostMetaMarkerFunc)(
- AkPluginID in_uPluginID,
- AkUInt32 in_uMetadata
- );
- extern AKSOUNDENGINE_API PushTimerFunc g_fnPushTimer;
- extern AKSOUNDENGINE_API PopTimerFunc g_fnPopTimer;
- extern AKSOUNDENGINE_API PostMarkerFunc g_fnPostMarker;
- extern AKSOUNDENGINE_API PostMetaMarkerFunc g_fnPostMetaMarker;
- class Scope
- {
- public:
- inline Scope(AkPluginID in_uPluginID, const char* in_pszZoneName)
- {
- m_pToken = g_fnPushTimer(in_uPluginID, in_pszZoneName);
- }
- inline ~Scope()
- {
- g_fnPopTimer(m_pToken);
- }
- private:
- void* m_pToken;
- };
- #endif
- }
- }
- #if !defined(AK_OPTIMIZED)
- #define AK_INSTRUMENT_BEGIN(_plugin_id_, _zone_name_) (AK::Instrument::g_fnPushTimer(_plugin_id_, _zone_name_))
- #define AK_INSTRUMENT_END(__token__) (AK::Instrument::g_fnPopTimer(__token__))
- #define AK_INSTRUMENT_MARKER(_plugin_id_, _marker_name_) (AK::Instrument::g_fnPostMarker(_plugin_id_, _marker_name_))
- #define AK_INSTRUMENT_MARKER_PROFILINGID(_profilingid_) (AK::Instrument::g_fnPostMarker(AKMAKECLASSID( AkPluginTypeNone, AKCOMPANYID_AUDIOKINETIC, _profilingid_ ), nullptr))
- #define AK_INSTRUMENT_METAMARKER(_plugin_id_, _metadata_) (AK::Instrument::g_fnPostMetaMarker(_plugin_id_, _metadata_))
- #define AK_INSTRUMENT_CONCAT_INNER(_base_, _counter_) _base_ ## _counter_
- #define AK_INSTRUMENT_CONCAT(_base_, _counter_) AK_INSTRUMENT_CONCAT_INNER(_base_, _counter_)
- #define AK_INSTRUMENT_SCOPE(_zone_name_) \
- AK::Instrument::Scope AK_INSTRUMENT_CONCAT(_akInstrumentScope_, __LINE__)(0, _zone_name_)
- #define AK_INSTRUMENT_SCOPE_ID(_plugin_id_, _zone_name_) \
- AK::Instrument::Scope AK_INSTRUMENT_CONCAT(_akInstrumentScope_, __LINE__)(_plugin_id_, _zone_name_)
- #define AK_INSTRUMENT_SCOPE_PROFILINGID(_profilingid_) \
- AK::Instrument::Scope AK_INSTRUMENT_CONCAT(_akInstrumentScope_, __LINE__)(AKMAKECLASSID( AkPluginTypeNone, AKCOMPANYID_AUDIOKINETIC, _profilingid_ ), nullptr)
- #define AK_INSTRUMENT_THREAD_START( _thread_name_ )
-
- #else
- #define AK_INSTRUMENT_BEGIN(_plugin_id_, _zone_name_) (void*)( 0 )
- #define AK_INSTRUMENT_END(__token__)
- #define AK_INSTRUMENT_MARKER(_plugin_id_, _zone_name_)
- #define AK_INSTRUMENT_MARKER_PROFILINGID(_profilingid_)
- #define AK_INSTRUMENT_METAMARKER(_plugin_id_, _metadata_)
- #define AK_INSTRUMENT_SCOPE( _zone_name_ )
- #define AK_INSTRUMENT_SCOPE_ID(_plugin_id_, _zone_name_)
- #define AK_INSTRUMENT_SCOPE_PROFILINGID(_plugin_id_)
- #define AK_INSTRUMENT_THREAD_START( _thread_name_ )
- #endif
- #ifndef AK_INSTRUMENT_BEGIN_C
- #define AK_INSTRUMENT_BEGIN_C(_plugin_id_, _color_, _zone_name_) AK_INSTRUMENT_BEGIN(_plugin_id_, _zone_name_)
- #endif
|