Jolt Physics
A multi core friendly Game Physics Engine
Loading...
Searching...
No Matches
Profiler.h File Reference
#include <mutex>
#include <Jolt/Core/NonCopyable.h>
#include <Jolt/Core/TickCounter.h>
#include <Jolt/Core/UnorderedMap.h>
#include "Profiler.inl"

Go to the source code of this file.

Classes

class  Profiler
 Singleton class for managing profiling information. More...
 
class  ProfileSample
 
class  ProfileThread
 Collects all samples of a single thread. More...
 
class  ProfileMeasurement
 Create this class on the stack to start sampling timing information of a particular scope. More...
 

Macros

#define JPH_PROFILE_START(name)   do { Profiler::sInstance = new Profiler; JPH_PROFILE_THREAD_START(name); } while (false)
 Start instrumenting program. More...
 
#define JPH_PROFILE_END()   do { JPH_PROFILE_THREAD_END(); delete Profiler::sInstance; Profiler::sInstance = nullptr; } while (false)
 End instrumenting program. More...
 
#define JPH_PROFILE_THREAD_START(name)   do { if (Profiler::sInstance) ProfileThread::sInstance = new ProfileThread(name); } while (false)
 Start instrumenting a thread. More...
 
#define JPH_PROFILE_THREAD_END()   do { delete ProfileThread::sInstance; ProfileThread::sInstance = nullptr; } while (false)
 End instrumenting a thread. More...
 
#define JPH_PROFILE_TAG2(line)   profile##line
 Scope profiling measurement. More...
 
#define JPH_PROFILE_TAG(line)   JPH_PROFILE_TAG2(line)
 
#define JPH_PROFILE(...)   ProfileMeasurement JPH_PROFILE_TAG(__LINE__)(__VA_ARGS__)
 
#define JPH_PROFILE_FUNCTION()   JPH_PROFILE(JPH_FUNCTION_NAME)
 Scope profiling for function. More...
 
#define JPH_PROFILE_NEXTFRAME()   Profiler::sInstance->NextFrame()
 Update frame counter
More...
 
#define JPH_PROFILE_DUMP(...)   Profiler::sInstance->Dump(__VA_ARGS__)
 Dump profiling info. More...
 

Macro Definition Documentation

◆ JPH_PROFILE

#define JPH_PROFILE (   ...)    ProfileMeasurement JPH_PROFILE_TAG(__LINE__)(__VA_ARGS__)

◆ JPH_PROFILE_DUMP

#define JPH_PROFILE_DUMP (   ...)    Profiler::sInstance->Dump(__VA_ARGS__)

Dump profiling info.

◆ JPH_PROFILE_END

#define JPH_PROFILE_END ( )    do { JPH_PROFILE_THREAD_END(); delete Profiler::sInstance; Profiler::sInstance = nullptr; } while (false)

End instrumenting program.

◆ JPH_PROFILE_FUNCTION

#define JPH_PROFILE_FUNCTION ( )    JPH_PROFILE(JPH_FUNCTION_NAME)

Scope profiling for function.

◆ JPH_PROFILE_NEXTFRAME

#define JPH_PROFILE_NEXTFRAME ( )    Profiler::sInstance->NextFrame()

Update frame counter

◆ JPH_PROFILE_START

#define JPH_PROFILE_START (   name)    do { Profiler::sInstance = new Profiler; JPH_PROFILE_THREAD_START(name); } while (false)

Start instrumenting program.

◆ JPH_PROFILE_TAG

#define JPH_PROFILE_TAG (   line)    JPH_PROFILE_TAG2(line)

◆ JPH_PROFILE_TAG2

#define JPH_PROFILE_TAG2 (   line)    profile##line

Scope profiling measurement.

◆ JPH_PROFILE_THREAD_END

#define JPH_PROFILE_THREAD_END ( )    do { delete ProfileThread::sInstance; ProfileThread::sInstance = nullptr; } while (false)

End instrumenting a thread.

◆ JPH_PROFILE_THREAD_START

#define JPH_PROFILE_THREAD_START (   name)    do { if (Profiler::sInstance) ProfileThread::sInstance = new ProfileThread(name); } while (false)

Start instrumenting a thread.