12 mThreadName(inThreadName)
30 if (current_thread ==
nullptr)
50 if (!sOutOfSamplesReported)
52 sOutOfSamplesReported =
true;
53 Trace(
"ProfileMeasurement: Too many samples, some data will be lost!");
61 if (mSample !=
nullptr)
67 static_assert(
sizeof(
ProfileSample) == 32,
"Assume 32 bytes");
68 static_assert(
alignof(
ProfileSample) == 16,
"Assume 16 byte alignment");
69 #if defined(JPH_USE_SSE)
70 const __m128i *src =
reinterpret_cast<const __m128i *
>(&mTemp);
71 __m128i *dst =
reinterpret_cast<__m128i *
>(mSample);
72 __m128i val = _mm_loadu_si128(src);
73 _mm_stream_si128(dst, val);
74 val = _mm_loadu_si128(src + 1);
75 _mm_stream_si128(dst + 1, val);
76 #elif defined(JPH_USE_NEON)
77 const int *src =
reinterpret_cast<const int *
>(&mTemp);
78 int *dst =
reinterpret_cast<int *
>(mSample);
79 int32x4_t val = vld1q_s32(src);
81 val = vld1q_s32(src + 4);
82 vst1q_s32(dst + 4, val);
#define JPH_TSAN_NO_SANITIZE
Definition Core.h:625
#define JPH_NAMESPACE_END
Definition Core.h:414
std::uint32_t uint32
Definition Core.h:484
#define JPH_NAMESPACE_BEGIN
Definition Core.h:408
TraceFunction Trace
Definition IssueReporting.cpp:14
JPH_NAMESPACE_BEGIN JPH_INLINE uint64 GetProcessorTickCount()
Functionality to get the processors cycle counter.
Definition TickCounter.h:26
ProfileMeasurement(const char *inName, uint32 inColor=0)
Constructor.
Definition Profiler.inl:27
~ProfileMeasurement()
Definition Profiler.inl:59
Definition Profiler.h:187
uint32 mColor
Color to use for this sample.
Definition Profiler.h:192
uint64 mEndCycle
Cycle counter at end of measurement.
Definition Profiler.h:196
JPH_OVERRIDE_NEW_DELETE const char * mName
User defined name of this item.
Definition Profiler.h:191
uint64 mStartCycle
Cycle counter at start of measurement.
Definition Profiler.h:195
Collects all samples of a single thread.
Definition Profiler.h:201
ProfileSample mSamples[cMaxSamples]
Buffer of samples.
Definition Profiler.h:212
uint mCurrentSample
Next position to write a sample to.
Definition Profiler.h:213
~ProfileThread()
Definition Profiler.inl:17
JPH_OVERRIDE_NEW_DELETE ProfileThread(const string_view &inThreadName)
Constructor.
Definition Profiler.inl:11
static ProfileThread * sGetInstance()
Definition Profiler.h:220
static const uint cMaxSamples
Definition Profiler.h:209
void RemoveThread(ProfileThread *inThread)
Remove a thread from being instrumented.
Definition Profiler.cpp:95
void AddThread(ProfileThread *inThread)
Add a thread to be instrumented.
Definition Profiler.cpp:88
static Profiler * sInstance
Singleton instance.
Definition Profiler.h:117