15GX_CORE_NAMESPACE_BEGIN()
35 static const GxColor ColorMainUpdate;
36 static const GxColor ColorBaseTool;
37 static const GxColor ColorBaseUnit;
38 static const GxColor ColorBaseStage;
39 static const GxColor ColorBaseResource;
40 static const GxColor ColorBaseRender;
41 static const GxColor ColorBasePhysics;
43 class GxScopeProfiler;
45 class GxThreadProfile;
47 class GxThreadProfileIterator;
65 _temporaryTotalTime = 0;
69 _temporaryTimeCount = 0;
83 u32 _temporaryTotalTime;
87 u16 _temporaryTimeCount;
106 , _pParent( nullptr )
111 , _pBufferData( nullptr )
128 GxLogData* _pBufferData;
143 ~GxProfiler(
void )
override;
146 b32 initialize(
const u32 logMax );
149 b32 initializeThreadProfiling(
const u32 index );
151 void terminateThreadProfiling(
const u32 index );
160 GxThreadProfileIterator getThreadProfileIterator(
void );
163 constexpr GxGpuProfile* getGpuProfile(
void )
const {
return _pGpuProfile; }
166 constexpr u32 getProfilingLogMax(
void )
const {
return _profilingLogMax; }
168 void setIsActive(
b32 isActive);
171 constexpr void setProfileFrame( s32 frame ) { _profileFrame = frame; }
172 static b32 isActive(
void ) {
return _isActive; }
176 const GxLogData* getProfileData( GX_CSTR name );
180 static void setNativeProfilerFunction(
void* pInitializeFunction,
void* pRecordFunction,
void* pEnterCodeBlockName,
void* pExitCodeBlockName);
190 virtual void update(
void );
193 void clearAllData(
void );
195 void setIsOpenAllTree(
b32 isOpen );
201 void endThreadProfiling( GX_CSTR name );
204 void setThreadProfilerUpdateLock(
b32 lock );
212 static b32 _isActive;
213 b32 _requestIsActive;
219 u32 _profilingLogMax;
220 GxThreadProfile** _ppThreadProfile;
221 GxGpuProfile* _pGpuProfile;
227GX_FORCE_INLINE GxProfiler* getGxProfiler(
void){
return GxProfiler::getSingletonPointer(); }
232class GxProfiler::GxProfileBase :
public GxClassBase
240 GX_RTTI_ABSTRACT_CLASS( GxProfiler::GxProfileBase,
GxClassBase )
243 GX_OPERATOR_NEW_DELETE(GxAllocatorList::ALLOCATOR_TYPE::DEVELOP)
246 static constexpr u32 BUFFER_COUNT = 16;
255 GxProfileBase(
void );
258 ~GxProfileBase(
void )
override;
267 virtual void update( u32 timeTotalAll );
270 constexpr GxLog* getTopLog(
void )
const {
return _pLog ? _pLog[0]._pChild : nullptr ; }
273 void attachLog(
void );
276 constexpr u32 getBackBufferIndex(
void)
const {
return _backBufferIndex; }
279 constexpr u32 getBufferIndex(
void )
const {
return _bufferIndex; }
282 void clearAllData(
void );
284 void setIsOpenAllTree(
b32 isOpen );
287 constexpr u32 getLogMax(
void )
const {
return _logMax; }
290 void clearLogData(GxLog* pLog);
293 void setUpdateLock(
b32 lock ) { _isUpdateLocked = lock; }
297 b32 allocateLogTree( u32 logMax );
300 GxLog* createLog( GX_CSTR name, GxLog* pParent );
303 void updateLog( GxLog* pLog,
const u32 bufferIndex,
const u32 timeTotalAll );
314 u32 _backBufferIndex;
315 GxLogData* _pLogData;
317 GxLog** _ppCurrentLog;
319 u32 _lockedTimeTotal;
327class GxProfiler::GxThreadProfile :
public GxProfileBase
335 GX_RTTI_CLASS( GxProfiler::GxThreadProfile, GxProfileBase )
338 GX_OPERATOR_NEW_DELETE(GxAllocatorList::ALLOCATOR_TYPE::DEVELOP)
347 GxThreadProfile(
void );
350 ~GxThreadProfile(
void )
override {}
353 b32 initialize(
void );
365 void endProfiling( GX_CSTR name,
const u32 endTime,
GxCriticalSection& criticalSection);
378 constexpr GxThreadProfile* getNext(
void )
const {
return _pNext; }
381 constexpr GxThreadProfile* getPrevious(
void )
const {
return _pPrevious; }
384 constexpr void setNext( GxThreadProfile* pNext ) { _pNext = pNext; }
387 constexpr void setPrevious( GxThreadProfile* pPrevious ) { _pPrevious = pPrevious; }
395 GxThreadProfile* _pNext;
396 GxThreadProfile* _pPrevious;
405class GxProfiler::GxGpuProfile :
public GxProfiler::GxProfileBase
413 GX_RTTI_CLASS( GxProfiler::GxGpuProfile, GxProfiler::GxProfileBase )
431 GxGpuProfile(
void );
434 ~GxGpuProfile(
void )
override;
437 b32 initialize(
void );
440 void terminate(
void);
449 void beginProfiling( GX_CSTR name,
const GxColor& color,
const b32 adjustFromName );
452 void endProfiling( GX_CSTR name );
455 GxLog* getCurrentLog(
void );
458 void update( u32 timeTotalAll )
override;
467 GxLogDataGpu* _pLogDataGpu;
476class GxProfiler::GxScopeProfiler
487 ~GxScopeProfiler(
void );
503class GxProfiler::GxThreadProfileIterator
511 GxThreadProfileIterator( GxThreadProfile* pProfile );
520 constexpr GxThreadProfile* begin(
void )
const {
return _pTop; }
522 constexpr GxThreadProfile* current(
void )
const {
return _pCurrent; }
524 constexpr GxThreadProfile* next(
void ) { _pCurrent = _pCurrent->getNext();
return _pCurrent; }
526 constexpr GxThreadProfile* end(
void )
const {
return _pTop ? _pTop->getPrevious() :
nullptr; }
534 GxThreadProfile* _pTop;
535 GxThreadProfile* _pCurrent;
550#define GX_PROFILE_BEGIN(name) getGxProfiler()->beginThreadProfiling( name )
553#define GX_PROFILE_BEGIN_COLOR( name, color ) getGxProfiler()->beginThreadProfiling( name, color )
556#define GX_PROFILE_BEGIN_COLOR_ADJUST( name, colorBase ) getGxProfiler()->beginThreadProfiling( name, colorBase, true )
559#define GX_PROFILE_END( name ) getGxProfiler()->endThreadProfiling( name )
568#define GX_PROFILE( name ) GxProfiler::GxScopeProfiler __scopeProfiler( name )
571#define GX_PROFILE_COLOR( name, color ) GxProfiler::GxScopeProfiler __scopeProfiler( name, color )
574#define GX_PROFILE_COLOR_ADJUST( name, colorBase ) GxProfiler::GxScopeProfiler __scopeProfiler( name, colorBase, true )
582#define GX_TIME_FUNCTION( function, time ) { \
585 time = __timer.getDiff(); \
588#define GX_TIME_FUNCTION_ITERATION( function, time, iteration ) { \
590 for(u32 __i=0; __i<iteration; ++__i) { function; }\
591 time = __timer.getDiff(); \
596GX_CORE_NAMESPACE_END()
600#define GX_PROFILE_BEGIN(name)
601#define GX_PROFILE_BEGIN_COLOR(name, COLOR )
602#define GX_PROFILE_BEGIN_COLOR_ADJUST(name, COLOR )
603#define GX_PROFILE_END(name)
604#define GX_PROFILE(name)
605#define GX_PROFILE_COLOR(name, color)
606#define GX_PROFILE_COLOR_ADJUST(name, color)
#define GX_PROHIBIT_CLASS_BASE(__CLASS__)
GxClassBase継承の禁止宣言
Definition GxBase.h:240
オブジェクト基底クラス
Definition GxBase.h:88
クリティカルセクションクラス
Definition GxThread.h:20
描画コマンドの並列発行を管理します。
Definition GxRenderContext.h:28
GPUクエリを管理する
Definition GxRenderQuery.h:19
タイマークラス
Definition GxTimer.h:110
シングルトン基礎クラス
Definition GxSingleton.h:19
static const GxColor DARK_GRAY
暗いグレー
Definition GxColor.h:45
static const GxColor LIGHT_CYAN
明るいシアン
Definition GxColor.h:52
32bitブーリアン
Definition GxDefine.h:173