MCPcopy Create free account
hub / github.com/defold/defold / GetOrCreateThreadData

Function GetOrCreateThreadData

engine/profiler/src/basic/profiler_basic.cpp:348–363  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

346}
347
348static ThreadData* GetOrCreateThreadData(ProfileContext* ctx, int32_t thread_id)
349{
350 ThreadData** pdata = ctx->m_ThreadData.Get(thread_id);
351 if (pdata)
352 return *pdata;
353
354 ThreadData* td = new ThreadData(thread_id);
355
356 if (ctx->m_ThreadData.Full())
357 {
358 uint32_t cap = ctx->m_ThreadData.Capacity() + 16;
359 ctx->m_ThreadData.SetCapacity((cap * 2) / 3, cap);
360 }
361 ctx->m_ThreadData.Put(thread_id, td);
362 return td;
363}
364
365///////////////////////////////////////////////////////////////////////////////////////////////
366

Callers 2

ScopeBeginFunction · 0.85
ScopeEndFunction · 0.85

Calls 5

GetMethod · 0.45
FullMethod · 0.45
CapacityMethod · 0.45
SetCapacityMethod · 0.45
PutMethod · 0.45

Tested by

no test coverage detected